Skip to content

fix forced tool_choice 400 on claude 5.5 models and surface openrouter upstream errors - #3055

Merged
RaajeevChandran merged 1 commit into
mainfrom
fix/forced-tool-choice-claude-5
Oct 9, 2026
Merged

RaajeevChandran merged 1 commit into
mainfrom
fix/forced-tool-choice-claude-5

Conversation

@RaajeevChandran

Copy link
Copy Markdown
Contributor

Summary

Resolves #3051

  • Delegated tasks to anthropic/claude-sonnet-5.5 failed with HTTP 400 before any output because Osaurus sent tool_choice: "required", which Opus 5.5, Sonnet 5.5, Fable 5.1 and Mythos 5.1 reject on every host
  • RemoteReasoningPolicy.sanitizedToolChoice now downgrades required and named tool choices to auto for those models, matched on the bare model id so OpenRouter (anthropic/claude-sonnet-5.5) and native (claude-sonnet-5-5) ids are both covered
  • The check runs before the provider switch, so OpenRouter, native Anthropic and other hosts all get it. Haiku 5.5 and older Claude models keep forced tool use
  • OpenRouter's generic "Provider returned error" now includes the upstream reason from metadata.raw, so the failure explains itself
  • Numeric error codes (OpenRouter sends 400 as a number) are now shown alongside the message
  • Added tests for the downgrade across hosts and model id forms, the pass-through for older models, and both JSON and plain-text metadata.raw

Changes

  • Behavior change
  • UI change (screenshots below)
  • Refactor / chore
  • Tests
  • Docs

Checklist

  • I have read CONTRIBUTING.md
  • I added/updated tests where reasonable
  • I updated docs/README as needed
  • I verified build on macOS with Xcode 16.4+

@github-actions github-actions Bot added the bug Something isn't working label Oct 9, 2026
@RaajeevChandran
RaajeevChandran merged commit 0e10989 into main Oct 9, 2026
9 checks passed
@RaajeevChandran
RaajeevChandran deleted the fix/forced-tool-choice-claude-5 branch October 9, 2026 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working pending release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Delegated tasks to anthropic/claude-sonnet-5.5 fail with HTTP 400: forced tool_choice is rejected

1 participant