From 4c35e8a39ed03ab026a1dff230e06f5d9449fbef Mon Sep 17 00:00:00 2001 From: kaitranntt Date: Thu, 1 Jan 2026 01:38:19 -0500 Subject: [PATCH] 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. --- src/cliproxy/cliproxy-executor.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cliproxy/cliproxy-executor.ts b/src/cliproxy/cliproxy-executor.ts index 5a98b181..a8e821ed 100644 --- a/src/cliproxy/cliproxy-executor.ts +++ b/src/cliproxy/cliproxy-executor.ts @@ -121,7 +121,11 @@ export async function execClaudeWithCLIProxy( args: string[], config: Partial = {} ): Promise { - 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; + const cfg = { ...DEFAULT_CONFIG, ...filteredConfig }; const verbose = cfg.verbose || args.includes('--verbose') || args.includes('-v'); const log = (msg: string) => {