fix(terminal): select the Windows shell from ComSpec - #366
Merged
Conversation
lzcer (lzcer)
requested review from
Olga Lavrichenko (OLavrik),
Rustam Sadykov (SBOne-Kenobi),
danyaberezun and
Rinat S (rsolmano)
as code owners
September 1, 2026 08:03
danyaberezun
approved these changes
Sep 2, 2026
danyaberezun
approved these changes
Sep 2, 2026
danyaberezun
left a comment
Collaborator
There was a problem hiding this comment.
Approved — ready to merge.
danyaberezun
enabled auto-merge
September 2, 2026 00:46
danyaberezun
disabled auto-merge
September 2, 2026 00:48
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.
Summary
SHELLfor users who configure oneComSpec/COMSPECon Windows, withcmd.exeas the final fallback/bin/bashfallback on non-Windows platformsProblem
ThinkRail can be launched from a Windows GUI environment where
SHELLis not defined. The terminal manager currently falls back to/bin/bash, which is not a valid default Windows executable, sobun-ptycannot spawn the terminal and the tab reportscould not start a shell.Approach
The terminal module now resolves the PTY executable from the environment and platform. An explicitly configured
SHELLstill wins on every platform. Windows otherwise follows its nativeComSpecconvention, while Unix-like platforms retain the existing bash fallback. This avoids inventing a globalSHELLvalue that would also affect the in-process agent and unrelated child processes.Validation
bun test packages/server/src/terminal/shellArgs.test.ts(5 pass, 0 fail)bun-ptyspawn usingC:\Windows\System32\cmd.exebun run check:depsbun run check:boundariesbun run check:seamsbun run lint(passes with 6 existing warnings)bun run typecheckThe complete unit and no-agent E2E suites were also attempted on Windows. Existing fixture/platform assumptions fail before this terminal path is exercised, including
spawnSync mv ENOENT, missing project fixture rows, JetBrains Central remainingabsent, temporary-directoryEBUSY, and POSIXsleepusage.