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

Closed
opened 2026-02-16 17:55:28 -05:00 by yindo · 0 comments
Owner

Originally created by @mizaibear on GitHub (Jan 14, 2026).

Originally assigned to: @adamdotdevin on GitHub.

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

Originally created by @mizaibear on GitHub (Jan 14, 2026). Originally assigned to: @adamdotdevin on GitHub. ### 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: ```rust #[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`: ```typescript 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
yindo added the windowsbugweb labels 2026-02-16 17:55:28 -05:00
yindo closed this issue 2026-02-16 17:55:28 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#5672