Skip to content

Commit b503c21

Browse files
committed
fix(telegram): retain preview message on generation mismatch race
Fixes #85807 When forceNewMessage() races with an in-flight Telegram preview send, the generation-mismatch path in draft-stream.ts was deleting the successfully sent message instead of retaining it. Added `retain: true` to the onSupersededPreview call in the generation-mismatch block, matching the behavior already used by the text-splitting superseded path at line 215-220. Test updated to verify retain field is set correctly.
1 parent c96fc45 commit b503c21

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

‎extensions/telegram/src/draft-stream.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ describe("createTelegramDraftStream", () => {
334334
textSnapshot: "Message A partial",
335335
parseMode: undefined,
336336
visibleSinceMs: supersededPreview.visibleSinceMs,
337+
retain: true,
337338
});
338339
expect(typeof supersededPreview.visibleSinceMs).toBe("number");
339340
expect(Number.isFinite(supersededPreview.visibleSinceMs)).toBe(true);

‎extensions/telegram/src/draft-stream.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ export function createTelegramDraftStream(params: {
177177
textSnapshot: renderedText,
178178
parseMode: renderedParseMode,
179179
visibleSinceMs,
180+
retain: true,
180181
});
181182
return true;
182183
}

0 commit comments

Comments
 (0)