fix(presets): clear inherited VIRTUAL_ENV before building the run venv - #349
Open
smolpaws wants to merge 1 commit into
Open
fix(presets): clear inherited VIRTUAL_ENV before building the run venv#349smolpaws wants to merge 1 commit into
smolpaws wants to merge 1 commit into
Conversation
When the local agent-server is launched via `uv run`, its child bash shells inherit VIRTUAL_ENV. The preset setup.sh then runs `uv pip install` which targets that inherited venv instead of the freshly-created .venv, leaving the run venv empty; main.py fails with ModuleNotFoundError: No module named 'openhands' even though setup reports success. Clear VIRTUAL_ENV before the uv venv/pip calls in both the prompt and plugin presets so the SDK installs into the run's own .venv. Fixes OpenHands#348 Co-authored-by: smolpaws <engel@enyst.org>
Contributor
|
👋 This PR needs a couple of things fixed before OpenHands can review it:
Push an update once this is addressed and this check re-runs automatically. This is an automated check - no AI was used to generate this comment. |
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.
What
Clear an inherited
VIRTUAL_ENVbefore building the per-run virtualenv in both presetsetup.shfiles (promptandplugin).Why
In local agent-server mode, when the agent-server is launched via
uv run, its child bash shells inheritVIRTUAL_ENVpointing at the agent-server's own venv. The presetsetup.shthen does:uv pip installinstalls into$VIRTUAL_ENVwhen it's set, so the SDK lands in the inherited venv, not the freshly-created.venv. The run's.venvstays empty,setup.shstill prints[setup] Done, andmain.pythen fails:This makes local-agent-server automation runs fail on any deployment whose agent-server runs under
uv run.Fix
unset VIRTUAL_ENVright before theuv venv/uv pip installcalls, so uv targets the.venvcreated in the run's working directory. One line, both presets.Verification
Reproduced on a self-hosted local-mode deployment: a bash command run through the agent-server printed
VIRTUAL_ENV=/…/.venv; runs failed atimport openhandswith an empty run.venv. After clearingVIRTUAL_ENV, the same install populated the run.venvcorrectly and the automation completed end-to-end.Fixes #348