Compare commits

...
Author SHA1 Message Date
Cursor Agent f8c9d71187 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
2026-03-25 21:07:23 +00:00
4 changed files with 30 additions and 3 deletions

No files matched your search

@@ -95,7 +95,7 @@ const makeClaudeTextGeneration = Effect.gen(function* () {
const runClaudeCommand = Effect.gen(function* () { const runClaudeCommand = Effect.gen(function* () {
const command = ChildProcess.make( const command = ChildProcess.make(
claudeSettings?.binaryPath ?? "claude", claudeSettings?.binaryPath || "claude",
[ [
"-p", "-p",
"--output-format", "--output-format",
@@ -153,7 +153,7 @@ const makeCodexTextGeneration = Effect.gen(function* () {
const reasoningEffort = const reasoningEffort =
modelSelection.options?.reasoningEffort ?? CODEX_GIT_TEXT_GENERATION_REASONING_EFFORT; modelSelection.options?.reasoningEffort ?? CODEX_GIT_TEXT_GENERATION_REASONING_EFFORT;
const command = ChildProcess.make( const command = ChildProcess.make(
codexSettings?.binaryPath ?? "codex", codexSettings?.binaryPath || "codex",
[ [
"exec", "exec",
"--ephemeral", "--ephemeral",
+1 -1
View File
@@ -97,7 +97,7 @@ export function deriveProviderStartOptions(
}, },
} }
: {}), : {}),
...(settings.claude ...(settings.claude?.binaryPath
? { ? {
claudeAgent: { claudeAgent: {
binaryPath: settings.claude.binaryPath, binaryPath: settings.claude.binaryPath,
+27
View File
@@ -159,6 +159,33 @@ export function migrateLocalSettingsToServer(): void {
} }
} }
// Migrate old flat binary-path keys into their new nested shape
const codexBinaryPath = old["codexBinaryPath"];
const codexHomePath = old["codexHomePath"];
const claudeBinaryPath = old["claudeBinaryPath"];
if (
(typeof codexBinaryPath === "string" && codexBinaryPath) ||
(typeof codexHomePath === "string" && codexHomePath)
) {
const existing = (serverPatch["codex"] as Record<string, unknown> | undefined) ?? {};
serverPatch["codex"] = {
...existing,
...(typeof codexBinaryPath === "string" && codexBinaryPath
? { binaryPath: codexBinaryPath }
: {}),
...(typeof codexHomePath === "string" && codexHomePath ? { homePath: codexHomePath } : {}),
};
}
if (typeof claudeBinaryPath === "string" && claudeBinaryPath) {
const existing = (serverPatch["claude"] as Record<string, unknown> | undefined) ?? {};
serverPatch["claude"] = {
...existing,
binaryPath: claudeBinaryPath,
};
}
if (Object.keys(serverPatch).length > 0) { if (Object.keys(serverPatch).length > 0) {
void ensureNativeApi() void ensureNativeApi()
.server.updateSettings(serverPatch as ServerSettingsPatch) .server.updateSettings(serverPatch as ServerSettingsPatch)