Skip to content

fix(terminal): check system Git paths before shutil.which on Windows (#47837) - #47920

Closed
kyssta-exe wants to merge 1 commit into
NousResearch:mainfrom
kyssta-exe:auto-fix/issue-47837
Closed

fix(terminal): check system Git paths before shutil.which on Windows (#47837)#47920
kyssta-exe wants to merge 1 commit into
NousResearch:mainfrom
kyssta-exe:auto-fix/issue-47837

Conversation

@kyssta-exe

Copy link
Copy Markdown
Contributor

Fixes #47837.

On Native Windows with both Git for Windows and WSL installed, _find_bash() resolves to WSL's bash.exe instead of Git for Windows' bash.exe. This is because shutil.which("bash") on the system PATH returns WSL's bash.exe (C:\Windows\system32\bash.exe), which is checked before the Git-for-Windows paths.

The fix reorders the lookup: system Git-for-Windows paths (Program Files\Git\bin\bash.exe, etc.) are now checked before falling back to shutil.which("bash"). This ensures Git Bash (MSYS) is preferred over WSL bash when both are available.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint tool/terminal Terminal execution and process management duplicate This issue or pull request already exists labels Jun 17, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #46586 — identical fix: moves the shutil.which("bash") fallback to after the Git-for-Windows path loop in tools/environments/local.py _find_bash(), so Git Bash is preferred over WSL's bash.exe. #46586 (2026-06-15) is the earlier open twin with the same mechanism.

Related: #47854 (same fix, later), #35675 (different mechanism — WSL cwd handling in base.py), and the source issue #47837.

@teknium1

teknium1 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Superseded by PR #56384. This is the same _find_bash() reorder (Git for Windows before shutil.which), which was salvaged from the earliest submission of that fix (#46586) with authorship preserved. Correct fix — thanks for confirming the approach and referencing #47837.
#56384

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

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists tool/terminal Terminal execution and process management type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: _find_bash() resolves to WSL bash before checking system Git-for-Windows paths on Native Windows

3 participants