fix(llm): inject _noop tool for all providers when messages contain tool history - #36221
fix(llm): inject _noop tool for all providers when messages contain tool history#36221Robin1987China wants to merge 1 commit into
Conversation
…ool history Bedrock (and other providers) requires a toolConfig when messages contain toolUse/toolResult content blocks, even if no active tools are being used. Previously the _noop tool injection was limited to github-copilot, but the underlying constraint affects Compaction on Bedrock-backed providers too (e.g. Portkey) — resulting in "toolConfig field must be defined" errors. Remove the github-copilot-specific guard so the _noop tool is injected whenever messages contain prior tool calls but no current tools are active. Closes anomalyco#34089
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: I found a potentially related PR: #34094 - This PR addresses the same underlying issue with Bedrock-backed providers requiring |
|
Closes #34089 |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #34089
Type of change
What does this PR do?
Bedrock (and other providers) requires a
toolConfigwhen messages containtoolUse/toolResultcontent blocks, even if no active tools are being used. Previously the_nooptool injection was limited togithub-copilot, but the underlying constraint affects Compaction on Bedrock-backed providers too (e.g. Portkey), resulting in "toolConfig field must be defined" errors.Removes the
github-copilot-specific guard so the_nooptool is injected whenever messages contain prior tool calls but no current tools are active.How did you verify your code works?
bun typecheckinpackages/opencode(0 errors onv2). The change is a 2-line removal (guard condition + comment); the_noopinjection andhasToolCallslogic are unchanged.Checklist