fix(telegram): send Direct Messages topics with direct_messages_topic_id#21941
fix(telegram): send Direct Messages topics with direct_messages_topic_id#21941max-chad wants to merge 1 commit into
Conversation
|
Updating after reading PR #22053 by @leehack, which proposes a different (and structurally more correct) fix for the same issue and supersedes the approach in this PR. The scope analysis from earlier still applies: the original diff fixes one outgoing send site, and The bigger issue is the field choice. After comparing both diffs, the underlying Bot API behavior is subtler than this PR's approach captures: Hermes creates private-chat topic lanes via The actual mechanism Telegram supports for keeping replies in these lanes is
#22053 also propagates the routing through shared helpers in Recommend closing this PR as superseded so the maintainer reviews only one fix. The Thanks for filing. The discussion in this thread helped clarify the bug surface. |
|
Thanks for filing this — you correctly identified the post-Bot-API-10.0 regression and that
The third case turned out to be the more common one for our users — Hermes creates private-chat topic lanes via Your single-funnel Closing as superseded by #22410 — thanks for the contribution and the discussion that helped clarify the bug surface! |
Fixes Telegram Direct Messages topic delivery after Bot API/PTB split topic routing into separate fields.\n\nRoot cause: Hermes stored Telegram Direct Messages topic ids in source.thread_id and sent them as message_thread_id, which is for forum/group topics. Telegram rejects that with 'Thread not found'; the existing fallback retried without thread_id, so replies landed in the root/global DM view.\n\nChange:\n- route positive private/direct chat topic ids via direct_messages_topic_id;\n- preserve message_thread_id for group/forum topics;\n- keep General forum-topic send behavior unchanged;\n- add regressions for explicit dm metadata and current gateway metadata shape.\n\nValidation:\n- .venv/bin/python -m pytest tests/gateway/test_telegram_thread_fallback.py -q → 13 passed\n- .venv/bin/python -m compileall -q gateway/platforms/telegram.py\n- .venv/bin/python -m py_compile gateway/platforms/telegram.py tests/gateway/test_telegram_thread_fallback.py\n- git diff --check