Environment
- Windows 11 24H2, opencode 1.18.15 (desktop/TUI)
- PowerShell 7.6.2 installed via Store (MSIX, WindowsApps app-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.json contains "shell": "pwsh" (confirmed loaded):
> opencode debug config
"shell": "pwsh",
- pwsh is 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 shell config.
Expected
The bash tool should honor shell: "pwsh" on Windows, matching the documented behavior ("Compatible shells are also used for agent tool calls").
Impact
- shell config 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) and rg.
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).
Reactions are currently unavailable
Environment
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
spawnSync('pwsh', ['-NoProfile','-Command','Write-Output hi']) → status 0, stdout "hi"Expected
The bash tool should honor shell: "pwsh" on Windows, matching the documented behavior ("Compatible shells are also used for agent tool calls").
Impact
Repro steps
Workaround (agent-side)
Explicitly invoke pwsh per command: pwsh -NoProfile -Command '...' (single-quote the inner command to avoid outer-shell variable expansion).