fix(telegram): keep topic thread when replying with message tool

This commit is contained in:
Cindy
2026-04-02 19:53:10 +13:00
committed by Ayaan Zaidi
parent dd080b6fb0
commit c001c090b9
2 changed files with 16 additions and 2 deletions

View File

@@ -254,6 +254,20 @@ describe("telegramPlugin threading", () => {
currentThreadTs: "77",
});
});
it("keeps current DM topic threadId even when replyToId is present", () => {
const resolved = telegramPlugin.threading?.resolveAutoThreadId?.({
cfg: createCfg(),
to: "telegram:1234",
replyToId: "4103",
toolContext: {
currentChannelId: "telegram:1234",
currentThreadTs: "533274",
},
});
expect(resolved).toBe("533274");
});
});
describe("telegramPlugin bindings", () => {

View File

@@ -824,8 +824,8 @@ export const telegramPlugin = createChatChannelPlugin({
threading: {
topLevelReplyToMode: "telegram",
buildToolContext: (params) => buildTelegramThreadingToolContext(params),
resolveAutoThreadId: ({ to, toolContext, replyToId }) =>
replyToId ? undefined : resolveTelegramAutoThreadId({ to, toolContext }),
resolveAutoThreadId: ({ to, toolContext }) =>
resolveTelegramAutoThreadId({ to, toolContext }),
},
outbound: {
base: {