Official Codebase of 3DCodeVerse
Python
bench: a one-shot repair lost to a provider outage is infra_failed, not a 0
ziyao0c34e0bd0ba6
diff --git a/harness/bench/compare_backends.py b/harness/bench/compare_backends.pyindex d5b7d683..db467fce 100644--- a/harness/bench/compare_backends.py+++ b/harness/bench/compare_backends.py@@ -247,7 +247,14 @@ def run_cell(battery: Battery, item: BenchPrompt, arm: Arm, out: Path, opts: Com_run_harness(spec, cell, eval_ws, deps, res)else:_generate_oneshot(arm, spec, cell, eval_ws, opts, deps, res)- if (eval_ws.root / MODEL_FILE).is_file():+ # A one-shot arm whose LAST attempt was lost to the provider has not finished+ # its protocol: `oneshot+repair` writes attempt 0's file before the repair call,+ # so when that call dies in a 503 storm the broken pre-repair code was being+ # evaluated and scored 0 — a hard zero for someone else's downtime, the exact+ # asymmetry tests/compare_bench/test_infra_failures.py exists to end. Drop the+ # cell instead (infra_failed); --redo-status re-runs the lost attempt only.+ truncated = arm.kind != "harness" and res.error_is_infra+ if (eval_ws.root / MODEL_FILE).is_file() and not truncated:outcome = deps.evaluator.evaluate(eval_ws, spec)eval_ws.write_json(eval_ws.root / "eval.json", outcome)_fill_from_outcome(res, outcome)diff --git a/harness/tests/compare_bench/test_infra_failures.py b/harness/tests/compare_bench/test_infra_failures.pyindex 0071bb41..e587f59b 100644--- a/harness/tests/compare_bench/test_infra_failures.py+++ b/harness/tests/compare_bench/test_infra_failures.py@@ -216,3 +216,52 @@ def test_preflight_skips_loop_models_for_oneshot_only_batteries(monkeypatch):arms = cb.parse_arms("oneshot:claude-code,oneshot:codex")assert cb._preflight("gemini:fixed-judge", arms, cb.CompareOptions(judge="gemini:fixed-judge")) is Trueassert probed == ["gemini:fixed-judge"], probed+++def test_a_repair_lost_to_an_outage_drops_the_cell_instead_of_scoring_the_pre_repair_code(tmp_path):+ """compare_v4, 2026-08-25: four `oneshot+repair` cells whose repair call died in a 503+ storm were recorded build_failed / score 0 — the broken attempt-0 file was already in+ the eval workspace, so the arm was scored on code its protocol had not finished with.+ A truncated one-shot protocol is downtime, not a capability result: infra_failed, and+ --redo-status re-runs only the lost attempt (attempt 0 is cached)."""+ from bench._oneshot import OneShotResult+ from bench.compare_backends import CompareDeps, CompareOptions, parse_arm, run_cell+ from bench.run_bench import Battery+ from codeverse.contracts.common import Usage+ from tests.compare_bench.conftest import BATTERY, GOOD, FakeEvaluator++ broken = GOOD.format(score=0.5).replace("\n", "\n# BOOM\n", 1)++ class StormBackend:+ id = "oneshot:fake"++ def __init__(self, storm_on_repair: bool):+ self.calls, self.storm_on_repair = 0, storm_on_repair++ def generate(self, prompt, *, out_dir, timeout_s=0, label=""):+ self.calls += 1+ out_dir.mkdir(parents=True, exist_ok=True)+ if self.calls == 1 or not self.storm_on_repair:+ return OneShotResult(ok=True, text=broken, usage=Usage(cost_usd=0.02), duration_s=1.0,+ transcript_dir=str(out_dir))+ return OneShotResult(ok=False, text="", usage=Usage(), duration_s=1.0, transcript_dir=str(out_dir),+ notes="ModelError: Gemini API error 503: This model is currently experiencing high demand.",+ infra_failed=True)++ battery = Battery.load(BATTERY)+ opts = CompareOptions(judge="gemini:x", loop_judge="gemini:x", repair_attempts=1)+ arm = parse_arm("oneshot+repair:gemini:gemini-3.7-flash")++ ev = FakeEvaluator()+ r = run_cell(battery, battery.prompts[0], arm, tmp_path / "storm", opts,+ CompareDeps(ev, oneshot_backend=lambda t: StormBackend(storm_on_repair=True)))+ assert (r.status, r.score, r.error_is_infra) == ("infra_failed", None, True), r+ assert ev.evaluated == [], "the pre-repair code must not be judged"+ assert "503" in r.error++ # the same broken code with the repair delivered (and still broken) keeps its earned zero+ ev2 = FakeEvaluator()+ r2 = run_cell(battery, battery.prompts[0], arm, tmp_path / "calm", opts,+ CompareDeps(ev2, oneshot_backend=lambda t: StormBackend(storm_on_repair=False)))+ assert (r2.status, r2.score, r2.build_ok) == ("build_failed", 0.0, False), r2+ assert ev2.evaluated and r2.attempts == 2