test(agents): align direct media block delivery coverage

This commit is contained in:
Ayaan Zaidi
2026-05-06 14:52:15 +05:30
parent 5dd5fba730
commit e9bb1314fe
2 changed files with 2 additions and 4 deletions

View File

@@ -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 () => {

View File

@@ -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,