fix: thread replyToId and threadId through message tool send action (#14948)

* fix: thread replyToId and threadId through message tool send action

* fix: omit replyToId/threadId from gateway send params

* fix: add threading seam regression coverage (#14948) (thanks @mcaxtr)

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
Marcus Castro
2026-02-13 00:55:20 -03:00
committed by GitHub
parent 8c920b9a18
commit 13bfd9da83
6 changed files with 127 additions and 0 deletions

View File

@@ -153,8 +153,10 @@ describe("runMessageAction threading auto-injection", () => {
});
const call = mocks.executeSendAction.mock.calls[0]?.[0] as {
threadId?: string;
ctx?: { params?: Record<string, unknown> };
};
expect(call?.threadId).toBe("42");
expect(call?.ctx?.params?.threadId).toBe("42");
});
@@ -235,8 +237,40 @@ describe("runMessageAction threading auto-injection", () => {
});
const call = mocks.executeSendAction.mock.calls[0]?.[0] as {
threadId?: string;
ctx?: { params?: Record<string, unknown> };
};
expect(call?.threadId).toBe("999");
expect(call?.ctx?.params?.threadId).toBe("999");
});
it("threads explicit replyTo through executeSendAction", async () => {
mocks.executeSendAction.mockResolvedValue({
handledBy: "plugin",
payload: {},
});
await runMessageAction({
cfg: telegramConfig,
action: "send",
params: {
channel: "telegram",
target: "telegram:123",
message: "hi",
replyTo: "777",
},
toolContext: {
currentChannelId: "telegram:123",
currentThreadTs: "42",
},
agentId: "main",
});
const call = mocks.executeSendAction.mock.calls[0]?.[0] as {
replyToId?: string;
ctx?: { params?: Record<string, unknown> };
};
expect(call?.replyToId).toBe("777");
expect(call?.ctx?.params?.replyTo).toBe("777");
});
});