Clear session-scoped approval state on /resume and /branch - #14246
Closed
Es1la wants to merge 1 commit into
Closed
Conversation
Collaborator
Contributor
5 tasks
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.
Summary
This fixes a session-boundary state leak in the gateway.
Before this change, session-scoped dangerous-command approvals and
/yolostate were keyed by
session_key, but they were not cleared when the userswitched conversations via
/resumeor/branch. That meant approval statefrom the previous conversation could silently carry over into the newly
resumed or branched conversation.
What changed
GatewayRunner._clear_session_boundary_security_state(session_key)/resumeswitch/branchswitch_pending_approvalsentry for that session as partof the same boundary cleanup
Why this is correct
/resumeand/branchare real conversation-boundary operations:they switch the active transcript to a different session. Session-scoped
dangerous-command approvals should not survive that boundary.
This matches the existing isolation direction already applied to
/newandother session-boundary cleanup paths.
Tests
Added regression tests covering:
/resumeclears session-scoped approval state/resumeclears session-scoped/yolostate/resumeclears only the active session’s pending approval cache/branchclears session-scoped approval state/branchclears session-scoped/yolostate/branchdoes not affect other sessionsValidated with: