Official Codebase of 3DCodeVerse
Python
cli: a judge_unavailable run resumes as it is — the judge's provider being down is not the run's end
gaoypeng00f8a069d939
diff --git a/harness/codeverse3d/cli/main.py b/harness/codeverse3d/cli/main.pyindex dde7b0db..c4a8c71e 100644--- a/harness/codeverse3d/cli/main.py+++ b/harness/codeverse3d/cli/main.py@@ -553,7 +553,10 @@ def _finished_reason(ws, raised: dict) -> str:as a real billed model call and rewrote run_state.status back to 'planning', leavinga finished run stuck mid-pipeline. Two stops are the documented exceptions — raisingthe cap a run stopped on is how you continue it: BUDGET (any raised cap) and- MAX_ROUNDS (a raised ``--rounds``; the run goes on from its last round).+ MAX_ROUNDS (a raised ``--rounds``; the run goes on from its last round). The stops+ that name something outside the run — AGENT_QUOTA (the vendor's limit) and+ JUDGE_UNAVAILABLE (the judge's provider) — resume as they are: the loop re-judges the+ unjudged last round and goes on, where ``--force`` would have thrown every paid round away."""from codeverse3d.contracts.run import RunStatusfrom codeverse3d.orchestrator import RunState, StateCorrupt@@ -572,7 +575,7 @@ def _finished_reason(ws, raised: dict) -> str:return "" if raised else f"{detail}: raise a cap to continue it (--max-minutes / --rounds)"if status is RunStatus.MAX_ROUNDS:return "" if "max_rounds" in raised else f"{detail}: raise --rounds to continue it"- finished = (RunStatus.STOPPED, RunStatus.NO_CHANGE, RunStatus.NO_REFINE_TASKS, RunStatus.JUDGE_UNAVAILABLE)+ finished = (RunStatus.STOPPED, RunStatus.NO_CHANGE, RunStatus.NO_REFINE_TASKS)return detail if status in finished else ""diff --git a/harness/docs/RUNBOOK.md b/harness/docs/RUNBOOK.mdindex a1c3e130..dac6273a 100644--- a/harness/docs/RUNBOOK.md+++ b/harness/docs/RUNBOOK.md@@ -141,8 +141,9 @@ unless you type `--host` yourself; it never serves a path outside the declared r# continues from run_state + stages/*.json (input-hash cached) and from the# LAST round (a run recorded before 2026-09-22 that restored its best round# is put back on its last). A max_rounds run resumes only with a raised- # --rounds, a budget run with any raised cap; an agent_quota or failed run- # resumes as is; the other stops are finished. The budget+ # --rounds, a budget run with any raised cap; an agent_quota, judge_unavailable+ # (its last round is re-judged) or failed run resumes as is; the other stops+ # are finished. The budget# SNAPSHOT is restored: the active minutes already spent still count, so a# raised --max-minutes grants only the difference (downtime never counts);# the money is the ledger's, and the step log (the run's minutes) carries on.diff --git a/harness/tests/flywheel_cli/test_cli.py b/harness/tests/flywheel_cli/test_cli.pyindex bb9dd26f..d2db05b3 100644--- a/harness/tests/flywheel_cli/test_cli.py+++ b/harness/tests/flywheel_cli/test_cli.py@@ -547,3 +547,16 @@ def test_resume_reports_a_corrupt_run_state_cleanly(made_run):assert r.exit_code == 2 and "run_state.json" in r.output and "Traceback" not in r.output+def test_a_judge_unavailable_run_resumes_as_it_is(made_run, stub_track):+ """The judge's provider being down is not the run's end: resume re-judges and goes on+ (it was refused as finished, and --force re-bought every round)."""+ from codeverse3d.contracts.run import RunStatus+ from codeverse3d.orchestrator import RunState+ from codeverse3d.workspace import Workspace++ runs, run_dir = made_run()+ RunState(status=RunStatus.JUDGE_UNAVAILABLE, stop_reason="judge_unavailable").save(Workspace(run_dir))+ entered = []+ stub_track(lambda spec, resume, force: entered.append((resume, force)))+ assert runner.invoke(app, ["resume", run_dir.name, "--runs-dir", str(runs)]).exit_code == 130+ assert entered == [(True, False)]