

























@@ -3179,8 +3179,11 @@ describe("dispatchTelegramMessage draft streaming", () => {
31793179);
31803180});
318131813182-it("handles error block + response final — error delivered, response finalizes preview", async () => {
3183-const draftStream = createDraftStream(999);
3182+it("sends a fresh final after a visible error block bubble pushes the preview up", async () => {
3183+const draftStream = createTestDraftStream({
3184+messageId: 999,
3185+visibleSinceMs: Date.now() - 1_000,
3186+});
31843187createTelegramDraftStream.mockReturnValue(draftStream);
31853188editMessageTelegram.mockResolvedValue({ ok: true });
31863189dispatchReplyWithBufferedBlockDispatcher.mockImplementation(
@@ -3201,16 +3204,18 @@ describe("dispatchTelegramMessage draft streaming", () => {
3201320432023205await dispatchWithContext({ context: createContext() });
320332063204-// Block error went through deliverReplies
3205-expect(deliverReplies).toHaveBeenCalledTimes(1);
3206-// Final was finalized via preview edit
3207-expect(editMessageTelegram).toHaveBeenCalledWith(
3208-123,
3209-999,
3210-"The command timed out. Here's what I found...",
3211-expect.any(Object),
3207+// Error block + fresh final both went through deliverReplies; preview was
3208+// not edited in place and the stale preview was cleared.
3209+expect(deliverReplies).toHaveBeenCalledTimes(2);
3210+expect(editMessageTelegram).not.toHaveBeenCalled();
3211+expect(deliverReplies).toHaveBeenLastCalledWith(
3212+expect.objectContaining({
3213+replies: [
3214+expect.objectContaining({ text: "The command timed out. Here's what I found..." }),
3215+],
3216+}),
32123217);
3213-expect(draftStream.clear).not.toHaveBeenCalled();
3218+expect(draftStream.clear).toHaveBeenCalled();
32143219});
3215322032163221// #76529: when a visible non-final message is delivered after the answer
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。