Skip to content

Desktop app always uses SHELL (WSL) on Windows #8396

Closed

Description

@mizaibear

Description

Desktop app ignores OPENCODE_GIT_BASH_PATH.
when execution with BashTool, always uses SHELL (WSL) on Windows

Environment:

  • OS: Windows 10
  • OpenCode: Desktop version
  • Git Bash: Installed at C:\Program Files\Git\bin\bash.exe
  • WSL: Ubuntu installed
  • OPENCODE_GIT_BASH_PATH set to C:\Program Files\Git\bin\bash.exe in Windows environment variables
$ where bash
C:\Program Files\Git\usr\bin\bash.exe
C:\Windows\System32\bash.exe

Description:
The desktop app ignores the OPENCODE_GIT_BASH_PATH environment variable when spawning the CLI sidecar. The CLI shell detection logic in shell.ts prioritizes process.env.SHELL over OPENCODE_GIT_BASH_PATH, causing it to use WSL bash instead of Git Bash. This breaks the Bash tool since Windows environment variables (PATH, PYTHONPATH, etc.) are not inherited by the WSL environment.

Reproduction:

  1. Install OpenCode Desktop on Windows
  2. Install Git Bash and WSL
  3. Set OPENCODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe in Windows environment variables

Expected Behavior:
The Bash tool should use Git Bash as configured via OPENCODE_GIT_BASH_PATH, preserving all Windows environment variables.

Actual Behavior:
The Bash tool uses WSL bash (from SHELL environment variable), causing:

  • All Windows environment variables to be unavailable
  • Commands requiring Windows tools to fail
  • Configurations in Git Bash (PATH, npm, Python, etc.) to be ignored

Root Cause:
In packages/desktop/src-tauri/src/cli.rs, the create_command() function for Windows does not pass the OPENCODE_GIT_BASH_PATH environment variable to the CLI sidecar:

#[cfg(target_os = "windows")]
pub fn create_command(app: &tauri::AppHandle, args: &str) -> Command {
    // ... existing env variables ...
    .env("OPENCODE_CLIENT", "desktop")
    .env("XDG_STATE_HOME", &state_dir);
    // Missing: .env("OPENCODE_GIT_BASH_PATH", ...)
}

The CLI's shell detection in packages/opencode/src/shell/shell.ts prioritizes SHELL:

export const acceptable = lazy(() => {
  const s = process.env.SHELL  // Checked first
  if (s && !BLACKLIST.has(...)) return s
  return fallback()  // OPENCODE_GIT_BASH_PATH is only checked here
})

Plugins

No response

OpenCode version

1.1.19

Steps to reproduce

1.Git-Bash Installed.
2.WSL Installed.

Screenshot and/or share link

No response

Operating System

Win10 22H2

Terminal

OpenCode-Desktop-Win64

Activity

  1. github-actions commented on Jan 14, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if this doesn't address your specific case.

  2. pschiel commented on Jan 15, 2026

    @pschiel
    Contributor

    You need to get your PATH order right in order for this to work.

    WSL bash lives in C:/Windows/System32

    if you want git bash to be executed, this needs to have higher priority:

    Image

    on top you can also set both env variables SHELL and OPENCODE_GIT_BASH_PATH to be on the safe side:

    Image
  3. anddam commented on Jan 19, 2026

    @anddam
  4. pschiel commented on Jan 19, 2026

    @pschiel
    Contributor

    @mizaibear

    This breaks the Bash tool since Windows environment variables (PATH, PYTHONPATH, etc.) are not inherited by the WSL environment.

    Check https://learn.microsoft.com/en-us/windows/wsl/wsl-config#interop-settings for adding windows PATH to the WSL env, and https://devblogs.microsoft.com/commandline/share-environment-vars-between-wsl-and-windows/ for the other vars.

    Mixing both systems will cause a lot of errors, because WSL cant handle Windows paths at all. Working with Windows programs, those paths will inevitably occur.

    Windows paths are added by default and can be removed with

    [interop]
    appendWindowsPath = false
    

    Git bash, MSYS, Powershell, cmd, were already a challenge to get fixed, you're setting yourself up for a whole bunch of issues. WSL works if you stay inside its VM.

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingwebRelates to opencode on web / desktopwindows

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions