anomalyco / anomalyco/opencode
Windows: bash tool ignores shell: pwsh config — always runs PowerShell 5.1 (1.18.15)
@Hona is already working on this.
Since Aug 9, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Environment
- Windows 11 24H2, opencode 1.18.15 (desktop/TUI)
- PowerShell 7.6.2 installed via Store (MSIX,
WindowsAppsapp-execution alias)
Problem
The shell config option is documented as "Default shell to use for terminal and bash tool" and the docs state "Compatible shells are also used for agent tool calls". On Windows, however, the built-in bash tool always runs Windows PowerShell 5.1 regardless of the configured shell.
Evidence
- Global config
~/.config/opencode/opencode.jsoncontains"shell": "pwsh"(confirmed loaded):> opencode debug config "shell": "pwsh", pwshis resolvable and spawnable from Node (same mechanism opencode uses):spawnSync('pwsh', ['-NoProfile','-Command','Write-Output hi']) → status 0, stdout "hi"- Yet the agent bash tool executes as PowerShell 5.1:
$PSVersionTable.PSVersion.ToString() → 5.1.26100.8875 $PSEdition → Desktop - The bash tool's generated description literally says "Windows PowerShell (5.1)" — it appears to use a hard-coded Windows default rather than the
shellconfig.
Expected
The bash tool should honor shell: "pwsh" on Windows, matching the documented behavior ("Compatible shells are also used for agent tool calls").
Impact
shellconfig only affects the interactive terminal, not agent tool calls.- Windows users cannot make agents use pwsh 7 (modern syntax, UTF-8-no-BOM default), which matters for tools like
Set-Content(5.1 corrupts UTF-8 Chinese text) andrg.
Repro steps
- Set
"shell": "pwsh"in global config - Restart opencode
- Invoke the bash tool with
$PSVersionTable.PSVersion.ToString() - Observe
5.1.26100.8875/Desktop
Workaround (agent-side)
Explicitly invoke pwsh per command: pwsh -NoProfile -Command '...' (single-quote the inner command to avoid outer-shell variable expansion).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.