Skip to content

Commit 2e94b2b

Browse files
authored
fix: Don't update tool call content for permissions requests (#210)
1 parent 96e72d4 commit 2e94b2b

4 files changed

Lines changed: 3 additions & 62 deletions

File tree

src/CodexApprovalHandler.ts

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -101,20 +101,13 @@ export class CodexApprovalHandler implements ApprovalHandler {
101101
params: CommandExecutionRequestApprovalParams
102102
): acp.RequestPermissionRequest {
103103
const options = this.buildCommandOptions(params).map(({ option }) => option);
104-
const content = this.createContent([
105-
params.reason ?? null,
106-
this.formatNetworkApprovalContext(params),
107-
this.formatExecpolicyAmendment(params),
108-
this.formatNetworkPolicyAmendments(params),
109-
]);
110104
return {
111105
sessionId,
112106
toolCall: {
113107
toolCallId: params.itemId,
114108
kind: "execute",
115109
status: "pending",
116110
rawInput: params.command ? { command: stripShellPrefix(params.command), cwd: params.cwd } : null,
117-
...(content ? { content } : {}),
118111
},
119112
options,
120113
_meta: { codex: { params } }
@@ -126,17 +119,12 @@ export class CodexApprovalHandler implements ApprovalHandler {
126119
params: FileChangeRequestApprovalParams
127120
): acp.RequestPermissionRequest {
128121
const options = this.buildFileChangeOptions(params).map(({ option }) => option);
129-
const content = this.createContent([
130-
params.reason ?? null,
131-
params.grantRoot ? `Grant Root: ${params.grantRoot}` : null,
132-
]);
133122
return {
134123
sessionId,
135124
toolCall: {
136125
toolCallId: params.itemId,
137126
kind: "edit",
138127
status: "pending",
139-
...(content ? { content } : {}),
140128
},
141129
options,
142130
_meta: { codex: { params } }
@@ -363,26 +351,6 @@ export class CodexApprovalHandler implements ApprovalHandler {
363351
: `Block ${amendment.host} in the Future`;
364352
}
365353

366-
private formatNetworkApprovalContext(params: CommandExecutionRequestApprovalParams): string | null {
367-
const context = params.networkApprovalContext;
368-
if (!context) return null;
369-
return `Network Approval Context: ${context.protocol} ${context.host}`;
370-
}
371-
372-
private formatExecpolicyAmendment(params: CommandExecutionRequestApprovalParams): string | null {
373-
const amendment = params.proposedExecpolicyAmendment;
374-
if (!amendment || amendment.length === 0) return null;
375-
return `Proposed Command Pattern: ${amendment.join(" ")}`;
376-
}
377-
378-
private formatNetworkPolicyAmendments(params: CommandExecutionRequestApprovalParams): string | null {
379-
const amendments = params.proposedNetworkPolicyAmendments;
380-
if (!amendments || amendments.length === 0) return null;
381-
return `Proposed Network Policy Amendments: ${amendments
382-
.map((amendment) => `${amendment.action} ${amendment.host}`)
383-
.join(", ")}`;
384-
}
385-
386354
private formatRequestedPermissions(permissions: RequestPermissionProfile): string | null {
387355
const content: string[] = [];
388356
if (permissions.network?.enabled !== undefined && permissions.network.enabled !== null) {

src/__tests__/CodexACPAgent/data/approval-command-allow-once.json

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,7 @@
77
"toolCallId": "item-snapshot",
88
"kind": "execute",
99
"status": "pending",
10-
"rawInput": null,
11-
"content": [
12-
{
13-
"type": "content",
14-
"content": {
15-
"type": "text",
16-
"text": "Running npm install"
17-
}
18-
}
19-
]
10+
"rawInput": null
2011
},
2112
"options": [
2213
{

src/__tests__/CodexACPAgent/data/approval-command-with-rawInput.json

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,7 @@
1010
"rawInput": {
1111
"command": "npm install",
1212
"cwd": "/home/user/project"
13-
},
14-
"content": [
15-
{
16-
"type": "content",
17-
"content": {
18-
"type": "text",
19-
"text": "Installing dependencies"
20-
}
21-
}
22-
]
13+
}
2314
},
2415
"options": [
2516
{

src/__tests__/CodexACPAgent/data/approval-file-change.json

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,7 @@
66
"toolCall": {
77
"toolCallId": "file-change-snapshot",
88
"kind": "edit",
9-
"status": "pending",
10-
"content": [
11-
{
12-
"type": "content",
13-
"content": {
14-
"type": "text",
15-
"text": "Modifying config file"
16-
}
17-
}
18-
]
9+
"status": "pending"
1910
},
2011
"options": [
2112
{

0 commit comments

Comments
 (0)