Skip to content

test(core): normalize ambient SHELL for Windows shell tests - #54105

Open
dpviivqb wants to merge 1 commit into
anomalyco:devfrom
dpviivqb:fix/windows-shell-tests
Open

dpviivqb wants to merge 1 commit into
anomalyco:devfrom
dpviivqb:fix/windows-shell-tests

Conversation

@dpviivqb

@dpviivqb dpviivqb commented Oct 9, 2026 •

Copy link
Copy Markdown

Issue for this PR

Fixes #54104

Type of change

  • Bug fix

What does this PR do?

Windows shell tests hard-code PowerShell syntax, but shell selection prefers process.env.SHELL, which Git Bash sets to /usr/bin/bash. Running the core suite from Git Bash therefore selected bash and every platform-branched command failed with bash syntax errors, while CI stayed green because its bash steps don't propagate SHELL. This deletes SHELL in test/preload.ts on win32 so tests exercise the platform default shell (PowerShell), the same one Windows CI resolves.

Discovered while running the full core suite on Windows from Git Bash; full reproduction and CI-side evidence are in #54104.

How did you verify your code works?

On Windows 11, from a Git Bash environment with SHELL=/usr/bin/bash, using the project runner (bun run test in packages/core):

  • without the change: test/tool-shell.test.ts exits 1 with /usr/bin/bash: -c: line 1: syntax error near unexpected token failures
  • with the change: 108/108 pass in test/tool-shell.test.ts, and test/shell.test.ts (which drives SHELL explicitly per test) still passes
  • also verified a single ShellTool test flips red/green by adding/removing SHELL alone
  • bun run typecheck in packages/core is clean

Screenshots / recordings

N/A

Checklist

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

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks right to me, but I couldn't run it: it only does something on Windows, and our review sandbox is Linux. From reading the code: ShellSelect checks process.env.SHELL before anything else, so an inherited SHELL=/usr/bin/bash from Git Bash would make the shell tests pick bash while they expect PowerShell. Removing it in the test preload runs before any shell is chosen, and test/shell.test.ts sets or removes SHELL in each test itself, so its Windows and Git Bash tests aren't affected. No blocking concerns. A maintainer on Windows can confirm it by running SHELL=/usr/bin/bash bun run test test/tool-shell.test.ts in packages/core from Git Bash.

@dpviivqb
dpviivqb force-pushed the fix/windows-shell-tests branch from c2d1776 to 8d4f469 Compare October 10, 2026 09:08
@thdxr
thdxr changed the base branch from v2 to dev October 10, 2026 19:38

This branch has not been deployed

No deployments
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.

core: shell tests fail on Windows when launched from Git Bash (ambient SHELL env)

1 participant