This repository was archived by the owner on Jun 8, 2026. It is now read-only.
fix/shell-path-resolution: extract shared shell PATH resolver for CLI spawns - #56
Merged
Merged
Conversation
… spawns
Electron inherits a minimal PATH that excludes /opt/homebrew/bin, nvm, volta,
and other user-local tool directories. CLI commands (claude, gh, codex) installed
in those locations fail with ENOENT.
- Extract getShellPath() from health-check.ts into shared shell-path.ts module
- Replace all 14 hardcoded PATH fallbacks across 10 operation files
- Add env to spawnStreaming calls that previously inherited bare process.env
- Expand ~ segments before caching (spawn/execFile does not do tilde expansion)
- Use sentinel markers to strip shell startup chatter from echo PATH output
- Add 23 tests covering PATH resolution, tilde expansion, and output extraction
Testing: pnpm -C apps/desktop exec tsx --test test/shell-path.test.ts (23 pass)
just desktop-lint, just desktop-typecheck (clean)
Risks: getShellPath spawns the login shell once on first call; 3s timeout
with fallback to process.env.PATH + homebrew paths if shell hangs.
Tests that set process.env.PATH to a fake-bin directory need to also reset the getShellPath() cache, otherwise the cached login-shell PATH from a previous call takes precedence and the fake binaries are not found (ENOENT on CI). - Add resetShellPathCache() after every process.env.PATH assignment and restore in afterEach hooks across 8 test files - Bump version to 0.9.5
mikeangstadt
approved these changes
Mar 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Electron inherits a minimal PATH that excludes /opt/homebrew/bin, nvm, volta, and other user-local tool directories. CLI commands (claude, gh, codex) installed in those locations fail with ENOENT.
Testing: pnpm -C apps/desktop exec tsx --test test/shell-path.test.ts (23 pass) just desktop-lint, just desktop-typecheck (clean)
Risks: getShellPath spawns the login shell once on first call; 3s timeout with fallback to process.env.PATH + homebrew paths if shell hangs.