mirror of
https://github.com/tiennm99/ccs.git
synced 2026-08-07 06:28:20 +00:00
fix(codex): gate ccsxp config overrides
This commit is contained in:
@@ -483,9 +483,8 @@ export async function reconcileExhaustedRotationAccounts(
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
const { pauseAccountForQuotaCooldown, restoreExpiredQuotaPauses } = await import(
|
const { pauseAccountForQuotaCooldown, restoreExpiredQuotaPauses } =
|
||||||
'../accounts/account-safety'
|
await import('../accounts/account-safety');
|
||||||
);
|
|
||||||
restoreExpiredQuotaPauses();
|
restoreExpiredQuotaPauses();
|
||||||
|
|
||||||
const config = loadOrCreateUnifiedConfig();
|
const config = loadOrCreateUnifiedConfig();
|
||||||
@@ -593,9 +592,8 @@ export async function preflightCheck(provider: CLIProxyProvider): Promise<Prefli
|
|||||||
return { proceed: true, accountId: defaultAccount?.id || '' };
|
return { proceed: true, accountId: defaultAccount?.id || '' };
|
||||||
}
|
}
|
||||||
|
|
||||||
const { pauseAccountForQuotaCooldown, restoreExpiredQuotaPauses } = await import(
|
const { pauseAccountForQuotaCooldown, restoreExpiredQuotaPauses } =
|
||||||
'../accounts/account-safety'
|
await import('../accounts/account-safety');
|
||||||
);
|
|
||||||
restoreExpiredQuotaPauses();
|
restoreExpiredQuotaPauses();
|
||||||
|
|
||||||
const config = loadOrCreateUnifiedConfig();
|
const config = loadOrCreateUnifiedConfig();
|
||||||
|
|||||||
@@ -112,9 +112,8 @@ export async function runImageAnalysisCheck(results: HealthCheck): Promise<void>
|
|||||||
* Fix image analysis configuration issues
|
* Fix image analysis configuration issues
|
||||||
*/
|
*/
|
||||||
export async function fixImageAnalysisConfig(): Promise<boolean> {
|
export async function fixImageAnalysisConfig(): Promise<boolean> {
|
||||||
const { updateConfig, loadOrCreateUnifiedConfig } = await import(
|
const { updateConfig, loadOrCreateUnifiedConfig } =
|
||||||
'../../config/config-loader-facade'
|
await import('../../config/config-loader-facade');
|
||||||
);
|
|
||||||
|
|
||||||
const config = loadOrCreateUnifiedConfig();
|
const config = loadOrCreateUnifiedConfig();
|
||||||
let fixed = false;
|
let fixed = false;
|
||||||
|
|||||||
@@ -289,20 +289,19 @@ export class CodexAdapter implements TargetAdapter {
|
|||||||
const runtimeConfigOverrides = creds?.runtimeConfigOverrides ?? [];
|
const runtimeConfigOverrides = creds?.runtimeConfigOverrides ?? [];
|
||||||
|
|
||||||
if (profileType === 'default') {
|
if (profileType === 'default') {
|
||||||
const modelFlagNormalization = isCcsxpCliproxyShortcut()
|
const isCcsxpShortcut = isCcsxpCliproxyShortcut();
|
||||||
|
const modelFlagNormalization = isCcsxpShortcut
|
||||||
? normalizeCcsxpCodexModelFlagAliases(userArgs)
|
? normalizeCcsxpCodexModelFlagAliases(userArgs)
|
||||||
: { args: userArgs, overrides: [] };
|
: { args: userArgs, overrides: [] };
|
||||||
const overrides = [...runtimeConfigOverrides, ...modelFlagNormalization.overrides];
|
const overrides = [...runtimeConfigOverrides, ...modelFlagNormalization.overrides];
|
||||||
if (reasoningOverride) {
|
if (reasoningOverride) {
|
||||||
overrides.push(`model_reasoning_effort=${formatTomlString(reasoningOverride)}`);
|
overrides.push(`model_reasoning_effort=${formatTomlString(reasoningOverride)}`);
|
||||||
}
|
}
|
||||||
if (overrides.length === 0) {
|
const needsConfigOverrideSupport = isCcsxpShortcut || overrides.length > 0;
|
||||||
return modelFlagNormalization.args;
|
if (needsConfigOverrideSupport && !codexBinarySupportsConfigOverrides(options?.binaryInfo)) {
|
||||||
|
throw buildConfigOverrideSupportError(hydrateCodexBinaryVersion(options?.binaryInfo));
|
||||||
}
|
}
|
||||||
if (!codexBinarySupportsConfigOverrides(options?.binaryInfo)) {
|
if (overrides.length === 0) {
|
||||||
if (reasoningOverride || modelFlagNormalization.overrides.length > 0) {
|
|
||||||
throw buildConfigOverrideSupportError(hydrateCodexBinaryVersion(options?.binaryInfo));
|
|
||||||
}
|
|
||||||
return modelFlagNormalization.args;
|
return modelFlagNormalization.args;
|
||||||
}
|
}
|
||||||
return [...buildConfigOverrideArgs(overrides), ...modelFlagNormalization.args];
|
return [...buildConfigOverrideArgs(overrides), ...modelFlagNormalization.args];
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
import { afterEach, beforeEach, describe, expect, it } from 'bun:test';
|
import { afterEach, beforeEach, describe, expect, it } from 'bun:test';
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
import { CCSXP_CLIPROXY_SHORTCUT_ENV } from '../../../src/targets/codex-cliproxy-provider-config';
|
||||||
|
|
||||||
const wrapperPath = require.resolve('../../../src/bin/ccsxp-runtime.ts');
|
const wrapperPath = require.resolve('../../../src/bin/ccsxp-runtime.ts');
|
||||||
const ccsPath = require.resolve('../../../src/ccs.ts');
|
const ccsPath = require.resolve('../../../src/ccs.ts');
|
||||||
|
|
||||||
describe('ccsxp runtime wrapper', () => {
|
describe('ccsxp runtime wrapper', () => {
|
||||||
const originalArgv = process.argv;
|
const originalArgv = process.argv;
|
||||||
const originalEntryTarget = process.env.CCS_INTERNAL_ENTRY_TARGET;
|
const originalEntryTarget = process.env.CCS_INTERNAL_ENTRY_TARGET;
|
||||||
const originalCodexHome = process.env.CODEX_HOME;
|
const originalShortcut = process.env[CCSXP_CLIPROXY_SHORTCUT_ENV];
|
||||||
const originalCcsCodexProfile = process.env.CCS_CODEX_PROFILE;
|
const originalCodexHome = process.env.CODEX_HOME;
|
||||||
const originalCcsxpCodexHome = process.env.CCSXP_CODEX_HOME;
|
const originalCcsCodexProfile = process.env.CCS_CODEX_PROFILE;
|
||||||
|
const originalCcsxpCodexHome = process.env.CCSXP_CODEX_HOME;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
delete require.cache[wrapperPath];
|
delete require.cache[wrapperPath];
|
||||||
@@ -25,6 +27,11 @@ describe('ccsxp runtime wrapper', () => {
|
|||||||
} else {
|
} else {
|
||||||
process.env.CCS_INTERNAL_ENTRY_TARGET = originalEntryTarget;
|
process.env.CCS_INTERNAL_ENTRY_TARGET = originalEntryTarget;
|
||||||
}
|
}
|
||||||
|
if (originalShortcut === undefined) {
|
||||||
|
delete process.env[CCSXP_CLIPROXY_SHORTCUT_ENV];
|
||||||
|
} else {
|
||||||
|
process.env[CCSXP_CLIPROXY_SHORTCUT_ENV] = originalShortcut;
|
||||||
|
}
|
||||||
if (originalCodexHome === undefined) {
|
if (originalCodexHome === undefined) {
|
||||||
delete process.env.CODEX_HOME;
|
delete process.env.CODEX_HOME;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { describe, expect, test } from 'bun:test';
|
import { describe, expect, test } from 'bun:test';
|
||||||
|
|
||||||
import { CodexAdapter } from '../../../src/targets/codex-adapter';
|
import { CodexAdapter } from '../../../src/targets/codex-adapter';
|
||||||
|
import { CCSXP_CLIPROXY_SHORTCUT_ENV } from '../../../src/targets/codex-cliproxy-provider-config';
|
||||||
import {
|
import {
|
||||||
buildCodexBrowserMcpOverrides,
|
buildCodexBrowserMcpOverrides,
|
||||||
getCodexBrowserMcpServerName,
|
getCodexBrowserMcpServerName,
|
||||||
@@ -97,6 +98,30 @@ describe('CodexAdapter', () => {
|
|||||||
).toThrow(/does not advertise --config overrides/);
|
).toThrow(/does not advertise --config overrides/);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('rejects ccsxp default launches when codex lacks config override support', () => {
|
||||||
|
const originalShortcut = process.env[CCSXP_CLIPROXY_SHORTCUT_ENV];
|
||||||
|
process.env[CCSXP_CLIPROXY_SHORTCUT_ENV] = '1';
|
||||||
|
try {
|
||||||
|
expect(() =>
|
||||||
|
adapter.buildArgs('default', ['--config', 'model_provider="cliproxy"', '--version'], {
|
||||||
|
profileType: 'default',
|
||||||
|
binaryInfo: {
|
||||||
|
path: '/tmp/codex',
|
||||||
|
needsShell: false,
|
||||||
|
version: 'codex-cli 0.1.0',
|
||||||
|
features: [],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
).toThrow(/does not advertise --config overrides/);
|
||||||
|
} finally {
|
||||||
|
if (originalShortcut === undefined) {
|
||||||
|
delete process.env[CCSXP_CLIPROXY_SHORTCUT_ENV];
|
||||||
|
} else {
|
||||||
|
process.env[CCSXP_CLIPROXY_SHORTCUT_ENV] = originalShortcut;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
test('injects transient config overrides for CCS-backed launches', () => {
|
test('injects transient config overrides for CCS-backed launches', () => {
|
||||||
const runtimeConfigOverrides = buildCodexBrowserMcpOverrides();
|
const runtimeConfigOverrides = buildCodexBrowserMcpOverrides();
|
||||||
const args = adapter.buildArgs('codex', ['--search'], {
|
const args = adapter.buildArgs('codex', ['--search'], {
|
||||||
@@ -120,7 +145,9 @@ describe('CodexAdapter', () => {
|
|||||||
expect(args).toContain('model_provider="ccs_runtime"');
|
expect(args).toContain('model_provider="ccs_runtime"');
|
||||||
expect(args).toContain('model_providers.ccs_runtime.env_key="CCS_CODEX_API_KEY"');
|
expect(args).toContain('model_providers.ccs_runtime.env_key="CCS_CODEX_API_KEY"');
|
||||||
expect(args).toContain('model="gpt-5.4"');
|
expect(args).toContain('model="gpt-5.4"');
|
||||||
expect(args).toContain(`mcp_servers.${getCodexBrowserMcpServerName()}.command=${JSON.stringify(process.platform === 'win32' ? 'npx.cmd' : 'npx')}`);
|
expect(args).toContain(
|
||||||
|
`mcp_servers.${getCodexBrowserMcpServerName()}.command=${JSON.stringify(process.platform === 'win32' ? 'npx.cmd' : 'npx')}`
|
||||||
|
);
|
||||||
expect(args).toContain('model_reasoning_effort="high"');
|
expect(args).toContain('model_reasoning_effort="high"');
|
||||||
expect(args[args.length - 1]).toBe('--search');
|
expect(args[args.length - 1]).toBe('--search');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -714,8 +714,10 @@ process.exit(0);
|
|||||||
|
|
||||||
expect(result.status).toBe(0);
|
expect(result.status).toBe(0);
|
||||||
expect(result.stdout).toContain('codex-cli 9.9.9-test');
|
expect(result.stdout).toContain('codex-cli 9.9.9-test');
|
||||||
expect(readLoggedCodexCalls(codexArgsLogPath)).toEqual([
|
expect(readLoggedCodexCalls(codexArgsLogPath).at(-1)).toEqual([
|
||||||
['--config', 'model_provider="cliproxy"', '--version'],
|
'--config',
|
||||||
|
'model_provider="cliproxy"',
|
||||||
|
'--version',
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -737,19 +739,17 @@ process.exit(0);
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(result.status).toBe(0);
|
expect(result.status).toBe(0);
|
||||||
expect(readLoggedCodexEnv(codexEnvLogPath)).toEqual([
|
expect(readLoggedCodexEnv(codexEnvLogPath).at(-1)).toEqual({
|
||||||
{
|
CODEX_HOME: path.join(tmpHome, '.codex'),
|
||||||
CODEX_HOME: path.join(tmpHome, '.codex'),
|
CODEX_CI: undefined,
|
||||||
CODEX_CI: undefined,
|
CODEX_MANAGED_BY_BUN: undefined,
|
||||||
CODEX_MANAGED_BY_BUN: undefined,
|
CODEX_THREAD_ID: undefined,
|
||||||
CODEX_THREAD_ID: undefined,
|
ANTHROPIC_BASE_URL: undefined,
|
||||||
ANTHROPIC_BASE_URL: undefined,
|
CLIPROXY_API_KEY: 'ccs-internal-managed',
|
||||||
CLIPROXY_API_KEY: 'ccs-internal-managed',
|
CCS_BROWSER_USER_DATA_DIR: undefined,
|
||||||
CCS_BROWSER_USER_DATA_DIR: undefined,
|
CCS_BROWSER_PROFILE_DIR: undefined,
|
||||||
CCS_BROWSER_PROFILE_DIR: undefined,
|
CCS_BROWSER_DEVTOOLS_WS_URL: undefined,
|
||||||
CCS_BROWSER_DEVTOOLS_WS_URL: undefined,
|
});
|
||||||
},
|
|
||||||
]);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('routes default ccsxp launches through native Codex with the cliproxy provider override', () => {
|
it('routes default ccsxp launches through native Codex with the cliproxy provider override', () => {
|
||||||
@@ -768,24 +768,50 @@ process.exit(0);
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(result.status).toBe(0);
|
expect(result.status).toBe(0);
|
||||||
expect(readLoggedCodexCalls(codexArgsLogPath)).toEqual([
|
expect(readLoggedCodexCalls(codexArgsLogPath).at(-1)).toEqual([
|
||||||
['--config', 'model_provider="cliproxy"', 'fix failing tests'],
|
'--config',
|
||||||
|
'model_provider="cliproxy"',
|
||||||
|
'fix failing tests',
|
||||||
]);
|
]);
|
||||||
const codexConfig = fs.readFileSync(path.join(tmpHome, '.codex', 'config.toml'), 'utf8');
|
const codexConfig = fs.readFileSync(path.join(tmpHome, '.codex', 'config.toml'), 'utf8');
|
||||||
expect(codexConfig).toContain('[model_providers.cliproxy]');
|
expect(codexConfig).toContain('[model_providers.cliproxy]');
|
||||||
expect(codexConfig).toContain('env_key = "CLIPROXY_API_KEY"');
|
expect(codexConfig).toContain('env_key = "CLIPROXY_API_KEY"');
|
||||||
expect(readLoggedCodexEnv(codexEnvLogPath)).toEqual([
|
expect(readLoggedCodexEnv(codexEnvLogPath).at(-1)).toEqual({
|
||||||
{
|
CODEX_HOME: path.join(tmpHome, '.codex'),
|
||||||
CODEX_HOME: path.join(tmpHome, '.codex'),
|
CODEX_CI: undefined,
|
||||||
CODEX_CI: undefined,
|
CODEX_MANAGED_BY_BUN: undefined,
|
||||||
CODEX_MANAGED_BY_BUN: undefined,
|
CODEX_THREAD_ID: undefined,
|
||||||
CODEX_THREAD_ID: undefined,
|
ANTHROPIC_BASE_URL: undefined,
|
||||||
ANTHROPIC_BASE_URL: undefined,
|
CLIPROXY_API_KEY: 'ccs-internal-managed',
|
||||||
CLIPROXY_API_KEY: 'ccs-internal-managed',
|
CCS_BROWSER_USER_DATA_DIR: undefined,
|
||||||
CCS_BROWSER_USER_DATA_DIR: undefined,
|
CCS_BROWSER_PROFILE_DIR: undefined,
|
||||||
CCS_BROWSER_PROFILE_DIR: undefined,
|
CCS_BROWSER_DEVTOOLS_WS_URL: undefined,
|
||||||
CCS_BROWSER_DEVTOOLS_WS_URL: undefined,
|
});
|
||||||
},
|
});
|
||||||
|
|
||||||
|
it('fails fast when ccsxp needs unsupported Codex config overrides', () => {
|
||||||
|
if (process.platform === 'win32') return;
|
||||||
|
|
||||||
|
const result = runCcsxpAlias(['--version'], {
|
||||||
|
...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_CONFIG_OVERRIDE_STATUS: 'unsupported',
|
||||||
|
CCS_TEST_CODEX_VERSION: 'codex-cli 9.9.9-test',
|
||||||
|
CCS_TEST_CODEX_HELP: ' -p, --profile <CONFIG_PROFILE>\n',
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(result.status).toBe(1);
|
||||||
|
expect(result.stderr).toContain('Codex CLI (codex-cli 9.9.9-test)');
|
||||||
|
expect(result.stderr).toContain('does not advertise --config overrides');
|
||||||
|
expect(readLoggedCodexCalls(codexArgsLogPath)).toEqual([
|
||||||
|
['-c', 'model="gpt-5"', '--version'],
|
||||||
|
['--help'],
|
||||||
|
['--version'],
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -808,8 +834,10 @@ process.exit(0);
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(result.status).toBe(0);
|
expect(result.status).toBe(0);
|
||||||
expect(readLoggedCodexCalls(codexArgsLogPath)).toEqual([
|
expect(readLoggedCodexCalls(codexArgsLogPath).at(-1)).toEqual([
|
||||||
['--config', 'model_provider="cliproxy"', 'fix failing tests'],
|
'--config',
|
||||||
|
'model_provider="cliproxy"',
|
||||||
|
'fix failing tests',
|
||||||
]);
|
]);
|
||||||
const codexConfig = fs.readFileSync(path.join(codexHome, 'config.toml'), 'utf8');
|
const codexConfig = fs.readFileSync(path.join(codexHome, 'config.toml'), 'utf8');
|
||||||
expect(codexConfig).toContain('model = "gpt-5.5"');
|
expect(codexConfig).toContain('model = "gpt-5.5"');
|
||||||
@@ -903,24 +931,24 @@ supports_websockets = false
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(result.status).toBe(0);
|
expect(result.status).toBe(0);
|
||||||
expect(readLoggedCodexCalls(codexArgsLogPath)).toEqual([
|
expect(readLoggedCodexCalls(codexArgsLogPath).at(-1)).toEqual([
|
||||||
['--config', 'model_provider="cliproxy"', 'fix failing tests'],
|
'--config',
|
||||||
|
'model_provider="cliproxy"',
|
||||||
|
'fix failing tests',
|
||||||
]);
|
]);
|
||||||
const codexConfig = fs.readFileSync(path.join(codexHome, 'config.toml'), 'utf8');
|
const codexConfig = fs.readFileSync(path.join(codexHome, 'config.toml'), 'utf8');
|
||||||
expect(codexConfig).toContain('env_key = "CCS_CUSTOM_CLIPROXY_TOKEN"');
|
expect(codexConfig).toContain('env_key = "CCS_CUSTOM_CLIPROXY_TOKEN"');
|
||||||
expect(readLoggedCodexEnv(codexEnvLogPath)).toEqual([
|
expect(readLoggedCodexEnv(codexEnvLogPath).at(-1)).toEqual({
|
||||||
{
|
CODEX_HOME: codexHome,
|
||||||
CODEX_HOME: codexHome,
|
CODEX_CI: undefined,
|
||||||
CODEX_CI: undefined,
|
CODEX_MANAGED_BY_BUN: undefined,
|
||||||
CODEX_MANAGED_BY_BUN: undefined,
|
CODEX_THREAD_ID: undefined,
|
||||||
CODEX_THREAD_ID: undefined,
|
ANTHROPIC_BASE_URL: undefined,
|
||||||
ANTHROPIC_BASE_URL: undefined,
|
CCS_CUSTOM_CLIPROXY_TOKEN: 'ccs-internal-managed',
|
||||||
CCS_CUSTOM_CLIPROXY_TOKEN: 'ccs-internal-managed',
|
CCS_BROWSER_USER_DATA_DIR: undefined,
|
||||||
CCS_BROWSER_USER_DATA_DIR: undefined,
|
CCS_BROWSER_PROFILE_DIR: undefined,
|
||||||
CCS_BROWSER_PROFILE_DIR: undefined,
|
CCS_BROWSER_DEVTOOLS_WS_URL: undefined,
|
||||||
CCS_BROWSER_DEVTOOLS_WS_URL: undefined,
|
});
|
||||||
},
|
|
||||||
]);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('preserves a custom cliproxy provider base_url for ccsxp launches', () => {
|
it('preserves a custom cliproxy provider base_url for ccsxp launches', () => {
|
||||||
@@ -954,27 +982,27 @@ supports_websockets = false
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(result.status).toBe(0);
|
expect(result.status).toBe(0);
|
||||||
expect(readLoggedCodexCalls(codexArgsLogPath)).toEqual([
|
expect(readLoggedCodexCalls(codexArgsLogPath).at(-1)).toEqual([
|
||||||
['--config', 'model_provider="cliproxy"', 'fix failing tests'],
|
'--config',
|
||||||
|
'model_provider="cliproxy"',
|
||||||
|
'fix failing tests',
|
||||||
]);
|
]);
|
||||||
const codexConfig = fs.readFileSync(path.join(codexHome, 'config.toml'), 'utf8');
|
const codexConfig = fs.readFileSync(path.join(codexHome, 'config.toml'), 'utf8');
|
||||||
expect(codexConfig).toContain(
|
expect(codexConfig).toContain(
|
||||||
'base_url = "https://cliproxy.example.com/api/provider/codex/responses"'
|
'base_url = "https://cliproxy.example.com/api/provider/codex/responses"'
|
||||||
);
|
);
|
||||||
expect(codexConfig).toContain('env_key = "CCS_REMOTE_CLIPROXY_TOKEN"');
|
expect(codexConfig).toContain('env_key = "CCS_REMOTE_CLIPROXY_TOKEN"');
|
||||||
expect(readLoggedCodexEnv(codexEnvLogPath)).toEqual([
|
expect(readLoggedCodexEnv(codexEnvLogPath).at(-1)).toEqual({
|
||||||
{
|
CODEX_HOME: codexHome,
|
||||||
CODEX_HOME: codexHome,
|
CODEX_CI: undefined,
|
||||||
CODEX_CI: undefined,
|
CODEX_MANAGED_BY_BUN: undefined,
|
||||||
CODEX_MANAGED_BY_BUN: undefined,
|
CODEX_THREAD_ID: undefined,
|
||||||
CODEX_THREAD_ID: undefined,
|
ANTHROPIC_BASE_URL: undefined,
|
||||||
ANTHROPIC_BASE_URL: undefined,
|
CCS_REMOTE_CLIPROXY_TOKEN: 'ccs-internal-managed',
|
||||||
CCS_REMOTE_CLIPROXY_TOKEN: 'ccs-internal-managed',
|
CCS_BROWSER_USER_DATA_DIR: undefined,
|
||||||
CCS_BROWSER_USER_DATA_DIR: undefined,
|
CCS_BROWSER_PROFILE_DIR: undefined,
|
||||||
CCS_BROWSER_PROFILE_DIR: undefined,
|
CCS_BROWSER_DEVTOOLS_WS_URL: undefined,
|
||||||
CCS_BROWSER_DEVTOOLS_WS_URL: undefined,
|
});
|
||||||
},
|
|
||||||
]);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('keeps ccsxp native when the CCS default profile is a Claude account', () => {
|
it('keeps ccsxp native when the CCS default profile is a Claude account', () => {
|
||||||
@@ -1005,22 +1033,22 @@ supports_websockets = false
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(result.status).toBe(0);
|
expect(result.status).toBe(0);
|
||||||
expect(readLoggedCodexCalls(codexArgsLogPath)).toEqual([
|
expect(readLoggedCodexCalls(codexArgsLogPath).at(-1)).toEqual([
|
||||||
['--config', 'model_provider="cliproxy"', 'fix failing tests'],
|
'--config',
|
||||||
]);
|
'model_provider="cliproxy"',
|
||||||
expect(readLoggedCodexEnv(codexEnvLogPath)).toEqual([
|
'fix failing tests',
|
||||||
{
|
|
||||||
CODEX_HOME: path.join(tmpHome, '.codex'),
|
|
||||||
CODEX_CI: undefined,
|
|
||||||
CODEX_MANAGED_BY_BUN: undefined,
|
|
||||||
CODEX_THREAD_ID: undefined,
|
|
||||||
ANTHROPIC_BASE_URL: undefined,
|
|
||||||
CLIPROXY_API_KEY: 'ccs-internal-managed',
|
|
||||||
CCS_BROWSER_USER_DATA_DIR: undefined,
|
|
||||||
CCS_BROWSER_PROFILE_DIR: undefined,
|
|
||||||
CCS_BROWSER_DEVTOOLS_WS_URL: undefined,
|
|
||||||
},
|
|
||||||
]);
|
]);
|
||||||
|
expect(readLoggedCodexEnv(codexEnvLogPath).at(-1)).toEqual({
|
||||||
|
CODEX_HOME: path.join(tmpHome, '.codex'),
|
||||||
|
CODEX_CI: undefined,
|
||||||
|
CODEX_MANAGED_BY_BUN: undefined,
|
||||||
|
CODEX_THREAD_ID: undefined,
|
||||||
|
ANTHROPIC_BASE_URL: undefined,
|
||||||
|
CLIPROXY_API_KEY: 'ccs-internal-managed',
|
||||||
|
CCS_BROWSER_USER_DATA_DIR: undefined,
|
||||||
|
CCS_BROWSER_PROFILE_DIR: undefined,
|
||||||
|
CCS_BROWSER_DEVTOOLS_WS_URL: undefined,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('keeps implicit ccs --target codex launches native when the CCS default is a Claude account', () => {
|
it('keeps implicit ccs --target codex launches native when the CCS default is a Claude account', () => {
|
||||||
@@ -1045,6 +1073,7 @@ supports_websockets = false
|
|||||||
HOME: tmpHome,
|
HOME: tmpHome,
|
||||||
CCS_HOME: tmpHome,
|
CCS_HOME: tmpHome,
|
||||||
CCS_CODEX_PATH: fakeCodexPath,
|
CCS_CODEX_PATH: fakeCodexPath,
|
||||||
|
CODEX_HOME: undefined,
|
||||||
CCS_TEST_CODEX_ARGS_OUT: codexArgsLogPath,
|
CCS_TEST_CODEX_ARGS_OUT: codexArgsLogPath,
|
||||||
CCS_TEST_CODEX_ENV_OUT: codexEnvLogPath,
|
CCS_TEST_CODEX_ENV_OUT: codexEnvLogPath,
|
||||||
CCS_THINKING: '8192',
|
CCS_THINKING: '8192',
|
||||||
@@ -1135,7 +1164,9 @@ supports_websockets = false
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(result.status).toBe(0);
|
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(readLoggedCodexCalls(codexArgsLogPath)).toEqual([['fix failing tests']]);
|
||||||
expect(readLoggedCodexEnv(codexEnvLogPath)).toEqual([
|
expect(readLoggedCodexEnv(codexEnvLogPath)).toEqual([
|
||||||
{
|
{
|
||||||
@@ -1205,19 +1236,17 @@ supports_websockets = false
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(result.status).toBe(0);
|
expect(result.status).toBe(0);
|
||||||
expect(readLoggedCodexEnv(codexEnvLogPath)).toEqual([
|
expect(readLoggedCodexEnv(codexEnvLogPath).at(-1)).toEqual({
|
||||||
{
|
CODEX_HOME: explicitCodexHome,
|
||||||
CODEX_HOME: explicitCodexHome,
|
CODEX_CI: undefined,
|
||||||
CODEX_CI: undefined,
|
CODEX_MANAGED_BY_BUN: undefined,
|
||||||
CODEX_MANAGED_BY_BUN: undefined,
|
CODEX_THREAD_ID: undefined,
|
||||||
CODEX_THREAD_ID: undefined,
|
ANTHROPIC_BASE_URL: undefined,
|
||||||
ANTHROPIC_BASE_URL: undefined,
|
CLIPROXY_API_KEY: 'ccs-internal-managed',
|
||||||
CLIPROXY_API_KEY: 'ccs-internal-managed',
|
CCS_BROWSER_USER_DATA_DIR: undefined,
|
||||||
CCS_BROWSER_USER_DATA_DIR: undefined,
|
CCS_BROWSER_PROFILE_DIR: undefined,
|
||||||
CCS_BROWSER_PROFILE_DIR: undefined,
|
CCS_BROWSER_DEVTOOLS_WS_URL: undefined,
|
||||||
CCS_BROWSER_DEVTOOLS_WS_URL: undefined,
|
});
|
||||||
},
|
|
||||||
]);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('fails with a clean CLI error when ccsxp receives a malformed --target flag', () => {
|
it('fails with a clean CLI error when ccsxp receives a malformed --target flag', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user