diff --git a/packages/web/server/lib/opencode/env-runtime.js b/packages/web/server/lib/opencode/env-runtime.js index 34043275..c14557bd 100644 --- a/packages/web/server/lib/opencode/env-runtime.js +++ b/packages/web/server/lib/opencode/env-runtime.js @@ -455,10 +455,10 @@ export const createOpenCodeEnvRuntime = (deps) => { return null; } -// Fast path: 'command -v' via plain sh (no login shell, no .zshrc sourcing). -// This is much faster than the full login shell probe below and catches -// brew paths when the Electron login shell env merge already augmented PATH -// or when /bin/sh has a broader default PATH than the process. + // Fast path: 'command -v' via plain sh (no login shell, no .zshrc sourcing). + // This is much faster than the full login shell probe below and catches + // brew paths when the Electron login shell env merge already augmented PATH + // or when /bin/sh has a broader default PATH than the process. if (process.platform !== 'win32') { try { const fastResult = runSpawnSync('/bin/sh', ['-c', 'command -v opencode'], { @@ -548,10 +548,10 @@ export const createOpenCodeEnvRuntime = (deps) => { return null; } -// Fast path: 'command -v' via plain sh (no login shell, no .zshrc sourcing). -// This is much faster than the full login shell probe below and catches -// brew paths when the Electron login shell env merge already augmented PATH -// or when /bin/sh has a broader default PATH than the process. + // Fast path: 'command -v' via plain sh (no login shell, no .zshrc sourcing). + // This is much faster than the full login shell probe below and catches + // brew paths when the Electron login shell env merge already augmented PATH + // or when /bin/sh has a broader default PATH than the process. if (process.platform !== 'win32') { try { const fastResult = runSpawnSync('/bin/sh', ['-c', 'command -v node'], { @@ -653,10 +653,10 @@ export const createOpenCodeEnvRuntime = (deps) => { return null; } -// Fast path: 'command -v' via plain sh (no login shell, no .zshrc sourcing). -// This is much faster than the full login shell probe below and catches -// brew paths when the Electron login shell env merge already augmented PATH -// or when /bin/sh has a broader default PATH than the process. + // Fast path: 'command -v' via plain sh (no login shell, no .zshrc sourcing). + // This is much faster than the full login shell probe below and catches + // brew paths when the Electron login shell env merge already augmented PATH + // or when /bin/sh has a broader default PATH than the process. if (process.platform !== 'win32') { try { const fastResult = runSpawnSync('/bin/sh', ['-c', 'command -v bun'], { diff --git a/scripts/reproduce-issue-1720.mjs b/scripts/reproduce-issue-1720.mjs index 7fff57a1..40be62bb 100644 --- a/scripts/reproduce-issue-1720.mjs +++ b/scripts/reproduce-issue-1720.mjs @@ -25,9 +25,10 @@ * spawnSync($SHELL, ['-il', '-c', 'env -0'], { timeout: 5000 }) * * If the shell startup is slow (>5s due to nvm, pyenv, etc.), this times - * out and PATH stays minimal. The fast-path (Step 3b) catches standard brew - * paths even with minimal PATH, and all shell probes now have a 5s timeout - * to prevent blocking startup indefinitely. + * out and PATH stays minimal. The hardcoded fallback paths catch standard + * brew locations, the fast-path (Step 3b) catches binaries already visible + * in the inherited PATH without sourcing shell config, and all shell probes + * now have a 5s timeout to prevent blocking startup indefinitely. */ import fs from 'node:fs';