fix(gateway): avoid cross-profile session recovery (#58119 salvage) - #59325
Merged
Conversation
santhreal
pushed a commit
to santhreal/hermes-agent
that referenced
this pull request
Jul 13, 2026
Co-authored-by: yoma <yingwaizhiying@gmail.com>
justemu
pushed a commit
to justemu/hermes-agent
that referenced
this pull request
Jul 18, 2026
Co-authored-by: yoma <yingwaizhiying@gmail.com>
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
Co-authored-by: yoma <yingwaizhiying@gmail.com>
leewenjie
pushed a commit
to leewenjie/hermes-agent
that referenced
this pull request
Aug 7, 2026
Co-authored-by: yoma <yingwaizhiying@gmail.com>
randlee
pushed a commit
to randlee/hermes-agent
that referenced
this pull request
Aug 11, 2026
Co-authored-by: yoma <yingwaizhiying@gmail.com>
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
Session recovery no longer revives another profile's session:
_recover_session_from_dbrejects recovered rows whosesession_keyencodes a different profile namespace than the active profile.Salvages #58119 by @tianma-if (cherry-picked, authorship preserved). Fixes #58032.
Root cause:
_recover_session_from_db/hermes_state.find_latest_gateway_session_for_peerfilter only by session_key or peer tuple (source/user/chat/thread) with no profile constraint. After turning multiplexing off, the peer-tuple fallback could revive anagent:coder:...row for anagent:main:...request — the user's chat silently resumes in the wrong profile's session.Changes
gateway/session.py: profile-namespace guard on recovered rows; same-profile legacy migration preservedtests/gateway/test_multiplex_phase0.py: rejects cross-profile fallback, allows same-profile fallbackValidation
Fifth PR in the multiplex isolation cluster (#59310, #59315, #59320, #59321).
Infographic