You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
core: shell tests fail on Windows when launched from Git Bash (ambient SHELL env) #54104
packages/core shell tests branch command syntax on process.platform === "win32" and hard-code PowerShell (e.g. test/tool-shell.test.ts), but shell selection (src/shell/select.ts, environment()) prefers process.env.SHELL whenever it is set. Git Bash exports SHELL=/usr/bin/bash, so running the core suite from Git Bash makes the shell tool select bash and every platform-branched command fails with bash syntax errors:
/usr/bin/bash: -c: line 1: syntax error near unexpected token `$env:OPENCODE_SESSION_ENV_TEST'
CI stays green because its bash steps do not propagate SHELL into the test process, so Windows CI silently runs PowerShell while a Git Bash developer machine runs bash. script/test.ts also forwards SHELL (its env filter only strips provider credentials), so the project runner reproduces this too.
Suggested fix: normalize SHELL in test/preload.ts on win32 so unit tests exercise the platform default shell, matching the PowerShell syntax the tests already assert. PR incoming.
Steps to reproduce
On Windows, open Git Bash in a v2 checkout with dependencies installed.
cd packages/core && SHELL=/usr/bin/bash bun run test test/tool-shell.test.ts
ShellTool tests fail with bash syntax errors; the same command from PowerShell (where SHELL is unset) passes.
Thanks for the detailed report. I couldn't run this here: the failure needs Windows and Git Bash, and our sandbox is Linux, where the tests never use PowerShell syntax.
I did read the latest v2 (2f3ba04), which is the commit you reported. The cause you describe is still there: src/shell/select.ts picks the shell from process.env.SHELL first, and test/preload.ts doesn't touch SHELL. So running the core suite from Git Bash should still pick bash while the tests assert PowerShell syntax.
A maintainer with a Windows setup will need to confirm it. Your PR that normalizes SHELL in the test preload will be a useful starting point for that.
Activity
opencode-agent commentedon Oct 9, 2026
Thanks for the detailed report. I couldn't run this here: the failure needs Windows and Git Bash, and our sandbox is Linux, where the tests never use PowerShell syntax.
I did read the latest
v2(2f3ba04), which is the commit you reported. The cause you describe is still there:src/shell/select.tspicks the shell fromprocess.env.SHELLfirst, andtest/preload.tsdoesn't touchSHELL. So running the core suite from Git Bash should still pick bash while the tests assert PowerShell syntax.A maintainer with a Windows setup will need to confirm it. Your PR that normalizes
SHELLin the test preload will be a useful starting point for that.