Skip to content

fix(gateway): pin Telegram DM-topic routing to user's current topic#28513

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-6063e704
May 19, 2026
Merged

fix(gateway): pin Telegram DM-topic routing to user's current topic#28513
teknium1 merged 2 commits into
mainfrom
hermes/hermes-6063e704

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Salvage of #26609 (@karthikeyann). Two routing bugs in DM topic mode:

  1. Cross-topic Reply leak: Replying to a bot message in topic A while currently viewing topic B sent the new message into topic A (Telegram-side behavior). Runner switched to A's session — perceived 'context loss'.
  2. Stripped-reply lobby drop: _build_message_event strips message_thread_id for non-topic messages (PR [Bug]: Telegram DM sends fail with 'Message thread not found' — spurious thread_id from reply chains #3206), routing topic-mode replies to no-thread lobby session.

Fix: pin routing to the user's current topic instead of trusting inbound message_thread_id.

Authorship preserved via cherry-pick. 36/36 topic-mode tests passing.

karthikeyann and others added 2 commits May 18, 2026 22:29
Topic-mode DM replies were fragmenting one conversation across many sessions: a Reply on a message in another topic delivered Telegram's message_thread_id for *that* topic, and #3206's strip routed plain replies to the lobby. Both pulled the user away from their current session. Fix: when topic mode is on, rewrite source.thread_id to the user's most-recent binding if the inbound id is missing/General or not a known topic. Non-topic-mode users unchanged.
@teknium1 teknium1 merged commit fc42bb9 into main May 19, 2026
@teknium1 teknium1 deleted the hermes/hermes-6063e704 branch May 19, 2026 05:30
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-6063e704 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 8920 on HEAD, 8918 on base (🆕 +2)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 4671 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/telegram Telegram bot adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants