From 8860d2ed7f330dea2bb722ec82dd4b20788235d3 Mon Sep 17 00:00:00 2001 From: damaozi <1811866786@qq.com> Date: Thu, 5 Feb 2026 03:40:46 +0800 Subject: [PATCH] fix(telegram): preserve DM topic threadId in deliveryContext When receiving messages in Telegram DM topics (Topics in Private Chats), the threadId was not saved in the session's deliveryContext, causing replies to go to General chat instead of the topic. Now we pass threadId to updateLastRoute for DM topics. Fixes #8891 --- src/telegram/bot-message-context.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/telegram/bot-message-context.ts b/src/telegram/bot-message-context.ts index 9c4db19b6..c09da0774 100644 --- a/src/telegram/bot-message-context.ts +++ b/src/telegram/bot-message-context.ts @@ -637,6 +637,8 @@ export const buildTelegramMessageContext = async ({ channel: "telegram", to: String(chatId), accountId: route.accountId, + // Preserve DM topic threadId for replies (fixes #8891) + threadId: dmThreadId != null ? String(dmThreadId) : undefined, } : undefined, onRecordError: (err) => {