Skip to content

Official Codebase of 3DCodeVerse

Python

bench: a bare agent that ran out of its window is graded, even when a recovered 503 made it transient

gaoypeng61d2c51d0e76
diff --git a/eval/bench/compare_backends.py b/eval/bench/compare_backends.py
index b1cdd176..75c59cf2 100644
--- a/eval/bench/compare_backends.py
+++ b/eval/bench/compare_backends.py
@@ -323,9 +323,12 @@ def _run_bare_agent(arm: Arm, spec: Spec, cell: Path, eval_ws: Workspace, opts:
res.gen_seconds = result.duration_s
res.minutes = round(max(0.0, result.duration_s - result.provider_wait_s) / 60, 2)
res.harness_status = result.exit_reason
- if not result.ok and result.transient:
+ if not result.ok and result.transient and result.exit_reason != "timeout":
# A provider can fail after the CLI has written a placeholder or an
# unfinished revision. File existence is not a completed agent session.
+ # A session that ran out of its window is the arm's own result, even when a
+ # recovered 503 made the backend call it transient: re-rolling timeouts until
+ # one gets lucky would bias the bare arm (review 2026-09-23).
res.error = f"bare agent interrupted by provider ({result.exit_reason}: {'; '.join(result.errors)[:600]})"
res.error_is_infra = True
if not (eval_ws.root / entry_of(spec)).is_file():
diff --git a/eval/tests/test_infra_failures.py b/eval/tests/test_infra_failures.py
index bfbb76c7..ddc33bab 100644
--- a/eval/tests/test_infra_failures.py
+++ b/eval/tests/test_infra_failures.py
@@ -372,9 +372,10 @@ def test_a_harness_run_whose_judge_never_answered_is_dropped_and_redone_fresh(tm
assert any(p.name.startswith("run.attempt") for p in (tmp_path / "cells" / battery.prompts[0].id / arm.slug).iterdir())
[email protected]('outage', [True, False])
-def test_bare_agent_provider_failure_with_a_partial_file_is_not_a_quality_zero(tmp_path, monkeypatch, outage):
- """A CLI can leave a placeholder before its API fails; preserve but don't grade it."""
[email protected](('outage', 'reason'), [(True, 'error'), (False, 'error'), (True, 'timeout')])
+def test_bare_agent_provider_failure_with_a_partial_file_is_not_a_quality_zero(tmp_path, monkeypatch, outage, reason):
+ """A CLI can leave a placeholder before its API fails; preserve but don't grade it. A session that
+ ran out of its window is graded even when a recovered 503 made it transient — else timeouts re-roll."""
from bench.compare_backends import CompareDeps, CompareOptions, parse_arm, run_cell
from bench.run_bench import Battery
from codeverse3d.contracts.agent import AgentResult
@@ -385,7 +386,7 @@ def test_bare_agent_provider_failure_with_a_partial_file_is_not_a_quality_zero(t
# code so the calm control demonstrates that capability errors keep 0.
eval_ws.src.mkdir(parents=True, exist_ok=True)
(eval_ws.src / 'model.py').write_text(GOOD.format(score=0.5).replace('\n', '\n# BOOM\n', 1))
- return AgentResult(ok=False, exit_reason='error', transient=outage,
+ return AgentResult(ok=False, exit_reason=reason, transient=outage,
errors=['Gemini API error 503' if outage else 'model produced invalid code'])
monkeypatch.setattr('bench._bare_agent.run_bare_agent', interrupted)
@@ -393,7 +394,7 @@ def test_bare_agent_provider_failure_with_a_partial_file_is_not_a_quality_zero(t
evaluator=FakeEvaluator()
result=run_cell(battery,battery.prompts[0],parse_arm('agent:gemini-cli:gemini-3.8-flash'),
tmp_path,CompareOptions(judge='gemini:x',loop_judge='gemini:x'),CompareDeps(evaluator))
- if outage:
+ if outage and reason == 'error':
assert (result.status,result.score,result.error_is_infra)==('infra_failed',None,True)
assert evaluator.evaluated==[]
assert '503' in result.error