Skip to content

fix: don't retry a failed provider / anthropic bug - #47

Merged
paperclover merged 1 commit into
mainfrom
push-pllkwzwzznkl
Jul 23, 2026
Merged

fix: don't retry a failed provider / anthropic bug#47
paperclover merged 1 commit into
mainfrom
push-pllkwzwzznkl

Conversation

@paperclover

Copy link
Copy Markdown
Contributor

Two independent fallback bugs surfaced by a cross-provider agent run where Anthropic 400d and every turn silently fell back to Gemini.

  1. Tool input wrapping. A wrapper-object tool (non-object top-level schema) stores only its inner value. When that call is replayed after the tool is no longer registered, nothing re-wraps it, so the raw scalar reached Anthropic as tool_use.input and was rejected with "Input should be an object". Add a shared ensureToolInputObject that wraps stray non-objects under content, and route both the Anthropic history serializer and the shared serializeWrappedToolArguments (which had the same unregistered-tool gap) through the guarantee. Not adapter-specific.

  2. Fallback latency. A deterministic input-level error (4xx client, unsupported_file_type, image_too_large) recurs on every later turn because history only grows, yet each turn restarted the fallback list at the primary and re-paid the guaranteed failure. Track such models per run and skip them as long as a viable fallback remains.

Assisted-by: claude-opus-4.8

…ng models

Two independent fallback bugs surfaced by a cross-provider agent run where
Anthropic 400d and every turn silently fell back to Gemini.

1. Tool input wrapping. A wrapper-object tool (non-object top-level schema)
   stores only its inner value. When that call is replayed after the tool is no
   longer registered, nothing re-wraps it, so the raw scalar reached Anthropic
   as tool_use.input and was rejected with "Input should be an object". Add a
   shared ensureToolInputObject that wraps stray non-objects under `content`,
   and route both the Anthropic history serializer and the shared
   serializeWrappedToolArguments (which had the same unregistered-tool gap)
   through the guarantee. Not adapter-specific.

2. Fallback latency. A deterministic input-level error (4xx client,
   unsupported_file_type, image_too_large) recurs on every later turn because
   history only grows, yet each turn restarted the fallback list at the primary
   and re-paid the guaranteed failure. Track such models per run and skip them
   as long as a viable fallback remains.

Assisted-by: claude-opus-4.8
@paperclover
paperclover merged commit 5c6600b into main Jul 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant