Repository navigation
fix(core): pair reused tool-call ids by transcript order - #7996
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Pairing and restoration packages/core/src/core/message-filter.ts, packages/core/src/__tests__/message-filter.test.ts |
The repair records results by issuer and call ID, emits all results associated with each call, and resolves kept results to their recorded issuer. Tests verify reused-ID pairing and restoration. |
Priority:
Estimated code review effort: 2 (Simple) | ~12 minutes
Change: Bug fix
Possibly related issues
- CopilotKit/CopilotKit issue 7891 describes mis-pairing when tool-call IDs are reused. This change addresses that behavior.
Possibly related PRs
- CopilotKit/CopilotKit#7984: Changes the
toolCallIdsOfhelper used by the repair path to identify call IDs. - CopilotKit/CopilotKit#7748: Adds the once-per-object expansion guard that the updated result-emission logic retains.
Merge Risk: 
Minimal · up to 5205f
-
The pairing change appears mergeable after normal checks; no actionable risk remains identified.
Pre-merge checks: 
5
-
Full details: Title check
-
Explanation
The title "fix(core): pair reused tool-call ids by transcript order" matches the main change. The change in message-filter.ts makes ɵrepairToolCallPairs pair each tool result with the nearest unmatched preceding assistant call that has the same call ID, so reused IDs across turns resolve by transcript order. The test additions cover the same behavior. The title is specific, concise, and follows the conventional commit style. It is consistent with the PR objectives, which describe pairing tool results with the nearest unmatched tool call when IDs are reused.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
@copilotkit/a2ui-renderer
@copilotkit/agentcore-runner
@copilotkit/angular
@copilotkit/channels
@copilotkit/channels-core
@copilotkit/channels-discord
@copilotkit/channels-intelligence
@copilotkit/channels-slack
@copilotkit/channels-teams
@copilotkit/channels-ui
@copilotkit/channels-whatsapp
@copilotkit/core
@copilotkit/intelligence-langgraph
@copilotkit/intelligence-mastra
@copilotkit/learning
@copilotkit/mcp-apps-renderer
@copilotkit/react-core
@copilotkit/react-native
@copilotkit/react-textarea
@copilotkit/react-ui
@copilotkit/runtime
@copilotkit/runtime-client-gql
@copilotkit/sdk-js
@copilotkit/shared
@copilotkit/sqlite-runner
@copilotkit/voice
@copilotkit/vue
@copilotkit/web-components
@copilotkit/web-inspector
commit: |
BenTaylorDev
left a comment
There was a problem hiding this comment.
Verified on current main merged with this branch and #7984: the message-filter tests pass (100) and the full core suite passes (1,479). Reverting message-filter.ts to main fails both new tests, including the issue's identity-filter repro. Pairing each result with the newest open call for its id matches ɵkeepToolResultsWithCalls. One edge for the record: with two same-id calls before both results (a1, a2, t1, t2), t1 pairs with a2. That case is ambiguous, and main drops t1 there, so this is still an improvement. Thanks!
I bless the code with a glad heart
What does this PR do?
Pairs tool results with the nearest unmatched tool call when a conversation reuses a tool-call ID across turns. This prevents filtered message repair from attaching a result to the wrong call.
Related PRs and Issues
Part of #7891.
Checklist
!and the description includes aBREAKING CHANGE:line with migration stepsSummary by CodeRabbit