-
Notifications
You must be signed in to change notification settings - Fork 84
fix: propagate guardian code delivery failures #9733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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.
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.
🔴 Orphaned verification session left active when guardian code delivery fails
When
deliverVerificationCodeToGuardianfails, the approval has already been atomically resolved to'approved'and a verification session has already been created (both happen insidehandleAccessRequestDecisionataccess-request-decision.ts:58-101before the delivery attempt). The session remains inawaiting_responsestatus with a valid secret, but the code was never delivered to the guardian.Root Cause and Impact
The sequence in
handleAccessRequestApprovalis:handleAccessRequestDecision()→ resolves approval to'approved'AND creates verification session (access-request-decision.ts:62andaccess-request-decision.ts:86-94)deliverVerificationCodeToGuardian()→ fails (guardian-approval-interception.ts:1005-1012)codeDelivered = false→ requester is told "try again later" (guardian-approval-interception.ts:1029-1036)But there is no cleanup of the orphaned verification session. The session sits in
awaiting_responsestatus for 10 minutes with a code nobody knows. More critically, the approval is already consumed (status: 'approved'), so if the requester "tries again later" by sending a new message,findPendingAccessRequestForRequesterwon't find a pending approval — the flow cannot be retried.The requester is permanently stuck: the approval is consumed, the code was never delivered, and there's no retry path. The session will eventually expire, but the user experience is a dead end.
The fix should either (a) revoke/expire the verification session when delivery fails (e.g.,
updateSessionStatus(decisionResult.verificationSessionId, 'revoked')) so it doesn't linger, or (b) roll back the approval status so it can be retried, or (c) both.Prompt for agents
Was this helpful? React with 👍 or 👎 to provide feedback.