Description
On Windows systems without WSL installed, the bash tool in OpenPI-created subagent / Web sessions fails with the same error (exit code 1) for any command, even something as simple as echo hi:
??? Linux ? Windows ?????????????
?????? Microsoft Store ??????:
https://aka.ms/wslstore
(The message above is in Chinese and originates from C:\Windows\System32\bash.exe, the WSL launcher stub, not a real bash shell.)
This indicates the tool is invoking the WSL stub (System32\bash.exe) rather than the user-configured shell (e.g., Git Bash).
Environment
- OS: Windows (Chinese edition), WSL not installed
- Git for Windows: installed at
D:\Git (non‑default path)
- Pi version: 0.85.1
- OpenPI version: 0.5.0
- Global setting:
~/.pi/agent/settings.json contains "shellPath": "D:/Git/bin/bash.exe" (the file exists and is executable)
Steps to Reproduce
- Configure
"shellPath": "D:/Git/bin/bash.exe" in settings.json.
- In the interactive Pi session, run
!echo hi → works as expected (hi is printed), confirming the main flow respects shellPath.
- Enter an OpenPI subagent or Web session and use the
bash tool to execute any command (e.g., echo hi) → the above WSL stub error appears.
Root Cause (Hypothesis)
- The main interactive flow follows the Pi documentation and respects
settings.shellPath.
- However, the
bash tool in OpenPI‑derived sessions hard‑codes a bare bash call and does not propagate the user‑configured shellPath.
- On Windows,
CreateProcess searches System32 before PATH, so it finds System32\bash.exe—the WSL stub—first. Changing PATH alone cannot override this because the system directory takes precedence.
- Code‑level confirmation needed: The host registration for the
bash tool in subagent / Web sessions should be checked to see whether it reads shellPath.
Suggested Fixes
- Align the
bash tool in derived sessions with the main flow’s shell resolution logic:
shellPath → Git Bash discovery → fallback to bash—but never use the System32 stub.
- If resolution results in
System32\bash.exe (the WSL stub), pre‑check whether WSL is actually available. If not, fail fast with a clear, actionable error message.
- On Windows, affected sessions could fall back to or switch to a
powershell tool as an alternative.
- Minor: Ensure tool output is decoded correctly (e.g., GBK for legacy console code pages) to avoid garbled messages that obscure the real error.
Workaround
- Perform shell operations inside the main interactive Pi session where
shellPath is respected.
- After modifying the configuration, restart the host process that serves OpenPI sessions.
Description
On Windows systems without WSL installed, the
bashtool in OpenPI-created subagent / Web sessions fails with the same error (exit code 1) for any command, even something as simple asecho hi:(The message above is in Chinese and originates from
C:\Windows\System32\bash.exe, the WSL launcher stub, not a real bash shell.)This indicates the tool is invoking the WSL stub (
System32\bash.exe) rather than the user-configured shell (e.g., Git Bash).Environment
D:\Git(non‑default path)~/.pi/agent/settings.jsoncontains"shellPath": "D:/Git/bin/bash.exe"(the file exists and is executable)Steps to Reproduce
"shellPath": "D:/Git/bin/bash.exe"insettings.json.!echo hi→ works as expected (hiis printed), confirming the main flow respectsshellPath.bashtool to execute any command (e.g.,echo hi) → the above WSL stub error appears.Root Cause (Hypothesis)
settings.shellPath.bashtool in OpenPI‑derived sessions hard‑codes a barebashcall and does not propagate the user‑configuredshellPath.CreateProcesssearchesSystem32beforePATH, so it findsSystem32\bash.exe—the WSL stub—first. ChangingPATHalone cannot override this because the system directory takes precedence.bashtool in subagent / Web sessions should be checked to see whether it readsshellPath.Suggested Fixes
bashtool in derived sessions with the main flow’s shell resolution logic:shellPath→ Git Bash discovery → fallback tobash—but never use theSystem32stub.System32\bash.exe(the WSL stub), pre‑check whether WSL is actually available. If not, fail fast with a clear, actionable error message.powershelltool as an alternative.Workaround
shellPathis respected.