Fix codex approve policy

This commit is contained in:
weishu
2026-03-16 13:00:09 +08:00
parent bfc9ad9f0c
commit 1f02bb7de1
12 changed files with 461 additions and 49 deletions
+22 -1
View File
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { parseCodexCliOverrides } from './codexCliOverrides';
import { parseCodexCliOverrides, stripCodexCliOverrides } from './codexCliOverrides';
describe('parseCodexCliOverrides', () => {
it('parses sandbox and approval flags', () => {
@@ -50,4 +50,25 @@ describe('parseCodexCliOverrides', () => {
sandbox: 'read-only'
});
});
it('strips approval and sandbox overrides while keeping unrelated args', () => {
expect(stripCodexCliOverrides([
'--sandbox',
'read-only',
'--ask-for-approval=never',
'--model',
'o3',
'--full-auto',
'--dangerously-bypass-approvals-and-sandbox',
'--',
'--sandbox',
'danger-full-access'
])).toEqual([
'--model',
'o3',
'--',
'--sandbox',
'danger-full-access'
]);
});
});