Skip to content

fix(gateway): use persisted session origin for shutdown notifications#13013

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-e110a05f
Apr 20, 2026
Merged

fix(gateway): use persisted session origin for shutdown notifications#13013
teknium1 merged 1 commit into
mainfrom
hermes/hermes-e110a05f

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Use persisted session-store origin for shutdown notification routing instead of reparsing session keys with _parse_session_key().

Fixes misrouting when chat identifiers contain colons (e.g. Matrix room IDs like !room123:example.org). Falls back to session-key parsing for legacy sessions without persisted origin.

Changes

  • gateway/run.py: Prefer session_store._entries[key].origin in _notify_active_sessions_of_shutdown()
  • tests/gateway/restart_test_helpers.py: Wire _entries dict on mocked session_store
  • tests/gateway/test_restart_drain.py: Regression test for Matrix-style colon-bearing room IDs

Validation

Before After
Matrix !room123:example.org Truncated to !room123 Full ID preserved
Normal Telegram 999 Works Works (unchanged)

14/14 restart drain tests pass.

Salvaged from #12766 by @Ruzzgar — cherry-picked with authorship preserved.

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 teknium1 merged commit 0613f10 into main Apr 20, 2026
3 of 4 checks passed
@teknium1 teknium1 deleted the hermes/hermes-e110a05f branch April 20, 2026 12:15
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