From 3edc765ddd075e4b32e796129d43783f526d201b Mon Sep 17 00:00:00 2001 From: Mayuresh Kadu <23300+mskadu@users.noreply.github.com> Date: Thu, 20 Aug 2026 18:14:41 +0100 Subject: [PATCH] fix: restore fast-path comment indentation, correct reproduce script claim MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Address bot review findings: - Indent the three 'Fast path' comment blocks to match surrounding code - Reproduce script header no longer claims the fast path catches brew paths with a minimal PATH — the hardcoded fallbacks do that; the fast path only sees binaries already in the inherited PATH --- .../web/server/lib/opencode/env-runtime.js | 24 +++++++++---------- scripts/reproduce-issue-1720.mjs | 7 +++--- 2 files changed, 16 insertions(+), 15 deletions(-) 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';