You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds a durable owner_profile to async delegation records and requires owner_profile AND (session_key OR origin_ui_session_id OR parent_session_id) in interrupt_for_session/has_live_for_session, so deleting a session can never cooperatively-stop a live background delegation belonging to a different Hermes profile. Backward-compatible: callers that pass no owner keep the previous OR semantics.
Root Cause
The async delegation registry is process-global and interrupt_for_session combined the three selectors (session_key/origin_ui_session_id/parent_session_id) with pure OR logic, WITHOUT a profile owner. Session IDs are NOT unique across profiles — deleting a session in one profile could interrupt a live background delegation from another profile.
Verification
New isolation test: two profiles sharing the same session key — interrupt scoped to profile A only stops A's delegation (count=1), never B's. Backward-compat test: without owner_profile, the original OR behavior is preserved. All 39 existing delegation tests pass.
AI code review — automated review for reference; please use your judgment.
tools/async_delegation.py:_matches_session_selectors — Positive: owner_profile scoping is implemented as an AND over (profile match, at least one selector) rather than replacing the selector OR — so a profile-scoped interrupt can never leak across profiles on a colliding session_key/UI id, while every existing caller that omits the parameter keeps the exact legacy OR semantics (all pinned by tests, including has_live_for_session). The durable owner_profile column with additive ALTER TABLE and restart-recovery restore means post-crash delegations keep correct ownership too.
Nit: the fix only protects surfaces that actually pass owner_profile down to interrupt_for_session/has_live_for_session. Worth a quick audit that gateway session-end and /new-reset paths in multiplex mode supply it — otherwise those callers silently retain the old cross-profile OR behavior. No change requested beyond confirming that.
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
comp/toolsTool registry, model_tools, toolsetsP2Medium — degraded but workaround existssweeper:risk-session-stateSweeper risk: may lose/corrupt/mis-associate session or context statetool/delegateSubagent delegationtype/bugSomething isn't working
3 participants
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 Changed
Adds a durable
owner_profileto async delegation records and requiresowner_profile AND (session_key OR origin_ui_session_id OR parent_session_id)ininterrupt_for_session/has_live_for_session, so deleting a session can never cooperatively-stop a live background delegation belonging to a different Hermes profile. Backward-compatible: callers that pass no owner keep the previous OR semantics.Root Cause
The async delegation registry is process-global and
interrupt_for_sessioncombined the three selectors (session_key/origin_ui_session_id/parent_session_id) with pure OR logic, WITHOUT a profile owner. Session IDs are NOT unique across profiles — deleting a session in one profile could interrupt a live background delegation from another profile.Verification
New isolation test: two profiles sharing the same session key — interrupt scoped to profile A only stops A's delegation (count=1), never B's. Backward-compat test: without owner_profile, the original OR behavior is preserved. All 39 existing delegation tests pass.
Closes #6949