From 89296a60634bf5fec5ec119f18a48df2b1ec2abc Mon Sep 17 00:00:00 2001 From: Dotta Date: Thu, 3 Sep 2026 01:21:10 -0500 Subject: [PATCH] fix(runner): separate Codex approvals from questions --- .../src/drivers/acpx/codex-runtime-adapter.test.ts | 2 +- .../src/drivers/acpx/codex-runtime-adapter.ts | 2 +- .../test/acpx-codex-package-contract.test.mjs | 7 +++++++ patches/@agentclientprotocol__codex-acp@1.6.2.patch | 9 +++++++++ pnpm-lock.yaml | 8 ++++---- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/packages/paperclip-runner/src/drivers/acpx/codex-runtime-adapter.test.ts b/packages/paperclip-runner/src/drivers/acpx/codex-runtime-adapter.test.ts index f525adb27c0..391af18bd45 100644 --- a/packages/paperclip-runner/src/drivers/acpx/codex-runtime-adapter.test.ts +++ b/packages/paperclip-runner/src/drivers/acpx/codex-runtime-adapter.test.ts @@ -93,7 +93,7 @@ describe("Codex ACPX runtime adapter", () => { OPENAI_API_KEY: "credential-secret", }); expect(runtimeOptions?.spawnCwd).toBe("/workspace"); - expect(runtimeOptions?.elicitationModes).toEqual([]); + expect(runtimeOptions?.elicitationModes).toEqual(["form"]); expect(await port.identity()).toEqual({ acpxRecordId: "record-1", backendSessionId: "backend-1", diff --git a/packages/paperclip-runner/src/drivers/acpx/codex-runtime-adapter.ts b/packages/paperclip-runner/src/drivers/acpx/codex-runtime-adapter.ts index 939582f509f..0c9834f94a0 100644 --- a/packages/paperclip-runner/src/drivers/acpx/codex-runtime-adapter.ts +++ b/packages/paperclip-runner/src/drivers/acpx/codex-runtime-adapter.ts @@ -228,7 +228,7 @@ export async function openQualifiedAcpxRuntime( overrides: { [options.profile.agent]: [VERIFIED_COMMAND_SENTINEL] }, }), permissionMode: options.permissionMode, - elicitationModes: options.profile.agent === "codex" ? [] : ["form"], + elicitationModes: ["form"], nonInteractivePermissions: "fail", permissionPolicy: { ...options.permissionPolicy, diff --git a/packages/paperclip-runner/test/acpx-codex-package-contract.test.mjs b/packages/paperclip-runner/test/acpx-codex-package-contract.test.mjs index 3b504d57410..6b2fb2065db 100644 --- a/packages/paperclip-runner/test/acpx-codex-package-contract.test.mjs +++ b/packages/paperclip-runner/test/acpx-codex-package-contract.test.mjs @@ -130,6 +130,13 @@ test("the Codex patch enforces isolated instructions, tools, and skills", () => } }); +test("the Codex patch keeps MCP tool approvals on the governed permission channel", () => { + assert.match( + codexPatch, + /!context\.isToolApproval && this\.shouldUseAcpElicitation\(params\)/, + ); +}); + test("the Claude patch removes ambient project and local configuration", () => { for (const token of [ "PAPERCLIP_ACPX_ISOLATED_CONTEXT", diff --git a/patches/@agentclientprotocol__codex-acp@1.6.2.patch b/patches/@agentclientprotocol__codex-acp@1.6.2.patch index f6a8c34bfe2..e9355a29016 100644 --- a/patches/@agentclientprotocol__codex-acp@1.6.2.patch +++ b/patches/@agentclientprotocol__codex-acp@1.6.2.patch @@ -1,6 +1,15 @@ diff --git a/dist/index.js b/dist/index.js --- a/dist/index.js +++ b/dist/index.js +@@ -25341,7 +25341,7 @@ + async handleElicitation(params) { + try { + const context = this.createMcpElicitationContext(params); +- if (this.shouldUseAcpElicitation(params)) { ++ if (!context.isToolApproval && this.shouldUseAcpElicitation(params)) { + const response2 = await this.connection.request( + methods.client.elicitation.create, + this.buildElicitationRequest(params, context), @@ -25563,7 +25563,7 @@ toolCall: { toolCallId: context.correlatedCallId, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 431f4d67a63..276de9214c4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,7 +17,7 @@ patchedDependencies: hash: axsvv3fhdlmmbmnhpi2cywic6q path: patches/@agentclientprotocol__claude-agent-acp@0.73.0.patch '@agentclientprotocol/codex-acp@1.6.2': - hash: grbydorkxatbzksnwwfuawwtim + hash: elxjibratyxkrkkxxyoqtz36pe path: patches/@agentclientprotocol__codex-acp@1.6.2.patch acpx@0.12.0: hash: b2ggqg6aj4hdob4whk6vq6jmc4 @@ -176,7 +176,7 @@ importers: dependencies: '@agentclientprotocol/codex-acp': specifier: ^1.6.2 - version: 1.6.2(patch_hash=grbydorkxatbzksnwwfuawwtim) + version: 1.6.2(patch_hash=elxjibratyxkrkkxxyoqtz36pe) '@paperclipai/adapter-utils': specifier: workspace:* version: link:../../adapter-utils @@ -479,7 +479,7 @@ importers: version: 0.70.0(patch_hash=fymctidcjqjhi4cj72qtivlxry)(@anthropic-ai/sdk@0.121.0(zod@4.4.3))(@modelcontextprotocol/sdk@1.30.0(zod@4.4.3)) '@agentclientprotocol/codex-acp': specifier: 1.6.2 - version: 1.6.2(patch_hash=grbydorkxatbzksnwwfuawwtim) + version: 1.6.2(patch_hash=elxjibratyxkrkkxxyoqtz36pe) acpx: specifier: 0.13.1 version: 0.13.1(patch_hash=lzpwjtiaybzoijy455dfycwavu) @@ -8538,7 +8538,7 @@ snapshots: - '@anthropic-ai/sdk' - '@modelcontextprotocol/sdk' - '@agentclientprotocol/codex-acp@1.6.2(patch_hash=grbydorkxatbzksnwwfuawwtim)': + '@agentclientprotocol/codex-acp@1.6.2(patch_hash=elxjibratyxkrkkxxyoqtz36pe)': dependencies: '@agentclientprotocol/sdk': 1.4.0(zod@4.4.3) '@openai/codex': 0.148.0