Repository navigation
fix: an approval runs its stored connection action only once - #137
Open
charan-rathore wants to merge 1 commit into
Open
charan-rathore wants to merge 1 commit into
charan-rathore wants to merge 1 commit into
Conversation
Signed-off-by: Charan Rathore <180254320+charan-rathore@users.noreply.github.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Contributor
Author
|
This is green on CI and conflict-free on my end. Is there anything you'd like changed before it can land? Happy to adjust. |
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.
What this changes
An approval-gated connection action could be executed more than once under the same approval.
claimActionkeys execution claims on(threadId, toolCallId), which stops a double click or a retried request from running twice. But nothing bound the approval itself to one run: after an approved action completed, POSTing the sameapprovalIdwith a freshtoolCallIdpassed every check (approval found, conversation matches, inside the one-hour TTL, tool still bound) and ran the stored request again. While the first run was still in flight, a secondtoolCallIdcould even start a concurrent execution of the same approved call.The POST path now looks up the action an approval was already claimed for and refuses a different
toolCallIdwith a 409. Same-toolCallIdretries still recover their saved result, and this composes with the interrupted-claim reclaim in #135, which reclaims under the sametoolCallId.Tests
New regression test in
tests/connections.test.ts: approve once (runs, receiptdone), then POST the sameapprovalIdunder a newtoolCallIdand expect a 409 with the send mock called exactly once. The test failed before the change (the stored request ran a second time) and passes after. Full suite: 303 passed across 48 files,tsc --noEmitand eslint clean.