Skip to content

fix(desktop): resolve login shell when loading env - #26449

Merged
Brendonovich merged 3 commits into
anomalyco:devfrom
qunqin24:fix-desktop-shell-env-login-shell
May 13, 2026
Merged

Brendonovich merged 3 commits into
anomalyco:devfrom
qunqin24:fix-desktop-shell-env-login-shell

Conversation

@qunqin24

@qunqin24 qunqin24 commented May 9, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #26356

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Desktop can start with SHELL unset, especially from GUI launch contexts. In that case getUserShell() 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().shell before /bin/sh, keeping process.env.SHELL as the explicit override. That lets the existing -il shell 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 ENOENT class 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.ts from packages/desktop
  • bun run oxlint packages/desktop/src/main/shell-env.ts packages/desktop/src/main/shell-env.test.ts
  • Pre-push bun turbo typecheck passed
  • Manual Desktop-path verification: launched the patched Electron main process with SHELL unset and PATH=/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.
  • Manual MCP verification with a ReactBits config using command: ["npx", "-y", "reactbits-dev-mcp-server"]: after the patched Desktop process loaded the login-shell env, the failure no longer reached spawn npx ENOENT.
  • The remaining ReactBits log was 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

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@qunqin24
qunqin24 requested a review from adamdotdevin as a code owner May 9, 2026 02:12
@Brendonovich
Brendonovich merged commit 80543fb into anomalyco:dev May 13, 2026
8 checks passed
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
isaacfinnegan pushed a commit to isaacfinnegan/whispercode that referenced this pull request Jun 15, 2026
MarsQiu007 referenced this pull request in MarsQiu007/openNovel Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Local MCP servers fail with 'spawn ENOENT' after version update — PATH not inherited on macOS

2 participants