[codex] fix gateway session key isolation for named profiles#12102
[codex] fix gateway session key isolation for named profiles#12102cola-runner wants to merge 2 commits into
Conversation
b6448bf to
0d3a2f7
Compare
0d3a2f7 to
cd8a9f0
Compare
cd8a9f0 to
3d92475
Compare
|
Thanks @alt-glitch — rebased on main and stripped this down to just the session-key fix (6 files, +189/-9) so the scope now matches #12103. Approach is the same (new One thing this PR adds on top of #12103: Happy to defer to #12103 if maintainers prefer it; in that case the |
build_session_key() and _parse_session_key() hardcoded `agent:main` as the prefix, so concurrent profiles (e.g. `profiles/wechat` and `profiles/feishu`) collided in the gateway session namespace for the same platform/chat identifiers. Derive the prefix from `HERMES_HOME` via a new `hermes_constants.get_profile_name()` helper that reuses the existing `parent.name == "profiles"` detection (standard and Docker layouts). The default deployment still emits `agent:main:…`, so existing session keys are unchanged. Named profiles now emit `agent:<name>:…` and are isolated. `_parse_session_key()` is loosened to accept any non-empty profile segment in position 1 — without this, keys built under a named profile would round-trip to `None` and break gateway routing. Fixes NousResearch#12099
Unblocks the check-attribution CI for this PR. The author is the PR submitter (cola-runner), confirmed via the GitHub email lookup. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0784343 to
59d28e6
Compare
|
Quick CI update after rebase onto current
Ready for review whenever. |
Summary
agent:mainagent:mainfor the default/custom-root deployment so existing session keys remain stable_parse_session_key()to understand named-profile session keys and add regression coverageRoot Cause
build_session_key()always emitted theagent:mainprefix, so named profiles shared the same gateway session namespace. That let different profiles generate colliding session keys for the same platform/chat identifiers.Testing
python -m pytest tests/gateway/test_session.py -qpython -m pytest tests/gateway/test_background_process_notifications.py -qpython -m pytest tests/gateway/test_interrupt_key_match.py -q tests/gateway/test_resume_command.py -q tests/gateway/test_session_model_reset.py -q tests/gateway/test_session_race_guard.py -qFixes #12099