fix(opencode): ensure standard PATH directories for bash tool on macOS#21347
fix(opencode): ensure standard PATH directories for bash tool on macOS#21347divitkashyap wants to merge 1 commit intoanomalyco:devfrom
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Note on e2e (windows) failuresThe 4 failing e2e tests are unrelated to this change:
These tests are platform-specific to Windows and don't exercise the code changed (bash.ts PATH fix only runs on The failures appear to be pre-existing flaky tests - notice they failed on retry attempts (retry #1, #2) indicating timing/race condition issues rather than regressions. This change only modifies @rekram1-node could you review? This partially addresses issue #17792. |
On macOS, the agent bash tool may lack access to /opt/homebrew/bin, causing 'git' and 'gh' to fail with 'env: sh: No such file or directory'. This prepends standard macOS PATH directories before bash execution. Fixes a partial aspect of anomalyco#17792
6dbcace to
938ad69
Compare
Issue for this PR
Type of change
What does this PR do?
On macOS, the agent's bash tool may not have access to standard directories like
/opt/homebrew/binwhen the parent process has an incomplete PATH. This causes commands likegitandghto fail withenv: sh: No such file or directory.This change prepends standard macOS PATH directories to the shell environment before executing bash commands, ensuring consistency with the user's shell environment.
Modified
packages/opencode/src/tool/bash.tsto prepend standard paths (/opt/homebrew/bin,/usr/local/bin,/usr/bin,/bin) on macOS when missing from PATH.How did you verify your code works?
Logic review — the change ensures standard directories are present in PATH before bash command execution, which is the same location where PATH issues were occurring.
Checklist