fix(gateway): route multiplex clarify replies by profile - #83346
fix(gateway): route multiplex clarify replies by profile#83346Burningiron wants to merge 1 commit into
Conversation
|
Independent production confirmation of the root cause this PR fixes — same mechanism, different platform (Matrix, not Telegram). We hit this on 2026-08-10 in a multiplexed gateway (
Our interim downstream mitigation (adapter-side override in our plugin, since we don't patch core): neurosovereign/hermes-matrix-tng@5e7aaab — resolves the reply at ingress against the profile-namespaced key. Verified in production after gateway restart: clarify replies now bind instantly while the turn is busy. On this PR's approach (profile-namespaced key for the clarify lookup only, adapter-local busy bookkeeping left in One note for reviewers: when |
One xfail per open member of the class mapped on NousResearch#82936: profile-scoped state resolved from ambient process state at use time instead of bound to the owning profile/session at creation. Test-only; fixes nothing; flips to XPASS as per-site fixes land. Members: NousResearch#82936 (multiplex terminal env), NousResearch#81952 (corrupt config silent fallback), NousResearch#83346 (ambient session-key profile), NousResearch#80318 (profile scope hides root MoA presets), NousResearch#83197/NousResearch#83557 (cron delivery scope reset before delivery).
fix(gateway): route multiplex clarify replies by profile
|
What does this PR do?
Routes active-session clarify replies through a profile-aware session key.
Under gateway multiplexing, the adapter busy guard remains adapter-local and uses the legacy
agent:mainkey, while a pending clarify request for a named profile is stored underagent:<profile>. The previous clarify bypass reused the adapter-local key, so replies for secondary profiles missed the pending clarify and fell through to the busy interrupt path.The fix builds a canonical clarify lookup key from the inbound event, including
event.source.profile, while leaving adapter-local active-session bookkeeping unchanged. This preserves default-profile behavior and routes secondary-profile replies to the existing clarify resolver.Related Issue
Fixes #83345
Type of Change
Changes Made
gateway/platforms/base.py: build the pending-clarify lookup key with the routed source profile.tests/gateway/test_clarify_active_session_bypass.py: add a behavioral regression test covering an adapter busy key underagent:mainand pending clarify underagent:research.How to Test
gateway.multiplex_profiles: true, a default profile, and a named secondary profile.clarify, then reply with a choice such as1.Focused automated verification:
The original behavior was reproduced on a Linux gateway. The focused regression suite was run on Linux with Python 3.11.
Checklist
Code
fix(scope):,feat(scope):, etc.)Documentation & Housekeeping
cli-config.yaml.exampleupdate: N/A — no configuration keys changedCONTRIBUTING.md/AGENTS.mdupdate: N/A — no architecture or workflow changesScreenshots / Logs
No deployment screenshots or private gateway logs are attached because they may contain messaging identifiers. The minimal reproduction, focused test output, and regression test contain no account or peer data.