fix(bash): platform-aware shell resolution on Windows (#518) - #537
Merged
Conversation
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.
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
bash -cinterpreter withresolveShell: honors an explicit shell, usesbash -con non-Windows, and on Windows prefers real bash (Git Bash/WSL/MSYS) → PowerShell (-Command) → cmd (/C).*exec.Error) and return actionable guidance instead of a barecode -1, so the model stops retrying bash blindly.TestResolveShellcovering every branch via an injectedlookPath.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/...