Skip to content

Commit c3da194

Browse files
Lukavyiobviyus
authored andcommitted
fix: populate currentThreadTs in threading tool context fallback for Telegram DM topics (#52217)
When a channel plugin lacks a custom buildToolContext (e.g. Telegram), the fallback path in buildThreadingToolContext did not set currentThreadTs from the inbound MessageThreadId. This caused resolveTelegramAutoThreadId to return undefined, so message tool sends without explicit threadId would route to the main chat instead of the originating DM topic. Fixes #52217
1 parent 3ae5d33 commit c3da194

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/auto-reply/reply/agent-runner-utils.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,13 @@ export function buildThreadingToolContext(params: {
4848
// Fallback for unrecognized/plugin channels (e.g., BlueBubbles before plugin registry init)
4949
const threading = provider ? getChannelPlugin(provider)?.threading : undefined;
5050
if (!threading?.buildToolContext) {
51+
const threadTs =
52+
sessionCtx.MessageThreadId != null ? String(sessionCtx.MessageThreadId) : undefined;
5153
return {
5254
currentChannelId: originTo?.trim() || undefined,
5355
currentChannelProvider: provider ?? (rawProvider as ChannelId),
5456
currentMessageId,
57+
currentThreadTs: threadTs || undefined,
5558
hasRepliedRef,
5659
};
5760
}

0 commit comments

Comments
 (0)