opencode
opencode copied to clipboard
fix: avoid Anthropic tool-history requests without tools
What does this PR do?
Fixes Anthropic/LiteLLM proxies rejecting requests when message history contains tool calls but tools param is empty.
Adds a dummy tool when:
- Model is Anthropic/Claude
- Message history has
tool-callortool-result - No tools provided
The dummy tool is excluded from
activeToolsso it won't be invoked. Fixes #8246 Relates to #2915
How did you verify your code works?
-
bun run tsc --noEmitpasses - Tested with LiteLLM gateway: tool-history requests now succeed
- Existing tests unaffected (557 pass, 95 fail - same as baseline)