From 5776e9c3b1ac584eebcd01c6332196acc6ff7aa4 Mon Sep 17 00:00:00 2001 From: "Kai (Tam Nhu) Tran" <61256810+kaitranntt@users.noreply.github.com> Date: Sat, 30 May 2026 14:54:35 -0400 Subject: [PATCH] fix: stop ccsxp model alias parsing at option terminator --- src/targets/codex-adapter.ts | 4 +++ .../targets/codex-runtime-integration.test.ts | 30 ++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/targets/codex-adapter.ts b/src/targets/codex-adapter.ts index ba22c63b..2798968c 100644 --- a/src/targets/codex-adapter.ts +++ b/src/targets/codex-adapter.ts @@ -143,6 +143,10 @@ function normalizeCcsxpCodexModelFlagAliases(args: string[]): { for (let index = 0; index < normalizedArgs.length; index += 1) { const arg = normalizedArgs[index]; + if (arg === '--') { + break; + } + if (arg === '-m' || arg === '--model') { const nextValue = normalizedArgs[index + 1]; if (typeof nextValue === 'string') { diff --git a/tests/unit/targets/codex-runtime-integration.test.ts b/tests/unit/targets/codex-runtime-integration.test.ts index 4018dd45..5f043903 100644 --- a/tests/unit/targets/codex-runtime-integration.test.ts +++ b/tests/unit/targets/codex-runtime-integration.test.ts @@ -848,6 +848,32 @@ process.exit(0); ]); }); + it('preserves ccsxp positional model-like arguments after the option terminator', () => { + if (process.platform === 'win32') return; + + const result = runCcsxpAlias(['--', '--', '-m', 'gpt-5.5-high-fast', 'prompt text'], { + ...process.env, + CI: '1', + NO_COLOR: '1', + HOME: tmpHome, + CCS_HOME: tmpHome, + CCS_CODEX_PATH: fakeCodexPath, + CCS_TEST_CODEX_ARGS_OUT: codexArgsLogPath, + CCS_TEST_CODEX_ENV_OUT: codexEnvLogPath, + }); + + expect(result.status).toBe(0); + const codexCalls = readLoggedCodexCalls(codexArgsLogPath); + expect(codexCalls.at(-1)).toEqual([ + '--config', + 'model_provider="cliproxy"', + '--', + '-m', + 'gpt-5.5-high-fast', + 'prompt text', + ]); + }); + it('normalizes ccsxp native low Codex tuning aliases in config.toml', () => { if (process.platform === 'win32') return; @@ -1137,7 +1163,9 @@ supports_websockets = false }); expect(result.status).toBe(0); - expect(result.stderr).not.toContain('Codex CLI does not support Claude account-based profiles.'); + expect(result.stderr).not.toContain( + 'Codex CLI does not support Claude account-based profiles.' + ); expect(readLoggedCodexCalls(codexArgsLogPath)).toEqual([['fix failing tests']]); expect(readLoggedCodexEnv(codexEnvLogPath)).toEqual([ {