From dd773dcd059667a7fae747712af5944c1834e835 Mon Sep 17 00:00:00 2001 From: Dongwook Date: Mon, 20 Jul 2026 02:37:48 +0900 Subject: [PATCH] test(codex): cover image tool output replay (#7698) (#7704) Co-authored-by: Diego Rodrigues de Sa e Souza --- ...odex-custom-tool-image-output-7698.test.ts | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/unit/codex-custom-tool-image-output-7698.test.ts diff --git a/tests/unit/codex-custom-tool-image-output-7698.test.ts b/tests/unit/codex-custom-tool-image-output-7698.test.ts new file mode 100644 index 0000000000..819dd60ba7 --- /dev/null +++ b/tests/unit/codex-custom-tool-image-output-7698.test.ts @@ -0,0 +1,35 @@ +import test from "node:test"; +import assert from "node:assert/strict"; + +import { CodexExecutor } from "../../open-sse/executors/codex.ts"; + +test("Codex passthrough preserves image-view custom tool output input parts (#7698)", () => { + const executor = new CodexExecutor(); + const body = { + _nativeCodexPassthrough: true, + input: [ + { + type: "message", + role: "user", + content: [{ type: "input_text", text: "Inspect the image." }], + }, + { + type: "custom_tool_call_output", + call_id: "call_view_image", + output: [ + { type: "input_text", text: "Script completed\nOutput:\n" }, + { type: "input_image", image_url: "data:image/png;base64,AA==" }, + ], + }, + ], + stream: false, + }; + + const result = executor.transformRequest("gpt-5.6", body, false, { + requestEndpointPath: "/responses", + }); + const toolOutput = result.input.find((item) => item.type === "custom_tool_call_output"); + + assert.deepEqual(toolOutput, body.input[1]); + assert.equal(JSON.stringify(toolOutput).includes('"type":"output_text"'), false); +});