From 46638c859072eabfc4a32a9908e32752d8194b99 Mon Sep 17 00:00:00 2001 From: tensorlink-dev Date: Wed, 25 Nov 2026 01:33:34 +0000 Subject: [PATCH 1/3] fix(validator): offloaded bench sweeps resolve uv on the host (#903) build_bench_remote_command hard-coded ~/.local/bin/uv; a sweep host whose image puts uv elsewhere (Lium template: /usr/local/bin/uv) failed every offloaded lane A sweep as infra_failed, while the lane D bench path (shutil.which) worked. The default now resolves on the host: `command -v uv`, else ~/.local/bin/uv. An explicit uv_bin is used as given. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01SG5aamoFze4bkhr1suMufY --- cascade/validator/eval_offload.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cascade/validator/eval_offload.py b/cascade/validator/eval_offload.py index 9cf231854..6a9aae1bf 100644 --- a/cascade/validator/eval_offload.py +++ b/cascade/validator/eval_offload.py @@ -38,6 +38,9 @@ # uv on the pod (runs the benchmarks/ sidecar's own locked env), matching # cascade.trainer.bench_hook.BenchPlan.uv_bin. DEFAULT_UV_BIN = "~/.local/bin/uv" +# #903: the default is resolved ON the host (the Lium template has /usr/local/bin/uv, +# the worker image /bin/uv): PATH first, the bootstrap-era path as the fallback. +UV_RESOLVE = '"$(command -v uv 2>/dev/null || echo ~/.local/bin/uv)"' class PrivateEvalUnavailable(RuntimeError): @@ -652,7 +655,7 @@ def build_bench_remote_command( return ( prefix + (f"timeout --signal=TERM --kill-after=15s {max(1, timeout_s)}s " if timeout_s else "") - + f"{uv_bin} run --project {shlex.quote(f'{host.workdir}/benchmarks')} " + + f"{UV_RESOLVE if uv_bin == DEFAULT_UV_BIN else uv_bin} run --project {shlex.quote(f'{host.workdir}/benchmarks')} " + " ".join(bench_uv_args(suites)) + " " + quoted ) From 03e3ab7145822e461ef9e5bdbea3b3bfa4b69246 Mon Sep 17 00:00:00 2001 From: tensorlink-dev Date: Wed, 25 Nov 2026 01:33:52 +0000 Subject: [PATCH 2/3] test(validator): offloaded sweep uv resolution (#903) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01SG5aamoFze4bkhr1suMufY --- tests/unit/test_offload_uv_resolve.py | 39 +++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 tests/unit/test_offload_uv_resolve.py diff --git a/tests/unit/test_offload_uv_resolve.py b/tests/unit/test_offload_uv_resolve.py new file mode 100644 index 000000000..9e0952530 --- /dev/null +++ b/tests/unit/test_offload_uv_resolve.py @@ -0,0 +1,39 @@ +"""#903: the offloaded bench sweep finds uv wherever the host has it.""" +from __future__ import annotations + +import os +import shlex +import stat +import subprocess +from types import SimpleNamespace + +from cascade.validator.eval_offload import DEFAULT_UV_BIN, UV_RESOLVE, build_bench_remote_command + + +def _host(): + return SimpleNamespace(workdir="/root/cascade", cuda_device=None) + + +def test_default_uv_is_resolved_on_the_host(): + cmd = build_bench_remote_command(_host(), "/w/c", "/w/r", suites="gift-eval") + assert UV_RESOLVE in cmd and f"{DEFAULT_UV_BIN} run" not in cmd.replace(UV_RESOLVE, "") + + +def test_explicit_uv_bin_is_used_as_given(): + cmd = build_bench_remote_command(_host(), "/w/c", "/w/r", suites="gift-eval", uv_bin="/bin/uv") + assert shlex.split(cmd)[0] == "/bin/uv" and UV_RESOLVE not in cmd + + +def test_resolver_prefers_path_then_falls_back(tmp_path): + fake = tmp_path / "bin" / "uv" + fake.parent.mkdir() + fake.write_text("#!/bin/sh\n") + fake.chmod(fake.stat().st_mode | stat.S_IEXEC) + script = f"echo {UV_RESOLVE}" + env = {"HOME": str(tmp_path), "PATH": f"{fake.parent}:/usr/bin:/bin"} + assert subprocess.run(["bash", "-c", script], env=env, capture_output=True, text=True).stdout.strip() == str(fake) + env["PATH"] = "/usr/bin:/bin" + got = subprocess.run(["bash", "-c", script], env=env, capture_output=True, text=True).stdout.strip() + want = ("/usr/bin/uv" if os.access("/usr/bin/uv", os.X_OK) else + "/bin/uv" if os.access("/bin/uv", os.X_OK) else os.path.join(str(tmp_path), ".local/bin/uv")) + assert got == want From 800cd2c29d8280b240c98356c4225022beca9b3e Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 25 Nov 2026 01:57:08 +0000 Subject: [PATCH 3/3] test(W3b6a): #903 uv-resolve tests in tests/accept/w3b6a (one combined PR) The tests now check what the remote uv word expands to in bash on a host (PATH first, ~/.local/bin/uv fallback, explicit uv_bin as given, still --frozen), so each fails on BASE with an assertion. PATHS: cascade/validator/eval_offload.py rides along. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BMT4D7eZUKUF2gocYLVFmj --- tests/accept/w3b6a/PATHS | 2 + .../w3b6a/test_w3b6a_offload_uv_resolve.py | 74 +++++++++++++++++++ tests/unit/test_offload_uv_resolve.py | 39 ---------- 3 files changed, 76 insertions(+), 39 deletions(-) create mode 100644 tests/accept/w3b6a/test_w3b6a_offload_uv_resolve.py delete mode 100644 tests/unit/test_offload_uv_resolve.py diff --git a/tests/accept/w3b6a/PATHS b/tests/accept/w3b6a/PATHS index f512017f1..421013ac2 100644 --- a/tests/accept/w3b6a/PATHS +++ b/tests/accept/w3b6a/PATHS @@ -12,3 +12,5 @@ cascade/validator/lane_d_bench_host.py # The optional `bench_hosts` key of the --lane-d-inputs TOML, and the # source handing the bench host each digest's effective context. cascade/validator/lane_d_inputs.py +# #903: the offloaded sweep's remote command resolves uv on the host. +cascade/validator/eval_offload.py diff --git a/tests/accept/w3b6a/test_w3b6a_offload_uv_resolve.py b/tests/accept/w3b6a/test_w3b6a_offload_uv_resolve.py new file mode 100644 index 000000000..59e88c92f --- /dev/null +++ b/tests/accept/w3b6a/test_w3b6a_offload_uv_resolve.py @@ -0,0 +1,74 @@ +"""#903 (W3b6a): the offloaded bench sweep finds uv wherever the sweep host has +it. The default used to be the hard-coded ``~/.local/bin/uv``; a host whose +image puts uv elsewhere (the Lium template: ``/usr/local/bin/uv``) failed +every offloaded lane A sweep as ``infra_failed``. The default is now resolved +ON the host (PATH first, ``~/.local/bin/uv`` as the fallback); an explicit +``uv_bin`` is used as given. The command still runs the sidecar's checked-in +lock (``--frozen``), so the report is unchanged.""" +from __future__ import annotations + +import shlex +import subprocess +from types import SimpleNamespace + +from cascade.validator import eval_offload as EO + + +def _host(): + return SimpleNamespace(workdir="/root/cascade", cuda_device=None) + + +def _uv_token(cmd: str) -> str: + """The shell word that names uv in the remote command.""" + head, sep, _ = cmd.partition(" run --project ") + assert sep, cmd + return head + + +def _on_host(word: str, *, home, path) -> str: + """What ``word`` expands to in the host's bash (HOME / PATH as given).""" + out = subprocess.run(["/bin/bash", "-c", f"echo {word}"], env={"HOME": str(home), + "PATH": str(path)}, capture_output=True, text=True, check=True) + return out.stdout.strip() + + +def _fake_uv(tmp_path): + fake = tmp_path / "usr-local-bin" / "uv" + fake.parent.mkdir() + fake.write_text("#!/bin/sh\n", encoding="utf-8") + fake.chmod(0o755) + return fake + + +def test_w3b6a_default_uv_resolves_from_path_then_falls_back(tmp_path): + fake = _fake_uv(tmp_path) + empty = tmp_path / "empty-bin" + empty.mkdir() + word = _uv_token(EO.build_bench_remote_command(_host(), "/w/c", "/w/r", suites="gift-eval")) + assert _on_host(word, home=tmp_path, path=fake.parent) == str(fake), ( + "#903: the default uv is not resolved from the host's PATH") + assert _on_host(word, home=tmp_path, path=empty) == str(tmp_path / ".local/bin/uv") + + +def test_w3b6a_explicit_uv_bin_is_used_as_given(tmp_path): + fake = _fake_uv(tmp_path) + cmd = EO.build_bench_remote_command(_host(), "/w/c", "/w/r", suites="gift-eval", + uv_bin="/opt/uv/bin/uv") + assert shlex.split(cmd)[0] == "/opt/uv/bin/uv" + assert _on_host(_uv_token(cmd), home=tmp_path, path=fake.parent) == "/opt/uv/bin/uv" + default = EO.build_bench_remote_command(_host(), "/w/c", "/w/r", suites="gift-eval") + assert _on_host(_uv_token(default), home=tmp_path, path=fake.parent) == str(fake), ( + "#903: the default uv is not resolved from the host's PATH") + + +def test_w3b6a_resolved_uv_still_runs_the_frozen_lock_with_a_timeout(tmp_path): + fake = _fake_uv(tmp_path) + cmd = EO.build_bench_remote_command( + SimpleNamespace(workdir="/root/cascade", cuda_device="1"), "/w/c", "/w/r", + suites="gift-eval,time", timeout_s=600) + assert cmd.startswith("CUDA_VISIBLE_DEVICES=1 timeout --signal=TERM --kill-after=15s 600s ") + word = _uv_token(cmd).split("600s ", 1)[1] + assert _on_host(word, home=tmp_path, path=fake.parent) == str(fake), ( + "#903: the default uv is not resolved from the host's PATH") + tail = cmd.partition(" run --project ")[2] + assert tail.startswith("/root/cascade/benchmarks --frozen --extra time cascade-benchmark ") diff --git a/tests/unit/test_offload_uv_resolve.py b/tests/unit/test_offload_uv_resolve.py deleted file mode 100644 index 9e0952530..000000000 --- a/tests/unit/test_offload_uv_resolve.py +++ /dev/null @@ -1,39 +0,0 @@ -"""#903: the offloaded bench sweep finds uv wherever the host has it.""" -from __future__ import annotations - -import os -import shlex -import stat -import subprocess -from types import SimpleNamespace - -from cascade.validator.eval_offload import DEFAULT_UV_BIN, UV_RESOLVE, build_bench_remote_command - - -def _host(): - return SimpleNamespace(workdir="/root/cascade", cuda_device=None) - - -def test_default_uv_is_resolved_on_the_host(): - cmd = build_bench_remote_command(_host(), "/w/c", "/w/r", suites="gift-eval") - assert UV_RESOLVE in cmd and f"{DEFAULT_UV_BIN} run" not in cmd.replace(UV_RESOLVE, "") - - -def test_explicit_uv_bin_is_used_as_given(): - cmd = build_bench_remote_command(_host(), "/w/c", "/w/r", suites="gift-eval", uv_bin="/bin/uv") - assert shlex.split(cmd)[0] == "/bin/uv" and UV_RESOLVE not in cmd - - -def test_resolver_prefers_path_then_falls_back(tmp_path): - fake = tmp_path / "bin" / "uv" - fake.parent.mkdir() - fake.write_text("#!/bin/sh\n") - fake.chmod(fake.stat().st_mode | stat.S_IEXEC) - script = f"echo {UV_RESOLVE}" - env = {"HOME": str(tmp_path), "PATH": f"{fake.parent}:/usr/bin:/bin"} - assert subprocess.run(["bash", "-c", script], env=env, capture_output=True, text=True).stdout.strip() == str(fake) - env["PATH"] = "/usr/bin:/bin" - got = subprocess.run(["bash", "-c", script], env=env, capture_output=True, text=True).stdout.strip() - want = ("/usr/bin/uv" if os.access("/usr/bin/uv", os.X_OK) else - "/bin/uv" if os.access("/bin/uv", os.X_OK) else os.path.join(str(tmp_path), ".local/bin/uv")) - assert got == want