Skip to content

Commit f8c9d71

Browse files
committed
fix: prevent empty-string binary paths from breaking CLI spawning and migrate old flat binary path keys
- Guard claude branch in deriveProviderStartOptions on binaryPath being truthy, not just the claude object existing (which is always truthy due to schema defaults) - Use || instead of ?? for binaryPath fallbacks in ClaudeTextGeneration and CodexTextGeneration so empty strings correctly fall back to default CLI names - Add explicit migration of old flat keys (claudeBinaryPath, codexBinaryPath, codexHomePath) into the new nested codex/claude objects in migrateLocalSettingsToServer
1 parent 3f089a4 commit f8c9d71

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

apps/server/src/git/Layers/ClaudeTextGeneration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const makeClaudeTextGeneration = Effect.gen(function* () {
9595

9696
const runClaudeCommand = Effect.gen(function* () {
9797
const command = ChildProcess.make(
98-
claudeSettings?.binaryPath ?? "claude",
98+
claudeSettings?.binaryPath || "claude",
9999
[
100100
"-p",
101101
"--output-format",

apps/server/src/git/Layers/CodexTextGeneration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ const makeCodexTextGeneration = Effect.gen(function* () {
153153
const reasoningEffort =
154154
modelSelection.options?.reasoningEffort ?? CODEX_GIT_TEXT_GENERATION_REASONING_EFFORT;
155155
const command = ChildProcess.make(
156-
codexSettings?.binaryPath ?? "codex",
156+
codexSettings?.binaryPath || "codex",
157157
[
158158
"exec",
159159
"--ephemeral",

apps/server/src/serverSettings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export function deriveProviderStartOptions(
9797
},
9898
}
9999
: {}),
100-
...(settings.claude
100+
...(settings.claude?.binaryPath
101101
? {
102102
claudeAgent: {
103103
binaryPath: settings.claude.binaryPath,

apps/web/src/hooks/useSettings.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,33 @@ export function migrateLocalSettingsToServer(): void {
159159
}
160160
}
161161

162+
// Migrate old flat binary-path keys into their new nested shape
163+
const codexBinaryPath = old["codexBinaryPath"];
164+
const codexHomePath = old["codexHomePath"];
165+
const claudeBinaryPath = old["claudeBinaryPath"];
166+
167+
if (
168+
(typeof codexBinaryPath === "string" && codexBinaryPath) ||
169+
(typeof codexHomePath === "string" && codexHomePath)
170+
) {
171+
const existing = (serverPatch["codex"] as Record<string, unknown> | undefined) ?? {};
172+
serverPatch["codex"] = {
173+
...existing,
174+
...(typeof codexBinaryPath === "string" && codexBinaryPath
175+
? { binaryPath: codexBinaryPath }
176+
: {}),
177+
...(typeof codexHomePath === "string" && codexHomePath ? { homePath: codexHomePath } : {}),
178+
};
179+
}
180+
181+
if (typeof claudeBinaryPath === "string" && claudeBinaryPath) {
182+
const existing = (serverPatch["claude"] as Record<string, unknown> | undefined) ?? {};
183+
serverPatch["claude"] = {
184+
...existing,
185+
binaryPath: claudeBinaryPath,
186+
};
187+
}
188+
162189
if (Object.keys(serverPatch).length > 0) {
163190
void ensureNativeApi()
164191
.server.updateSettings(serverPatch as ServerSettingsPatch)

0 commit comments

Comments
 (0)