fix: preserve Telegram DM topic thread routing#18993
Conversation
|
The formal models extracted constants ( This check is informational (not blocking merges yet). If this change is intentional, follow up by updating the formal models repo or regenerating the extracted artifacts there. |
1 similar comment
|
The formal models extracted constants ( This check is informational (not blocking merges yet). If this change is intentional, follow up by updating the formal models repo or regenerating the extracted artifacts there. |
|
The formal models extracted constants ( This check is informational (not blocking merges yet). If this change is intentional, follow up by updating the formal models repo or regenerating the extracted artifacts there. |
761a61b to
6076eee
Compare
|
Merged via maintainer workflow. What I ran:
Merge details:
Notes:
|
Fixes #18974.
What changed:
message_thread_idfor private chats in Telegram send paths.message_thread_idfor DM topics.message thread not found, retry once withoutmessage_thread_id.Tests:
src/telegram/send.test.tsto assert DM topic sends keepmessage_thread_id.chat not founddoes not trigger thread fallback retry.pnpm vitest run src/telegram/send.test.tspasses.Greptile Summary
This PR fixes Telegram DM topic routing by removing the blanket suppression of
message_thread_idfor private chats (positive chat IDs). Previously,isTelegramPrivateChatstripped thread IDs for all positive chat IDs, which broke DM topics since Telegram Bot API does support topics in private chats. The fix replaces sign-based filtering with scope-based routing:parseTelegramTargetprovideschatType, whichbuildTelegramThreadReplyParamsuses to set the correct thread scope ("dm"vs"forum"), delegating to the existingbuildTelegramThreadParamshelper that already handled DM scope correctly.isTelegramPrivateChathelper and its blanket thread ID suppression for positive chat IDschatTypeparameter tobuildTelegramThreadReplyParamsto route thread scope by parsed chat type rather than chat ID signwithTelegramThreadFallbackretry for "message thread not found" errors, which safely handles plain DMs without topic supportAIDEV-NOTE) against widening the fallback to cover "chat not found" errorsConfidence Score: 5/5
buildTelegramThreadParamsalready handled "dm" scope), and the thread-not-found retry fallback provides a safety net for edge cases. Three new regression tests cover DM topic sends, DM thread-not-found retry, and chat-not-found non-retry. No new dependencies, no security surface changes, and backward compatible (only changes behavior for DM targets with thread IDs, which were previously broken).Last reviewed commit: 3537aa9