fix(telegram): ignore messageThreadId for DM chats (#14653)#17235
Closed
robbyczgw-cla wants to merge 1 commit intoopenclaw:mainfrom
Closed
fix(telegram): ignore messageThreadId for DM chats (#14653)#17235robbyczgw-cla wants to merge 1 commit intoopenclaw:mainfrom
robbyczgw-cla wants to merge 1 commit intoopenclaw:mainfrom
Conversation
Contributor
Author
|
Closing — this appears to be already fixed upstream. |
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.
Problem
In Telegram DM chats (non-forum),
resolveTelegramThreadSpec()forwardsmessage_thread_idas a thread ID in thethreadSpec. This causes reply routing issues since DMs do not have real threads — Telegram sometimes sendsmessage_thread_idin DMs (e.g. when Topics are enabled globally), but it has no semantic meaning there.Fixes #14653
Solution
Remove the
messageThreadIdbranch from the DM path inresolveTelegramThreadSpec(). DMs now always return{ scope: "dm" }without anidfield, regardless of whethermessage_thread_idis present.Changes
src/telegram/bot/helpers.ts— Collapsed the DM branch to always return{ scope: "dm" }(+1/−7 lines)src/telegram/bot-message-context.dm-topic-threadid.test.ts— Updated assertions to expect nothreadIdfor DMssrc/telegram/bot-message-dispatch.test.ts— Updated 4 test cases:threadSpecfor DMs no longer includesidTesting
All existing Telegram tests pass. The updated tests verify the new behavior: DMs never carry a thread ID.
Greptile Summary
This PR fixes a reply routing issue in Telegram DMs by removing spurious
message_thread_idhandling. Previously, when Telegram sentmessage_thread_idin DM chats (which can happen when Topics are enabled globally), the code incorrectly treated it as a real thread ID, causing session routing problems. The fix ensures DMs always return{ scope: "dm" }without anidfield, since DMs don't have semantic threads. The change correctly propagates through the codebase:replyThreadId,dmThreadId, andMessageThreadIdall becomeundefinedfor DMs, which is the intended behavior. All test updates properly verify that DMs never carry thread IDs, even whenmessage_thread_idis present in the Telegram message payload.Confidence Score: 5/5
{ scope: "dm" }without anid, which aligns with Telegram's semantics wheremessage_thread_idhas no meaning in DM chats. All affected code paths handleundefinedthreadSpec.id correctly (e.g.,buildTypingThreadParams,dmThreadIdextraction, session key resolution). The test updates comprehensively verify the new behavior across multiple scenarios. No edge cases or potential issues identified.Last reviewed commit: cd890e1