anomalyco / anomalyco/opencode

Windows: bash tool ignores shell: pwsh config — always runs PowerShell 5.1 (1.18.15)

Open
#41,426 2 comments 1 reaction 1 assignee View on GitHub

@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, 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

  1. Global config ~/.config/opencode/opencode.json contains "shell": "pwsh" (confirmed loaded):
    > opencode debug config
    "shell": "pwsh",
    
  2. pwsh is resolvable and spawnable from Node (same mechanism opencode uses):
    spawnSync('pwsh', ['-NoProfile','-Command','Write-Output hi']) → status 0, stdout "hi"
    
  3. Yet the agent bash tool executes as PowerShell 5.1:
    $PSVersionTable.PSVersion.ToString() → 5.1.26100.8875
    $PSEdition → Desktop
    
  4. 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

  1. Set "shell": "pwsh" in global config
  2. Restart opencode
  3. Invoke the bash tool with $PSVersionTable.PSVersion.ToString()
  4. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.