Skip to content

Commit f78faee

Browse files
fix: remove description for elicitation option _meta
1 parent 52eee0c commit f78faee

5 files changed

Lines changed: 26 additions & 39 deletions

src/CodexElicitationHandler.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@ function buildToolApprovalOption(
2323
optionId: string,
2424
name: string,
2525
kind: acp.PermissionOption["kind"],
26-
description: string
2726
): acp.PermissionOption {
2827
return {
2928
optionId,
3029
name,
31-
kind,
32-
_meta: { description },
30+
kind
3331
};
3432
}
3533

@@ -73,8 +71,7 @@ function buildToolApprovalOptions(
7371
buildToolApprovalOption(
7472
ApprovalOptionId.AllowOnce,
7573
"Allow",
76-
"allow_once",
77-
"Run the tool and continue."
74+
"allow_once"
7875
),
7976
];
8077
// Codex advertises MCP tool approval persistence choices in request _meta.persist.
@@ -83,23 +80,20 @@ function buildToolApprovalOptions(
8380
options.push(buildToolApprovalOption(
8481
ApprovalOptionId.AllowForSession,
8582
"Allow for this session",
86-
"allow_always",
87-
"Run the tool and remember this choice for this session."
83+
"allow_always"
8884
));
8985
}
9086
if (persistOptions.has("always") && allowPersistentApproval) {
9187
options.push(buildToolApprovalOption(
9288
ApprovalOptionId.AllowPersist,
9389
"Always allow",
94-
"allow_always",
95-
"Run the tool and remember this choice for future tool calls."
90+
"allow_always"
9691
));
9792
}
9893
options.push(buildToolApprovalOption(
9994
ApprovalOptionId.RejectOnce,
10095
"Cancel",
101-
"reject_once",
102-
"Cancel this tool call."
96+
"reject_once"
10397
));
10498
return options;
10599
}

src/__tests__/CodexACPAgent/data/elicitation-tool-approval-all-persist.json

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,29 @@
2424
}
2525
}
2626
},
27-
"_meta": "_meta",
27+
"_meta": {
28+
"is_mcp_tool_approval": true
29+
},
2830
"options": [
2931
{
3032
"optionId": "allow_once",
3133
"name": "Allow",
32-
"kind": "allow_once",
33-
"_meta": "_meta"
34+
"kind": "allow_once"
3435
},
3536
{
3637
"optionId": "allow_for_session",
3738
"name": "Allow for this session",
38-
"kind": "allow_always",
39-
"_meta": "_meta"
39+
"kind": "allow_always"
4040
},
4141
{
4242
"optionId": "allow_persist",
4343
"name": "Always allow",
44-
"kind": "allow_always",
45-
"_meta": "_meta"
44+
"kind": "allow_always"
4645
},
4746
{
4847
"optionId": "reject_once",
4948
"name": "Cancel",
50-
"kind": "reject_once",
51-
"_meta": "_meta"
49+
"kind": "reject_once"
5250
}
5351
]
5452
}

src/__tests__/CodexACPAgent/data/elicitation-tool-approval-no-persist.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@
2424
}
2525
}
2626
},
27-
"_meta": "_meta",
27+
"_meta": {
28+
"is_mcp_tool_approval": true
29+
},
2830
"options": [
2931
{
3032
"optionId": "allow_once",
3133
"name": "Allow",
32-
"kind": "allow_once",
33-
"_meta": "_meta"
34+
"kind": "allow_once"
3435
},
3536
{
3637
"optionId": "reject_once",
3738
"name": "Cancel",
38-
"kind": "reject_once",
39-
"_meta": "_meta"
39+
"kind": "reject_once"
4040
}
4141
]
4242
}

src/__tests__/CodexACPAgent/data/elicitation-tool-approval-session-only.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,24 @@
2424
}
2525
}
2626
},
27-
"_meta": "_meta",
27+
"_meta": {
28+
"is_mcp_tool_approval": true
29+
},
2830
"options": [
2931
{
3032
"optionId": "allow_once",
3133
"name": "Allow",
32-
"kind": "allow_once",
33-
"_meta": "_meta"
34+
"kind": "allow_once"
3435
},
3536
{
3637
"optionId": "allow_for_session",
3738
"name": "Allow for this session",
38-
"kind": "allow_always",
39-
"_meta": "_meta"
39+
"kind": "allow_always"
4040
},
4141
{
4242
"optionId": "reject_once",
4343
"name": "Cancel",
44-
"kind": "reject_once",
45-
"_meta": "_meta"
44+
"kind": "reject_once"
4645
}
4746
]
4847
}

src/__tests__/CodexACPAgent/elicitation-events.test.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ describe('Elicitation Events', () => {
146146
};
147147

148148
await fixture.sendServerRequest('mcpServer/elicitation/request', params);
149-
await expect(fixture.getAcpConnectionDump(['_meta'])).toMatchFileSnapshot('data/elicitation-tool-approval-all-persist.json');
149+
await expect(fixture.getAcpConnectionDump([])).toMatchFileSnapshot('data/elicitation-tool-approval-all-persist.json');
150150

151151
completeTurn();
152152
await promptPromise;
@@ -173,25 +173,21 @@ describe('Elicitation Events', () => {
173173
optionId: 'allow_once',
174174
name: 'Allow',
175175
kind: 'allow_once',
176-
_meta: { description: 'Run the tool and continue.' },
177176
},
178177
{
179178
optionId: 'allow_for_session',
180179
name: 'Allow for this session',
181180
kind: 'allow_always',
182-
_meta: { description: 'Run the tool and remember this choice for this session.' },
183181
},
184182
{
185183
optionId: 'allow_persist',
186184
name: 'Always allow',
187185
kind: 'allow_always',
188-
_meta: { description: 'Run the tool and remember this choice for future tool calls.' },
189186
},
190187
{
191188
optionId: 'reject_once',
192189
name: 'Cancel',
193190
kind: 'reject_once',
194-
_meta: { description: 'Cancel this tool call.' },
195191
},
196192
]);
197193

@@ -296,7 +292,7 @@ describe('Elicitation Events', () => {
296292
};
297293

298294
await fixture.sendServerRequest('mcpServer/elicitation/request', params);
299-
await expect(fixture.getAcpConnectionDump(['_meta'])).toMatchFileSnapshot('data/elicitation-tool-approval-session-only.json');
295+
await expect(fixture.getAcpConnectionDump([])).toMatchFileSnapshot('data/elicitation-tool-approval-session-only.json');
300296

301297
completeTurn();
302298
await promptPromise;
@@ -315,7 +311,7 @@ describe('Elicitation Events', () => {
315311
};
316312

317313
await fixture.sendServerRequest('mcpServer/elicitation/request', params);
318-
await expect(fixture.getAcpConnectionDump(['_meta'])).toMatchFileSnapshot('data/elicitation-tool-approval-no-persist.json');
314+
await expect(fixture.getAcpConnectionDump([])).toMatchFileSnapshot('data/elicitation-tool-approval-no-persist.json');
319315

320316
completeTurn();
321317
await promptPromise;

0 commit comments

Comments
 (0)