auto approve title tool for codex

This commit is contained in:
weishu
2026-03-31 18:36:31 +08:00
parent 2c20b04bec
commit ca7cb9ac90
6 changed files with 371 additions and 40 deletions
@@ -35,6 +35,23 @@ function createHarness(mode: 'default' | 'read-only' | 'safe-yolo' | 'yolo') {
}
describe('CodexPermissionHandler', () => {
it('auto-approves change_title tools in default mode', async () => {
const { handler, getAgentState } = createHarness('default');
await expect(handler.handleToolCall('perm-1', 'mcp__hapi__change_title', { title: 'Rename' })).resolves.toEqual({
decision: 'approved'
});
expect(getAgentState().requests).toEqual({});
expect(getAgentState().completedRequests).toMatchObject({
'perm-1': {
tool: 'mcp__hapi__change_title',
status: 'approved',
decision: 'approved'
}
});
});
it('auto-approves yolo requests for the session', async () => {
const { handler, getAgentState } = createHarness('yolo');