From ecfc5a5ee7048155ed8aa0d24b71c308c8499a42 Mon Sep 17 00:00:00 2001 From: Sebastian <19554889+sebslight@users.noreply.github.com> Date: Mon, 16 Feb 2026 22:16:01 -0500 Subject: [PATCH] test(agents): cover tool result media placeholders --- ...ded-subscribe.handlers.tools.media.test.ts | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/agents/pi-embedded-subscribe.handlers.tools.media.test.ts b/src/agents/pi-embedded-subscribe.handlers.tools.media.test.ts index 1c9599bc50..0677a525fc 100644 --- a/src/agents/pi-embedded-subscribe.handlers.tools.media.test.ts +++ b/src/agents/pi-embedded-subscribe.handlers.tools.media.test.ts @@ -1,9 +1,9 @@ import { describe, expect, it, vi } from "vitest"; +import type { EmbeddedPiSubscribeContext } from "./pi-embedded-subscribe.handlers.types.js"; import { handleToolExecutionEnd, handleToolExecutionStart, } from "./pi-embedded-subscribe.handlers.tools.js"; -import type { EmbeddedPiSubscribeContext } from "./pi-embedded-subscribe.handlers.types.js"; // Minimal mock context factory. Only the fields needed for the media emission path. function createMockContext(overrides?: { @@ -167,6 +167,28 @@ describe("handleToolExecutionEnd media emission", () => { expect(onToolResult).not.toHaveBeenCalled(); }); + it("does NOT emit media for placeholder text", async () => { + const onToolResult = vi.fn(); + const ctx = createMockContext({ shouldEmitToolOutput: false, onToolResult }); + + await handleToolExecutionEnd(ctx, { + type: "tool_execution_end", + toolName: "tts", + toolCallId: "tc-1", + isError: false, + result: { + content: [ + { + type: "text", + text: " placeholder with successful preflight voice transcript", + }, + ], + }, + }); + + expect(onToolResult).not.toHaveBeenCalled(); + }); + it("emits media from details.path fallback when no MEDIA: text", async () => { const onToolResult = vi.fn(); const ctx = createMockContext({ shouldEmitToolOutput: false, onToolResult });