fix(telegram): respect reply_to_mode for DM topic reply fallback#24004
Closed
liuhao1024 wants to merge 1 commit into
Closed
fix(telegram): respect reply_to_mode for DM topic reply fallback#24004liuhao1024 wants to merge 1 commit into
liuhao1024 wants to merge 1 commit into
Conversation
The DM topic reply fallback code in send() hardcoded should_thread=True when telegram_dm_topic_reply_fallback metadata was present, bypassing _should_thread_reply() and ignoring reply_to_mode config. This caused quote bubbles on every response even with reply_to_mode: 'off'. Fix: - Add reply_to_mode param to _reply_to_message_id_for_send() and _thread_kwargs_for_send() classmethods - In send(), check self._reply_to_mode != 'off' for DM topic fallback - Suppress reply anchor and reply_to_message_id when mode is 'off' while preserving message_thread_id for correct topic routing - Thread reply_to_mode through all 29 call sites Regression coverage: 10 new tests in test_telegram_reply_mode.py covering classmethod behavior, send() integration, and backward compatibility. Fixes reply_to_mode: 'off' ignored by Telegram DM topic reply fallback code NousResearch#23994
Contributor
This was referenced May 19, 2026
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
reply_to_mode: 'off'is ignored when sending messages via Hermes-created DM topic lanes (Telegram private-chat topics). The bot continues to show quote bubbles pointing to the user's message despite the explicit config.Root Cause
Commit
b3239572fintroduced a DM topic reply fallback path insend()that hardcodesshould_thread = reply_to_source is not None, completely bypassing_should_thread_reply()— the single method that checks_reply_to_mode.Additionally,
_reply_to_message_id_for_send()and_thread_kwargs_for_send()unconditionally return the reply anchor for DM topic fallback sends, propagating the ignore through all ~29 call sites.Fix
reply_to_modeparameter to_reply_to_message_id_for_send()and_thread_kwargs_for_send()classmethodssend(), changed DM topic fallback to checkself._reply_to_mode != "off"before settingshould_threadreply_to_mode == "off":_reply_to_message_id_for_send()returnsNone(no quote bubble)_thread_kwargs_for_send()returns onlymessage_thread_id(preserves topic routing without reply anchor)reply_to_mode=self._reply_to_modethrough all 29 call sitesRegression Coverage
10 new tests in
test_telegram_reply_mode.py(TestDMTopicFallbackReplyToMode):test_reply_to_id_suppressed_when_offtest_reply_to_id_returned_when_first/alltest_reply_to_id_returned_when_no_modetest_explicit_reply_to_overrides_modetest_thread_kwargs_suppressed_reply_anchor_when_offtest_thread_kwargs_returns_full_when_firsttest_thread_kwargs_no_mode_backward_compattest_send_dm_topic_off_no_quotetest_send_dm_topic_first_still_quotesAll 40 tests in
test_telegram_reply_mode.pypass (30 existing + 10 new).All 107 tests across
test_telegram_reply_mode.py,test_telegram_reply_quote.py,test_telegram_thread_fallback.py, andtest_telegram_topic_mode.pypass.Testing
Fixes reply_to_mode: 'off'ignored by Telegram DM topic reply fallback code #23994