Skip to content

fix(llm): inject _noop tool for all providers when messages contain tool history#36221

Open
Robin1987China wants to merge 1 commit into
anomalyco:v2from
Robin1987China:noop-tool-v2
Open

fix(llm): inject _noop tool for all providers when messages contain tool history#36221
Robin1987China wants to merge 1 commit into
anomalyco:v2from
Robin1987China:noop-tool-v2

Conversation

@Robin1987China

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #34089

Type of change

  • Bug fix

What does this PR do?

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.

Removes the github-copilot-specific guard so the _noop tool is injected whenever messages contain prior tool calls but no current tools are active.

How did you verify your code works?

bun typecheck in packages/opencode (0 errors on v2). The change is a 2-line removal (guard condition + comment); the _noop injection and hasToolCalls logic are unchanged.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

…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
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

I found a potentially related PR:

#34094 - fix(opencode): restore _noop tool injection for Bedrock-backed providers during compaction

This PR addresses the same underlying issue with Bedrock-backed providers requiring toolConfig when messages contain tool history. It appears to be directly related to issue #34089 mentioned in the current PR. You may want to check if this PR was already closed/merged or if there's overlap in the fix approach.

@Robin1987China

Copy link
Copy Markdown
Contributor Author

Closes #34089

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant