From a6a5e3cd51cc374559b88064659a458bcc8aaa9c Mon Sep 17 00:00:00 2001 From: rshirali Date: Wed, 28 Jan 2026 14:54:21 +0100 Subject: [PATCH] test(exec): update approval-id test mocks for new two-phase flow Mock both exec.approval.request (registration) and exec.approval.waitDecision (decision) calls to match the new internal implementation. --- src/agents/bash-tools.exec.approval-id.test.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/agents/bash-tools.exec.approval-id.test.ts b/src/agents/bash-tools.exec.approval-id.test.ts index a5587355b..43262476e 100644 --- a/src/agents/bash-tools.exec.approval-id.test.ts +++ b/src/agents/bash-tools.exec.approval-id.test.ts @@ -51,6 +51,11 @@ describe("exec approvals", () => { vi.mocked(callGatewayTool).mockImplementation(async (method, _opts, params) => { if (method === "exec.approval.request") { + // Return registration confirmation (status: "accepted") + return { status: "accepted", id: (params as { id?: string })?.id }; + } + if (method === "exec.approval.waitDecision") { + // Return the decision when waitDecision is called return { decision: "allow-once" }; } if (method === "node.invoke") { @@ -159,10 +164,14 @@ describe("exec approvals", () => { resolveApproval = resolve; }); - vi.mocked(callGatewayTool).mockImplementation(async (method) => { + vi.mocked(callGatewayTool).mockImplementation(async (method, _opts, params) => { calls.push(method); if (method === "exec.approval.request") { resolveApproval?.(); + // Return registration confirmation + return { status: "accepted", id: (params as { id?: string })?.id }; + } + if (method === "exec.approval.waitDecision") { return { decision: "deny" }; } return { ok: true };