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

@@ -22,12 +22,17 @@ export function buildThreadingToolContext(params: {
hasRepliedRef: { value: boolean } | undefined;
}): ChannelThreadingToolContext {
const { sessionCtx, config, hasRepliedRef } = params;
const currentMessageId = sessionCtx.MessageSidFull ?? sessionCtx.MessageSid;
if (!config) {
return {};
return {
currentMessageId,
};
}
const rawProvider = sessionCtx.Provider?.trim().toLowerCase();
if (!rawProvider) {
return {};
return {
currentMessageId,
};
}
const provider = normalizeChannelId(rawProvider) ?? normalizeAnyChannelId(rawProvider);
// Fallback for unrecognized/plugin channels (e.g., BlueBubbles before plugin registry init)
@@ -36,6 +41,7 @@ export function buildThreadingToolContext(params: {
return {
currentChannelId: sessionCtx.To?.trim() || undefined,
currentChannelProvider: provider ?? (rawProvider as ChannelId),
currentMessageId,
hasRepliedRef,
};
}
@@ -48,6 +54,7 @@ export function buildThreadingToolContext(params: {
From: sessionCtx.From,
To: sessionCtx.To,
ChatType: sessionCtx.ChatType,
CurrentMessageId: currentMessageId,
ReplyToId: sessionCtx.ReplyToId,
ThreadLabel: sessionCtx.ThreadLabel,
MessageThreadId: sessionCtx.MessageThreadId,
@@ -57,6 +64,7 @@ export function buildThreadingToolContext(params: {
return {
...context,
currentChannelProvider: provider!, // guaranteed non-null since dock exists
currentMessageId: context.currentMessageId ?? currentMessageId,
};
}