Skip to content

Official Codebase of 3DCodeVerse

Python

Merge origin/main into the articulated wave — upstream owns the axis repair and the loose root_link match; this branch keeps what it lacks

ziyao26a4a139fced
diff --cc harness/bench/compare_backends.py
index 89152c94,8d0d4cca..6c0d5129
--- a/harness/bench/compare_backends.py
+++ b/harness/bench/compare_backends.py
@@@ -503,12 -520,8 +520,11 @@@ def main(argv: Sequence[str] | None = N
ap.add_argument("--ids", default="", help="comma-separated prompt ids")
ap.add_argument("--tiers", default="", help="comma-separated tiers (easy,medium,hard)")
ap.add_argument("--rounds", type=int, default=3)
- ap.add_argument("--max-usd", type=float, default=2.5)
ap.add_argument("--max-minutes", type=float, default=45.0, help="wall-clock ceiling for ONE harness run")
ap.add_argument("--loop-judge", default=None, help="harness in-loop judge (default: settings default)")
+ ap.add_argument("--planner", default=None,
+ help="harness planner model id (default: settings default) — e.g. gemini:gemini-3.1-pro-preview "
+ "to plan with a stronger model than the generator (compare_art_v4, 2026-08-28)")
ap.add_argument("--repair-attempts", type=int, default=2)
ap.add_argument("--gen-timeout", type=float, default=900.0)
ap.add_argument("--judge-samples", type=int, default=2,
@@@ -529,7 -542,7 +545,7 @@@
if ns.report_only:
build_compare_report(Path(ns.out))
return 0
- opts = CompareOptions(judge=ns.judge, loop_judge=ns.loop_judge, planner=ns.planner, rounds=ns.rounds, max_usd=ns.max_usd,
- opts = CompareOptions(judge=ns.judge, loop_judge=ns.loop_judge, rounds=ns.rounds,
++ opts = CompareOptions(judge=ns.judge, loop_judge=ns.loop_judge, planner=ns.planner, rounds=ns.rounds,
max_minutes=ns.max_minutes, parallel=ns.parallel,
limit=ns.limit, ids=[i for i in ns.ids.split(",") if i],
tiers=[t for t in ns.tiers.split(",") if t], resume=not ns.no_resume,
diff --cc harness/codeverse/contracts/plan.py
index a787b026,4bba6738..e27e75ac
--- a/harness/codeverse/contracts/plan.py
+++ b/harness/codeverse/contracts/plan.py
@@@ -371,6 -430,19 +430,28 @@@ class ArticulatedPlan(StaticPlan)
part["bbox"] = {"center": [(lo[a] + hi[a]) / 2 for a in range(3)],
"extents": [hi[a] - lo[a] for a in range(3)]}
+ # 4. root_link that names no part: loose word-match against the part list
+ root = data.get("root_link")
+ if isinstance(root, str) and root.strip():
+ names = {to_snake(p.get("name", "")): p.get("name") for p in parts if p.get("name")}
+ rk = to_snake(root)
+ if rk not in names:
+ # same word-boundary rule as repair 1b, never bare substring ("arm" != "alarm")
+ hits = [orig for k, orig in names.items()
+ if rk in k.split("_") or k.endswith(f"_{rk}") or k.startswith(f"{rk}_")]
+ if len(hits) == 1:
+ notes.append(f"root_link '{root}' named no part; rewrote to '{hits[0]}'")
+ data["root_link"] = hits[0]
++ elif not hits:
++ # 4b. nothing even loosely matches (a UUID, prose — ab_repairs
++ # grand_piano 2026-08-29, three plans in a row): the one part no
++ # joint names as a child is the root; unique → unambiguous
++ children = {to_snake(str(j.get("child", ""))) for j in joints}
++ roots = [orig for k, orig in names.items() if k not in children]
++ if len(roots) == 1:
++ notes.append(f"root_link '{root}' named no part; rewrote to the one link no joint moves: '{roots[0]}'")
++ data["root_link"] = roots[0]
+
data["parts"], data["joints"], data["normalisations"] = parts, joints, notes
return data
diff --cc harness/codeverse/spatial/joints.py
index bbf1c5a0,8271ba98..a9f8f3a8
--- a/harness/codeverse/spatial/joints.py
+++ b/harness/codeverse/spatial/joints.py
@@@ -37,7 -34,6 +34,8 @@@ from codeverse.spatial.joints_sweep imp
Overlap,
SweepReport,
SweepSummary,
+ aggregate_findings,
++ buried_links,
motion_direction_check,
summary_text,
sweep_collisions,
@@@ -46,7 -42,7 +44,7 @@@
__all__ = [
"ARTICULATION_SHEET_NAME", "ZUP_TO_YUP", "Joint", "Link", "MotionCheck", "Overlap", "Robot", "SweepReport",
- "SweepSummary", "UrdfError", "blender_render_glb", "fk", "joint_sweep_observation", "limit_poses",
+ "SweepSummary", "UrdfError", "fk", "limit_poses",
"link_world_meshes", "load_urdf", "motion_direction_check", "pose_label", "pose_samples", "render_poses",
- "robot_scene", "summary_text", "sweep_collisions", "aggregate_findings", "sweep_findings", "urdf_to_glb", "world_bboxes",
- "robot_scene", "summary_text", "sweep_collisions", "sweep_findings", "urdf_to_glb",
++ "aggregate_findings", "buried_links", "robot_scene", "summary_text", "sweep_collisions", "sweep_findings", "urdf_to_glb",
]
diff --cc harness/codeverse/spatial/joints_sweep.py
index f729908f,ba409444..8796810e
--- a/harness/codeverse/spatial/joints_sweep.py
+++ b/harness/codeverse/spatial/joints_sweep.py
@@@ -247,57 -226,6 +226,108 @@@ def sweep_findings(report: SweepReport
return out
+#: ERROR findings kept after aggregation (the deepest pairs); the rest fold into one WARN
+MAX_PAIR_FINDINGS = 8
+
+
+def aggregate_findings(findings: list[GateFinding]) -> list[GateFinding]:
+ """One finding per link pair (or per floating link), the worst pose first.
+
+ compare_art_v3 (2026-08-28): a run produced 59 penetration findings for a handful of
+ pairs — one per sampled pose — and the refine prompt carried them as 59 lines the
+ agent could not act on; the loop burnt its budget without converging. Merge the
+ poses of a pair into one line that says how many poses, the worst depth and where,
+ keep the deepest ``MAX_PAIR_FINDINGS`` as ERRORs and summarise the remainder.
+ """
+ groups: dict[tuple[str, str | None], list[GateFinding]] = {}
+ order: list[tuple[str, str | None]] = []
+ for f in findings:
+ key = (f.data.get("kind", ""), f.target)
+ if key not in groups:
+ groups[key] = []
+ order.append(key)
+ groups[key].append(f)
+ merged: list[GateFinding] = []
+ for key in order:
+ fs = groups[key]
+ if len(fs) == 1 or key[0] != "penetration":
+ merged.extend(fs if key[0] != "penetration" else [fs[0]])
+ continue
+ worst = max(fs, key=lambda f: float(f.data.get("depth_m") or 0.0))
+ rest = [f for f in fs if not f.data.get("pose")]
+ moved = [f for f in fs if f.data.get("pose")]
+ sev = Severity.ERROR if any(f.severity == Severity.ERROR for f in fs) else Severity.WARN
+ worst_pose = worst.data.get("pose") or {}
+ where = "at rest" if not worst_pose else "at " + ", ".join(f"{k}={v:.2f}" for k, v in worst_pose.items())
+ msg = (f"links '{key[1]}' overlap in {len(fs)} of the sampled poses (worst {float(worst.data.get('depth_m') or 0) * 1000:.1f} mm "
+ f"{where}" + (f"; {len(rest)} at rest" if rest and moved else "") + ")")
+ merged.append(GateFinding(gate=worst.gate, severity=sev, target=worst.target, message=msg, fix_hint=worst.fix_hint,
+ data={**worst.data, "n_poses": len(fs), "poses": [f.data.get("pose") for f in fs][:12],
+ "max_depth_m": float(worst.data.get("depth_m") or 0.0)}))
+ errors = sorted([f for f in merged if f.severity == Severity.ERROR],
+ key=lambda f: -float(f.data.get("max_depth_m") or f.data.get("depth_m") or f.data.get("gap_m") or 0.0))
+ warns = [f for f in merged if f.severity != Severity.ERROR]
+ if len(errors) > MAX_PAIR_FINDINGS:
+ extra = errors[MAX_PAIR_FINDINGS:]
+ errors = errors[:MAX_PAIR_FINDINGS]
+ warns.append(GateFinding(gate=extra[0].gate, severity=Severity.WARN, target="overall",
+ message=f"{len(extra)} more overlapping pair(s) not listed: " + ", ".join(str(f.target) for f in extra[:10]),
+ fix_hint="fix the listed pairs first; the rest are re-measured after the next build",
+ data={"kind": "penetration_summary", "pairs": [f.target for f in extra]}))
+ return errors + warns
+
+
++#: share of a link's sampled surface that must lie inside ONE other link to call it buried
++BURIED_FRACTION = 0.98
++BURIED_SAMPLES = 200
++
++
++def _inside_fraction(body: Any, points_world: np.ndarray) -> float:
++ """Share of ``points_world`` inside any of ``body``'s islands (these LinkBodies are
++ built from world meshes, so the pose transform is the identity)."""
++ local = trimesh.transform_points(points_world, body.T_inv)
++ mask = np.zeros(len(local), dtype=bool)
++ for isl in body.islands:
++ mask |= np.asarray(collide.inside_island(isl, local), dtype=bool)
++ return float(mask.mean()) if len(mask) else 0.0
++
++
++def buried_links(robot: Robot, *, samples: int = BURIED_SAMPLES, fraction: float = BURIED_FRACTION) -> list[GateFinding]:
++ """Links whose surface lies (almost) entirely inside another link at rest — the part
++ can neither be seen nor move (compare_art_v4: a clamp's swivel pad was generated
++ inside the jaw and the judge reported it missing). Uses the sweep's own
++ :class:`LinkBody` island containment, so this check and the collision sweep agree
++ about what "inside" means; works on the open meshes agents actually export."""
++ from codeverse.spatial.joints_model import link_world_meshes
++
++ meshes = link_world_meshes(robot, {})
++ bodies = {n: collide.LinkBody(n, m) for n, m in meshes.items() if not m.is_empty and m.area > 0}
++ out: list[GateFinding] = []
++ for name in bodies:
++ pts, _ = trimesh.sample.sample_surface(meshes[name], samples, seed=0)
++ lo, hi = meshes[name].bounds
++ for other, ob in bodies.items():
++ if other == name:
++ continue
++ olo, ohi = meshes[other].bounds
++ if not (np.all(olo <= lo + 1e-6) and np.all(hi <= ohi + 1e-6)):
++ continue # not even inside its box
++ try:
++ frac = _inside_fraction(ob, pts)
++ except Exception: # noqa: BLE001 — a degenerate mesh; skip, never fail the gate
++ continue
++ if frac >= fraction:
++ out.append(GateFinding(
++ gate="articulation", severity=Severity.ERROR, target=name,
++ message=f"link '{name}' lies entirely inside '{other}' at rest ({frac * 100:.0f}% of its surface): "
++ f"it can neither be seen nor move",
++ fix_hint=f"move '{name}' outside '{other}' (or cut a pocket in '{other}' where it sits) so the part "
++ f"is visible in the rest pose; if it is really internal, merge it into '{other}'",
++ data={"kind": "buried", "inside": other, "fraction": round(frac, 3)}))
++ break
++ return out
++
++
# ------------------------------------------------------------------ motion direction
_DIRS: dict[str, tuple[float, float, float]] = {
"+x": (1, 0, 0), "-x": (-1, 0, 0), "+y": (0, 1, 0), "-y": (0, -1, 0), "+z": (0, 0, 1), "-z": (0, 0, -1),
diff --cc harness/codeverse/spatial/render.py
index 48ccd2cf,6f723acd..0e55eab7
--- a/harness/codeverse/spatial/render.py
+++ b/harness/codeverse/spatial/render.py
@@@ -8,11 -8,12 +8,13 @@@ requested ``out_dir`` so every call sti
from __future__ import annotations
+ import contextlib
import hashlib
import json
+import logging
import os
import shutil
+ import threading
import time
from collections.abc import Sequence
from pathlib import Path
diff --cc harness/codeverse/tracks/articulated_object.py
index e0902922,e2877785..309140dc
--- a/harness/codeverse/tracks/articulated_object.py
+++ b/harness/codeverse/tracks/articulated_object.py
@@@ -133,13 -147,7 +147,12 @@@ def default_joint_sweep(ws: Workspace,
return GateReport(gate=SWEEP_GATE, passed=False, findings=[GateFinding(
gate=SWEEP_GATE, severity=Severity.ERROR, target="robot.urdf", message=f"URDF sweep failed: {e}",
fix_hint="fix robot.urdf so every link has a mesh under meshes/<link>.glb and joints form one tree")]), []
- findings = [f.model_copy(update={"gate": SWEEP_GATE}) for f in joints.sweep_findings(report)]
+ findings = [f.model_copy(update={"gate": SWEEP_GATE})
+ for f in joints.aggregate_findings(joints.sweep_findings(report))]
- if repairs_enabled():
- try:
- findings += [f.model_copy(update={"gate": SWEEP_GATE}) for f in buried_links(robot)]
- except Exception as e: # noqa: BLE001 — an extra check never fails the gate
- log.warning("buried-link check failed: %s", e)
++ try:
++ findings += [f.model_copy(update={"gate": SWEEP_GATE}) for f in joints.buried_links(robot)]
++ except Exception as e: # noqa: BLE001 — an extra check never fails the gate
++ log.warning("buried-link check failed: %s", e)
gate = GateReport(gate=SWEEP_GATE, passed=not any(f.severity == Severity.ERROR for f in findings), findings=findings,
duration_ms=int((time.time() - t0) * 1000))
views: list[RenderView] = []
diff --cc harness/codeverse/tracks/planner.py
index 44d22f3c,949e6975..57b7bbf4
--- a/harness/codeverse/tracks/planner.py
+++ b/harness/codeverse/tracks/planner.py
@@@ -32,10 -32,11 +32,11 @@@ from codeverse.contracts.chat import Ch
from codeverse.contracts.common import Language, Track, Usage
from codeverse.contracts.plan import AcceptanceItem, EngineeringBrief
from codeverse.contracts.spec import Spec
-from codeverse.conventions import LANGUAGE_FRAME, frame_doc, to_pascal
+from codeverse.conventions import LANGUAGE_FRAME, frame_doc, to_pascal, to_snake
from codeverse.models.schema_utils import parse_json_lenient
+ from codeverse.proc import sha256_file
from codeverse.prompts import load_text, prompt_hash, render
- from codeverse.tracks.common import language_contract, load_prompt_or
+ from codeverse.tracks.common import language_contract
from codeverse.tracks.prompting import constraints_text
from codeverse.workspace import Workspace
@@@ -1020,6 -888,6 +1008,6 @@@ def normalise_names[P: BaseModel](plan_
return plan_obj
-__all__ = ["MAX_QUALITY_REASKS", "MAX_VALIDATION_REASKS", "PLAN_TOKENS_MAX", "PlanningError", "plan",
+__all__ = ["MAX_GEOMETRY_REASKS", "articulation_acceptance", "PLAN_GEOMETRY_ENV", "geometry_check_enabled", "MAX_QUALITY_REASKS", "MAX_VALIDATION_REASKS", "PLAN_TOKENS_MAX", "PlanningError", "plan",
"plan_tokens", "plan_with_usage", "plan_example", "ensure_acceptance", "add_acceptance_item",
- "default_event_stats", "normalise_names", "build_system_prompt", "build_user_prompt", "load_prompt_or"]
+ "default_event_stats", "normalise_names", "build_system_prompt", "build_user_prompt"]
diff --cc harness/docs/ARCHITECTURE.md
index ef5840e6,8503c86f..30248ac4
--- a/harness/docs/ARCHITECTURE.md
+++ b/harness/docs/ARCHITECTURE.md
@@@ -168,14 -183,11 +183,14 @@@ codeverse
(CV3D_PLAN_BRIEF), plan budgets and the worked examples),
plan_features.py (CV3D_PLAN_FEATURES: one switch per plan-loop change, so each
can be A/B'd alone, + pin_plan_blockers() deciding when two arms may share
- one plan — docs/PLAN_LOOP.md, docs/EVAL.md §8.1),
+ one plan — docs/EVAL.md §8.1),
depth.py,
+ plan_checks.py (plan-time geometry checks on an ArticulatedPlan — attachment,
+ pivot placement, swept-box collision over the joint range — fed back to the
+ planner as a re-ask before any code is written),
skills_hook.py (the round's view of codeverse/skills: attach before generating,
probe reads after — a no-op unless CV3D_SKILLS is on)
- flywheel/ record.py, export.py, pack.py, sample.py, pairs.py, migrate.py (schema moves),
+ flywheel/ record.py (+ best_round_record), export.py, pack.py, sample.py, pairs.py,
deliverable.py, telemetry.py, captions.py, quality.py (tiers + dedupe + code/mesh fingerprints), index.py,
code_quality.py (the delivered CODE's own vector — magic numbers per 100 LOC,
function length, dead functions, duplication, docstrings → record.extra
diff --cc harness/docs/DECISIONS.md
index 6ce73e6c,c8675d64..056f0a19
--- a/harness/docs/DECISIONS.md
+++ b/harness/docs/DECISIONS.md
@@@ -221,10 -241,6 +241,9 @@@ written) that were accepted because th
a one-shot arm whose LAST attempt was lost to the provider is `infra_failed` (redone);
a harness `PlanningError` is `no_code` / 0.0, like a one-shot answer in the wrong
format; "Error creating WebGL context" (a saturated shared GPU) is an infra marker.
- Added 2026-08-28 (compare_art_v4_pp, pro planner): a Gemini stream that exceeds its
++ Added 2026-08-28/29 (pro planner + gemini-cli runs): a Gemini stream that exceeds its
+ attempt budget, a 504 "Deadline expired", and a `finish_reason=PROHIBITED_CONTENT`
- (the provider's content filter tripping mid-JSON on a furniture plan) are provider
- failures too — dropped and redone, never zeros.
++ (the content filter tripping mid-JSON on a furniture plan) are provider failures too.
* **D42 `compare_backends` follows the battery's track (2026-08-25).** Context: the
fixed evaluator was static_object-only. Decision: `FixedEvaluator(track=, language=)`
picks the runtime from the battery and the rubric per cell (`_fixed_eval.rubric_for`, the
@@@ -237,42 -253,308 +256,339 @@@
generated bpy file made CPython 3.11's `ast.parse` raise `SystemError` and the round died
in `build_once`. Decision: `_ast_lint.safe_parse` catches SyntaxError / RecursionError /
SystemError / MemoryError / ValueError; every python lint reports a lint ERROR with a
- flatten-the-literal hint instead.
- * **D44 An articulated plan is checked for geometric self-consistency before any code
- is written (2026-08-28).** Context: compare_art_v3's low scorers failed on kinematics
- the plan already contradicted — a pivot nowhere near the door it turns, a stretcher link
- floating 40 mm off its parent, a lid whose range swings it through the box — and the
- joint sweep only reported it after a full build round. Decision:
- `tracks/plan_checks.geometry_complaints` runs three box-arithmetic checks on the plan's
- own numbers (attachment gap ≤ 15 mm; pivot within 20 mm of BOTH links; the child's box
- posed at q=lower/upper against every link that is neither its subtree nor a housing
- holding ≥ 80 % of it at rest, real intersection ≥ 20 mm or half the part's thickness),
- and the planner re-asks with the numbers (`MAX_GEOMETRY_REASKS = 2`, event
- `plan.geometry`). After the cap the plan SHIPS — this never raises `PlanningError`
- (the plan-loop wave's C1 `fit` re-ask, docs/PLAN_LOOP.md §2, killed 3 of 8 cells that
- way and was reverted). Articulated plans only; `CV3D_PLAN_GEOMETRY=0` is the control
- arm (`plan_features.LIVE_SWITCHES`). Retro-fired on the 14 recorded compare_art_v3
- plans: 8 draw a complaint (mean score 0.362), 6 do not (0.610); the six lowest scorers
- all draw one. **Measured 2026-08-28** (compare_art_v4, flash planner, gemini-cli
- generator, judge pro n = 3, 14 prompts, check ON vs OFF as paired arms): score Δ
- +0.064 [−0.188, +0.315], wins 6/6/2; final gate errors 0.00 vs 0.25; round-0 distinct
- joint_sweep targets 0.54 vs 0.25; the re-ask fired in 7/14 cells. No measurable gain,
- so the switch ships OFF (`CV3D_PLAN_GEOMETRY=1` turns it on) — the plan-loop rule.
- Its effect is read on judge-free quantities the
- 8–14-prompt batteries CAN resolve — joint_sweep error count, build rate, rounds to a
- clean sweep — not on the judge mean (docs/EVAL.md §8.1).
- * **D45 Joint-sweep findings reach the fixer aggregated per link pair (2026-08-28).**
+ flatten-the-literal hint instead. The forbidden-import floor is one set:
+ `_ast_lint.BASE_FORBIDDEN_IMPORTS` (pickle, threading, importlib, webbrowser, ftplib,
+ smtplib, …) — since 2026-08-29 urdf's `model.py` lint is on it too (those became
+ ERRORs there) plus an explicit allow-list `{bpy, bmesh, mathutils, math, random, numpy}`;
+ anything else imported is a WARN, a `codeverse` self-import an ERROR.
+ * **D44 The 2026-08-29 cleanup: delete, do not relocate (owner).** Context: an external
+ review of `codeverse` proposed executor / policy abstractions (a `RoundExecutor`, a
+ `CandidateRunner`, a metering seam, a per-track prompt-policy object). Decision: all
+ rejected — each moved code between files without deleting any (L4: a merge must delete).
+ What was done instead: (a) **candidates are rounds** — `run_candidate` / `quick_judge`
+ went, a best-of-N candidate is `steps._run_round(kind="candidate")` in its sub-workspace
+ with two knobs (`render=quick_render`, `geometry_views=False`), its own `events.jsonl`
+ and a one-sample judge; (b) **one ledger writer** — `BudgetGuard` buckets and enforces
+ only, `MeteredAgent` / `MeteredChatModel` write `telemetry/cost.jsonl`, and
+ `BaseTrack.run` opens the run ledger itself (`per_call_metering`, `_ledger_row`,
+ `run_ledger_path` deleted; `CV3D_COST_LEDGER=off` now really writes nothing);
+ (c) **a garbage env flag is OFF** — `config.env_flag` reads on/off/1/0/true/false/yes/no;
+ unset or empty is the caller's fallback (usually the Settings value), but an unparseable
+ value warns and reads as OFF, so a typo in a bench command is a control run, never a
+ silent arm (and never the variant, which a fallback of `True` would have handed it); (d) one MCP command (`default_mcp_command`, `sys.executable`),
+ one JSON-envelope finder, one union-find, one sha256, one `ask_structured`, one
+ `RENDER_MODES`; the retired mechanisms (`3dcv migrate-runs`, turntables + ffmpeg, the
+ `CV3D_SYSPROMPT=v0` arm, `shader_presence` / counterfactual renders, the in-process
+ turn-cap backstop, the concurrent-session registry) are gone with their docs.
+
+ * **D45 The 2026-08-30 batch: verified before applied.** Context: a second external review
+ listed six P1s, three P2s and eight deletions; separately a 12-subsystem comparison against
+ `astra3d-brilliana` produced 36 claims about the static_object track. Every item was
+ reproduced or refuted by an independent auditor BEFORE any edit — of the review, two claims
+ were refuted outright and four downgraded; of the comparison, ten of 36 survived and only one
+ at high severity. Decision: apply what reproduced, and prefer the fix that deletes.
+ (a) **`material_index` has a warning and a recipe.** One mesh object per plan part means
+ per-feature colour inside a part is per-polygon `material_index` — a string that appeared
+ NOWHERE in `codeverse/`, the prompts, the skills or the docs, while `_census.py` warned only
+ about a mesh with NO material. `h2h_microscope_x1b` authored 31 materials and 19 `tag_faces`
+ calls that all silently no-opped (`bmesh.ops.create_cube` returns `{'verts'}`, so
+ `res["faces"]` raises), shipped an 11-slot arm in one off-white, and lost 0.271 to
+ `untextured_flat` (which fired on 4 of 12 h2h runs — all four losses). The census now records
+ `n_material_slots` + `material_indices_used` off the evaluated mesh and warns on unused slots
+ and on an out-of-range index; the blender cookbook carries the recipe and the trap.
+ Deliberately a build WARNING, not a gate: an agent may legitimately append a slot it fills a
+ round later.
+ (b) **The cost ledger has no process-wide default.** `bind_run` / `set_default_ledger` /
+ `default_ledger_path` are gone; `bound_run` and `bound_ledger` hold ContextVar tokens. The old
+ save-and-restore republished a sibling's run the moment the first parallel bench cell exited,
+ so later rows landed in a finished run's file — the interleave 1756866 deleted `_active_ledgers`
+ for, left standing on this half. Standing rule: **a thread that may bill a model is spawned
+ through `proc.fan_out`, never a bare pool** (`texturing/generate.py` was the last one).
+ (c) **A paid verdict is never re-bought or reversed.** `PairwiseNote` moved into
+ `contracts/run.py` and onto `RoundRecord`; `reconcile_resume` replays it
+ (`candidates.replay_best_round`). Reconciliation may re-rank; it may not undo a comparison the
+ run paid for. **The guarantee is forward-only** — 0 of the 1 466 `rounds/rNN.json` on disk carry
+ the field, so for every existing run `replay_best_round` degenerates to the pre-2026-08-30
+ `BestSelector().pick`, which is why nothing on disk changed behaviour. Of the 30 recorded dirs
+ whose stored best disagrees with a plain re-rank, exactly one is re-enterable by `3dcv resume`
+ (20 are `plateau`, refused without `--force`; 9 name generator kinds deleted 2026-08-28).
+ KNOWN DIVERGENCE, unresolved: on the re-judge path `_promote_best` runs TWICE for one index
+ (`lifecycle._round_loop`) — once with `judgment=None`, which lets `choose_best_round`'s
+ `score is None` branch move the incumbent onto a round an earlier pairwise kept out, and again
+ after `rejudge_round`. `replay_best_round` models one promotion per index, so after a judge
+ outage the live loop and the replay can pick different rounds (reproduced: live r1, replay r0).
+ Replay's answer is the one that honours the earlier verdict; the live loop is what reverses it
+ inside the unscored window. Fixing the LIVE side is the change this law implies, and it is not
+ made here.
+ (d) **One render-cache authority.** `spatial/tool_common.py` may name a deterministic out_dir;
+ only `spatial/render.py` decides a PNG is still good. The deleted `renderset.json` marker keyed
+ on GLB size+mtime alone: it served stale views after a same-size rebuild, ignored a rig edit,
+ and returned paths inside the ORIGINAL workspace for a copied run.
+ (e) **`bench run --no-resume` is gone** — it dropped the recorded rows and then resumed the
+ workspace anyway (`resume = ws.exists()` never read it), carrying the old spec, spend and clock.
+ `--redo-status` is the one fresh rerun and it archives first. `compare_backends --no-resume` is
+ documented and has three readers, so it stayed — and now archives the cell's `run/` first.
+ (f) **Anthropic/OpenAI derive each SDK call's timeout from the remaining `max_wait_s`**
+ (`min(client timeout, max(20 s, remaining))`) instead of a fixed 600 s socket timeout under a
+ deadline only checked between attempts.
+ (g) **Prompt files have no size limits.** `tests/prompts/test_files.py` capped a cookbook at
+ 950 lines, a contract at 150 and every prompt at >500 chars. The blender cookbook hit the cap
+ the day a measured failure earned it a new recipe, and the test's answer was to make the recipe
+ worse. Prompt text is not a resource to ration by line count (owner, 2026-08-30); the
+ structural checks — chaptered, jinja-inert, states its units and frame, carries a runnable
+ example — stay.
+ (h) Deleted: `languages/file_lint.py` (orphaned when `api_tools.py` went 2026-08-28 — a vendor
+ CLI's writes cannot be intercepted), the `Materialized` DTO (its one signal is now a
+ `log.warning`), `AgentJob.images`, `SkillRead.first_seen_turn`, `RenderSet.turntable` (360
+ records carry the key, 0 non-null), `attribute_changes(own_hints=)`, `BudgetGuard.charge`'s
+ role/label/outcome + `by_round` (`CallCost` carries all three per call), the `spent_usage`
+ resume fallback, the root-`cost_ledger.jsonl` leg of `existing_ledger_path` (zero real files
+ exist; 677 symlinks), and `FakeImageModel` → `tests/texturing/conftest.py`.
+ Also fixed: `kind="detail"` files as `Stage.REFINE`, `Stage.ASSEMBLE` maps to the generator
+ role, and pairwise books `Stage.PAIRWISE` instead of hiding in the judge bucket.
+
+ * **D46 The judge is grounded in what the gates measure (2026-08-30).** Context: a 7-study
+ audit of 420 judged static_object rounds. The judge did not SEE interpenetration, it READ the
+ connectivity gate's text — P(flag | gate ERROR) = 69/69, 110 of 237 flags citing only WARNs the
+ rubric excuses, a coin flip (117/97) where the gate was silent; the measured-absent veto had
+ fired for it 0 times (cap rule `penetration_error`, defect `interpenetration`, matched on id)
+ and an unrelated failing gate switched it off for floating too (53/62 blocked cases, mostly
+ the invented-plan contract); one unverified must-item pinned 121/424 verdicts to a flat 0.600;
+ and the gate itself was blind where a thin member's tip is a small share of a large part's
+ surface (`PENETRATION_MIN_FRACTION`, a telescope spreader 4 mm into three legs at 0.7–1.0 % of
+ 600 samples). Decisions, each measured offline on the stored corpus before it shipped
+ (`bench/rejudge_offline.py`, 419 verdicts, $0):
+ (a) **`CapRule.measures`** names the checklist defect a gate rule is the measurement of, and the
+ object rubrics' `floating_part` / `penetration_error` watch `connectivity` only. The veto is
+ depth-aware: a penetration WARN measured at `VETO_PENETRATION_DEPTH_M` (8 mm) or deeper is not
+ "measured absent" — the WARN-blind veto switched off 163 claims, and since (d) a stile 17 mm
+ through a seat is a WARN too. 8 mm, not 5: at 5 the paired re-judge marked the pipe tee's
+ 5.8 mm branch socket — the canonical designed weld — as the defect (−0.32 on that side), and
+ the corpus holds only 9 standing claims in the 5–8 mm band against 16 at 8–10 and 43 with an
+ ERROR behind them. Replayed with (b):
+ 230 verdicts move (0 down), mean +0.086, pass 15.0 % → 21.0 %, pearson(gate errors, overall)
+ −0.219 → −0.301, vetoed on replay: interpenetration 130, floating 72. articulated_v1 keeps
+ `gate: "*"` — no single gate owns either measurement there (joint_sweep + connectivity).
+ `Rubric.content_hash` hashes what the YAML declares, not the model's defaults, so a schema field
+ (`measures`, `graded`) never re-keys recorded verdicts of an unchanged rubric.
+ (b) **The acceptance cap is graded**: `cap + (1 − cap) · verified/total` must items. Pass/fail
+ unchanged (`must_missing` still fails). Without it 98 of the rounds (a) frees are re-pinned to
+ 0.600 by the flat cap; with it the 0.600 spike falls 130 → 20.
+ (c) **A defect vote tie is absent** (D36 amended); acceptance ties unchanged. `SCORING_VERSION`
+ = 2 is stamped on every breakdown; the replay tool holds identity only to same-version verdicts.
+ (d) **The gate measures overlap where it is**: a dense pass on the AABB-overlap region, a
+ `local_fraction` trigger beside the global one, and a `through_ratio` (2·depth / thickness of
+ the part entered). The ratio is MEASURED AND NAMED, never a severity: a 0.9 ERROR line was
+ tried and flipped 9 runs of designed joinery (a boom 5 mm into a mast at 0.96, arch stretchers
+ in 8 mm ribs at 0.91–0.97) because the number saturates at the container's mid-plane. Severity
+ stays on depth — and ERROR keeps its old meaning, deep AND a visible share of the part
+ (`PENETRATION_MIN_FRACTION`): a deep overlap only the dense pass can see (a chair's rear stile
+ 17 mm through its seat, 1 % of either surface) is a WARN with every number, because ERROR by
+ depth alone flipped 27 runs of such joinery pass→fail on a cap the eye cannot confirm. Final
+ corpus re-run over 217 GLBs: 441 pairs newly WARN, 0 newly ERROR, 50 WARN→ERROR (pairs the old
+ gate already reported, now measured 9.4 → 11.3 mm), 14 runs whose gate now fails; median gate
+ time 344 → 378 ms, p90 1381 → 1085 ms.
+ (e) **The contact ledger is kept**: one INFO finding (`data.kind = "ledger"`) per report with every
+ contact's gap, every overlap down to sub-threshold welds, the ground gap per part, and the plan's
+ `attach_to` pairs measured regardless of the AABB prefilter (CONTACT / OPEN). One resolver,
+ `spatial.contract.planned_joins`: a child is offered against EVERY parent copy its box touches
+ and the gate keeps what the exact distances say (each CONTACT row, else the nearest) — resolving
+ the tie by list order printed "OPEN: Brace_1→Leg_0" for a join the plan never meant, and
+ reducing per child hid a second, genuinely open one. An open planned join is reported, not
+ failed — that policy is the owner's.
+ (f) **Orientation is measured** in the contract gate: an extents-permutation test in the plan
+ frame (lying / stood → ERROR, turned → WARN), 0 flags over 629 corpus measurements, fires on
+ brilliana's c-clamp and gate-valve. Facing-away and upside-down are not visible to an AABB.
+ (g) **World frames are composed by walking the graph's edge matrices**: trimesh 4.12 left a
+ scene-root `pivot` rotation out of its descendants and re-parented a renamed duplicate node, so
+ brilliana's three THREE-exported h2h sides measured lying on their side; a GLB with
+ duplicate / unnamed nodes now lands a finding. Our own exporters name every node uniquely
+ (0 of 14 recorded threejs GLBs differ).
+ (h) **The judge reads the ledger, not WARN prose**: `gates_section` renders one measured
+ overlap line, a MEASURED STRUCTURE block with the plan's joins as contact / OPEN, and the
+ lowest point above the floor — from the stored `GateReport`, so `3dcv judge` and calibration
+ see what the in-run judge saw, and a pre-ledger round renders byte-identical (1 254
+ "interpenetrate by ≈d mm" sentences on 241 stored rounds → 0; 171 rounds carry an OPEN
+ planned join). It rides on the v1 `judge_prompt_hash` — per-run text is not hashed — so its
+ effect is measured by a paired re-judge, never by replay.
+ (i) **`VlmJudge(fixed_order=True)`** and `calibration --fixed-order`: the per-sample shuffle
+ measures view-order robustness; the loop's σ-keyed stops need the model's re-judge noise.
+ Measured on 53 items × 3 ($7.79): σ 0.035 mean / 0.027 median / 0.060 p90 — the magnitude
+ `JUDGE_NOISE` already tables, so the corpus's 0.072 round-to-round spread is generation, not
+ the judge. Rejected on the way: a through-ratio ERROR line (d), and a per-part ground gap
+ for every part (a shade is legitimately 400 mm off the floor).
+ (j) **An OPEN planned join stays report-only** — the (e) policy, now measured (census
+ 2026-08-30: 217 static_object runs, 2 106 resolved planned rows — 0 unresolved names, was
+ 965 — 223 OPEN across 92 runs). 181/223 are a child measurably welded to OTHER parts (mean
+ overall 0.630; the judge had already priced 74 %), 41/41 genuinely detached children already
+ carry the floating ERROR (mean 0.326, their runs already fail), and the class an upgrade
+ exists to catch — touches nothing, unflagged — is EMPTY. An ERROR's entire marginal bite is
+ 46 currently-passing runs (mean 0.643, seven at 0.83–0.96) whose 94 open rows all read as
+ planner noise on the sheets (0/19 eyeballed rows show a defect the gate+judge miss in a
+ passing run: aprons weld into legs, a wheel rim rides its 8 spokes 419 mm from the hub the
+ plan named) — the invented `attach_to` edge becoming law, D45's failure verbatim, plus a
+ PROTECTED refine round each. Severity may not be smuggled through the kind string either:
+ `rubrics._finding_tokens` matches cap kinds against data/message/target, so `kind=open_join`
+ caps nothing while `kind=no_contact` silently adds the 0.6 cap AND blocks the measured-absent
+ veto. Re-open only if a future battery's ledger census shows a touches-nothing-unflagged row
+ (free to count), or a paired A/B (~$5.50, 46 runs × 2 arms) shows the judge under-prices the
+ OPEN lines it already reads.
+
+ * **D47 Judge payload v3: the 14-view rig through the montage machinery (2026-08-31).**
+ Supersedes D30's ≤ 3-montage cap. `OBJECT_VIEWS` becomes the brilliana 14-view rig
+ (three rings ±30° + eye-level cardinals + poles); the measured legacy clay cameras
+ move to their own `OBJECT_CLAY_VIEWS` (its `top` is el 88, the rig's is 90 — clay
+ tiles carry `mode != shaded` and label their own cameras); `OBJECT_RANK` packs
+ montage 1 as {front_right_high, back_left_high, top, bottom} so a cap truncation
+ still sees the underside; `MAX_MONTAGES` / `Judge.montages` / every profile's
+ `judge_montages` go 3 → 5 (at 3 the low ring + poles are silently dropped; flash-C
+ is $0.032/verdict, so economy keeps the full payload too). `OBJECT_VIEWS_QUICK`
+ stays 4 views by name, so agent contact sheets / texture pass / candidates / scene
+ assets keep their cost.
+ Measured: 4-arm A/B, 42 items (18 corpus rounds + 24 h2h sides) × n=3 pro, plus
+ 3.7-flash and 3.6-flash replicas, ≈ $47. Arms: A = 8 views, no clay (old
+ baseline); A2 = production-faithful 8 views + clay; B = 14 labelled 640 px single
+ views; C = 14 views + clay through our montage machinery (this decision). The
+ only comparison that survives multiplicity is same-cap C−A **+0.038** (n=29,
+ SE 0.013, t≈2.98); the raw deltas C−B p=.041 and C−A p=.024 do NOT survive Holm — cap flips
+ make the raw delta distribution heavy-tailed (sd(d) ~0.10–0.14). The cap story
+ is the visible one: `untextured_flat` cap-rule fires 11(A) / 6(A2) / 8(B) /
+ **3(C)** — more sky and underside pixels stop the judge inventing flatness.
+ B rejected: $0.198 & 67.5k input tok/verdict (C: $0.155 / 40.9k), its −0.025 vs A2
+ is entirely cap flips (~half contradicting the pixels on eyeball), and its
+ "best defect-hunter" halo was text-quoting — the provenance pass over every
+ defect-PRESENT vote shows interpenetration pure-view TP 0/14 in EVERY arm (the
+ 14/14 naive TP measures reading comprehension of the shared gate text, not payload
+ quality), and B's floating lead reduces to one genuinely visual item. Flash
+ replicas (3.7 and 3.6): payload Δ ≈ 0 — the rig pays only at pro tier, which is
+ the verdict judge anyway. The SHIPPED grouping was itself re-measured (arm Cprod, $7.2, same 42 × n=3):
+ montage grouping ALONE moves the mean −0.044 vs C's accidental grouping — as large
+ as the rig effect itself — because leading montage 1 with the poles ends C's
+ dirty-item leniency (the 11-error windmill: C 0.51 → Cprod 0.04; clean/dirty gap
+ 0.134 → 0.155) and lands ≈ A2 overall (−0.016, inside noise). A payload experiment
+ must therefore measure the exact grouping it ships; this entry's operative numbers
+ are Cprod's. Underside full-res singles (arm Cplus: Cprod + bottom and
+ front_right_low appended as 768 px singles, $6.8): recovers the espresso-class
+ underside catch (0.795 with render_artifacts flagged, vs 0.965 blind in Cprod) but
+ degrades everything else — worst clean/dirty gap 0.112, highest row-σ 0.040, and
+ the windmill relapses to 0.62 with all three samples dropping the floating and
+ primitive reads — measured and REJECTED; a variant that replaces the semantically
+ odd bottom ground-band crop instead of appending stays queued. Temperature
+ (A2 @ t=0, $6.0): σ 0.037 → 0.022 with 8/42 rows fully deterministic — temperature
+ is ~40 % of re-judge noise — but the mean shifts −0.037 and pearson(gate errors)
+ drops −0.195 → −0.126: re-keying every σ threshold to buy half the noise is a bad
+ trade; **t = 0.2 stays**.
+
+ * **D48 Conditional cross-section slices + provenance elicitation on gate-ERROR rounds
+ (2026-08-31).** Context: the judge's interpenetration verdicts were reading
+ comprehension of the gate text, not seeing (D47's provenance pass: pure-view TP 0/14
+ in every arm). Three measured iterations on the same 42-item battery (n=3 pro),
+ under a pre-registered stopping rule — adopt only if the guarded image-cited
+ interp majority on the 14 conn-dirty rows reaches 8/14, with a per-vote provenance
+ guard that verifies every "visible in slice n" citation against the slice manifest
+ and PNGs: **v1** (slices always on + a primed rig text) hit 8/14 but primed the
+ defect and damaged clean rounds; **v2** (de-primed: F1 hatch only gate-ERROR pairs,
+ F2 neutral legend "measured overlap (gate ERROR)", F3 anti-over-read sentence, F4
+ degenerate-slice drop) killed the clean-row damage but fell to 5/14 — the judges
+ still *saw* (the catches stayed) but stopped narrating; **v3** (conditional: slices
+ + one neutral elicitation sentence ONLY on rounds whose connectivity gate carries an
+ ERROR; every clean row byte-identical to production by construction) restored
+ **8/14 guard-verified** (2/23 citations fabricated, both guard-caught, 0 rows
+ flipped) with honest negatives: on the 4 rows whose error pairs miss both centre
+ planes the judges wrote text-only evidence in 10/12 present-votes instead of
+ inventing citations. Both real catches retained (gate_valve wrong_orientation
+ 3/3, clock_theirs hatch-verified interp); dirty-row mean at CPROD parity excluding
+ the one collapse; clean−dirty gap 0.155 → 0.198. Cost: dirty verdict **$0.154 vs
+ $0.172** baseline — cheaper — so amortised ≤ $0 and no profile dial moves.
+ Shipped: `spatial.sections.judge_slices` (+ typed `SliceManifest` beside the PNGs —
+ citations stay auditable), `JudgeInput.glb_path`, `Settings.judge.slices`
+ ("on-error" default | "off", `CV3D_JUDGE__SLICES`), slices appended AFTER the
+ montages/crops with the F2/F3 rig text and the elicitation sentence in the DEFECT
+ CHECKLIST bullet; clean rounds byte-identical (test-pinned), `judge_prompt_hash`
+ untouched.
+ **Watch item ANSWERED 2026-08-31 — the channel stays, two sentences change.** The
+ battery ran on a REBUILT corpus (the original scratchpad was destroyed by a /tmp
+ cleanup, so this is a fresh selection, not a replay): all 223 `static_object` runs
+ under `bench/out` with a GLB + plan re-gated live (92 dirty / 131 clean), then 16
+ dirty (12 blender / 4 threejs, 12 batteries, stored 0.052–0.980, 1–37 ERRORs, five
+ ≥ 0.88) + 6 clean controls re-rendered on the D47 rig and judged UNPATCHED in three
+ arms × n=3 ($11.45, 0 errors). Payload drift vs the measured shim was not re-run —
+ it was closed line by line at the implementation review, and the shim is gone.
+ (a) **It is the slice IMAGES, not the sentence.** Dirty rows 0.468 (off) → 0.429
+ (shipped), marked defects 2.50 → 2.75; the sentence-only arm (`slice_payload →
+ ([], True)`, the state a crashed drawing already produces) is FLAT at 0.471 / 2.38 —
+ it carries +0.0035 of the −0.039. The mean move is inside noise (paired bootstrap
+ 95 % CI [−0.114, +0.035]; 9 down / 5 up / 2 tie), i.e. not a uniform penalty.
+ (b) **The cap stack was the wrong thing to fear.** Hard-cap loss FALLS 0.0204 →
+ 0.0149 (the additive defect penalty is what rises, 0.189 → 0.204), is exactly 0.000
+ on 12 of 16 rows in BOTH arms, no row loses > 0.1 to a cap `off` did not apply
+ (max +0.032), and no cap brought by a new mark binds anywhere. b36_v0_02 reproduces
+ only weakly — 0.579 → 0.202, of which 0.000 is caps — not the 0.54 → 0.008 that
+ wrote this watch item.
+ (c) **The shipped arm is the more ACCURATE one, not merely the harsher one.** All 16
+ majority-marked disagreements were adjudicated against the rig renders and the exact
+ slice PNGs: +6 true marks gained, 0 true marks lost, 6 false `off` marks deleted, 4
+ false gained (net true +6 / net false −2). Real wins: `h2h_office_chair`'s armrests
+ standing clear of the seat (off missed it 0/3 → 3/3), b36_v0_02's stacked-cylinder
+ scroll and painted-on f-holes. Real deletions: the `sv2_violin` volute/C-bouts/
+ cut-out f-holes and the `machinist_vise` lofted casting that `off` had called
+ primitive.
+ (d) **The debt is two sentences, both inside slices-only text** (so clean-round
+ identity and `judge_prompt_hash` are untouched): the legend suffix
+ `[outline: open section]` named a MESH property and read as a hole report — it alone
+ moved `holes_or_inverted_faces` 0 → 2 cases, now `[outline only — not filled; NOT a
+ hole]`; and the in-plane caveat was too generic to stop a 2.4 mm open join and
+ section-cut islands being marked floating — it now POINTS AT the views that can
+ decide ("judge floating_part and holes_or_inverted_faces from the shaded and
+ geometry views") rather than forbidding the mark, because a bare prohibition would
+ suppress the true marks the channel exists to win. Rejected: a revert (it nets +6
+ true marks), dropping the elicitation (inert on dirty rounds, and it produces the
+ citations this audit was read from), a cap-interaction guard (no such cap fired).
+ Clean-row invariant now MEASURED, not inherited: all 6 controls rebuild
+ byte-identical under both dials. Forcing the sentence onto clean rows costs −0.092,
+ so it must never be promoted to unconditional — the on-error gate is load-bearing.
+ Separately fundable, NOT D48's: `untextured_flat` is over-applied by BOTH arms on
+ shaded models with a uniform sensible colour, which the rubric item's own text
+ exempts.
+
++* **D49 An articulated plan is checked for geometric self-consistency before any code is
++ written — measured, ships OFF (2026-08-28/29).** Context: compare_art_v3's low scorers
++ failed on kinematics the plan already contradicted, and the joint sweep only reported it
++ after a full build round. Decision: `tracks/plan_checks.geometry_complaints` runs three
++ box-arithmetic checks on the plan's own numbers (attachment gap ≤ 15 mm; hinge pivot
++ within 25 mm of BOTH links; the child's box posed at q=lower/upper as a point lattice
++ against every link that is neither its subtree, a housing holding ≥ 80 % of it at rest,
++ interlocked with it at rest, nor — for a slide — its parent), and the planner re-asks
++ with the numbers (`MAX_GEOMETRY_REASKS = 2`, event `plan.geometry`). After the cap the
++ plan ships; this never raises `PlanningError` (the plan-loop wave's C1 died that way).
++ **Measured** (compare_art_v4, 14 prompts, check ON vs OFF as paired arms, flash planner,
++ gemini-cli generator, judge pro n = 3): score Δ +0.064 [−0.188, +0.315]; final gate
++ errors 0.00 vs 0.25; round-0 distinct joint_sweep targets 0.54 vs 0.25; the re-ask fired
++ in 7/14 cells. No measurable gain — with gemini-cli generation round-0 sweep errors are
++ near zero either way — so `CV3D_PLAN_GEOMETRY` ships OFF (=1 enables;
++ `plan_features.LIVE_SWITCHES`).
++* **D50 Joint-sweep findings reach the fixer aggregated per link pair (2026-08-28).**
+ Context: one compare_art_v3 run produced 59 penetration findings for a handful of pairs
- — one line per sampled pose — and `build_refine_instructions` de-duplicates by
- (target, kind) keeping the FIRST pose's line, so the agent saw the shallowest instance
- and the loop burnt its budget without converging. Decision:
++ — one per sampled pose — and `build_refine_instructions` de-duplicates by (target, kind)
++ keeping the FIRST pose's line, so the agent saw a pair's shallowest instance and the loop
++ burnt its budget without converging. Decision:
+ `spatial/joints_sweep.aggregate_findings` merges a pair's poses into one line (how many
- poses, worst depth and at which q, rest count), ranks ERRORs by depth, keeps the
- deepest `MAX_PAIR_FINDINGS = 8` and folds the rest into one WARN
- `penetration_summary`; `default_joint_sweep` applies it. The raw report is unchanged.
++ poses, worst depth and at which q, rest count), ranks ERRORs by depth, keeps the deepest
++ `MAX_PAIR_FINDINGS = 8` and folds the rest into one WARN `penetration_summary`;
++ `default_joint_sweep` applies it, and adds `buried_links` — a link whose sampled surface
++ lies ≥ 98 % inside another link at rest is an ERROR (invisible to every view, reported
++ "missing" by the judge). The raw sweep report is unchanged. Companion measurement: a
++ deterministic-repairs bundle (axis flip + buried check) A/B'd at Δ −0.039 ± 0.105 over
++ 12 paired prompts, the flip firing in 1 cell of 12 — the aggregation ships on rationale,
++ not on a resolved score delta.
+
## Rejected / deferred
+ * A versioned `Spec`/`RunRecord`/`RunState` load-normaliser (rejected 2026-08-30: of the seven
+ compatibility branches it was meant to absorb, only two are schema-shaped — 14 lines — so it
+ would add an abstraction and delete nothing, L4).
+ * Deleting `spatial/sections.py` (rejected 2026-08-30: it IS the registered `cross_section` MCP
+ tool, imported at module level by `spatial/tools.py`; removing it takes down the MCP server).
* Registering `single-shot` as a CodingAgent kind (rejected: it has no tools/session).
* A free-form `dict` judge schema (rejected: flash skips criteria).
* Storing URDF meshes Y-up and converting on load (rejected: breaks foreign loaders).
diff --cc harness/tests/compare_bench/test_infra_failures.py
index cef3133c,7ee8af1e..c077633c
--- a/harness/tests/compare_bench/test_infra_failures.py
+++ b/harness/tests/compare_bench/test_infra_failures.py
@@@ -325,9 -301,32 +301,40 @@@ def test_a_classifier_crash_still_recor
+def test_stream_attempt_budget_and_504_are_infra():
+ from bench._infra import is_infra_failure
+
+ assert is_infra_failure(RuntimeError("ModelError: Gemini stream exceeded its attempt budget after 293 chunks"))
+ assert is_infra_failure(RuntimeError("Gemini API error 504: Deadline expired before operation could complete."))
+ assert is_infra_failure(RuntimeError("ModelError: structured output unavailable (finish_reason=PROHIBITED_CONTENT; raise max_output_tokens if truncated)"))
++
++
+ def test_the_ab_viewer_refuses_to_call_a_winner_it_cannot_support():
+ from bench.ab_view import Run, verdict
+
+ def arm(name, *scores):
+ return [Run(slug=f"{name}{i}", arm=name, final=s, status="passed") for i, s in enumerate(scores)]
+
+ cases = [
+ ((0.7,), (0.9,), "Inconclusive"),
+ ((0.70, 0.72), (0.74, 0.76), "Inconclusive"),
+ ((0.50, 0.70, 0.90), (0.56, 0.76, 0.96), "Inconclusive"),
+ ((0.30, 0.32, 0.31), (0.80, 0.82, 0.81), "B wins"),
+ ]
+ for a_scores, b_scores, expected in cases:
+ head, _ = verdict(arm("a", *a_scores), arm("b", *b_scores))
+ assert head.startswith(expected), head
+
+ # a run that never scored must not be counted as an observation
+ a = arm("a", 0.5, 0.5) + [Run(slug="a9", arm="a", final=None, status="failed")]
+ head, why = verdict(a, arm("b", 0.5))
+ assert head.startswith("Inconclusive") and "1 of 1" in why
+
+ def test_the_default_generator_and_the_cost_router_name_the_same_model():
+ """`3dcv cost` prints default_route(GENERATOR) as "the default"; if it disagrees with
+ Backends.generator the report is describing a model no run uses."""
+ from codeverse.contracts.common import Backends
+ from codeverse.cost.routing import default_route
+ from codeverse.cost.types import Role
+
+ assert default_route(Role.GENERATOR).model_id == Backends().generator
diff --cc harness/tests/core/test_plan_normalise.py
index 6697449e,675c4668..5ff334ba
--- a/harness/tests/core/test_plan_normalise.py
+++ b/harness/tests/core/test_plan_normalise.py
@@@ -165,20 -159,104 +159,123 @@@ def test_an_ambiguous_joint_reference_i
assert "chest_drawer" in msg and "spare_drawer" in msg, "the planner must be told the real names"
+def test_a_root_link_that_names_no_part_becomes_the_one_link_no_joint_moves():
+ """ab_repairs grand_piano, 2026-08-29: flash wrote a UUID as root_link three times and
+ the pinned plan died with 'root_link … is not a part'."""
+ d = _raw()
+ d["root_link"] = "040fbba3-b0f3-42e1-85b3-f61b0c034293"
+ plan = ArticulatedPlan.model_validate(d)
+ assert plan.root_link == "Cabinet"
- assert any("is not a part" in n and "Cabinet" in n for n in plan.normalisations)
++ assert any("no joint moves" in n and "Cabinet" in n for n in plan.normalisations)
+
+
+def test_an_ambiguous_root_is_still_rejected():
+ d = _raw()
+ d["root_link"] = "nowhere"
+ d["parts"].append({"name": "Pedestal", "role": "base", "description": "a plinth", "material": "oak",
+ "bbox": {"center": [0, 0, -0.05], "extents": [0.5, 0.6, 0.1]}})
+ with pytest.raises(ValidationError, match="root_link nowhere is not a part"):
+ ArticulatedPlan.model_validate(d)
++
++
+ def test_swapped_limits_are_written_as_the_swap_they_are():
+ d = _raw()
+ j = d["joints"][0]
+ j["lower"], j["upper"] = 1.2, 0.0
+ j["rest"] = 0.5
+ p = ArticulatedPlan.model_validate(d)
+ fixed = next(x for x in p.joints if x.name == j["name"])
+ assert (fixed.lower, fixed.upper) == (0.0, 1.2)
+ assert any("swapped" in n for n in p.normalisations)
+
+
+ def test_a_rest_outside_the_limits_is_clamped_not_fatal():
+ d = _raw()
+ j = d["joints"][0]
+ j["lower"], j["upper"], j["rest"] = 0.0, 1.0, 2.5
+ p = ArticulatedPlan.model_validate(d)
+ fixed = next(x for x in p.joints if x.name == j["name"])
+ assert fixed.rest == pytest.approx(1.0)
+ assert any("clamped" in n for n in p.normalisations)
+
+
+ def test_a_zero_axis_still_fails_validation():
+ d = _raw()
+ d["joints"][0]["axis"] = [0, 0, 0]
+ with pytest.raises(ValidationError):
+ ArticulatedPlan.model_validate(d)
+
+
+ def _rename_part(d: dict, old: str, new: str) -> None:
+ for part in d["parts"]:
+ if part["name"] == old:
+ part["name"] = new
+ if part.get("attach_to") == old:
+ part["attach_to"] = new
+ for j in d["joints"]:
+ for side in ("parent", "child"):
+ if j.get(side) == old:
+ j[side] = new
+ if d.get("root_link") == old:
+ d["root_link"] = new
+
+
+ def test_a_root_link_naming_no_part_is_resolved_by_the_1b_word_rule():
+ """af_excavator (2026-08-31, 3.7-flash): root_link 'chassis' over a part list that
+ spelt it differently killed the run after two re-asks. Same word-boundary match as
+ the joint-fragment repair — never a bare substring."""
+ d = _raw()
+ real_root = d["root_link"]
+ _rename_part(d, real_root, "TrackedChassis")
+ d["root_link"] = "Chassis"
+ p = ArticulatedPlan.model_validate(d)
+ assert p.root_link == "TrackedChassis"
+ assert any("root_link 'Chassis'" in n and "TrackedChassis" in n for n in p.normalisations)
+
+
+ def test_an_ambiguous_root_link_still_fails_validation():
+ d = _raw()
+ real_root = d["root_link"]
+ _rename_part(d, real_root, "TrackedChassis")
+ other = next(x["name"] for x in d["parts"] if x["name"] != "TrackedChassis")
+ _rename_part(d, other, "ChassisMount")
+ d["root_link"] = "Chassis"
+ with pytest.raises(ValidationError, match="root_link"):
+ ArticulatedPlan.model_validate(d)
+
+
+ def test_a_joint_naming_a_sub_part_by_word_subset_promotes_it():
+ """af_grandfather_clock: joint said GlazedDoor, the child was GlazedFrontDoor — no
+ affix match, so 1b could not save it. 1c matches by word subset and promotes."""
+ d = _raw()
+ parent = d["parts"][0]
+ parent.setdefault("children", []).append(
+ {"name": "GlazedFrontDoor", "role": "hinged door", "description": "a glazed door",
+ "bbox": {"center": list(parent["bbox"]["center"]), "extents": [e * 0.4 for e in parent["bbox"]["extents"]]},
+ "material": "oak and glass"})
+ d["joints"].append({"name": "CaseToGlazedDoor", "type": "revolute", "parent": parent["name"],
+ "child": "GlazedDoor", "axis": [0, 1, 0], "pivot": [0.2, 0.5, 0],
+ "lower": 0.0, "upper": 1.5, "rest": 0.0, "motion": "door swings open"})
+ p = ArticulatedPlan.model_validate(d)
+ names = [x.name for x in p.parts]
+ assert "GlazedFrontDoor" in names
+ j = next(x for x in p.joints if x.name == "CaseToGlazedDoor")
+ assert j.child == "GlazedFrontDoor"
+ assert any("resolved to sub-part GlazedFrontDoor" in n for n in p.normalisations)
+
+
+ def test_the_unknown_link_complaint_lists_the_sub_parts():
+ """The re-ask used to see only top-level parts — with everything nested, it was blind
+ to the very children the joints meant, and both re-asks died the same way."""
+ d = _raw()
+ parent = d["parts"][0]
+ parent.setdefault("children", []).append(
+ {"name": "PendulumBob", "role": "bob", "description": "a brass disc",
+ "bbox": {"center": list(parent["bbox"]["center"]), "extents": [0.1, 0.1, 0.02]},
+ "material": "brass"})
+ d["joints"].append({"name": "Mystery", "type": "revolute", "parent": parent["name"],
+ "child": "SomethingElse", "axis": [0, 1, 0], "pivot": [0, 0, 0],
+ "lower": 0.0, "upper": 1.0, "rest": 0.0, "motion": "?"})
+ with pytest.raises(ValidationError, match=r"Sub-parts that exist but are NOT links:.*PendulumBob"):
+ ArticulatedPlan.model_validate(d)
+
diff --cc harness/tests/urdf_joints/test_buried_links.py
index 00000000,00000000..93db52e0
new file mode 100644
--- /dev/null
+++ b/harness/tests/urdf_joints/test_buried_links.py
@@@ -1,0 -1,0 +1,47 @@@
++"""A link generated fully inside another is a gate ERROR (spatial.joints.buried_links)."""
++
++from __future__ import annotations
++
++from pathlib import Path
++
++from codeverse.contracts.artifacts import Severity
++from codeverse.spatial.joints import buried_links, load_urdf
++from tests.urdf_joints.conftest import box_glb
++
++URDF = """<?xml version="1.0"?>
++<robot name="t">
++ <link name="body"><visual><geometry><mesh filename="meshes/body.glb"/></geometry></visual></link>
++ <link name="door"><visual><geometry><mesh filename="meshes/door.glb"/></geometry></visual></link>
++ <link name="knob"><visual><geometry><mesh filename="meshes/knob.glb"/></geometry></visual></link>
++ <joint name="hinge" type="revolute">
++ <parent link="body"/>
++ <child link="door"/>
++ <origin xyz="0 0 0" rpy="0 0 0"/>
++ <axis xyz="0 0 1"/>
++ <limit lower="0" upper="1.57" effort="1" velocity="1"/>
++ </joint>
++ <joint name="knob_fixed" type="fixed">
++ <parent link="door"/>
++ <child link="knob"/>
++ <origin xyz="0 0 0" rpy="0 0 0"/>
++ </joint>
++</robot>
++"""
++
++
++def _robot(root: Path, *, knob_center):
++ meshes = root / "meshes"
++ meshes.mkdir(parents=True, exist_ok=True)
++ box_glb(meshes / "body.glb", (0, 0, 0.5), (0.6, 0.6, 1.0))
++ box_glb(meshes / "door.glb", (0.31, 0, 0.5), (0.02, 0.6, 1.0))
++ box_glb(meshes / "knob.glb", knob_center, (0.04, 0.04, 0.04))
++ urdf = root / "robot.urdf"
++ urdf.write_text(URDF)
++ return load_urdf(urdf, meshes)
++
++
++def test_buried_link_is_reported_and_a_visible_one_is_not(tmp_path):
++ out = buried_links(_robot(tmp_path / "a", knob_center=(0, 0, 0.5)))
++ assert [f.target for f in out] == ["knob"] and out[0].severity == Severity.ERROR
++ assert out[0].data["inside"] == "body" and out[0].data["fraction"] >= 0.98 and out[0].data["kind"] == "buried"
++ assert buried_links(_robot(tmp_path / "b", knob_center=(0.35, 0, 0.5))) == []