Skip to content

The agent that grows with you

fix(agent,cli): skip WSL/system bash.exe in Windows bash discovery (#116818)

chugiacan0abc3b044b13
diff --git a/tools/environments/local.py b/tools/environments/local.py
index 84588df3a58..894af95a1fa 100644
--- a/tools/environments/local.py
+++ b/tools/environments/local.py
@@ -462,7 +462,13 @@ def _windows_bash_candidates(custom: "str | None") -> list[str]:
candidates = list(dict.fromkeys(c for c in raw if c and os.path.isfile(c)))
found = shutil.which("bash")
if found and found not in candidates:
- candidates.append(found)
+ # Skip WSL/system bash.exe (C:\Windows\System32\bash.exe or
+ # WindowsApps bash.exe) — it is a stub launcher, not a usable shell.
+ norm = os.path.normpath(found).lower()
+ if "system32" in norm or "windowsapps" in norm:
+ logger.debug("Skipping WSL/system bash.exe at %s", found)
+ else:
+ candidates.append(found)
return candidates