fix(telegram): refresh topic binding on compression session split#23244
Closed
devsart95 wants to merge 1 commit into
Closed
fix(telegram): refresh topic binding on compression session split#23244devsart95 wants to merge 1 commit into
devsart95 wants to merge 1 commit into
Conversation
When context compression splits a Telegram DM topic session, the gateway correctly updates session_store._entries[session_key].session_id to the new child session, but does NOT refresh the separate SQLite topic binding (telegram_dm_topic_bindings). On the next inbound message in that topic, the binding resolves to the stale parent session_id, causing the gateway to switch back to the pre-compression transcript — leading to repeated preflight compression loops. Fix: call _record_telegram_topic_binding() after updating session_store when a compression split is detected in a Telegram topic lane. This mirrors the existing fix for /new at gateway/run.py:7721-7725 which already rebinds the topic after explicit session reset. Fixes NousResearch#20470 X: @rojassartorio Co-authored-by: Rojas Sartorio <rojassartorio@users.noreply.github.com>
Collaborator
Contributor
|
Automated hermes-sweeper review: this PR's Telegram topic-binding fix has already landed on current main via a broader implementation. Evidence:
Thanks for the duplicate fix attempt here; the maintainer discussion correctly identified this as one of several competing fixes for #20470, and the merged mainline fix covers the behavior this PR was targeting. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When context compression splits a Telegram DM topic session, the gateway updates
session_store._entries[session_key].session_idto the new child session, but does not refresh the separate SQLite topic binding (telegram_dm_topic_bindings).Root cause
In
gateway/run.py:_run_agent(), after detecting a session split during compression:On the next inbound message in that topic, the binding lookup at the top of
_handle_message_with_agentresolves to the stale parentsession_id, switching the lane back to the pre-compression transcript. This causes repeated preflight compression loops on every subsequent message.Fix
After updating
session_store, also call_record_telegram_topic_binding()when the source is a Telegram topic lane. This mirrors the existing fix for/new(line 7721-7725) which already rebinds the topic after explicit session resets.Files changed
gateway/run.py— +15 lines after the existing session-store update blockFixes #20470
X: @rojassartorio