fix(core,acp): reset owner_key/is_guest_context staleness, thread ACP identity into cross-thread store#6428
Merged
Merged
Conversation
…on, thread ACP identity into cross-thread store Reset session.owner_key and is_guest_context unconditionally at the top of every Agent::run loop iteration instead of relying solely on end_turn, so a fast-path slash-command dispatch that bypasses process_user_message cannot leak a stale value into the next LoopEvent regardless of its origin (#6418). Thread ACP's already-authenticated per-connection identity into all three ChannelMessage construction sites (do_prompt, /clear, /review) so ACP sessions get cross-thread store isolation consistent with gateway/A2A instead of collapsing to the shared local bucket (#6419). Closes #6418 Closes #6419
bug-ops
force-pushed
the
fix/6418-owner-key-stale-dispatch
branch
from
July 17, 2026 22:15
c935f38 to
2572e2c
Compare
bug-ops
enabled auto-merge (squash)
July 17, 2026 22:15
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
Two follow-ups from the cross-thread store
owner_keywork (spec-080, #6389 / PR #6416):session.owner_key/is_guest_contextwere set only in theLoopEvent::Messagearm of the agent loop and reset only atAgent::end_turn. A fast-path slash-command dispatch that exits the loop iteration viaDispatchFlow::Continue/Breakbefore reachingend_turncould leave a stale value in place for the nextLoopEvent(a scheduled task, autonomous tick, or a different sender's fast-path message). Both scalars are now reset unconditionally at the top of everyAgent::runloop iteration, closing the gap uniformly across CLI/TUI/Telegram/gateway/A2A/ACP.end_turn's existing reset is kept as defense-in-depth."local"bucket like the single-user CLI/TUI/Telegram paths, despite ACP having the strongest per-caller identity of any dispatch path. All threeChannelMessageconstruction sites in the ACP agent (do_prompt,/clear,/review) now carry that identity asowner_key.Review notes
session.owner_key/is_guest_contextbetween the reset and the point where they're set for the current iteration) and traced all ACP entry points to confirm the threeChannelMessagesites cover every path that reaches the cross-thread store.QueuedMessagehas noowner_key/is_guest_contextfields, so aChannelMessagequeued mid-turn silently loses its owner_key atdrain_channel. Confirmed unreachable today (every channel that can carry a real owner_key routes throughrecv(), nottry_recv()) and fail-safe in direction (falls back to the shared default bucket, never misattributes to another tenant). Worth a follow-up issue, not a blocker here.--profile ci, nextest, rustdoc gate) after rebase — all green.Test plan
Agentintegration test assertingowner_keyset/reset through a real turnscheduler_loop.rstest provingpersist_handoff_update/append_shared_state_blockare load-bearing onowner_key/clearand/reviewcargo +nightly fmt --checkcargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warningscargo nextest run --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins(14222 passed)RUSTFLAGS=-D warnings,--deny rustdoc::broken_intra_doc_links)Closes #6418
Closes #6419