fix(desktop): resolve login shell when loading env#26449
Merged
Brendonovich merged 3 commits intoMay 13, 2026
Conversation
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Issue for this PR
Closes #26356
Type of change
What does this PR do?
Desktop can start with
SHELLunset, especially from GUI launch contexts. In that casegetUserShell()fell back to/bin/sh, so the existing shell env probe did not read the user login shell where Homebrew, mise, nvm, and similar PATH setup often live.This changes the fallback to use
os.userInfo().shellbefore/bin/sh, keepingprocess.env.SHELLas the explicit override. That lets the existing-ilshell env loader probe the actual login shell and pass the resulting environment to the sidecar and local MCP processes.This should fully address the Desktop-specific
spawn npx ENOENTclass of failures for local MCP servers that work in the CLI but fail from the macOS app because the app did not inherit the user's login-shell PATH.How did you verify your code works?
bun test src/main/shell-env.test.tsfrompackages/desktopbun run oxlint packages/desktop/src/main/shell-env.ts packages/desktop/src/main/shell-env.test.tsbun turbo typecheckpassedSHELLunset andPATH=/usr/bin:/bin:/usr/sbin:/sbin, simulating a macOS GUI launch without Homebrew on PATH. The patched app logged[server] Loaded shell environment with -il (...), proving it resolved the real login shell instead of falling back to/bin/sh.command: ["npx", "-y", "reactbits-dev-mcp-server"]: after the patched Desktop process loaded the login-shell env, the failure no longer reachedspawn npx ENOENT.MCP error -32601: Method not found failed to get prompts, which happens after local MCP startup and is not the local process spawn/PATH failure fixed here.Screenshots / recordings
N/A - no UI changes.
Checklist