Skip to content

Official Codebase of 3DCodeVerse

Python

readers: every reader reports RunRecord.minutes — the record span, the bench wall clock and the rest go

gaoypengca5b0c10c5b6
diff --git a/eval/bench/_compare_report.py b/eval/bench/_compare_report.py
index 9f242873..5770f9d1 100644
--- a/eval/bench/_compare_report.py
+++ b/eval/bench/_compare_report.py
@@ -49,7 +49,10 @@ class CellResult(BaseModel):
gen_cost_usd: float = Field(default=0.0, description="generation cost (harness: whole run incl. its loop judge)")
judge_cost_usd: float = Field(default=0.0, description="fixed-judge cost for this cell")
gen_seconds: float = 0.0
- wall_s: float = 0.0
+ wall_s: float = Field(default=0.0, description="the cell's clock, provider waits included: what flag_degraded reads")
+ minutes: float | None = Field(default=None, description=(
+ "the cell's minutes (docs/COST.md §31): a harness arm's RunRecord.minutes, a one-shot or bare-agent "
+ "arm's generation time net of provider errors; None on a row written before 2026-09-22"))
attempts: int = 0
tool_calls: int = 0
criteria: dict[str, float] = Field(default_factory=dict)
@@ -84,6 +87,11 @@ class CellResult(BaseModel):
self.error = f"{self.error}; {msg}" if self.error else msg
+def cell_minutes(r: CellResult) -> float:
+ """A cell's minutes; a row written before step timing counts its own clock, as a record does."""
+ return r.wall_s / 60 if r.minutes is None else r.minutes
+
+
class PairRow(BaseModel):
prompt_id: str
arm_a: str
@@ -158,7 +166,7 @@ def arm_stats(rows: list[CellResult]) -> list[ArmStats]:
build_ok_rate=round(sum(r.build_ok for r in ev) / len(ev), 4) if ev else 0.0,
mean_gen_usd=round(statistics.fmean(r.gen_cost_usd for r in ev), 4) if ev else 0.0,
mean_judge_usd=round(statistics.fmean(r.judge_cost_usd for r in ev), 4) if ev else 0.0,
- mean_minutes=round(statistics.fmean(r.wall_s for r in ev) / 60, 2) if ev else 0.0,
+ mean_minutes=round(statistics.fmean(cell_minutes(r) for r in ev), 2) if ev else 0.0,
tool_calls=sum(r.tool_calls for r in ev), errors=sum(1 for r in rs if r.status in ("error", "judge_error")),
degraded=sum(1 for r in ev if r.degraded), ceiling_cut=sum(1 for r in ev if r.harness_aborted_rounds > 0),
))
@@ -250,7 +258,7 @@ def compare_markdown(out: Path, rows: list[CellResult], pairs: list[PairRow], me
md += ["", "## harness runs (loop judge score vs fixed judge score)", "",
"| prompt | arm | run status | stop | rounds | cut | loop score | fixed score | $run | min | degraded |", "|---|---|---|---|---|---|---|---|---|---|---|"]
md += [f"| {r.prompt_id} | {r.arm} | {r.harness_status} | {r.harness_stop_reason} | {r.harness_rounds} | {r.harness_aborted_rounds or ''} | "
- f"{_f(r.harness_loop_score)} | {_f(r.score)} | {r.gen_cost_usd:.2f} | {r.wall_s / 60:.1f} | {'† ' + r.degraded_reason if r.degraded else ''} |"
+ f"{_f(r.harness_loop_score)} | {_f(r.score)} | {r.gen_cost_usd:.2f} | {cell_minutes(r):.1f} | {'† ' + r.degraded_reason if r.degraded else ''} |"
for r in sorted(hr, key=lambda r: (r.prompt_id, r.arm))]
total_gen, total_judge, total_pw = sum(r.gen_cost_usd for r in rows), sum(r.judge_cost_usd for r in rows), sum(p.cost_usd for p in pairs)
md += ["", f"**Total cost**: generation ${total_gen:.2f} · fixed judge ${total_judge:.2f} · pairwise ${total_pw:.2f} "
@@ -295,7 +303,7 @@ def compare_html(out: Path, rows: list[CellResult], pairs: list[PairRow], meta:
img = f"<img src='report_assets/{dst.name}' loading='lazy'>"
cls = "ok" if r.passed else "bad"
tds.append(f"<td>{img}<b class='{cls}'>{_f(r.score, '.2f')}</b> {'pass' if r.passed else r.status} · "
- f"tris {r.tris or '-'} · ${r.gen_cost_usd:.2f} · {r.wall_s / 60:.1f} min"
+ f"tris {r.tris or '-'} · ${r.gen_cost_usd:.2f} · {cell_minutes(r):.1f} min"
f"{'<pre>' + html.escape(r.error[:300]) + '</pre>' if r.error else ''}</td>")
grid.append(f"<tr><td><b>{html.escape(pid)}</b></td>{''.join(tds)}</tr>")
grid.append("</table>")
diff --git a/eval/bench/ab_plan.py b/eval/bench/ab_plan.py
index 9f4f327f..ce271633 100644
--- a/eval/bench/ab_plan.py
+++ b/eval/bench/ab_plan.py
@@ -116,7 +116,7 @@ from bench.compare_backends import ( # noqa: E402
spec_for, # noqa: E402
)
from bench.pin_plan import PLAN_JSON, PinError, plan_once, seed_plan # noqa: E402
-from bench.run_bench import Battery, BenchPrompt, select_prompts # noqa: E402
+from bench.run_bench import Battery, BenchPrompt, record_minutes, select_prompts # noqa: E402
from codeverse3d.contracts.common import Backends # noqa: E402
from codeverse3d.proc import exclusive # noqa: E402
from codeverse3d.tracks.plan_features import pin_plan_blockers # noqa: E402
@@ -327,6 +327,7 @@ def spawn_cell(
judge=opts.judge,
workspace=str(cell),
wall_s=round(time.time() - t0, 1),
+ minutes=record_minutes(cell / "run"), # a run that raised left a FAILED record
status="infra_failed" if is_infra_failure(tail) else "error",
error=f"worker exited {rc} without a cell.json; log tail: {tail[-400:]!r}",
)
@@ -727,7 +728,7 @@ def main(argv: Sequence[str] | None = None) -> int:
def _log(r: CellResult) -> None:
print(
f"[{datetime.now().strftime('%H:%M:%S')}] {r.prompt_id:28s} {r.arm:8s} score={r.score} "
- f"${r.gen_cost_usd + r.judge_cost_usd:.2f} {r.wall_s / 60:.1f}min {r.status} {r.error[:80]!r}",
+ f"${r.gen_cost_usd + r.judge_cost_usd:.2f} {r.minutes or 0.0:.1f}min {r.status} {r.error[:80]!r}",
flush=True,
)
diff --git a/eval/bench/ab_view.py b/eval/bench/ab_view.py
index 7b74e095..22b0060a 100644
--- a/eval/bench/ab_view.py
+++ b/eval/bench/ab_view.py
@@ -33,6 +33,7 @@ for _p in (Path(__file__).resolve().parents[2] / "harness", Path(__file__).resol
from bench._jsonl import latest # noqa: E402
from bench.stats import mean_ci # noqa: E402
from codeverse3d.addons import select # noqa: E402
+from codeverse3d.record.record import load_record # noqa: E402
SHEET_W = 1100
@@ -47,7 +48,7 @@ class Run:
baseline: float | None = None
rounds: int = 0
usd: float = 0.0
- minutes: int = 0
+ minutes: int = 0 # RunRecord.minutes (docs/COST.md §31), rounded
error: str = ""
sheet: str = "" # data URI
notes: list[str] = field(default_factory=list)
@@ -79,7 +80,6 @@ def load_run(run_dir: Path, arm: str) -> Run:
rec = run_dir / "record.json"
if rec.is_file():
d = json.loads(rec.read_text())
- b = (d.get("extra") or {}).get("budget") or {}
r.brief = str((d.get("spec") or {}).get("prompt") or "")
try: # the round addons/select picks; a record it cannot read keeps only its status
s = select.summarise(run_dir)
@@ -87,7 +87,11 @@ def load_run(run_dir: Path, arm: str) -> Run:
except Exception: # noqa: BLE001 - one unreadable record must not blank the page
r.status = str(d.get("status") or "?")
r.rounds = len(d.get("rounds") or [])
- r.usd, r.minutes = round(float(b.get("spent_usd") or 0), 2), round(float(b.get("elapsed_min") or 0))
+ try: # the ledger's total and the steps' minutes, as every reader reports them
+ run = load_record(run_dir)
+ r.usd, r.minutes = round(run.total_usage.cost_usd, 2), round(run.minutes or 0)
+ except Exception: # noqa: BLE001 - an unreadable record keeps $0 / 0 min
+ pass
r.error = str(d.get("error") or "")[:300]
for rd in d.get("rounds") or []:
failed = [g.get("gate") for g in (rd.get("gates") or []) if not g.get("passed")]
diff --git a/eval/bench/compare_backends.py b/eval/bench/compare_backends.py
index a1a931d8..9aa2986f 100644
--- a/eval/bench/compare_backends.py
+++ b/eval/bench/compare_backends.py
@@ -85,6 +85,7 @@ from codeverse3d.contracts.common import ENTRY_FILE, Track # noqa: E402
from codeverse3d.contracts.run import RunRecord # noqa: E402
from codeverse3d.contracts.spec import Spec # noqa: E402
from codeverse3d.cost import run_ledger # noqa: E402
+from codeverse3d.cost.tally import tally # noqa: E402
from codeverse3d.proc import exclusive # noqa: E402
from codeverse3d.tracks.generation import MultiFileParseError # noqa: E402
from codeverse3d.tracks.planner import PlanningError # noqa: E402
@@ -197,10 +198,12 @@ def _generate_oneshot(arm: Arm, spec: Spec, cell: Path, eval_ws: Workspace, opts
for attempt in range(max_attempts):
gen_dir = cell / "gen" / f"attempt{attempt}"
cached = gen_dir / "result.json"
- if opts.resume and cached.is_file(): # a redo re-uses the recorded answer: no second subscription call
- gen = OneShotResult.model_validate_json(cached.read_text())
- else:
- gen = backend.generate(prompt, out_dir=gen_dir, timeout_s=opts.gen_timeout_s, label=f"oneshot_{spec.id.split('/')[-1]}")
+ with tally() as lost: # what the call lost to provider errors (a CLI one-shot books none)
+ if opts.resume and cached.is_file(): # a redo re-uses the recorded answer: no second subscription call
+ gen = OneShotResult.model_validate_json(cached.read_text())
+ else:
+ gen = backend.generate(prompt, out_dir=gen_dir, timeout_s=opts.gen_timeout_s,
+ label=f"oneshot_{spec.id.split('/')[-1]}")
if gen.ok: # failures (timeouts, 5xx) are not cached so a redo regenerates
gen_dir.mkdir(parents=True, exist_ok=True)
cached.write_text(gen.model_dump_json(indent=1))
@@ -208,6 +211,7 @@ def _generate_oneshot(arm: Arm, spec: Spec, cell: Path, eval_ws: Workspace, opts
res.gen_cost_usd += gen.usage.cost_usd
res.tool_calls += gen.tool_calls
res.gen_seconds += gen.duration_s
+ res.minutes = round((res.minutes or 0.0) + max(0.0, gen.duration_s - lost.lost_s()) / 60, 2)
if not gen.ok:
res.error = gen.notes or "empty answer"
res.error_is_infra = gen.infra_failed
@@ -266,6 +270,7 @@ def _run_harness(spec: Spec, cell: Path, eval_ws: Workspace, opts: CompareOption
summary = select.summarise(run_ws.root, record=rec)
res.gen_cost_usd = rec.total_usage.cost_usd
res.tool_calls = rec.total_usage.tool_calls
+ res.minutes = round(rec.minutes or 0.0, 2)
res.harness_status, res.harness_rounds, res.harness_loop_score = rec.status.value, len(rec.rounds), summary.picked_score
res.harness_stop_reason = summary.stop_reason
res.harness_aborted_rounds = len(rec.extra.get("aborted_rounds") or [])
@@ -297,6 +302,7 @@ def _run_bare_agent(arm: Arm, spec: Spec, cell: Path, eval_ws: Workspace, opts:
res.gen_cost_usd = result.usage.cost_usd
res.tool_calls = result.tool_calls
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 (eval_ws.root / entry_of(spec)).is_file():
res.error = f"bare agent delivered no {entry_of(spec)} ({result.exit_reason}: {'; '.join(result.errors)[:300]})"
@@ -599,7 +605,7 @@ def main(argv: Sequence[str] | None = None) -> int:
def _log(r: CellResult) -> None:
print(f"[{datetime.now().strftime('%H:%M:%S')}] {r.prompt_id:28s} {r.arm:44s} score={r.score} build_ok={r.build_ok} "
- f"${r.gen_cost_usd:.2f} {r.wall_s / 60:.1f}min {r.status} {r.error[:80]!r}", flush=True)
+ f"${r.gen_cost_usd:.2f} {r.minutes or 0.0:.1f}min {r.status} {r.error[:80]!r}", flush=True)
run_matrix(ns.prompts, ns.out, arms, opts, deps, on_result=_log)
print(f"report: {Path(ns.out) / 'report.md'}")
diff --git a/eval/bench/complexity_report.py b/eval/bench/complexity_report.py
index 9c926eba..e9f4530b 100644
--- a/eval/bench/complexity_report.py
+++ b/eval/bench/complexity_report.py
@@ -34,7 +34,7 @@ for _p in (Path(__file__).resolve().parents[2] / "harness", Path(__file__).resol
from bench.stats import correlation # noqa: E402
from codeverse3d.addons import select # noqa: E402
-from codeverse3d.contracts.run import RunId # noqa: E402
+from codeverse3d.contracts.run import RunId, RunRecord # noqa: E402
from codeverse3d.proc import read_json_or_none # noqa: E402
from codeverse3d.record.record import find_run_dirs # noqa: E402
from codeverse3d.spatial.complexity import ( # noqa: E402
@@ -106,11 +106,13 @@ def _picked_round(run: Path, record: dict[str, Any]) -> dict[str, Any] | None:
return next((r for r in rounds if r.get("index") == idx), rounds[-1] if rounds else None)
-def _minutes(record: dict[str, Any]) -> float:
- tel = (record.get("telemetry") or {}).get("cost") or {}
- if tel.get("wall_clock_s"):
- return round(float(tel["wall_clock_s"]) / 60.0, 2)
- return round(sum(float(r.get("duration_s") or 0.0) for r in record.get("rounds") or []) / 60.0, 2)
+def _minutes(record: dict[str, Any]) -> float | None:
+ """``RunRecord.minutes`` (docs/COST.md §31); None for a record that will not load."""
+ try:
+ minutes = RunRecord.model_validate(record).minutes
+ except Exception: # noqa: BLE001 - the historic corpus is read as-is
+ return None
+ return None if minutes is None else round(minutes, 2)
def row_for(run: Path, battery: str, slug: str | None = None) -> Row | None:
@@ -277,7 +279,7 @@ def per_run_table(rows: Sequence[Row], limit: int = 60) -> str:
f"| {r['battery']}/{r['slug']} | {r['part_count']} | {r['tri_count']} |"
f" {r['silhouette']:.1f} | {r['feature_density']:.0f} | {r['hollowness']:.2f} |"
f" {r['index']:.3f} | {r['band']} |{_fmt(r.get('overall'))} |{_fmt(r.get('geometry_detail'))} |"
- f" {r.get('cost_usd', 0):.2f} | {r.get('minutes', 0):.0f} |"
+ f" {r.get('cost_usd', 0):.2f} | {r.get('minutes') or 0:.0f} |"
)
return "\n".join(lines)
diff --git a/eval/bench/h2h_glb.py b/eval/bench/h2h_glb.py
index 86780a99..68b46cca 100644
--- a/eval/bench/h2h_glb.py
+++ b/eval/bench/h2h_glb.py
@@ -36,7 +36,6 @@ import argparse
import json
import statistics
import sys
-from datetime import datetime
from pathlib import Path
from typing import Any
@@ -46,7 +45,7 @@ for _p in (Path(__file__).resolve().parents[2] / "harness", Path(__file__).resol
sys.path.insert(0, str(_p)) # this tree's codeverse3d (harness/) + the `bench` package (eval/)
from bench._fixed_eval import RUBRIC # noqa: E402
-from bench.run_bench import Battery, BenchPrompt # noqa: E402
+from bench.run_bench import Battery, BenchPrompt, record_minutes # noqa: E402
from bench.stats import sign_test # noqa: E402
from codeverse3d.addons import select # noqa: E402
@@ -116,12 +115,7 @@ def our_side(runs_dir: Path, item_id: str) -> Side:
status = str(rec.get("status", ""))
side = Side(source="3dcodeverse", status=status, rounds=len(rec.get("rounds", [])),
cost_usd=float((rec.get("total_usage") or {}).get("cost_usd", 0.0)))
- try:
- t0 = datetime.fromisoformat(rec["started_at"])
- t1 = datetime.fromisoformat(rec["finished_at"])
- side.minutes = round((t1 - t0).total_seconds() / 60, 2)
- except (KeyError, TypeError, ValueError):
- pass
+ side.minutes = record_minutes(ws)
if not status or status in IN_PROGRESS:
side.error = f"run not finished (status={status!r})"
return side
diff --git a/eval/bench/h2h_scene.py b/eval/bench/h2h_scene.py
index c8c3ed0f..81355c04 100644
--- a/eval/bench/h2h_scene.py
+++ b/eval/bench/h2h_scene.py
@@ -30,7 +30,6 @@ import argparse
import json
import statistics
import sys
-from datetime import datetime
from pathlib import Path
from typing import Any
@@ -40,8 +39,7 @@ from pydantic import BaseModel
for _p in (Path(__file__).resolve().parents[2] / "harness", Path(__file__).resolve().parents[1]):
sys.path.insert(0, str(_p)) # this tree's codeverse3d (harness/) + the `bench` package (eval/)
-from bench._jsonl import latest, read_jsonl # noqa: E402
-from bench.run_bench import Battery, BenchPrompt # noqa: E402
+from bench.run_bench import Battery, BenchPrompt, record_minutes # noqa: E402
from bench.stats import sign_test # noqa: E402
from codeverse3d.addons import select # noqa: E402
from codeverse3d.contracts.artifacts import RenderSet, RenderView # noqa: E402
@@ -148,13 +146,8 @@ def our_frames(run_dir: Path) -> tuple[list[RenderView], dict[str, Any]] | None:
stills = [v for v in views if (v.time_s or 0.0) == 0.0 and v.mode == "shaded" and Path(v.path).is_file()]
flagged = [v for v in stills if v.judge] or stills
chosen = flagged[:MAX_VIEWS]
- row = latest(read_jsonl(run_dir.parent.parent / "results.jsonl"), key=lambda r: r.get("id")).get(run_dir.name)
- minutes = None if row is None else float(row.get("minutes") or 0.0)
- if minutes is None and rec.get("started_at") and rec.get("finished_at"):
- t0, t1 = (datetime.fromisoformat(rec[k]) for k in ("started_at", "finished_at"))
- minutes = (t1 - t0).total_seconds() / 60
meta = {"harness_score": summary.picked_score, "rounds": len(rec.get("rounds") or []), "picked_round": picked,
- "cost_usd": float((rec.get("total_usage") or {}).get("cost_usd") or 0.0), "minutes": round(minutes or 0.0, 2),
+ "cost_usd": float((rec.get("total_usage") or {}).get("cost_usd") or 0.0), "minutes": record_minutes(run_dir),
"status": summary.stop_reason}
return [RenderView(name=v.name, path=v.path, mode="shaded", width=v.width, height=v.height) for v in chosen], meta
diff --git a/eval/bench/report.py b/eval/bench/report.py
index 2c3b746d..d6a6d7b3 100644
--- a/eval/bench/report.py
+++ b/eval/bench/report.py
@@ -130,7 +130,6 @@ def _entry_for(r: BenchItemResult) -> RunEntry:
entry = None
if entry is not None:
entry.slug = r.id
- entry.minutes = r.minutes or entry.minutes
entry.error = entry.error or r.errors
return entry
return RunEntry(
diff --git a/eval/bench/run_bench.py b/eval/bench/run_bench.py
index ea3ceba4..a20badf6 100644
--- a/eval/bench/run_bench.py
+++ b/eval/bench/run_bench.py
@@ -31,7 +31,6 @@ import csv
import json
import logging
import sys
-import time
import traceback
from collections.abc import Callable, Sequence
from concurrent.futures import ThreadPoolExecutor, as_completed
@@ -55,6 +54,7 @@ from codeverse3d.contracts.run import RunRecord # noqa: E402
from codeverse3d.contracts.spec import Constraints, ReferenceImage, Spec # noqa: E402
from codeverse3d.cost import run_ledger # noqa: E402
from codeverse3d.proc import exclusive # noqa: E402
+from codeverse3d.record.record import load_record # noqa: E402
from codeverse3d.workspace import Workspace # noqa: E402
log = logging.getLogger(__name__)
@@ -103,7 +103,8 @@ class BenchItemResult(BaseModel):
picked_round: int | None = None
rounds: int = 0
cost_usd: float = 0.0
- minutes: float = 0.0
+ minutes: float = Field(default=0.0, description="RunRecord.minutes (docs/COST.md §31); 0 when the run left no "
+ "record — rows before 2026-09-22 carry the process's wall clock")
status: str = ""
errors: str = ""
workspace: str = ""
@@ -190,7 +191,16 @@ def spec_for(battery: Battery, item: BenchPrompt, opts: BenchOptions) -> Spec:
max_minutes=opts.max_minutes, tag0="bench")
-def result_from_record(item: BenchPrompt, rec: RunRecord, minutes: float, ws: Workspace) -> BenchItemResult:
+def record_minutes(run_dir: Path) -> float:
+ """The run's minutes (``RunRecord.minutes``) from the record it left — a run that raised writes
+ a FAILED record first — else 0.0: a run that never recorded a step timed none."""
+ try:
+ return round(load_record(run_dir).minutes or 0.0, 2)
+ except Exception: # noqa: BLE001 - no record / an unreadable one
+ return 0.0
+
+
+def result_from_record(item: BenchPrompt, rec: RunRecord, ws: Workspace) -> BenchItemResult:
s = select.summarise(ws.root, record=rec)
# A run whose rounds all lost their verdict still reports a normal status (`max_rounds`
# after three unjudged rounds), so a whole ARM can read as healthy and score nothing —
@@ -204,7 +214,7 @@ def result_from_record(item: BenchPrompt, rec: RunRecord, minutes: float, ws: Wo
return BenchItemResult(
id=item.id, tier=item.tier, category=item.category, score_baseline=s.baseline_score,
score_picked=s.picked_score, picked_round=s.picked_round,
- rounds=len(rec.rounds), cost_usd=rec.total_usage.cost_usd, minutes=round(minutes, 2),
+ rounds=len(rec.rounds), cost_usd=rec.total_usage.cost_usd, minutes=round(rec.minutes or 0.0, 2),
status=s.stop_reason, errors=error, workspace=str(ws.root),
generator=rec.spec.backends.generator, judge=rec.spec.backends.judge,
)
@@ -298,7 +308,6 @@ def run_battery(
spec = spec_for(battery, item, opts)
if not resume:
ws.write_json(ws.spec_path, spec)
- t0 = time.time()
try:
# one writer per run dir: --parallel runs these in threads of ONE process, so
# the run mutex is what keeps two cells off the same workspace
@@ -314,9 +323,9 @@ def run_battery(
status = "infra_failed" if is_infra_failure(e) else "error"
return BenchItemResult(id=item.id, tier=item.tier, category=item.category, status=status,
errors=f"{type(e).__name__}: {e}\n{traceback.format_exc()[-1500:]}",
- minutes=round((time.time() - t0) / 60, 2), workspace=str(ws.root),
+ minutes=record_minutes(ws.root), workspace=str(ws.root),
generator=spec.backends.generator, judge=spec.backends.judge)
- return result_from_record(item, rec, (time.time() - t0) / 60, ws)
+ return result_from_record(item, rec, ws)
seal_for_append(results_jsonl) # a kill left the last row unterminated; do not glue onto it
with ThreadPoolExecutor(max_workers=max(1, opts.parallel)) as pool, results_jsonl.open("a") as fh:
diff --git a/eval/docs/EVAL.md b/eval/docs/EVAL.md
index 405656c3..2f6f95d1 100644
--- a/eval/docs/EVAL.md
+++ b/eval/docs/EVAL.md
@@ -71,7 +71,12 @@ Each item = one full `3dcode make` run (its own workspace under `--out`) followe
hand-over `make` does — `addons/select.pick` by score, then `package` (deliverable/ +
selection.json); `results.jsonl` rows carry `score_baseline`, `score_picked` (rows written
before 2026-09-22 say `score_final`), `picked_round`, `rounds`, `cost_usd`, `minutes`,
-`status` (the stop reason), `generator`, `judge`. No `passed` column: since 2026-09-22 a run
+`status` (the stop reason), `generator`, `judge`. `minutes` is the run's `RunRecord.minutes` — its
+steps' clocks minus the time 503 / 429 / token-limit errors cost them (harness `docs/COST.md` §31);
+rows before 2026-09-22 carry the bench process's wall clock. A compare / A-B cell's `minutes` is the
+same number for a harness arm and the generation time net of provider errors for a one-shot or
+bare-agent arm; its `wall_s` stays the cell's clock, which `flag_degraded` reads to spot a cell that
+waited out a storm. No `passed` column: since 2026-09-22 a run
is not passed or failed. `report.md/html` tabulates per tier and category: mean baseline →
picked (the harness delta), cost, time. Keep `--judge` fixed across arms; vary only
`--generator` (and `--planner` if that is the variable). Resumable: re-running the same
@@ -312,7 +317,7 @@ A cell can end without a score for reasons that say nothing about the model, and
counting those as zeros silently rigs a comparison. `bench/_infra.py` classifies
them, and `compare_backends` applies the SAME rule to every arm:
-| status | what happened | score | build rate | wall clock |
+| status | what happened | score | build rate | minutes |
|---|---|---|---|---|
| `infra_failed` | provider outage — 503/529 storm, read timeout, exhausted key pool | excluded | excluded | excluded |
| `budget_exhausted` | ran out of minutes/dollars with zero rounds and no artifact | excluded | **counts as a miss** | excluded |
diff --git a/eval/tests/test_bench_shared.py b/eval/tests/test_bench_shared.py
index 9f203779..f1eb8b53 100644
--- a/eval/tests/test_bench_shared.py
+++ b/eval/tests/test_bench_shared.py
@@ -96,13 +96,13 @@ def test_a_run_that_scored_nothing_says_so_in_its_row(tmp_path: Path) -> None:
total_usage=Usage(cost_usd=1.76))
ws = Workspace(tmp_path)
- row = result_from_record(item, rec, 16.0, ws)
+ row = result_from_record(item, rec, ws)
assert row.score_picked is None and row.picked_round is None and row.status == "max_rounds"
assert "no verdict in any of 3 round(s)" in row.errors
judged = RoundRecord(index=0, kind="baseline", judgment=Judgment(rubric="r", scores={}, overall=0.6, passed=False))
rec.rounds = [judged, rounds[1]]
- row = result_from_record(item, rec, 16.0, ws)
+ row = result_from_record(item, rec, ws)
assert row.errors == "" and (row.score_picked, row.picked_round) == (0.6, 0) # one verdict is enough
diff --git a/eval/tests/test_complexity_report.py b/eval/tests/test_complexity_report.py
index c1c539c6..4882eb2f 100644
--- a/eval/tests/test_complexity_report.py
+++ b/eval/tests/test_complexity_report.py
@@ -11,6 +11,7 @@ import pytest
from bench import complexity_report as CR
from bench.stats import correlation
from codeverse3d.contracts.artifacts import Measurement
+from codeverse3d.contracts.plan import BBox, PartPlan, StaticPlan
REPO = Path(__file__).resolve().parents[1]
@@ -32,16 +33,20 @@ def _write_run(root: Path, slug: str, *, index: float, overall: float, detail: f
cost: float = 1.0, minutes: float = 10.0) -> Path:
run = root / "runs" / slug
(run / "artifacts").mkdir(parents=True)
+ box = BBox(center=(0, 0.5, 0), extents=(1, 1, 1))
rec = {
- "spec": {"track": "static_object", "language": "blender", "tags": ["bench", "hard"]},
- "plan": {"parts": [{"name": "a"}, {"name": "b"}]},
+ "spec": {"id": slug, "prompt": "a chair", "track": "static_object", "language": "blender",
+ "tags": ["bench", "hard"]},
+ "workspace": str(run),
+ "plan": StaticPlan(object_name="Chair", summary="s", overall_bbox=box, parts=[
+ PartPlan(name=n, role="r", description="d", bbox=box) for n in ("a", "b")]).model_dump(mode="json"),
"status": "passed", "best_round": 0,
"total_usage": {"cost_usd": cost},
- "telemetry": {"cost": {"wall_clock_s": minutes * 60}},
+ "extra": {"budget": {"elapsed_min": minutes}}, # a record before step timing counts its clock
"rounds": [{
- "index": 0, "gates": [],
+ "index": 0, "kind": "baseline", "gates": [],
"measurement": _measurement(index).model_dump(mode="json"),
- "judgment": {"overall": overall, "passed": overall >= 0.72,
+ "judgment": {"rubric": "static_object_v1", "overall": overall, "passed": overall >= 0.72,
"scores": {c: detail for c in CR.CRITERIA}, "issues": []},
}],
}
@@ -56,6 +61,7 @@ def test_collect_and_report_over_a_battery(tmp_path: Path) -> None:
_write_run(battery, "high", index=0.75, overall=0.55, detail=0.55, cost=3.0, minutes=40)
rows, skipped = CR.collect([battery])
assert skipped == 0 and len(rows) == 3
+ assert {r["slug"]: r["minutes"] for r in rows} == {"low": 5, "mid": 20, "high": 40}
assert {r["slug"] for r in rows} == {"low", "mid", "high"}
assert rows[0]["plan_parts"] == 2 and rows[0]["n_materials"] == 3
# the whole point of the study: a monotone fall shows up as a strong negative r
diff --git a/eval/tests/test_infra_failures.py b/eval/tests/test_infra_failures.py
index 0f207af0..4fb63373 100644
--- a/eval/tests/test_infra_failures.py
+++ b/eval/tests/test_infra_failures.py
@@ -341,13 +341,3 @@ def test_the_ab_viewer_refuses_to_call_a_winner_it_cannot_support():
Run(slug="bx", arm="b", brief="brief x", picked=0.0)]
head, why = verdict(arm("a", 0.5, 0.5, 0.5), b)
assert head.startswith("Inconclusive") and "over 3 paired briefs" in why
-
-def test_the_default_generator_and_the_cost_router_name_the_same_model():
- """`3dcode cost` prints the default=True GENERATOR route as "the default"; if it disagrees with
- Backends.generator the report is describing a model no run uses."""
- from codeverse3d.contracts.common import Backends
- from codeverse3d.cost.routing import ROUTES
- from codeverse3d.cost.types import Role
-
- (default,) = [r for r in ROUTES if r.role is Role.GENERATOR and r.default]
- assert default.model_id == Backends().generator
diff --git a/harness/codeverse3d/addons/dataset/index.py b/harness/codeverse3d/addons/dataset/index.py
index a9df97b0..8dda49d8 100644
--- a/harness/codeverse3d/addons/dataset/index.py
+++ b/harness/codeverse3d/addons/dataset/index.py
@@ -25,14 +25,14 @@ CREATE TABLE runs (
generator TEXT, planner TEXT, judge TEXT, status TEXT, -- status: why the run stopped
baseline_score REAL, picked_score REAL, picked_round INTEGER, n_rounds INTEGER,
cost_usd REAL, input_tokens INTEGER, output_tokens INTEGER,
- started_at TEXT, finished_at TEXT, duration_s REAL, error TEXT, has_captions INTEGER,
+ started_at TEXT, finished_at TEXT, minutes REAL, error TEXT, has_captions INTEGER,
gate_errors INTEGER, quality_tier TEXT, picked_commit TEXT,
rel TEXT, arm TEXT, cell TEXT -- run dir relative to the scan root + battery layout segments
);
CREATE TABLE rounds (
slug TEXT, round_index INTEGER, kind TEXT, commit_sha TEXT, agent_backend TEXT,
build_ok INTEGER, gate_errors INTEGER, score REAL, passed INTEGER, n_issues INTEGER,
- cost_usd REAL, duration_s REAL, started_at TEXT,
+ cost_usd REAL, minutes REAL, started_at TEXT,
PRIMARY KEY (slug, round_index)
);
CREATE TABLE usage (
@@ -50,7 +50,6 @@ def _run_row(ws: Workspace, rec: RunRecord, rid: RunId) -> tuple:
s = select.summarise(ws.root, record=rec)
picked = next((r for r in rec.rounds if r.index == s.picked_round), None)
j = effective_judgment(picked) if picked is not None else None # degraded → unjudged
- dur = (rec.finished_at - rec.started_at).total_seconds() if rec.finished_at else None
n_err = sum(gate_error_summary(picked).values())
tier = quality_tier(passed=j.passed if j else None, gate_errors=n_err, score=j.overall if j else None)
return (
@@ -59,7 +58,7 @@ def _run_row(ws: Workspace, rec: RunRecord, rid: RunId) -> tuple:
rec.spec.backends.judge, s.stop_reason, s.baseline_score, s.picked_score, s.picked_round,
len(rec.rounds), rec.total_usage.cost_usd, rec.total_usage.input_tokens,
rec.total_usage.output_tokens, rec.started_at.isoformat(),
- rec.finished_at.isoformat() if rec.finished_at else None, dur, rec.error,
+ rec.finished_at.isoformat() if rec.finished_at else None, rec.minutes, rec.error,
int(bool((rec.extra.get("captions") or {}).get("detailed"))),
n_err, tier, picked.commit if picked is not None else "",
rid.rel, rid.arm, rid.cell,
@@ -73,7 +72,7 @@ def _round_row(slug: str, r: RoundRecord) -> tuple:
None if r.build is None else int(r.build.ok), sum(len(g.errors) for g in r.gates),
j.overall if j is not None else None,
None if j is None else int(j.passed), 0 if j is None else len(j.issues),
- r.usage.cost_usd, r.duration_s, r.started_at.isoformat(),
+ r.usage.cost_usd, r.minutes, r.started_at.isoformat(),
)
diff --git a/harness/codeverse3d/addons/dataset/sample.py b/harness/codeverse3d/addons/dataset/sample.py
index 3da9312f..7b11cad0 100644
--- a/harness/codeverse3d/addons/dataset/sample.py
+++ b/harness/codeverse3d/addons/dataset/sample.py
@@ -373,7 +373,7 @@ def telemetry_digest(ws: Workspace, record: RunRecord) -> dict[str, Any]:
if tele.cost is not None:
out.update({
"total_usd": tele.cost.total_usd,
- "wall_clock_s": tele.cost.wall_clock_s,
+ "minutes": record.minutes,
"n_calls": tele.cost.n_calls,
"by_stage": {s.stage: s.cost_usd for s in tele.cost.by_stage},
"by_model": dict(tele.cost.by_model),
diff --git a/harness/codeverse3d/addons/gallery/compare.py b/harness/codeverse3d/addons/gallery/compare.py
index 8dd4f39c..67cb7f22 100644
--- a/harness/codeverse3d/addons/gallery/compare.py
+++ b/harness/codeverse3d/addons/gallery/compare.py
@@ -124,7 +124,7 @@ def render_compare(entries: list[RunEntry], urls: UrlMaker, *, note: str = "") -
+ "</span>" if e.gate_summary else "")),
_row("rounds", entries, lambda e: f"{e.rounds} · picked r{e.picked_round if e.picked_round is not None else '–'}"),
_row("cost", entries, lambda e: f"${e.cost_usd:.3f}"),
- _row("wall clock", entries, lambda e: "—" if e.minutes is None else f"{e.minutes:.1f} min"),
+ _row("minutes", entries, lambda e: "—" if e.minutes is None else f"{e.minutes:.1f}"),
_row("track", entries, lambda e: esc(e.track)),
_row("language", entries, lambda e: esc(e.language)),
_row("generator", entries, lambda e: esc(e.generator)),
diff --git a/harness/codeverse3d/addons/gallery/detail.py b/harness/codeverse3d/addons/gallery/detail.py
index 763f8100..7cf819ec 100644
--- a/harness/codeverse3d/addons/gallery/detail.py
+++ b/harness/codeverse3d/addons/gallery/detail.py
@@ -115,7 +115,7 @@ def _hero(entry: RunEntry, urls: UrlMaker, rec: RunRecord) -> str:
def _rounds_table(entry: RunEntry, urls: UrlMaker) -> str:
head = ("<tr><th>r</th><th>kind</th><th class='n'>score</th><th>verdict</th><th class='n'>gates</th>"
- "<th>build</th><th class='n'>$</th><th class='n'>sec</th><th>commit</th><th>views</th></tr>")
+ "<th>build</th><th class='n'>$</th><th class='n'>min</th><th>commit</th><th>views</th></tr>")
rows = []
for r in entry.round_rows:
verdict = "—" if r.passed is None else ("pass" if r.passed else "fail")
@@ -125,7 +125,7 @@ def _rounds_table(entry: RunEntry, urls: UrlMaker) -> str:
picked = " class='picked'" if r.index == entry.picked_round else ""
rows.append(f"<tr{picked}><td class='n'>{r.index}</td><td>{esc(r.kind)}</td>"
f"<td class='n'>{fmt(r.score)}</td><td>{verdict}</td><td class='n'>{esc(gates)}</td>"
- f"<td>{build}</td><td class='n'>{r.cost_usd:.3f}</td><td class='n'>{r.duration_s:.0f}</td>"
+ f"<td>{build}</td><td class='n'>{r.cost_usd:.3f}</td><td class='n'>{r.minutes:.1f}</td>"
f"<td><code class='xs'>{esc(r.commit)}</code></td><td>{sheet}</td></tr>")
body = "".join(rows) or "<tr><td colspan='10' class='faint'>no rounds recorded</td></tr>"
return _panel(f"rounds ({len(entry.round_rows)})",
@@ -267,7 +267,7 @@ def _cost_panel(entry: RunEntry, ws: Workspace, rec: RunRecord) -> str:
u = rec.total_usage
rows += "".join([_kv("total", f"${u.cost_usd:.4f}"),
_kv("input tokens", f"{u.input_tokens:,}"), _kv("output tokens", f"{u.output_tokens:,}")])
- per_round = "".join(_kv(f"r{r.index} {r.kind}", f"${r.usage.cost_usd:.4f} · {r.duration_s:.0f}s")
+ per_round = "".join(_kv(f"r{r.index} {r.kind}", f"${r.usage.cost_usd:.4f} · {r.minutes:.1f} min")
for r in rec.rounds)
return _panel("cost", f"<div class='kvs'>{rows}</div>"
f"<h3 style='margin-top:var(--s-4)'>per round</h3><div class='kvs'>{per_round}</div>",
@@ -283,7 +283,7 @@ def _cost_panel(entry: RunEntry, ws: Workspace, rec: RunRecord) -> str:
_kv("total", f"${cost.total_usd:.4f}"),
_kv("calls", str(cost.n_calls)),
- _kv("wall clock", f"{cost.wall_clock_s / 60:.1f} min"),
+ _kv("minutes", "—" if rec.minutes is None else f"{rec.minutes:.1f}"),
_kv("unattributed", f"${cost.unattributed_usd:.4f}"),
_kv("post-run", f"${cost.post_run_usd:.4f}"),
])
diff --git a/harness/codeverse3d/addons/gallery/index.py b/harness/codeverse3d/addons/gallery/index.py
index 2cf40feb..f3006ba1 100644
--- a/harness/codeverse3d/addons/gallery/index.py
+++ b/harness/codeverse3d/addons/gallery/index.py
@@ -195,7 +195,7 @@ def round_rows(ws: Workspace, rec: RunRecord) -> list[RoundRow]:
build_ok=None if r.build is None else r.build.ok,
score=j.overall if j else None, passed=j.passed if j else None,
gate_errors=sum(gates.values()), gates={k: v for k, v in gates.items() if v},
- cost_usd=round(r.usage.cost_usd, 6), duration_s=round(r.duration_s, 1),
+ cost_usd=round(r.usage.cost_usd, 6), minutes=round(r.minutes, 2),
sheet=_round_sheet(ws, rec, r.index),
))
return rows
@@ -245,7 +245,7 @@ def entry_from_record(battery: str, ws: Workspace, rec: RunRecord, *, slug: str
j = effective_judgment(rnd) if rnd is not None else None
gates = gate_error_summary(rnd)
n_err = sum(gates.values())
- minutes = ((rec.finished_at - rec.started_at).total_seconds() / 60.0) if rec.finished_at else None
+ minutes = rec.minutes
digest = telemetry_digest(ws, rec)
caps = rec.extra.get("captions") or {}
hero, hero_label, n_views = hero_view(ws, rec, picked)
diff --git a/harness/codeverse3d/addons/gallery/model.py b/harness/codeverse3d/addons/gallery/model.py
index 5c968789..bcfd2013 100644
--- a/harness/codeverse3d/addons/gallery/model.py
+++ b/harness/codeverse3d/addons/gallery/model.py
@@ -117,7 +117,7 @@ class RoundRow(BaseModel):
gate_errors: int = 0
gates: dict[str, int] = Field(default_factory=dict, description="gate name → error count")
cost_usd: float = 0.0
- duration_s: float = 0.0
+ minutes: float = Field(default=0.0, description="RoundRecord.minutes")
sheet: str = Field(default="", description="run-relative contact sheet of this round")
diff --git a/harness/codeverse3d/addons/select.py b/harness/codeverse3d/addons/select.py
index 1ff2240a..a8c47b39 100644
--- a/harness/codeverse3d/addons/select.py
+++ b/harness/codeverse3d/addons/select.py
@@ -65,7 +65,8 @@ class RoundRow(BaseModel):
build_ok: bool | None = None
commit: str = ""
cost_usd: float = 0.0
- minutes: float = 0.0
+ minutes: float = Field(default=0.0, description="the round's minutes (RoundRecord.minutes): its steps, "
+ "minus the time provider errors cost them")
class RunSummary(BaseModel):
@@ -117,7 +118,7 @@ def round_rows(run_dir: Path | str, *, record: RunRecord | None = None) -> list[
rows.append(RoundRow(index=r.index, kind=r.kind, score=j.overall if j else None, passed=j.passed if j else None,
gate_errors=sum(len(g.errors) for g in r.gates),
build_ok=None if r.build is None else r.build.ok, commit=r.commit,
- cost_usd=round(r.usage.cost_usd, 6), minutes=round(r.duration_s / 60.0, 2)))
+ cost_usd=round(r.usage.cost_usd, 6), minutes=round(r.minutes, 2)))
return rows
diff --git a/harness/codeverse3d/cli/layout_cmd.py b/harness/codeverse3d/cli/layout_cmd.py
index 7efa7620..2782adce 100644
--- a/harness/codeverse3d/cli/layout_cmd.py
+++ b/harness/codeverse3d/cli/layout_cmd.py
@@ -240,7 +240,8 @@ def print_cost_and_settings(ws: Workspace, record: RunRecord) -> None:
budget_line = fmt_usd(cost.total_usd)
console.print(kv_table("cost", {
"spent / budget": budget_line,
- "wall clock": f"{cost.wall_clock_s / 60:.1f} min of {cost.max_minutes:.0f} min",
+ "minutes": ("-" if record.minutes is None else f"{record.minutes:.1f}")
+ + f" (the clock's ceiling: {cost.max_minutes:.0f} min)",
"tokens": f"in {u.input_tokens:,} (cached {u.cached_tokens:,}) · out {u.output_tokens:,} · "
f"thoughts {u.thoughts_tokens:,} · {u.tool_calls} tool calls",
"model calls": cost.n_calls,
diff --git a/harness/codeverse3d/contracts/run.py b/harness/codeverse3d/contracts/run.py
index dd298044..06af7f35 100644
--- a/harness/codeverse3d/contracts/run.py
+++ b/harness/codeverse3d/contracts/run.py
@@ -307,7 +307,7 @@ class CostSummary(BaseModel):
schema_version: int = 1
total_usd: float = 0.0
- wall_clock_s: float = 0.0
+ minutes: float | None = Field(default=None, description="RunRecord.minutes when the record was written")
max_minutes: float = 0.0
n_calls: int = 0
tokens: Usage = Field(default_factory=Usage, description="run totals (record.total_usage)")
diff --git a/harness/codeverse3d/record/telemetry.py b/harness/codeverse3d/record/telemetry.py
index 88a467a1..5a9fea1e 100644
--- a/harness/codeverse3d/record/telemetry.py
+++ b/harness/codeverse3d/record/telemetry.py
@@ -253,13 +253,11 @@ def cost_summary(record: RunRecord, rows: list[dict[str, Any]]) -> CostSummary:
ordered += [sc for s, sc in sorted(by_stage.items()) if s not in order]
total = float(record.total_usage.cost_usd)
ledger = round(sum(_num(r, "cost_usd") for r in rows), 6)
- wall = 0.0
- if record.finished_at is not None:
- wall = max(0.0, (record.finished_at - record.started_at).total_seconds())
+ minutes = record.minutes
budget = record.spec.budget
return CostSummary(
total_usd=round(total, 6),
- wall_clock_s=round(wall, 1),
+ minutes=None if minutes is None else round(minutes, 2),
max_minutes=budget.max_minutes,
n_calls=sum(int(r.get("n_calls") or 1) for r in rows),
tokens=record.total_usage,
diff --git a/harness/tests/flywheel_cli/conftest.py b/harness/tests/flywheel_cli/conftest.py
index 0bd169f1..06f9d081 100644
--- a/harness/tests/flywheel_cli/conftest.py
+++ b/harness/tests/flywheel_cli/conftest.py
@@ -23,7 +23,7 @@ from codeverse3d.contracts.artifacts import (
Severity,
)
from codeverse3d.contracts.common import Backends, Language, Track, Usage
-from codeverse3d.contracts.run import RoundRecord, RunRecord, RunStatus
+from codeverse3d.contracts.run import RoundRecord, RunRecord, RunStatus, StepTime
from codeverse3d.contracts.spec import Spec
from codeverse3d.workspace import Workspace
@@ -114,7 +114,7 @@ def make_fake_run(
(ws.artifacts / "object.glb").write_bytes(b"glTF\x02\x00\x00\x00" + bytes([len(scores) - 1]) * 16) # the last round
rec = RunRecord(spec=spec, workspace=str(ws.root), status=RunStatus.MAX_ROUNDS, rounds=rounds,
total_usage=Usage(cost_usd=0.06, input_tokens=2000, output_tokens=1000),
- finished_at=datetime.now(UTC),
+ steps=[StepTime(step="plan", wall_s=30.0, lost_s=6.0)], finished_at=datetime.now(UTC),
environment={"blender": "Blender 5.0.1"})
ws.write_json(ws.record_path, rec)
return ws, rec