GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(ai): fold tool changes alongside context_management compaction on Responses by rekram1-node · Pull Request #65028 · anomalyco/opencode

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Nov 20, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

On OpenAI Responses, tool changes now fold into top-level tools when automatic context_management compaction is on, instead of going in place.

A removal in place leaves the tool declared in an earlier additional_tools item and adds a developer notice saying it's gone. Automatic compaction drops developer messages but keeps the declarations, so after it runs the model sees the tool with no notice:

 additional_tools: [weather]
-developer: "These tools are no longer available. Do not call them: weather."   ← dropped by compaction
 → the model keeps calling weather, and it's refused every step

I hit this live on gpt-6-astra with compactThreshold: 9000 while testing #64381: the model looped on the removed tool until the step limit, 2 of 2 runs. Folding sends the current tool list at the top, so a removed tool simply isn't declared. It's the same rule supportsEffortUpdates already uses for context_management.

The cost: with context_management on, a tool change misses the prompt cache, which is what every tool change does today.

Verification

  • New test in test/tool-updates.test.ts: with contextManagement set, no additional_tools item is sent and top-level tools is the current set. It fails without the change.
  • Full packages/ai suite, bun typecheck and bun run check pass.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rekram1-node rekram1-node mentioned this pull request Nov 20, 2026
feat(core): send mid-conversation tool changes in place #64381
Open
3 of 6 tasks
opencodejr[bot]
opencodejr Bot reviewed Nov 20, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks sound. I checked it in packages/ai, since OpenCode core still folds every tool change and so can't trigger either path. Both new tests in test/tool-updates.test.ts fail on the base and pass with this change. The full packages/ai suite and tsc type-checking pass.

The final custom-tool map still decides tool_choice and how new calls are parsed. The other users of OpenAIFreeform.tools (xAI, Chat, the compaction endpoint) are not affected, because only OpenAI Responses changes tools in place. Folding when contextManagement is set follows the same rule as supportsEffortUpdates.

The public API is unchanged; everything touched is internal to packages/ai.

No concerns.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rekram1-node
fix(ai): fold tool changes alongside context_management compaction on…
0ef0d4d
… Responses
@rekram1-node
rekram1-node force-pushed the responses-tool-change-fixes branch from 2476866 to 0ef0d4d Compare November 20, 2026 01:34
@rekram1-node rekram1-node changed the title fix(ai): keep earlier tool declarations stable across tool changes on Responses fix(ai): fold tool changes alongside context_management compaction on Responses Nov 20, 2026
opencodejr[bot]
opencodejr Bot reviewed Nov 20, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The free-form part was dropped, so this is now only the context_management fold. The change looks sound. It applies the same rule supportsEffortUpdates already uses, and with compaction on, a tool change misses the prompt cache, as every tool change does today. The new test fails on the base and passes here. The full packages/ai suite and tsc type-checking pass.

The public API is unchanged; the change is internal to packages/ai.

No concerns.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rekram1-node
rekram1-node merged commit ca9ba8a into dev Nov 27, 2026
12 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@rekram1-node
rekram1-node deleted the responses-tool-change-fixes branch November 27, 2026 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencodejr opencodejr[bot] opencodejr[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@rekram1-node
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.