From e9bb1314fe9104e0ec61090c46e7edecf24499ca Mon Sep 17 00:00:00 2001 From: Ayaan Zaidi Date: Wed, 6 May 2026 14:52:15 +0530 Subject: [PATCH] test(agents): align direct media block delivery coverage --- src/auto-reply/reply/agent-runner.media-paths.test.ts | 4 ++-- src/auto-reply/reply/reply-delivery.ts | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/auto-reply/reply/agent-runner.media-paths.test.ts b/src/auto-reply/reply/agent-runner.media-paths.test.ts index acfde87d4bc..3f93e1454c2 100644 --- a/src/auto-reply/reply/agent-runner.media-paths.test.ts +++ b/src/auto-reply/reply/agent-runner.media-paths.test.ts @@ -268,7 +268,8 @@ describe("runReplyAgent media path normalization", () => { }), ); - expect(result).toMatchObject({ + expect(result).toBeUndefined(); + expect(onBlockReply).toHaveBeenCalledWith({ text: "here is the chart", mediaUrl: "/tmp/outbound-media/1-chart.png", mediaUrls: ["/tmp/outbound-media/1-chart.png"], @@ -277,7 +278,6 @@ describe("runReplyAgent media path normalization", () => { audioAsVoice: false, }); expect(resolveOutboundAttachmentFromUrlMock).toHaveBeenCalledTimes(1); - expect(onBlockReply).not.toHaveBeenCalled(); }); it("does not create a second media context inside runAgentTurnWithFallback when onBlockReply is provided", async () => { diff --git a/src/auto-reply/reply/reply-delivery.ts b/src/auto-reply/reply/reply-delivery.ts index 8aba4bcb5f9..1df5b8322fb 100644 --- a/src/auto-reply/reply/reply-delivery.ts +++ b/src/auto-reply/reply/reply-delivery.ts @@ -158,8 +158,6 @@ export function createBlockReplyDeliveryHandler(params: { payload: blockPayload, }); } else if (blockHasMedia) { - // Media-bearing block replies (including text+media tool attachments) are not reliably - // reconstructible from the assistant's final text, so send them directly when streaming is off. await sendDirectBlockReply({ onBlockReply: params.onBlockReply, directlySentBlockKeys: params.directlySentBlockKeys,