opencode icon indicating copy to clipboard operation
opencode copied to clipboard

fix: avoid Anthropic tool-history requests without tools

Open seilk opened this issue 3 days ago • 1 comments

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-call or tool-result
  • No tools provided The dummy tool is excluded from activeTools so it won't be invoked. Fixes #8246 Relates to #2915

How did you verify your code works?

  • bun run tsc --noEmit passes
  • Tested with LiteLLM gateway: tool-history requests now succeed
  • Existing tests unaffected (557 pass, 95 fail - same as baseline)

seilk avatar Jan 13 '26 17:01 seilk