Skip to content

gateway: use persisted session origin for shutdown notifications#12766

Closed
Ruzzgar wants to merge 1 commit into
NousResearch:mainfrom
Ruzzgar:fix/gateway-shutdown-notification-routing
Closed

gateway: use persisted session origin for shutdown notifications#12766
Ruzzgar wants to merge 1 commit into
NousResearch:mainfrom
Ruzzgar:fix/gateway-shutdown-notification-routing

Conversation

@Ruzzgar

@Ruzzgar Ruzzgar commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix shutdown/restart notifications to route from the persisted session origin instead of reparsing the session key.

This avoids misrouting when session identifiers contain :, such as Matrix room IDs like !room123:example.org.

Problem

_notify_active_sessions_of_shutdown() was reconstructing the delivery target by reparsing session_key. That is fragile because session keys embed raw chat/thread identifiers, and some platforms legitimately use : inside those IDs.

As a result, active-session shutdown notifications could be truncated, misrouted, or dropped entirely on platforms with colon-bearing identifiers.

Fix

  • Prefer session_store._entries[session_key].origin when resolving the shutdown notification target
  • Keep the old session-key parsing as a fallback for legacy cases where no persisted origin is available
  • Preserve thread metadata when present

Tests

Added a regression test covering a Matrix-style room ID containing : and asserting that shutdown notifications are sent to the full persisted chat_id.

Also fixed the restart test helper so mocked session_store state matches what the runtime code expects.

teknium1 pushed a commit that referenced this pull request Apr 20, 2026
Prefer session_store origin over _parse_session_key() for shutdown
notifications. Fixes misrouting when chat identifiers contain colons
(e.g. Matrix room IDs like !room123:example.org).

Falls back to session-key parsing when no persisted origin exists.

Co-authored-by: Ruzzgar <ruzzgarcn@gmail.com>
Ref: #12766
teknium1 pushed a commit that referenced this pull request Apr 20, 2026
Prefer session_store origin over _parse_session_key() for shutdown
notifications. Fixes misrouting when chat identifiers contain colons
(e.g. Matrix room IDs like !room123:example.org).

Falls back to session-key parsing when no persisted origin exists.

Co-authored-by: Ruzzgar <ruzzgarcn@gmail.com>
Ref: #12766
@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #13013. Your commit was cherry-picked onto current main with your authorship preserved in git log. Thanks @Ruzzgar!

#13013

@teknium1 teknium1 closed this Apr 20, 2026
ulasbilgen pushed a commit to ulasbilgen/hermes-adhd-agent that referenced this pull request May 1, 2026
Prefer session_store origin over _parse_session_key() for shutdown
notifications. Fixes misrouting when chat identifiers contain colons
(e.g. Matrix room IDs like !room123:example.org).

Falls back to session-key parsing when no persisted origin exists.

Co-authored-by: Ruzzgar <ruzzgarcn@gmail.com>
Ref: NousResearch#12766
aj-nt pushed a commit to aj-nt/hermes-agent that referenced this pull request May 1, 2026
Prefer session_store origin over _parse_session_key() for shutdown
notifications. Fixes misrouting when chat identifiers contain colons
(e.g. Matrix room IDs like !room123:example.org).

Falls back to session-key parsing when no persisted origin exists.

Co-authored-by: Ruzzgar <ruzzgarcn@gmail.com>
Ref: NousResearch#12766
Luminet2023 pushed a commit to Luminet2023/hermes-agent that referenced this pull request May 1, 2026
Prefer session_store origin over _parse_session_key() for shutdown
notifications. Fixes misrouting when chat identifiers contain colons
(e.g. Matrix room IDs like !room123:example.org).

Falls back to session-key parsing when no persisted origin exists.

Co-authored-by: Ruzzgar <ruzzgarcn@gmail.com>
Ref: NousResearch#12766
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
Prefer session_store origin over _parse_session_key() for shutdown
notifications. Fixes misrouting when chat identifiers contain colons
(e.g. Matrix room IDs like !room123:example.org).

Falls back to session-key parsing when no persisted origin exists.

Co-authored-by: Ruzzgar <ruzzgarcn@gmail.com>
Ref: NousResearch#12766
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
Prefer session_store origin over _parse_session_key() for shutdown
notifications. Fixes misrouting when chat identifiers contain colons
(e.g. Matrix room IDs like !room123:example.org).

Falls back to session-key parsing when no persisted origin exists.

Co-authored-by: Ruzzgar <ruzzgarcn@gmail.com>
Ref: NousResearch#12766
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
Prefer session_store origin over _parse_session_key() for shutdown
notifications. Fixes misrouting when chat identifiers contain colons
(e.g. Matrix room IDs like !room123:example.org).

Falls back to session-key parsing when no persisted origin exists.

Co-authored-by: Ruzzgar <ruzzgarcn@gmail.com>
Ref: NousResearch#12766
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants