From bedd8b586b97ebdeab756df34ddbe2beb66446dd Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sat, 14 Mar 2026 23:16:59 -0700 Subject: [PATCH] ACP tests: cover rawInput-only safe tool approval --- src/acp/client.test.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/acp/client.test.ts b/src/acp/client.test.ts index 57d17c5be26..2595e89bfee 100644 --- a/src/acp/client.test.ts +++ b/src/acp/client.test.ts @@ -366,6 +366,26 @@ describe("resolvePermissionRequest", () => { expect(prompt).not.toHaveBeenCalled(); }); + it("auto-approves safe tools when rawInput is the only identity hint", async () => { + const prompt = vi.fn(async () => true); + const res = await resolvePermissionRequest( + makePermissionRequest({ + toolCall: { + toolCallId: "tool-raw-only", + title: "Searching files", + status: "pending", + rawInput: { + name: "search", + query: "foo", + }, + }, + }), + { prompt, log: () => {} }, + ); + expect(res).toEqual({ outcome: { outcome: "selected", optionId: "allow" } }); + expect(prompt).not.toHaveBeenCalled(); + }); + it("prompts when raw input spoofs a safe tool name for a dangerous title", async () => { const prompt = vi.fn(async () => false); const res = await resolvePermissionRequest(