fix(telegram): route resumed DM topic sends via direct_messages_topic_id#28488
Merged
Conversation
Contributor
🔎 Lint report:
|
4 tasks
This was referenced May 19, 2026
This was referenced May 27, 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.
Salvage of #27937 (@Qwinty).
Summary
After a gateway shutdown/resume, the final response goes through
gateway/platforms/base.py::_thread_metadata_for_source. That helper marked Telegram private topics withtelegram_dm_topic_reply_fallbackbut did NOT includedirect_messages_topic_id. Resumed/synthetic events often have nomessage_id, soTelegramAdapter._thread_kwargs_for_send()returned{}for the no-anchor path and delivered to the root DM lane.Complements #27212 (just merged) — which captures the triggering anchor for background-process notifications. This PR covers the resumed/synthetic-event path where no anchor is available at all by using Telegram's
direct_messages_topic_idBot API mechanism.Changes
gateway/platforms/base.py: adddirect_messages_topic_idto Telegram DM-topic thread metadata.gateway/platforms/telegram.py: when no anchor is available, fall back todirect_messages_topic_idinstead of returning{}.tests/gateway/test_telegram_thread_fallback.py: regression coverage.Validation
scripts/run_tests.sh tests/gateway/test_telegram_thread_fallback.py -q→ 35/35 passing.Conflict resolution
Docstring merge with #24004's
reply_to_modeclarification (both edits to the same docstring; merged in favor of keeping both notes).Authorship preserved via cherry-pick.