fix: preserve delivery thread fallback (#4911) (thanks @yevhen)

This commit is contained in:
Ayaan Zaidi
2026-01-31 09:23:40 +05:30
committed by Ayaan Zaidi
parent a642ca4ea8
commit 310eed825e
4 changed files with 17 additions and 2 deletions

View File

@@ -82,6 +82,7 @@ Status: stable.
- Telegram: avoid silent empty replies by tracking normalization skips before fallback. (#3796)
- Telegram: accept numeric messageId/chatId in react action and honor channelId fallback. (#4533) Thanks @Ayush10.
- Telegram: scope native skill commands to bound agent per bot. (#4360) Thanks @robhparker.
- Telegram: fall back to session origin thread id for delivery context when missing. (#4911) Thanks @yevhen.
- Mentions: honor mentionPatterns even when explicit mentions are present. (#3303) Thanks @HirokiKobayashi-R.
- Discord: restore username directory lookup in target resolution. (#3131) Thanks @bonald.
- Agents: align MiniMax base URL test expectation with default provider config. (#3131) Thanks @bonald.

View File

@@ -60,7 +60,7 @@ function normalizeSessionEntryDelivery(entry: SessionEntry): SessionEntry {
lastChannel: entry.lastChannel,
lastTo: entry.lastTo,
lastAccountId: entry.lastAccountId,
lastThreadId: entry.lastThreadId ?? entry.origin?.threadId,
lastThreadId: entry.lastThreadId ?? entry.deliveryContext?.threadId ?? entry.origin?.threadId,
deliveryContext: entry.deliveryContext,
});
const nextDelivery = normalized.deliveryContext;

View File

@@ -88,6 +88,20 @@ describe("delivery context helpers", () => {
accountId: undefined,
threadId: 42,
});
expect(
deliveryContextFromSession({
channel: "telegram",
lastTo: " -1001 ",
deliveryContext: { threadId: " 777 " },
origin: { threadId: 42 },
}),
).toEqual({
channel: "telegram",
to: "-1001",
accountId: undefined,
threadId: "777",
});
});
it("normalizes delivery fields and mirrors them on session entries", () => {

View File

@@ -98,7 +98,7 @@ export function deliveryContextFromSession(
lastChannel: entry.lastChannel,
lastTo: entry.lastTo,
lastAccountId: entry.lastAccountId,
lastThreadId: entry.lastThreadId ?? entry.origin?.threadId,
lastThreadId: entry.lastThreadId ?? entry.deliveryContext?.threadId ?? entry.origin?.threadId,
deliveryContext: entry.deliveryContext,
};
return normalizeSessionDeliveryFields(source).deliveryContext;