Repository navigation
fix(agent): reject duplicate call IDs before executing a tool batch - #133
Draft
LukasParke wants to merge 1 commit into
Draft
LukasParke wants to merge 1 commit into
LukasParke wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #128
This is @chiarorosa's fix. The branch head is their commit
dd315f7, unchanged and with their authorship, from the #128 discussion. It is opened from an org branch so CI runs; happy to close in favor of a PR from their fork if they prefer.What
When one response contains two
function_callitems with the samecall_id, the run now throws before any tool body runs and before any follow-up request is sent. The error names the repeated ID. Previously both calls ran and the follow-up carried twofunction_call_outputitems for one ID.assertUniqueCallIds) runs at all three dispatch sites inmodel-result.ts: the initial response, later loop turns, and the pending batch on thestopWhen/allowFinalResponsepath. On each path it runs before the approval gate.approval-gate-regressions.test.ts"gates duplicate identical calls separately..." now uses distinct IDs with identical name and args.doom-loop-integration.test.tsduplicate-ID evasion test now expects the batch to be refused.tests/unit/duplicate-call-ids.test.tsand a patch changeset.Policy decision for the maintainer
Reject the whole batch (this PR) vs. drop or de-duplicate the duplicates and run the rest.
This PR rejects. Please confirm that's the intended behavior before merging.
Known limitation
This only checks IDs within a single response batch. An ID reused in a later turn (the same
call_idas a call from an earlier turn) is not detected. Catching that needs a check against the conversation history, so it is a separate follow-up.Test plan
main'smodel-result.ts) and pass with it. The distinct-ID and manual-only controls pass either way.pnpm install --frozen-lockfile,pnpm lint,pnpm typecheck,pnpm test(agent: 1241 passed, mcp: 12 passed).🤖 Generated with Claude Code