Pre-flight Checklist
Related but distinct from #924 (that issue is about doctor PATHEXT detection + a false "3 copies" warning, and explicitly assumes gga.ps1 works). This report is about the gga.ps1 shim itself failing to locate bash.exe. Shim was introduced in #101.
📝 Bug Description
The generated gga.ps1 PowerShell shim (asset internal/assets/gga/gga.ps1) derives Git Bash from git's location with a single, fragile assumption:
$bash = Join-Path (Split-Path (Split-Path $gitCmd.Source)) "bin\bash.exe"
This only holds when git resolves from <GitRoot>\cmd\git.exe (two Split-Path ups → <GitRoot>, then bin\bash.exe is valid).
When git resolves from <GitRoot>\mingw64\bin\git.exe — common when mingw64\bin precedes cmd on PATH, or with certain Git installs — the shim computes <GitRoot>\mingw64\bin\bash.exe, which does not exist. The real bash.exe lives at <GitRoot>\bin\bash.exe and <GitRoot>\usr\bin\bash.exe.
Net effect: gga is completely unusable from PowerShell for affected users (the shim exits before ever reaching the bash script).
Note: the robust resolver already exists in Go at internal/installcmd/resolver.go (it tries multiple candidates + known locations), but the runtime PowerShell shim does not mirror that logic.
🔄 Steps to Reproduce
- Windows machine where
git resolves to the mingw64 copy. Verify with:
(Get-Command git).Source
# -> C:\Program Files\Git\mingw64\bin\git.exe
- Have gga installed via the ecosystem (
gga.ps1 shim present in a PATH dir, e.g. C:\Users\<user>\bin\gga.ps1).
- From PowerShell, run:
✅ Expected Behavior
The shim locates Git Bash regardless of whether git resolves from cmd\, bin\, or mingw64\bin\, then runs gga (e.g. prints gga v2.8.1).
❌ Actual Behavior
gga.ps1: Git Bash not found at 'C:\Program Files\Git\mingw64\bin\bash.exe'. Reinstall Git for Windows.
Exit code 1. bash.exe actually exists at C:\Program Files\Git\bin\bash.exe and C:\Program Files\Git\usr\bin\bash.exe.
Gentle AI Version
1.40.2
Operating System
Windows
AI Agent / Client
Claude Code
📋 Affected Area
Installation Pipeline
💡 Logs / Error Output
PS> (Get-Command git).Source
C:\Program Files\Git\mingw64\bin\git.exe
PS> gga --version
gga.ps1: Git Bash not found at 'C:\Program Files\Git\mingw64\bin\bash.exe'. Reinstall Git for Windows.
PS> Test-Path 'C:\Program Files\Git\bin\bash.exe'
True
PS> Test-Path 'C:\Program Files\Git\mingw64\bin\bash.exe'
False
Additional Context
Suggested fix — mirror the Go resolver inside the shim: try bash.exe on PATH (excluding the WSL launcher in System32), then walk up from git's directory trying both bin\bash.exe and usr\bin\bash.exe at each level, then fall back to known install locations:
$gitCmd = Get-Command git -ErrorAction SilentlyContinue
if (-not $gitCmd) {
Write-Error "Git not found on PATH. Install Git for Windows to use gga from PowerShell."
exit 1
}
$bash = $null
$bashCmd = Get-Command bash.exe -ErrorAction SilentlyContinue |
Where-Object { $_.Source -notlike "$env:WINDIR\System32\*" } |
Select-Object -First 1
if ($bashCmd) { $bash = $bashCmd.Source }
if (-not $bash) {
$candidates = @()
$dir = Split-Path $gitCmd.Source
for ($i = 0; $i -lt 4 -and $dir; $i++) {
$candidates += (Join-Path $dir 'bin\bash.exe')
$candidates += (Join-Path $dir 'usr\bin\bash.exe')
$dir = Split-Path $dir
}
$candidates += 'C:\Program Files\Git\bin\bash.exe'
$candidates += 'C:\Program Files\Git\usr\bin\bash.exe'
$bash = $candidates | Where-Object { Test-Path $_ } | Select-Object -First 1
}
if (-not $bash) {
Write-Error "Git Bash (bash.exe) not found. Reinstall Git for Windows or add its bin directory to PATH."
exit 1
}
& $bash -c "gga $args"
exit $LASTEXITCODE
Verified locally: applying the above makes gga --version return gga v2.8.1 (exit 0) and gga --help work from PowerShell on a machine where git is in mingw64\bin.
Environment
- OS: Windows 11
- gentle-ai: 1.40.2 (installed via Scoop)
- gga: v2.8.1
- git:
C:\Program Files\Git\mingw64\bin\git.exe
Pre-flight Checklist
status:approved📝 Bug Description
The generated
gga.ps1PowerShell shim (assetinternal/assets/gga/gga.ps1) derives Git Bash from git's location with a single, fragile assumption:This only holds when
gitresolves from<GitRoot>\cmd\git.exe(twoSplit-Pathups →<GitRoot>, thenbin\bash.exeis valid).When
gitresolves from<GitRoot>\mingw64\bin\git.exe— common whenmingw64\binprecedescmdon PATH, or with certain Git installs — the shim computes<GitRoot>\mingw64\bin\bash.exe, which does not exist. The realbash.exelives at<GitRoot>\bin\bash.exeand<GitRoot>\usr\bin\bash.exe.Net effect:
ggais completely unusable from PowerShell for affected users (the shim exits before ever reaching the bash script).Note: the robust resolver already exists in Go at
internal/installcmd/resolver.go(it tries multiple candidates + known locations), but the runtime PowerShell shim does not mirror that logic.🔄 Steps to Reproduce
gitresolves to the mingw64 copy. Verify with:gga.ps1shim present in a PATH dir, e.g.C:\Users\<user>\bin\gga.ps1).gga --version✅ Expected Behavior
The shim locates Git Bash regardless of whether
gitresolves fromcmd\,bin\, ormingw64\bin\, then runs gga (e.g. printsgga v2.8.1).❌ Actual Behavior
Exit code 1.
bash.exeactually exists atC:\Program Files\Git\bin\bash.exeandC:\Program Files\Git\usr\bin\bash.exe.Gentle AI Version
1.40.2
Operating System
Windows
AI Agent / Client
Claude Code
📋 Affected Area
Installation Pipeline
💡 Logs / Error Output
Additional Context
Suggested fix — mirror the Go resolver inside the shim: try
bash.exeon PATH (excluding the WSL launcher inSystem32), then walk up from git's directory trying bothbin\bash.exeandusr\bin\bash.exeat each level, then fall back to known install locations:Verified locally: applying the above makes
gga --versionreturngga v2.8.1(exit 0) andgga --helpwork from PowerShell on a machine wheregitis inmingw64\bin.Environment
C:\Program Files\Git\mingw64\bin\git.exe