-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
[Bug] Exec approval follow-up can leak into a new session after /new because it rebinds by sessionKey instead of original sessionId #59349
Copy link
Copy link
Closed
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
If a session has a pending exec approval and the user starts a new session with
/newor/resetbefore that approval resolves, the eventual approval follow-up can be delivered into the new session. This shows up as unrelated stale approval messages,Exec denied, or continuation text in a fresh conversation.Affected version
OpenClaw 2026.3.31
Observed behavior
The exec approval follow-up is effectively routed by logical
sessionKey. After/newor/reset, the samesessionKeycan point to a newsessionId, so when the old approval finishes its follow-up can land in the new session transcript.Expected behavior
The follow-up should stay bound to the original session instance. Once that
sessionKeyhas been rebound to a differentsessionId, stale follow-ups should be dropped instead of being delivered into the new session.Reproduction
sessionKey./newor/reset, creating a newsessionIdunder the same logical session key.Root cause
The follow-up path only tracked
sessionKey, not the originalsessionIdthat was active when the exec request was created.Proposed fix
Capture
expectedSessionIdwhen creating the exec approval follow-up target, then before sending compare it with the latestsessionKey -> sessionIdmapping. If they differ, log and drop the stale follow-up.Validation
I reproduced this locally, applied that guard in the installed dist, restarted the gateway, and verified that a previously pending approval no longer polluted the new session after
/reset.Concrete validation data from the local repro:
21abfe34-9309-40bb-9a2b-9a43349d4d7959ada67a-ec92-4955-b3f5-b894be448e136884416d-17e1-402a-870b-0b6a24762c4cIf helpful, I can also turn the validated local fix into a source-level PR.