FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Windows: bash tool ignores shell: pwsh config — always runs PowerShell 5.1 (1.18.15) · Issue #41426 · anomalyco/opencode · GitHub

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

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).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL