Skip to content

fix(bash): platform-aware shell resolution on Windows (#518) - #537

Merged
smallnest merged 1 commit into
masterfrom
fix/issue-518-windows-shell
Aug 1, 2026
Merged

fix(bash): platform-aware shell resolution on Windows (#518)#537
smallnest merged 1 commit into
masterfrom
fix/issue-518-windows-shell

Conversation

@smallnest

Copy link
Copy Markdown
Owner

Summary

  • Replace the hardcoded bash -c interpreter with resolveShell: honors an explicit shell, uses bash -c on non-Windows, and on Windows prefers real bash (Git Bash/WSL/MSYS) → PowerShell (-Command) → cmd (/C).
  • Detect a missing interpreter (*exec.Error) and return actionable guidance instead of a bare code -1, so the model stops retrying bash blindly.
  • Update the tool description to note the Windows fallback and nudge portable commands.
  • Add OS-agnostic TestResolveShell covering every branch via an injected lookPath.

Fixes the "window下经常无脑bash然后失败" loop: on stock Windows without bash on PATH, every bash call previously failed and the model kept retrying bash.

Closes #518

Test plan

  • go build ./...
  • go vet ./internal/agenttool/...
  • go test ./internal/agenttool/...

Hardcoded "bash -c" failed on stock Windows without bash on PATH,
so every bash tool call errored and the model retried blindly.
Now resolve bash (Git Bash/WSL) → PowerShell → cmd on Windows, and
report a missing interpreter with actionable guidance instead of a
bare exit -1.
@smallnest
smallnest merged commit 7aa6423 into master Aug 1, 2026
1 check passed
@smallnest
smallnest deleted the fix/issue-518-windows-shell branch August 1, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

window下经常无脑bash然后失败

1 participant