Skip to content

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

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

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

Conversation

@adammansfield
Copy link
Copy Markdown

@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 the default and fallback shell selection on Windows, which can affect terminal startup behavior on systems without pwsh.exe or with custom ComSpec usage.

Overview
Windows terminal sessions now prefer PowerShell 7 (pwsh.exe) by default. defaultShellResolver no longer uses ComSpec, and Windows fallback candidate ordering is updated to try pwsh.exe first, then powershell.exe, then ComSpec, then cmd.exe.

Tests for shell-spawn retry behavior were updated to account for Windows command normalization differences and to accept pwsh.exe as a valid fallback shell.

Reviewed by Cursor Bugbot for commit bef34cc. 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 bef34cc.

- 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: 370d91cd-0166-4f89-8112-9b5ddd35117d

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