fix(runtimes): harness setup reuses an installed uv - #2575
Draft
faresobeid wants to merge 1 commit into
Draft
Conversation
`_ENSURE_UV` checks `command -v uv` before installing: an image that pre-installs uv (or a box a previous rollout already set up) skips both `pip install -U --user uv` and the astral installer, so harness setup no longer depends on egress to PyPI / astral.sh when uv is already present. Images without uv take the same install path as before.
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
_ENSURE_UV(runtimes/base.py; also used bymcp/launch.py) now runscommand -v uvfirst and skips bothpip install -q -U --user uvand the astral installer whenuvis already on PATH. The PATH export still comes first, so a~/.local/bin/uvfrom an earlier rollout on the same box counts. Images withoutuvtake the same install path as before.Why
In a pipeline opening ~90 concurrent rollouts on prime sandboxes, about 3% of opens failed in harness setup because
_ENSURE_UVdownloadsuvon everyprepare_uv_script(pip on PyPI, else astral.sh) over flaky egress — even on images that shipuv. Auvthat is already present needs no network at all.Behavior change:
uvis no longer upgraded to the latest release when one is present.prepare_uv_scriptneeds auvthat knowsuv sync --script/uv python find --script; an image with a very old pre-installeduvwould now surface uv's own argument error instead of being silently upgraded.Validation
tests/v1/test_runtimes.pyruns the real snippet undershwith a stubpip(leaves a marker, drops auvinto~/.local/bin) and an optional stubuv: withuvpresent,pipdoes not run; without it,pipruns anduvis then found. Also assertscommand -v uvprecedespip installin the composed command.test_single_turn[null-harness-in-subprocess]andtest_agentic[bash-harness-in-subprocess]pass (they runprepare_uv_scripton a host withuvpre-installed).uv run pytest tests/v1 -m "not e2e",ruff,pre-commitpass.Note
Fix
_ENSURE_UVto reuse an installeduvon PATHuvis already discoverable before the pip-install branch; the curl/wget fallback still follows.pipanduvon a temporary PATH, plus a test asserting existinguvis preserved and missinguvtriggers installation.uvis already on PATH, instead of always running the pip branch.Macroscope summarized b94df19.