Official Codebase of 3DCodeVerse
Python
review round 4: the sweep's thresholds, the two probes' depths, and two scripts that lied
ziyao78dd379492a3
diff --git a/harness/bench/data/coupled/README.md b/harness/bench/data/coupled/README.mdindex 3eb16afd..b41fb267 100644--- a/harness/bench/data/coupled/README.md+++ b/harness/bench/data/coupled/README.md@@ -47,16 +47,33 @@ poses lie on a one-dimensional path, and the other two add a real second freedompram's wheel spins, the mirror's tilt). Every overlap the gate reports there is thereforean overlap the mechanism can actually reach. Over both arms' 20 runs the gate raised **49ERROR findings across 47 DISTINCT link pairs** — not one pair repeating — at a median-penetration of **5.8 mm** (max 16.7) against a 1 mm tolerance, and some are already-present at rest: `base_frame|screw_slider` on the scissor lift overlaps in 3 sampled poses,-worst 8.8 mm, one of them the rest pose.+penetration of **5.8 mm** (max 16.7), and some are already present at rest:+`base_frame|screw_slider` on the scissor lift overlaps in 3 sampled poses, worst 8.8 mm at+`screw_slider_joint=0.15`, and one of the three is the rest pose. All five numbers are+printed by `python bench/penetration_thresholds.py <both arms>`.++The sweep records an overlap from **2 mm** (`sweep_collisions(tol_m=)`, the default every+caller takes) and calls a REST overlap an ERROR only above **5 mm**+(`sweep_findings(rest_max_m=)`). An earlier version of this paragraph said "1 mm+tolerance"; that was wrong, and so was reading the 8.8 mm as a rest-pose depth — it is the+worst over three poses.So the coupling support did not reduce gate errors because those errors were not mostlyartefacts of unreachable poses: **the mechanisms genuinely self-intersect**. The defect-these prompts expose is in generation, not in the sampler and not in the gate — which is-consistent with the scores (median 0.241) and with the judge's leading complaint on the-scissor lift, "the deck does not rise".+these prompts expose is in generation, not in the sampler and not in the gate.++Two caveats the construction argument does not remove. Reachable means reachable in the+KINEMATIC MODEL: a plan with wrong joint limits lets the model reach poses the real object+could not. And "every sampled pose is reachable" holds for the eight one-DOF models; for+the pram and the mirror the sampler still combines the second freedom at random, which is+the pre-mimic situation for those joints.-One caveat the construction argument does not remove: reachable means reachable in the-KINEMATIC MODEL. A plan with wrong joint limits lets the model reach poses the real-object could not.+**What this paragraph may NOT lean on.** The rest-pose overlaps say nothing about whether+the sampler's unreachable poses were costing score — rest is sampled by both arms — only+that self-intersection is real. And the judge's complaint on the scissor lift ("the deck+does not rise") is **not** corroboration: until `joints_export.robot_scene` resolves+`<mimic>` followers, every per-pose GLB behind the articulation sheet posed the followers+at rest, so on a lift whose deck follows the screw slider the judge saw a deck that could+not rise whatever the code did. That is evidence about the sheet. The sweep poses through+fk, which does resolve followers, so the sweep-side evidence above stands on its own; the+judge quote has been removed rather than repaired.diff --git a/harness/bench/data/plan_stage/README.md b/harness/bench/data/plan_stage/README.mdindex 1e1870ec..92d0978a 100644--- a/harness/bench/data/plan_stage/README.md+++ b/harness/bench/data/plan_stage/README.md@@ -104,5 +104,11 @@ Two readings:declared the coupling correctly in all ten — an earlier reading of this table called thepram "3 of 8 declared" and was wrong.+ **This is a hand reading, and it is not reproducible from this directory.** The rows+ carry `n_parts` / `n_joints` / `n_mimic` only, so the joint-by-joint check was done on+ plan JSON that is not in the tree. `plan_stage_bench.py --keep-plans` now writes each+ call's `plan.json` beside its row so the next such reading can be re-done; the ten plans+ behind THIS sentence pre-date that flag.+The plan stage is therefore NOT what a full run of this battery would be measuring: itloses nothing here.diff --git a/harness/bench/penetration_thresholds.py b/harness/bench/penetration_thresholds.pyindex 616bc25c..ec2e32ee 100644--- a/harness/bench/penetration_thresholds.py+++ b/harness/bench/penetration_thresholds.py@@ -17,8 +17,8 @@ link pair. A threshold change is a behaviour change; this is the blast radius ffrom __future__ import annotationsimport argparse+import inspectimport json-import reimport statisticsimport sysfrom collections import Counter@@ -26,24 +26,41 @@ from pathlib import Pathsys.path.insert(0, str(Path(__file__).resolve().parent.parent))+from codeverse.languages.urdf import REST_PENETRATION_MAX_M # noqa: E402from codeverse.spatial.connectivity import ( # noqa: E402PENETRATION_ERROR_M,PENETRATION_WARN_M,)+from codeverse.spatial.joints_sweep import sweep_collisions, sweep_findings # noqa: E402#: candidate ERROR thresholds in metres, including the one that shipsCANDIDATES = (0.001, 0.002, 0.005, PENETRATION_ERROR_M)-#: `joint_sweep` reports a rest-pose overlap at this depth (joints_collide's tolerance)-SWEEP_TOLERANCE_M = 0.001-_PAIR = re.compile(r"links '([^|]+)\|([^']+)'")-_WORST = re.compile(r"worst ([\d.]+) mm")+#: The sweep's own two numbers, IMPORTED rather than restated — this file used to carry a+#: third copy of a constant the two probes already disagree on, and it had it wrong.+#: `sweep_collisions(tol_m=)` is the depth at which a moved-pose overlap is recorded at+#: all; `sweep_findings(rest_max_m=)` is the depth above which a REST overlap is an ERROR+#: rather than a WARN. Every caller takes both defaults.+SWEEP_TOLERANCE_M = float(inspect.signature(sweep_collisions).parameters["tol_m"].default)+SWEEP_REST_ERROR_M = float(inspect.signature(sweep_findings).parameters["rest_max_m"].default)+assert SWEEP_REST_ERROR_M == REST_PENETRATION_MAX_M, "the urdf runtime disagrees with the sweep default"+++#: sub-workspaces a run owns; their records are not runs of their own (`find_runs` skips+#: both, and `scene_stats.runs` did while this file skipped only `_cand`)+SUB_WORKSPACES = ("_cand", "_assets")def records(root: Path) -> list[dict]:- """Every articulated run record under ``root``, once per run."""+ """Every articulated run record under ``root``, once per run.++ `resolve()` before the dedupe so a symlinked cell (`run/telemetry/trajectories` is the+ documented one) is counted once, not twice — the trap that inflated COST §30. The+ review branch adds `flywheel.record.unique_files` for exactly this; both bench walkers+ should move to it when that lands.+ """out, seen = [], set()for rec in root.rglob("record.json"):- if rec.resolve() in seen or "_cand" in rec.parts:+ if rec.resolve() in seen or any(w in rec.parts for w in SUB_WORKSPACES):continueseen.add(rec.resolve())try:@@ -55,11 +72,42 @@ def records(root: Path) -> list[dict]:return out+def sweep_pairs(sweep: dict | None, *, rest_only: bool) -> dict[tuple[str, ...], float]:+ """``{link pair: worst depth}`` from a ``joint_sweep`` gate's ERROR findings.++ Read off the structured finding, never the message: ``target`` IS the pair key and+ ``data["max_depth_m"]`` the worst depth (``depth_m`` when the pair was not aggregated).+ A wording change in ``aggregate_findings`` used to zero this whole report.++ ``rest_only`` keeps the findings whose WORST pose is the rest pose — ``data["pose"]``+ falsy, which is what ``aggregate_findings`` writes for rest. Without it this compares+ the sweep's worst-over-all-poses depth against connectivity's rest-pose depth, and+ "2-3x deeper on the same pairs" is then not a statement about one pose.+ """+ out: dict[tuple[str, ...], float] = {}+ for f in (sweep or {}).get("findings") or []:+ if f.get("severity") != "error":+ continue+ d = f.get("data") or {}+ if d.get("kind") != "penetration":+ continue+ if rest_only and d.get("pose"):+ continue+ target = str(f.get("target") or "")+ if "|" not in target:+ continue+ key = tuple(sorted(target.split("|", 1)))+ depth = float(d.get("max_depth_m") or d.get("depth_m") or 0.0)+ out[key] = max(out.get(key, 0.0), depth)+ return out++def survey(recs: list[dict]) -> dict:"""Per-round worst connectivity depth, and how the two probes compare where both ran."""worst_per_round: list[float] = []fired: Counter[str] = Counter()both: list[tuple[str, str, float, float | None]] = []+ all_sweep_pairs: list[tuple[str, float]] = []for data in recs:for rnd in data.get("rounds") or []:gates = {g["gate"]: g for g in (rnd.get("gates") or [])}@@ -78,16 +126,18 @@ def survey(recs: list[dict]) -> dict:fired[f.get("severity", "")] += 1worst_per_round.append(worst)sweep = gates.get("joint_sweep")- for f in (sweep or {}).get("findings") or []:- if f.get("severity") != "error":- continue- pair, mm = _PAIR.search(f.get("message", "")), _WORST.search(f.get("message", ""))- if not (pair and mm):- continue- key = tuple(sorted([pair.group(1), pair.group(2)]))- both.append((data.get("spec", {}).get("id", "?"), "|".join(key),- float(mm.group(1)) / 1000, depths.get(key)))- return {"rounds": len(worst_per_round), "worst": worst_per_round, "fired": fired, "both": both}+ # every ERROR pair, for the corpus counts the docs cite+ for key, depth in sweep_pairs(sweep, rest_only=False).items():+ all_sweep_pairs.append(("|".join(key), depth))+ # and only the pairs whose worst pose IS rest, for the depth comparison+ for key, depth in sweep_pairs(sweep, rest_only=True).items():+ both.append((data.get("spec", {}).get("id", "?"), "|".join(key), depth, depths.get(key)))+ n_rest = sum(1 for _, _, _, c in both if c is not None)+ return {"rounds": len(worst_per_round), "worst": worst_per_round, "fired": fired, "both": both,+ "sweep_findings": len(all_sweep_pairs),+ "sweep_distinct": len({p for p, _ in all_sweep_pairs}),+ "sweep_depths": [d for _, d in all_sweep_pairs],+ "rest_comparable": n_rest}def corroborate(recs: list[dict], threshold_m: float) -> dict:@@ -111,13 +161,7 @@ def corroborate(recs: list[dict], threshold_m: float) -> dict:d = f.get("data") or {}if d.get("kind") == "penetration" and float(d.get("depth_m") or 0.0) >= threshold_m:deep.add(tuple(sorted([f.get("target", ""), str(d.get("other") or "")])))- flagged = set()- for f in sweep.get("findings") or []:- if f.get("severity") != "error":- continue- m = _PAIR.search(f.get("message", ""))- if m:- flagged.add(tuple(sorted([m.group(1), m.group(2)])))+ flagged = set(sweep_pairs(sweep, rest_only=False))both += len(deep & flagged)conn_only += len(deep - flagged)sweep_only += len(flagged - deep)@@ -127,7 +171,8 @@ def corroborate(recs: list[dict], threshold_m: float) -> dict:def report(root: Path) -> str:- s = survey(records(root))+ recs = records(root) # read once: this used to walk every record.json twice+ s = survey(recs)rounds, worst = s["rounds"], s["worst"]nonzero = [w for w in worst if w > 0]lines = [f"# penetration thresholds over {rounds} articulated round(s) under {root}", "",@@ -137,11 +182,21 @@ def report(root: Path) -> str:if nonzero:lines.append(f"depth recorded by connectivity: median {statistics.median(nonzero) * 1000:.1f} mm, "f"max {max(nonzero) * 1000:.1f} mm")+ sd = s["sweep_depths"]+ lines += ["",+ f"joint_sweep ERROR findings: {s['sweep_findings']} across {s['sweep_distinct']} distinct link "+ f"pair(s) (records an overlap at {SWEEP_TOLERANCE_M * 1000:.0f} mm; a REST overlap is an ERROR "+ f"only above {SWEEP_REST_ERROR_M * 1000:.0f} mm)"]+ if sd:+ lines.append(f"depth recorded by the sweep: median {statistics.median(sd) * 1000:.1f} mm, "+ f"max {max(sd) * 1000:.1f} mm")+ lines.append(f"pairs whose WORST sweep pose is rest (the only ones comparable with connectivity "+ f"pose-for-pose): {len(s['both'])}, of which {s['rest_comparable']} were also recorded "+ f"by connectivity in the same round")lines += ["", "| ERROR threshold | rounds at or over it | share |", "|---|--:|--:|"]for th in sorted(CANDIDATES):n = sum(1 for w in worst if w >= th)lines.append(f"| {th * 1000:.0f} mm | {n} | {n / max(1, rounds):.0%} |")- recs = records(root)for th in (0.002, 0.005):c = corroborate(recs, th)total = c["both"] + c["conn_only"]@@ -152,8 +207,8 @@ def report(root: Path) -> str:if c["examples"]:lines.append(f" uncorroborated examples: {', '.join(c['examples'][:4])}")if s["both"]:- lines += ["", f"the two probes on the same link pair ({len(s['both'])} sweep ERROR findings; "- f"sweep tolerance {SWEEP_TOLERANCE_M * 1000:.0f} mm):",+ lines += ["", "the two probes on the same link pair AT REST — the sweep rows below are all "+ "findings whose worst pose is the rest pose, so both columns describe one pose:","", "| run | pair | sweep | connectivity |", "|---|---|--:|--:|"]for run, pair, sw, cn in s["both"][:20]:lines.append(f"| {run} | `{pair}` | {sw * 1000:.1f} mm | "diff --git a/harness/bench/plan_stage_bench.py b/harness/bench/plan_stage_bench.pyindex e0eacdfe..5e405f6e 100644--- a/harness/bench/plan_stage_bench.py+++ b/harness/bench/plan_stage_bench.py@@ -113,14 +113,18 @@ def tree_provenance(tree: Path, codeverse_file: str) -> dict[str, str]:def run_one(battery, item, backends, label: str, rep: int, provenance: dict[str, str] | None = None,- keep_failed: Path | None = None) -> dict:+ keep_failed: Path | None = None, keep_plans: Path | None = None) -> dict:"""One plan-stage call in a throwaway workspace; never raises.``plan_once`` deliberately bypasses ``Track.run``: there is no build, no judge and norun ledger, so the JSONL row IS the record (it carries the call's own ``cost_usd``from the plan events, and the totals are printed at the end). ``keep_failed`` moves aworkspace that produced no plan out of the temp dir instead of deleting it, which is- the only way to read what the model actually wrote.+ the only way to read what the model actually wrote. ``keep_plans`` copies the plan+ JSON of a call that SUCCEEDED beside its row: the rows carry `n_parts` / `n_joints` /+ `n_mimic` only, so any joint-level reading of a committed arm ("eight of ten leave+ exactly one free joint and it IS the input") is otherwise a hand reading nobody can+ redo — review round 3 asked for this."""from bench.pin_plan import plan_oncefrom bench.run_bench import build_spec@@ -137,6 +141,11 @@ def run_one(battery, item, backends, label: str, rep: int, provenance: dict[str,"started_at": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime(started)),"seconds": round(time.time() - started, 1), **(provenance or {}),**_plan_shape(root / "ws"), **_stats(root / "ws")}+ if ok and keep_plans is not None:+ src = root / "ws" / "plan.json"+ if src.is_file():+ keep_plans.mkdir(parents=True, exist_ok=True)+ shutil.copy(src, keep_plans / f"{item.id}_r{rep}.json")if not ok and keep_failed is not None:# name what it was: a provider block says nothing about the code under test, and a# harvest of validation failures should not have to be filtered by hand@@ -162,6 +171,9 @@ def main(argv: list[str] | None = None) -> int:ap.add_argument("--keep-failed", type=Path, default=None,help="move the workspace of any call that produced no plan here (plan stage ""only, so they are small) instead of deleting it")+ ap.add_argument("--keep-plans", type=Path, default=None,+ help="copy each SUCCESSFUL call's plan.json here, so a joint-level reading of "+ "the arm can be redone from the tree (the rows carry shape counts only)")ns = ap.parse_args(argv)for kv in (x for x in ns.env.split(",") if x.strip()):@@ -194,7 +206,7 @@ def main(argv: list[str] | None = None) -> int:# imap-style ordering: pool.map yields in submission order, so one slow call holds# back every finished row behind it. Rows are the journal, so they go out as they# land instead (resume reads what is on disk, order does not matter).- futures = [pool.submit(run_one, battery, item, backends, ns.label, rep, prov, ns.keep_failed)+ futures = [pool.submit(run_one, battery, item, backends, ns.label, rep, prov, ns.keep_failed, ns.keep_plans)for item, rep in jobs]for fut in cf.as_completed(futures):row = fut.result()diff --git a/harness/bench/scene_stats.py b/harness/bench/scene_stats.pyindex 1e389226..01085e78 100644--- a/harness/bench/scene_stats.py+++ b/harness/bench/scene_stats.py@@ -35,8 +35,10 @@ STAGES = ("plan", "skeleton", "assets", "env", "layouts", "assemble", "generate"def runs(root: Path) -> list[tuple[str, dict, list[dict]]]:"""``(prompt id, record, events)`` per scene run under ``root``, once per run."""out, seen = [], set()+ # same rule as `penetration_thresholds.records`; both move to+ # `flywheel.record.unique_files` when the review branch landsfor rec in root.rglob("record.json"):- if rec.resolve() in seen or "_assets" in rec.parts or "_cand" in rec.parts:+ if rec.resolve() in seen or any(w in rec.parts for w in ("_cand", "_assets")):continueseen.add(rec.resolve())try:@@ -115,8 +117,10 @@ def layers(rows: list[tuple[str, dict, list[dict]]]) -> dict:if round_lost:gates["rounds_lost_to_the_box"] += 1j = rnd.get("judgment") or {}- if j.get("score") is not None:- scores.append(float(j["score"]))+ # `overall`, not `score`: `Judgment` has no `score` field (contracts/artifacts),+ # so this line never fired on a real record and the median was never printed.+ if j.get("overall") is not None:+ scores.append(float(j["overall"]))for issue in j.get("issues") or []:judge[f"{issue.get('severity', '?')}/{issue.get('kind', '?')}"] += 1return {"plan": plan, "assets": assets, "asset_kind": asset_kind, "tris": tris,diff --git a/harness/codeverse/spatial/connectivity.py b/harness/codeverse/spatial/connectivity.pyindex 88f63eb6..5e87a7ef 100644--- a/harness/codeverse/spatial/connectivity.py+++ b/harness/codeverse/spatial/connectivity.py@@ -64,10 +64,10 @@ PlannedEdge = tuple[str, "str | Sequence[str]"]MIN_PART_SIZE_M = 0.01#: penetration depth that is reported as WARN / ERROR. These bound the REST pose only,#: and with a 600-point surface draw per part: this check asks "do these two surfaces sit-#: inside each other as built". ``joint_sweep`` asks a different question with a denser-#: probe — "does moving a joint drive one link through another" — at a 1 mm tolerance, and-#: the two agree on only 7 of 50 link pairs at 2 mm (bench/penetration_thresholds.py,-#: D-entry 2026-09-04). They are not one check with two dials; do not align the numbers.+#: inside each other as built". ``joint_sweep`` asks a different question on posed meshes+#: — "does moving a joint drive one link through another" — at its own thresholds. They+#: are not one check with two dials: do not align the numbers (DECISIONS.md D53, with the+#: corpus measurement behind it in bench/penetration_thresholds.py).PENETRATION_WARN_M = 0.002PENETRATION_ERROR_M = 0.010#: fraction of one part's samples inside the other before we call it penetration ...diff --git a/harness/docs/DECISIONS.md b/harness/docs/DECISIONS.mdindex 625b4b49..b7c14aba 100644--- a/harness/docs/DECISIONS.md+++ b/harness/docs/DECISIONS.md@@ -757,37 +757,45 @@ written) that were accepted because the code works that way and the tests pin itreachable — but the gate still finds overlaps in them, and the two arms are not thesame artefacts measured twice (a pre-mimic plan declares no coupling at all).-* **The harness measures interpenetration twice, and the laxer probe is the one that- gates (found 2026-09-04, NOT changed).** `spatial/connectivity` samples 600 points per- surface, requires a minimum share of them inside the other part, and calls 2 mm a WARN- and **10 mm** an ERROR; `spatial/joints_collide` (the `joint_sweep` gate) probes the- posed meshes densely and reports at **1 mm**. Same quantity, different sensitivity —- and the sparse probe is behind the gate that fails a round. Measured over 374 recorded- articulated rounds (`bench/penetration_thresholds.py`): the connectivity penetration- ERROR has fired **0 times**, its WARN 50; the depths it records are median 2.0 mm, max- 9.9 mm, so its ERROR threshold is unreachable in practice. On the same link pairs the- sweep measures 2–3x deeper (8.8 vs 3.0 mm, 5.9 vs 3.8, 8.0 vs 3.0) and sometimes finds- an overlap connectivity does not report at all (15.0 mm on `base_frame|slider_crosshead`).- The visible consequence: on `coupled_v1`, 11 sweep ERRORs about the REST pose were- raised in rounds where the connectivity gate PASSED — the harness told the agent two- different things about one pose. Blast radius of a change, already computed: an ERROR- at 5 mm moves 1 round of 374, at 2 mm it moves 36 (10 %).+* **D53 Interpenetration is measured twice, and the two probes are asking different+ questions (found 2026-09-04, corrected 2026-09-06, NOT changed).** `spatial/connectivity`+ draws 600 points per surface, requires a minimum share of them inside the other part, and+ calls **2 mm** a WARN and **10 mm** an ERROR at the REST pose. `joint_sweep` poses the+ mechanism through fk and probes densely: it records an overlap from **2 mm**+ (`sweep_collisions(tol_m=)`, the default every caller takes) and treats a REST overlap as+ an ERROR only above **5 mm** (`sweep_findings(rest_max_m=)`, which+ `urdf.REST_PENETRATION_MAX_M` matches). So at rest the two share a WARN line and differ+ 2x on ERROR — not 10x, and `bench/penetration_thresholds.py` now imports both numbers+ instead of restating them.- **And then the threshold experiment answered itself, offline (2026-09-04): do not- change it.** Using the dense probe as the reference — for every pair connectivity- records at or over a candidate threshold, did the SAME round's sweep flag that pair? —- an ERROR at 2 mm would fire on 50 pairs of which only **7 are corroborated**, while the- 43 uncorroborated ones are static contacts the design intends (`shoulder_lock_knob|- swivel_post`, `base_underframe|center_top`) that a 600-point surface draw reads as- penetration; and the dense probe would still be alone on **120** pairs. At 5 mm: 2- pairs, 0 corroborated. The two probes are not measuring the same thing at different- sensitivities — one asks "do these surfaces sit inside each other at rest", the other- "does moving this joint drive one link through another". A shared threshold would- create uncorroborated failures and still miss what the sweep finds. What is wrong is- that the two read as one check with two dials; the fix belongs in what each is called- and documented to do, not in the numbers.+ Measured over 374 recorded articulated rounds: the connectivity ERROR has fired **0+ times**, its WARN 50, and the depths it records are median 2.0 mm, max 9.9 mm — its ERROR+ threshold is unreachable in practice. The sweep raises **295 ERROR findings across 191+ distinct link pairs**, median 5.0 mm, max 34.3.-* **D53 A gate never reports the machine as a defect, and a render is retried once when+ **A correction to how that gap was first read.** This entry used to say the sweep+ measures "2-3x deeper on the same link pairs (8.8 vs 3.0 mm, 5.9 vs 3.8, 8.0 vs 3.0)".+ That comparison was not about one pose: the sweep number was its worst over ALL sampled+ poses and the connectivity number was the rest pose. Restricted to the pairs whose worst+ sweep pose IS the rest pose — `data["pose"]` empty, which is the filter that makes the+ comparison mean what it says — there are 19 such pairs in the corpus, 4 of them also+ recorded by connectivity in the same round, and on those four **the two probes agree+ exactly**: 4.4/4.4, 4.4/4.4, 2.2/2.2, 2.5/2.5 mm. The probes do not disagree about depth.+ What differs is the question: 288 of the sweep's pairs are overlaps that exist only in a+ moved pose, which a rest-pose check cannot see by construction.++ **And the threshold experiment answered itself, offline: do not change it.** Using the+ dense probe as the reference — for every pair connectivity records at or over a candidate+ threshold, did the SAME round's sweep flag that pair? — an ERROR at 2 mm would fire on 50+ pairs of which only **7 are corroborated**, while the 43 uncorroborated ones are static+ contacts the design intends (`shoulder_lock_knob|swivel_post`, `base_underframe|center_top`)+ that a 600-point surface draw reads as penetration; the dense probe would still be alone on+ **288** pairs. At 5 mm: 2 pairs, 0 corroborated. A shared threshold would create+ uncorroborated failures and still miss what the sweep finds. What was wrong is that the+ two read as one check with two dials; the fix belongs in what each is called and documented+ to do, not in the numbers.++* **D54 A gate never reports the machine as a defect, and a render is retried once whenthe browser dies (2026-09-05).** The first recorded `scenes_v1` battery produced sixcells of which three built, passed every gate that does not need pixels, and kept ZEROrenders: `driver: Attempted to use detached Frame '<id>'` — Chrome reaping the render@@ -815,7 +823,7 @@ written) that were accepted because the code works that way and the tests pin itdocumented as flaky-by-construction under CPU contention (SwiftShader is notbit-reproducible when the box is busy) rather than weakened.-* **D54 `scene_placement` measures matter, and matter writes depth (2026-09-05).** Two of+* **D55 `scene_placement` measures matter, and matter writes depth (2026-09-05).** Two ofthe first six recorded scene cells failed the gate on nothing but their own atmosphere:"BlackPine_5 is sunken 3.46 m into AtmosphereHaze" and "WindowSnowView/Mesh_49 andEnvironment/MoonlightShaft overlap (100 % of the smaller box)". Both scenes were@@ -850,7 +858,7 @@ written) that were accepted because the code works that way and the tests pin itthe RAY term (`nearest < 0.3 m`) never fired once; every `camera_in_geometry` findingcame from the bbox term, and every one of those was a volumetric or a scatter field.-* **D55 A loaded GLB root is named after its asset (2026-09-05).** rooftop_garden's plan+* **D56 A loaded GLB root is named after its asset (2026-09-05).** rooftop_garden's planasked for one `blender_glb` asset; the Blender sub-run built it, the assembler wrote theloader, the browser loaded it and the census confirmed it was in the scene(`meshes_in_scene: 1, in_scene: true`) — and `scene_placement` still reported@@ -864,7 +872,7 @@ written) that were accepted because the code works that way and the tests pin itpath works end to end and only lost a name; an argument for a Blender assembly layer hasto be made on other grounds.-* **D56 A frame rate is a measurement of the renderer that produced it (2026-09-05).**+* **D57 A frame rate is a measurement of the renderer that produced it (2026-09-05).**Inside one `scenes_v1` battery `fps` was measured on two different backends — 11.5 fps onan RTX 6000 Ada for one cell, 2.0 / 5.1 / 7.1 on SwiftShader for the next three, because`gpu_launch.cjs` caches a negative GPU verdict for 20 minutes and the box's GPUs were at@@ -880,7 +888,7 @@ written) that were accepted because the code works that way and the tests pin itwithin one backend, which is a property of any battery run on a shared machine, not ofthis one.-* **D57 The scene texture pack is wired into the loop, behind a switch that is off+* **D58 The scene texture pack is wired into the loop, behind a switch that is off(2026-09-05).** Of 24 judge issues over the five scored cells of the first `scenes_v1`battery, four say the GROUND is a flat untextured colour, in near-identical words —"single flat brown color", "single flat color with no cobblestone texture", "flat,diff --git a/harness/docs/PAPER_WRITING.md b/harness/docs/PAPER_WRITING.mdindex 2ad8a234..b729fec7 100644--- a/harness/docs/PAPER_WRITING.md+++ b/harness/docs/PAPER_WRITING.md@@ -324,11 +324,22 @@ into a question it answers every time.**Why the gate rate did not move.** In the coupled arm every sampled pose is reachable byconstruction — eight of ten models have exactly one free joint — so each overlap the gatereports is one the mechanism can reach. Across both arms' 20 runs it raised 49 ERROR-findings over 47 distinct link pairs at a median 5.8 mm penetration (1 mm tolerance), some-already present at rest. The errors were never mostly artefacts of unreachable poses:-these mechanisms genuinely self-intersect, and the defect the battery exposes is in-generation rather than in the sampler or the gate. (Reachable here means reachable in the-kinematic model; wrong limits still let a model reach what the object could not.)+findings over 47 distinct link pairs at a median 5.8 mm penetration, some already present+at rest; all of those are printed by `bench/penetration_thresholds.py`. The errors were+never mostly artefacts of unreachable poses: these mechanisms genuinely self-intersect, and+the defect the battery exposes is in generation rather than in the sampler or the gate.++Three caveats, two of them corrections (2026-09-06). Reachable means reachable in the+KINEMATIC MODEL; wrong limits still let a model reach what the object could not. "Every+sampled pose is reachable" holds for the eight one-DOF models — for the pram and the mirror+the sampler still combines the second freedom at random. And the sweep's tolerance is+**2 mm**, with a rest-pose ERROR line at **5 mm** (`sweep_collisions(tol_m=)` and+`sweep_findings(rest_max_m=)`, both defaults every caller takes); an earlier version of this+paragraph said 1 mm. The judge's "the deck does not rise" was cited here as corroboration+and has been removed: until `joints_export.robot_scene` resolves `<mimic>` followers, the+articulation sheet posed every follower at rest, so that complaint is evidence about the+sheet, not about the generation. The sweep poses through fk, which does resolve followers,+so the sweep-side evidence stands on its own.**What did NOT move: the sweep gate's own failure rate.** On those eight prompts the`joint_sweep` gate fails 30 % of the rounds with couplings declared (11 of 37,@@ -516,7 +527,7 @@ data the repo does not carry; they are marked in the caveat column.too dark" is this track's most-cited defect (153 findings over 32 runs), some share ofthat history is the instrument; **the share is unknowable because those records aregone**, so no number should be put on it. The fixes are on `ziyao/scene-placement`- (D53–D57); arm B (`local/scripts/run_scene_fixed.sh`) is the measurement, and until it+ (D53–D58); arm B (`local/scripts/run_scene_fixed.sh`) is the measurement, and until itlands the paper should not cite a scene result. Handover note:`local/docs/PAPER-scene-track-correction.md`.@@ -538,7 +549,7 @@ a test enforces by grepping the tree; a switch nothing reads once produced "keep| `CV3D_LEAN_PROMPT` | drop duplicated contract/tool cards, select cookbook chapters, focus the refine prompt | **off** | +0.030 ±0.076, no cost saving (§4); **removed from the tree 2026-09-03**; last carried on `ziyao/articulated-wave-2` before commit `4cbb28c`. || `CV3D_FEWER_TURNS` (pre-existing) | fold gate checks into build, inline refine files | **off** | +0.015 ±0.126, dollars flat (§4) || `CV3D_AXIS_REPAIR` (upstream) | deterministic axis rewrite from the measured motion | on | upstream's, kept |-| `CV3D_SCENE_TEXTURES` | wire the scene texture pack into the loop: a stage before env/zones, and `texture_pack_prompt` in both prompts | **off** | added 2026-09-05 (D57) and NOT yet measured. Four of five scored cells of the first scene battery complain the ground is a flat untextured colour, in near-identical words; the pack generator existed and had never been called from the loop. Costs an image-model call per run (measured $0.15 for two 512 px textures, seam 0.001) |+| `CV3D_SCENE_TEXTURES` | wire the scene texture pack into the loop: a stage before env/zones, and `texture_pack_prompt` in both prompts | **off** | added 2026-09-05 (D58) and NOT yet measured. Four of five scored cells of the first scene battery complain the ground is a flat untextured colour, in near-identical words; the pack generator existed and had never been called from the loop. Costs an image-model call per run (measured $0.15 for two 512 px textures, seam 0.001) |Not switched, because they are bug fixes rather than levers: the MCP verdict/failed split(§5.2), `<mimic>` support (§5.3), the provider-failure markers and retries (§5.4), thediff --git a/harness/docs/RUNBOOK.md b/harness/docs/RUNBOOK.mdindex ef361b19..cd7c1b95 100644--- a/harness/docs/RUNBOOK.md+++ b/harness/docs/RUNBOOK.md@@ -173,7 +173,11 @@ python -m codeverse.judges.calibration runs/<slug> [runs/<slug2> …] --model ge24 cores under xdist; a battery holds Blender, a browser pool and several agent sessions.Twice on 2026-09-04/05 that produced 11 and 21 spurious failures that vanished on a cleanre-run (`tests/scene_runtime/lib/*` first, since those hold the renderer longest). A red-suite during a battery says nothing; re-run it when the battery is done.+suite during a battery is **not evidence until it reproduces on a quiet machine** — re-run+it there before pushing, and if the same tests are red again, it is real. The mechanism is+the one the next paragraph describes: `tests/scene_runtime/lib/*` reach the battery's+browser daemon through a shared `CV3D_CACHE_DIR`, so giving the suite its own cache dir may+let the two coexist.The same holds for a box loaded by OTHER work. On 2026-09-05, with 12 `proseg` processesholding 528 GB, swap full and all eight GPUs at ~100 %, the offline suite failed 12, thendiff --git a/harness/tests/compare_bench/test_scene_stats.py b/harness/tests/compare_bench/test_scene_stats.pyindex 316a10e1..a7616f2e 100644--- a/harness/tests/compare_bench/test_scene_stats.py+++ b/harness/tests/compare_bench/test_scene_stats.py@@ -13,7 +13,7 @@ from __future__ import annotationsimport jsonfrom pathlib import Path-from bench.scene_stats import layers, runs+from bench.scene_stats import layers, report, runsDETACHED = "driver: Attempted to use detached Frame '10276B428E350BFA074A02AF37D52E6C'."@@ -65,3 +65,28 @@ def test_a_gate_that_failed_ONLY_on_the_browser_is_not_a_failure(tmp_path: Path)d = layers(runs(tmp_path))assert d["gates"]["scene_frames:FAILED"] == 0 and d["gates"]["scene_frames:LOST"] == 1assert sum(d["gate_errors"].values()) == 0+++def test_the_median_score_is_read_off_the_real_Judgment_shape(tmp_path: Path) -> None:+ """`Judgment` has `overall`, never `score`. The script read `score`, so on every real+ record the median line was silently skipped — and no test caught it, because the+ fixtures wrote `judgment: {}`. Building the fixture from the model itself is what+ stops that drifting again."""+ from codeverse.contracts.artifacts import Judgment++ def judged(name: str, overall: float) -> None:+ d = tmp_path / name / "run"+ d.mkdir(parents=True, exist_ok=True)+ j = Judgment(rubric="scene_v1", scores={"a": overall}, overall=overall, passed=overall > 0.5)+ (d / "record.json").write_text(json.dumps({+ "spec": {"track": "scene", "id": name},+ "plan": {"assets": []},+ "rounds": [{"index": 0, "gates": [], "judgment": j.model_dump(mode="json")}],+ }))++ judged("low", 0.30)+ judged("high", 0.50)+ d = layers(runs(tmp_path))+ assert d["scores"] == [0.30, 0.50] or d["scores"] == [0.50, 0.30]+ text = report(tmp_path)+ assert "scored rounds: 2" in text and "median 0.400" in textdiff --git a/harness/tests/compare_bench/test_session_stats.py b/harness/tests/compare_bench/test_session_stats.pyindex a80fd72a..dd2fe89a 100644--- a/harness/tests/compare_bench/test_session_stats.py+++ b/harness/tests/compare_bench/test_session_stats.py@@ -163,6 +163,17 @@ def test_the_coupling_survey_counts_runs_not_copies_of_the_same_urdf(tmp_path: Passert _prompt_of(found[0]) == "cpl_umbrella"+def _sweep(pair: str, depth_m: float, *, poses: list[dict], worst_pose: dict) -> dict:+ """An aggregated `joint_sweep` penetration finding, in the shape `aggregate_findings`+ really emits: the pair is `target`, the worst depth is `data["max_depth_m"]`, and+ `data["pose"]` is the pose that worst depth was measured in ({} = rest). The message+ is deliberately junk here — reading it was the bug."""+ return {"gate": "articulation", "severity": "error", "target": pair,+ "message": "(wording changes; nothing may parse this)",+ "data": {"kind": "penetration", "depth_m": depth_m, "max_depth_m": depth_m,+ "pose": worst_pose, "poses": poses, "n_poses": len(poses)}}++def test_the_two_penetration_probes_are_compared_not_merged(tmp_path: Path) -> None:"""The corroboration view is what stopped a threshold change: for every pairconnectivity records at or over a candidate depth, did the same round's sweep flag it?@@ -178,8 +189,8 @@ def test_the_two_penetration_probes_are_compared_not_merged(tmp_path: Path) -> N"depth_m": 0.003}},]},{"gate": "joint_sweep", "passed": False, "findings": [- {"severity": "error", "message": "links 'arm|deck' overlap in 2 of the sampled poses (worst 6.0 mm)"},- {"severity": "error", "message": "links 'rod|frame' overlap in 1 of the sampled poses (worst 9.0 mm)"},+ _sweep("arm|deck", 0.006, poses=[{}, {"j": 0.15}], worst_pose={"j": 0.15}),+ _sweep("rod|frame", 0.009, poses=[{"j": 0.3}], worst_pose={"j": 0.3}),]},]}]}@@ -228,3 +239,41 @@ def test_scene_stats_attributes_a_failure_to_a_layer(tmp_path: Path) -> None:text = report(tmp_path)assert "| scene_placement | 1 | 1 | 1 |" in text and "'threejs': 1" in text+++def test_the_depth_comparison_is_restricted_to_one_pose() -> None:+ """`survey`'s two-probe table used to compare the sweep's worst-over-ALL-poses depth+ with connectivity's rest-pose depth, so "2-3x deeper on the same pairs" was not a+ statement about one pose at all. Over the 374-round corpus, restricted to the pairs+ whose worst sweep pose IS rest, the two probes agree exactly (4.4/4.4, 4.4/4.4,+ 2.2/2.2, 2.5/2.5 mm)."""+ from bench.penetration_thresholds import survey, sweep_pairs++ moved = _sweep("a|b", 0.0088, poses=[{}, {"j": 0.15}], worst_pose={"j": 0.15})+ at_rest = _sweep("c|d", 0.0044, poses=[{}], worst_pose={})+ gate = {"gate": "joint_sweep", "findings": [moved, at_rest]}++ assert set(sweep_pairs(gate, rest_only=False)) == {("a", "b"), ("c", "d")}+ assert set(sweep_pairs(gate, rest_only=True)) == {("c", "d")}, "the 8.8 mm is a moved pose"++ rec = {"spec": {"id": "b/p", "track": "articulated_object"}, "rounds": [{"gates": [+ {"gate": "connectivity", "passed": True, "findings": [+ {"severity": "warn", "target": "c", "data": {"kind": "penetration", "other": "d", "depth_m": 0.0044}},+ {"severity": "warn", "target": "a", "data": {"kind": "penetration", "other": "b", "depth_m": 0.0030}},+ ]},+ gate,+ ]}]}+ s = survey([rec])+ assert s["sweep_findings"] == 2 and s["sweep_distinct"] == 2+ assert [(p, sw, cn) for _, p, sw, cn in s["both"]] == [("c|d", 0.0044, 0.0044)], \+ "only the rest-worst pair is comparable, and there the two probes agree"+++def test_a_finding_whose_message_changes_still_counts() -> None:+ """The whole point of reading `target` / `data`: a wording change in+ `aggregate_findings` used to silently zero this report."""+ from bench.penetration_thresholds import sweep_pairs++ f = _sweep("x|y", 0.01, poses=[{}], worst_pose={})+ f["message"] = "completely different wording"+ assert sweep_pairs({"gate": "joint_sweep", "findings": [f]}, rest_only=False) == {("x", "y"): 0.01}