Skip to content

fix(server): prefer pwsh as the default Windows shell#1846

Open
adammansfield wants to merge 4 commits intopingdotgg:mainfrom
adammansfield:fix/win-terminal-prefer-pwsh
Open

fix(server): prefer pwsh as the default Windows shell#1846
adammansfield wants to merge 4 commits intopingdotgg:mainfrom
adammansfield:fix/win-terminal-prefer-pwsh

Conversation

@adammansfield
Copy link
Copy Markdown
Contributor

@adammansfield adammansfield commented Apr 8, 2026

What Changed

Prefer pwsh.exe as the default Windows shell, and do not rely on ComSpec to allow user shell selection on Windows.

Why

Do not rely on overriding ComSpec to allow user shell selection on Windows because many tools require it to be cmd.exe. For example, setting ComSpec as pwsh.exe and launching T3 Code breaks the "Open" Visual Studio Code button as it no longer does anything when clicked.

Prefer pwsh.exe because it matches Visual Studio Code's default shell behavior on Windows when pwsh.exe (PowerShell 7) is available.

UI Changes

No UI changes.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes -- no UI changes
  • I included a video for animation/interaction changes -- no animation/interaction changes

Validation

  • bun fmt
  • bun lint
  • bun typecheck
  • cd apps/server && bun run test -- src/terminal/Layers/Manager.test.ts -t "retries with fallback shells when preferred shell spawn fails"

Note

Medium Risk
Changes Windows terminal spawn defaults and fallback order, which can affect startup behavior on systems without PowerShell 7 or with unusual shell setups; non-Windows behavior is unchanged.

Overview
Windows terminal sessions now prefer pwsh.exe by default. defaultShellResolver no longer uses ComSpec/cmd.exe, and the Windows fallback list is reordered to try pwsh.exe then powershell.exe before falling back to ComSpec and cmd.exe.

Tests were updated to reflect the new Windows behavior, including allowing pwsh.exe as a valid fallback and accounting for Windows command normalization differences.

Reviewed by Cursor Bugbot for commit 4bc221f. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

[!NOTE]

Prefer pwsh.exe as the default Windows shell in terminal manager

  • Changes defaultShellResolver to return pwsh.exe unconditionally on Windows, replacing the previous default of ComSpec/cmd.exe.
  • Updates resolveShellCandidates fallback order on Windows to [requested, 'pwsh.exe', 'powershell.exe', ComSpec, 'cmd.exe'], prioritizing pwsh.exe ahead of cmd.exe.
  • Behavioral Change: Windows users will now get a pwsh.exe session by default instead of cmd.exe; systems without PowerShell Core installed will fall back to powershell.exe then cmd.exe.

Macroscope summarized 4bc221f.

- Do not rely on overriding ComSpec to allow user shell selection on Windows because tools require it to be cmd.exe. For example, setting ComSpec as pwsh.exe and launching T3 Code breaks the "Open" Visual Studio Code button as it no longer does anything when clicked.
- Prefer pwsh.exe because it matches VS Code's default shell behavior on Windows when pwsh.exe (PowerShell 7) is available.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 8, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7d25a38a-221b-444b-a7ea-96975bdac6c3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Apr 8, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 8, 2026

Approvability

Verdict: Needs human review

This PR changes the default Windows shell from cmd.exe to pwsh.exe (PowerShell Core), which is a runtime behavior change affecting all Windows users. While fallback logic exists, changing default user-facing behavior warrants human review.

You can customize Macroscope's approvability policy. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant