From 2b17a3e217bc86add18edcbef979d42a018b404d Mon Sep 17 00:00:00 2001 From: Ben Brandt Date: Wed, 17 Jun 2026 15:08:33 +0200 Subject: [PATCH] fix: Don't update tool call content for permissions requests --- src/CodexApprovalHandler.ts | 32 ------------------- .../data/approval-command-allow-once.json | 11 +------ .../data/approval-command-with-rawInput.json | 11 +------ .../data/approval-file-change.json | 11 +------ 4 files changed, 3 insertions(+), 62 deletions(-) diff --git a/src/CodexApprovalHandler.ts b/src/CodexApprovalHandler.ts index d3a4c7d..8531661 100644 --- a/src/CodexApprovalHandler.ts +++ b/src/CodexApprovalHandler.ts @@ -101,12 +101,6 @@ export class CodexApprovalHandler implements ApprovalHandler { params: CommandExecutionRequestApprovalParams ): acp.RequestPermissionRequest { const options = this.buildCommandOptions(params).map(({ option }) => option); - const content = this.createContent([ - params.reason ?? null, - this.formatNetworkApprovalContext(params), - this.formatExecpolicyAmendment(params), - this.formatNetworkPolicyAmendments(params), - ]); return { sessionId, toolCall: { @@ -114,7 +108,6 @@ export class CodexApprovalHandler implements ApprovalHandler { kind: "execute", status: "pending", rawInput: params.command ? { command: stripShellPrefix(params.command), cwd: params.cwd } : null, - ...(content ? { content } : {}), }, options, _meta: { codex: { params } } @@ -126,17 +119,12 @@ export class CodexApprovalHandler implements ApprovalHandler { params: FileChangeRequestApprovalParams ): acp.RequestPermissionRequest { const options = this.buildFileChangeOptions(params).map(({ option }) => option); - const content = this.createContent([ - params.reason ?? null, - params.grantRoot ? `Grant Root: ${params.grantRoot}` : null, - ]); return { sessionId, toolCall: { toolCallId: params.itemId, kind: "edit", status: "pending", - ...(content ? { content } : {}), }, options, _meta: { codex: { params } } @@ -363,26 +351,6 @@ export class CodexApprovalHandler implements ApprovalHandler { : `Block ${amendment.host} in the Future`; } - private formatNetworkApprovalContext(params: CommandExecutionRequestApprovalParams): string | null { - const context = params.networkApprovalContext; - if (!context) return null; - return `Network Approval Context: ${context.protocol} ${context.host}`; - } - - private formatExecpolicyAmendment(params: CommandExecutionRequestApprovalParams): string | null { - const amendment = params.proposedExecpolicyAmendment; - if (!amendment || amendment.length === 0) return null; - return `Proposed Command Pattern: ${amendment.join(" ")}`; - } - - private formatNetworkPolicyAmendments(params: CommandExecutionRequestApprovalParams): string | null { - const amendments = params.proposedNetworkPolicyAmendments; - if (!amendments || amendments.length === 0) return null; - return `Proposed Network Policy Amendments: ${amendments - .map((amendment) => `${amendment.action} ${amendment.host}`) - .join(", ")}`; - } - private formatRequestedPermissions(permissions: RequestPermissionProfile): string | null { const content: string[] = []; if (permissions.network?.enabled !== undefined && permissions.network.enabled !== null) { diff --git a/src/__tests__/CodexACPAgent/data/approval-command-allow-once.json b/src/__tests__/CodexACPAgent/data/approval-command-allow-once.json index c94a161..8c7e9d4 100644 --- a/src/__tests__/CodexACPAgent/data/approval-command-allow-once.json +++ b/src/__tests__/CodexACPAgent/data/approval-command-allow-once.json @@ -7,16 +7,7 @@ "toolCallId": "item-snapshot", "kind": "execute", "status": "pending", - "rawInput": null, - "content": [ - { - "type": "content", - "content": { - "type": "text", - "text": "Running npm install" - } - } - ] + "rawInput": null }, "options": [ { diff --git a/src/__tests__/CodexACPAgent/data/approval-command-with-rawInput.json b/src/__tests__/CodexACPAgent/data/approval-command-with-rawInput.json index 199929e..552c0ee 100644 --- a/src/__tests__/CodexACPAgent/data/approval-command-with-rawInput.json +++ b/src/__tests__/CodexACPAgent/data/approval-command-with-rawInput.json @@ -10,16 +10,7 @@ "rawInput": { "command": "npm install", "cwd": "/home/user/project" - }, - "content": [ - { - "type": "content", - "content": { - "type": "text", - "text": "Installing dependencies" - } - } - ] + } }, "options": [ { diff --git a/src/__tests__/CodexACPAgent/data/approval-file-change.json b/src/__tests__/CodexACPAgent/data/approval-file-change.json index d7f7884..7533e39 100644 --- a/src/__tests__/CodexACPAgent/data/approval-file-change.json +++ b/src/__tests__/CodexACPAgent/data/approval-file-change.json @@ -6,16 +6,7 @@ "toolCall": { "toolCallId": "file-change-snapshot", "kind": "edit", - "status": "pending", - "content": [ - { - "type": "content", - "content": { - "type": "text", - "text": "Modifying config file" - } - } - ] + "status": "pending" }, "options": [ {