Skip to content

fix: #2806 sanitize AnyLLM responses replay input before validation#2813

Merged
seratch merged 2 commits into
mainfrom
fix/any-llm-responses-replay-sanitization
Mar 31, 2026
Merged

fix: #2806 sanitize AnyLLM responses replay input before validation#2813
seratch merged 2 commits into
mainfrom
fix/any-llm-responses-replay-sanitization

Conversation

@seratch

@seratch seratch commented Mar 31, 2026

Copy link
Copy Markdown
Member

This pull request fixes #2806 a multi-turn AnyLLMModel Responses-path failure where replayed history could reach any-llm local validation with adapter-only metadata and explicit None fields that ResponsesParams does not accept.

The bug shows up after prior turns have produced replay items such as reasoning blocks or tool calls that still contain fields like provider_data, placeholder response IDs, or status: None. In that state, the request fails locally during ResponsesParams(**payload) construction before it ever reaches a backend such as vLLM or Ollama.

This change narrows the fix to the adapter layer by sanitizing replayed Responses input before validation:

  • strip provider_data
  • drop fake response IDs
  • remove recursively empty None fields
  • continue filtering provider-specific reasoning items that should not be replayed

The change keeps any-llm validation in place for supported versions instead of bypassing validation globally with a shim. It also adds regression coverage for reasoning-item sanitization and for the AnyLLM Responses fetch path so subsequent tool turns continue to validate and execute with sanitized replay input.

@seratch seratch force-pushed the fix/any-llm-responses-replay-sanitization branch from 40b8a1d to 6f4057d Compare March 31, 2026 10:19
@seratch seratch merged commit 40aada1 into main Mar 31, 2026
9 checks passed
@seratch seratch deleted the fix/any-llm-responses-replay-sanitization branch March 31, 2026 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working feature:extensions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AnyLLMModel failed ResponsePalms validation during multiple rounds of tool calls

1 participant