From 8cc06fff2cc00692652a1a8daf3ddd0913eb9c76 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 27 Apr 2026 20:34:27 +0100 Subject: [PATCH] test(acp): cover media agent dir dispatch --- src/auto-reply/reply/dispatch-acp.test.ts | 36 +++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/auto-reply/reply/dispatch-acp.test.ts b/src/auto-reply/reply/dispatch-acp.test.ts index 6632375df84..b0d51b08073 100644 --- a/src/auto-reply/reply/dispatch-acp.test.ts +++ b/src/auto-reply/reply/dispatch-acp.test.ts @@ -528,6 +528,42 @@ describe("tryDispatchAcpReply", () => { expect(mediaUnderstandingMocks.applyMediaUnderstanding).not.toHaveBeenCalled(); }); + it("passes the ACP agent directory to media understanding", async () => { + setReadyAcpResolution(); + mockVisibleTextTurn("image turn"); + const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "dispatch-acp-")); + const agentDir = path.join(tempDir, "codex-agent"); + const imagePath = path.join(tempDir, "inbound.png"); + try { + await fs.mkdir(agentDir); + await fs.writeFile(imagePath, "image-bytes"); + + await runDispatch({ + bodyForAgent: "describe image", + cfg: createAcpTestConfig({ + agents: { + list: [{ id: "codex-acp", agentDir }], + }, + channels: { + discord: { + attachmentRoots: [tempDir], + }, + }, + }), + ctxOverrides: { + MediaPath: imagePath, + MediaType: "image/png", + }, + }); + + expect(mediaUnderstandingMocks.applyMediaUnderstanding).toHaveBeenCalledWith( + expect.objectContaining({ agentDir }), + ); + } finally { + await fs.rm(tempDir, { recursive: true, force: true }); + } + }); + it("forwards normalized image attachments into ACP turns", async () => { const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "dispatch-acp-")); const imagePath = path.join(tempDir, "inbound.png");