fix(v1): isolate Bash commands from harness venv - #2251
Open
eigenpaul wants to merge 1 commit into
Open
Conversation
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.
Fixes #2250
This PR runs Bash subprocesses with a copy of the controller environment that removes
VIRTUAL_ENVand the harness added PATH entries. The controller environment itself is unchanged.Verified in a Prime
python:3.11-slimsandbox:Current
main:With this patch:
#2011 identified the same root cause but that PR targets the old
defaultharness path.Note
Low Risk
Small, localized change to bash tool env handling with no auth or data-path impact; main risk is edge cases if PATH stripping is incomplete on unusual layouts.
Overview
Bash tool subprocesses no longer inherit the harness’s uv virtualenv.
run_bashnow runsbash -cwith a copied environment that dropsVIRTUAL_ENVand strips the harness-addedPATHprefix ({venv}/binand$HOME/.local/bin), so agent commands resolve to the sandbox’s system Python and pip instead of the controller interpreter.The harness process environment is unchanged; only the bash tool’s child process gets the sanitized copy.
Reviewed by Cursor Bugbot for commit 87f3994. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Isolate Bash harness subprocess execution from the harness virtualenv
The
run_bashhelper in program.py now strips harness virtualenv paths from the subprocess environment before running user commands. It removesVIRTUAL_ENVand strips the leading venv and~/.local/binentries fromPATH, so user scripts resolve executables from the system environment rather than the harness venv. Risk: changes which executables are resolved for any bash command run through this harness.Macroscope summarized 87f3994.