Skip to content

fix(ai): add missing results for trailing tool calls - #52421

Merged
rekram1-node merged 1 commit into
v2from
trailing-tool-results
Oct 1, 2026
Merged

rekram1-node merged 1 commit into
v2from
trailing-tool-results

Conversation

@rekram1-node

Copy link
Copy Markdown
Collaborator

Issue for this PR

No linked issue.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Tool history normalization already adds a Tool result missing error result for an unanswered local tool call when the next user or assistant message arrives. A call at the very end of the history was left unanswered on purpose, so the request reached the provider with a call and no result, which providers reject.

This adds the same error result at the end of the history. Real results are kept, and provider-executed calls are still left alone. The tool is not run and is not reported as successful; the model is told the result is missing.

The provider test changes are fixtures whose history ends with an unanswered call. They now check the call message itself, or include the added error result where it was part of the asserted list.

How did you verify your code works?

  • New tool-history tests: trailing calls get an error result, available results are kept, and provider-executed calls are unchanged.
  • bun test in packages/ai: 1672 pass, 0 fail.
  • bun test test/session-runner.test.ts test/session-runner-tool-events.test.ts in packages/core: 246 pass.
  • bun typecheck in packages/ai and root bun run check.

Screenshots / recordings

Not a UI change.

Checklist

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

@rekram1-node
rekram1-node merged commit 9faf99a into v2 Oct 1, 2026
10 checks passed
@rekram1-node
rekram1-node deleted the trailing-tool-results branch October 1, 2026 04:29
Ichinose-Kazuki pushed a commit to Ichinose-Kazuki/opencode that referenced this pull request Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant