feat: enhance CodexProvider argument handling and configuration

- Added approval policy and web search features to the CodexProvider's argument construction, improving flexibility in command execution.
- Updated unit tests to validate the new configuration handling for approval and search features, ensuring accurate argument parsing.

These changes enhance the functionality of the CodexProvider, allowing for more dynamic command configurations and improving test coverage.
This commit is contained in:
DhanushSantosh
2026-01-08 00:16:57 +05:30
parent 48a4fa5c6c
commit 9d8464cceb
2 changed files with 19 additions and 13 deletions

View File

@@ -187,15 +187,19 @@ describe('codex-provider.ts', () => {
);
const call = vi.mocked(spawnJSONLProcess).mock.calls[0][0];
const approvalIndex = call.args.indexOf('--ask-for-approval');
const approvalConfigIndex = call.args.indexOf('--config');
const execIndex = call.args.indexOf(EXEC_SUBCOMMAND);
const searchIndex = call.args.indexOf('--search');
expect(call.args[approvalIndex + 1]).toBe('never');
expect(approvalIndex).toBeGreaterThan(-1);
const searchConfigIndex = call.args.indexOf('--config');
expect(call.args[approvalConfigIndex + 1]).toBe('approval_policy=never');
expect(approvalConfigIndex).toBeGreaterThan(-1);
expect(execIndex).toBeGreaterThan(-1);
expect(approvalIndex).toBeGreaterThan(execIndex);
expect(searchIndex).toBeGreaterThan(-1);
expect(searchIndex).toBeGreaterThan(execIndex);
expect(approvalConfigIndex).toBeGreaterThan(execIndex);
// Search should be in config, not as direct flag
const hasSearchConfig = call.args.some(
(arg, index) =>
arg === '--config' && call.args[index + 1] === 'features.web_search_request=true'
);
expect(hasSearchConfig).toBe(true);
});
it('injects user and project instructions when auto-load is enabled', async () => {