fix(telegram): make reaction handling soft-fail and message-id resilient (#20236)

* Telegram: soft-fail reactions and fallback to inbound message id

* Telegram: soft-fail missing reaction message id

* Update CHANGELOG.md

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
This commit is contained in:
LI SHANXIN
2026-02-23 23:25:14 +08:00
committed by GitHub
parent ea47ab29bd
commit c1b75ab8e2
17 changed files with 317 additions and 69 deletions

View File

@@ -14,7 +14,12 @@ describe("channels dock", () => {
const telegramContext = telegramDock?.threading?.buildToolContext?.({
cfg: emptyConfig(),
context: { To: " room-1 ", MessageThreadId: 42, ReplyToId: "fallback" },
context: {
To: " room-1 ",
MessageThreadId: 42,
ReplyToId: "fallback",
CurrentMessageId: "9001",
},
hasRepliedRef,
});
const googleChatContext = googleChatDock?.threading?.buildToolContext?.({
@@ -26,6 +31,7 @@ describe("channels dock", () => {
expect(telegramContext).toEqual({
currentChannelId: "room-1",
currentThreadTs: "42",
currentMessageId: "9001",
hasRepliedRef,
});
expect(googleChatContext).toEqual({
@@ -35,6 +41,23 @@ describe("channels dock", () => {
});
});
it("telegram threading does not treat ReplyToId as thread id in DMs", () => {
const hasRepliedRef = { value: false };
const telegramDock = getChannelDock("telegram");
const context = telegramDock?.threading?.buildToolContext?.({
cfg: emptyConfig(),
context: { To: " dm-1 ", ReplyToId: "12345", CurrentMessageId: "12345" },
hasRepliedRef,
});
expect(context).toEqual({
currentChannelId: "dm-1",
currentThreadTs: undefined,
currentMessageId: "12345",
hasRepliedRef,
});
});
it("irc resolveDefaultTo matches account id case-insensitively", () => {
const ircDock = getChannelDock("irc");
const cfg = {