fix(cliproxy): filter undefined config values to preserve defaults

Object spread with {port: undefined} was overwriting DEFAULT_CONFIG.port,
causing "Using existing CLIProxy on port undefined" after upgrade.

Root cause: profileInfo.port is undefined for hardcoded CLIProxy profiles
(gemini, codex, agy, qwen). When passed to execClaudeWithCLIProxy(), the
undefined value replaced the default port 8317.

Fix: Filter out undefined values before merging with DEFAULT_CONFIG.
This commit is contained in:
kaitranntt
2026-01-01 01:38:19 -05:00
parent d28e926ed4
commit 4c35e8a39e
+5 -1
View File
@@ -121,7 +121,11 @@ export async function execClaudeWithCLIProxy(
args: string[],
config: Partial<ExecutorConfig> = {}
): Promise<void> {
const cfg = { ...DEFAULT_CONFIG, ...config };
// Filter out undefined values to prevent overwriting defaults
const filteredConfig = Object.fromEntries(
Object.entries(config).filter(([, v]) => v !== undefined)
) as Partial<ExecutorConfig>;
const cfg = { ...DEFAULT_CONFIG, ...filteredConfig };
const verbose = cfg.verbose || args.includes('--verbose') || args.includes('-v');
const log = (msg: string) => {