Official Codebase of 3DCodeVerse
Python
review round 3 of #4: the pose export resolves <mimic>, one file walker, and the docs match the code
Claudef330c1fa3064
diff --git a/harness/bench/coupling_stats.py b/harness/bench/coupling_stats.pyindex 2f5a62c1..2f8dba78 100644--- a/harness/bench/coupling_stats.py+++ b/harness/bench/coupling_stats.py@@ -23,11 +23,9 @@ from pathlib import Pathsys.path.insert(0, str(Path(__file__).resolve().parent.parent)) # `python bench/coupling_stats.py` from the repo root+from codeverse.flywheel.record import unique_files # noqa: E402from codeverse.spatial.joints_model import UrdfError, load_urdf # noqa: E402-#: run-layout directories holding a SUB-workspace, as in bench/session_stats-SUBRUN_DIRS = frozenset({"_cand", "_assets"})-def _urdfs(root: Path) -> list[Path]:"""The BUILT ``robot.urdf`` of each run under ``root``, once per run.@@ -35,18 +33,9 @@ def _urdfs(root: Path) -> list[Path]:A run holds the same file three times — ``src/`` (what the agent wrote),``artifacts/`` (what the build produced) and ``deliverable/`` (what finalise copied) —so counting files instead of runs multiplies every mechanical number by three. The- artefact is the one the sweep actually posed.-- ``recurse_symlinks=True`` + resolve-dedupe for the same reason as- ``bench/session_stats._sessions``: batteries symlink each other's cells, and a walk- that leaves symlink behaviour to the default counts a run once or twice depending on- how the tree happens to be laid out."""- seen: dict[Path, Path] = {}- for p in sorted(root.rglob("robot.urdf", recurse_symlinks=True)):- if p.parent.name != "artifacts" or SUBRUN_DIRS & set(p.parts):- continue- seen.setdefault(p.resolve(), p)- return sorted(seen.values())+ artefact is the one the sweep actually posed. The walk is+ ``flywheel.record.unique_files``, so a cell symlinked from another battery is one run."""+ return [p for p in unique_files(root, "robot.urdf") if p.parent.name == "artifacts"]def _prompt_of(path: Path) -> str:@@ -114,11 +103,7 @@ def gate_stats(root: Path) -> dict:The mechanical counts below say which poses were SAMPLED; this says what the gate thatjudges those poses reported, which is the loss event a coupled battery is run for."""rounds = ran = failed = errors = 0- seen: set[Path] = set()- for rec in root.rglob("record.json"):- if rec.resolve() in seen or SUBRUN_DIRS & set(rec.parts):- continue- seen.add(rec.resolve())+ for rec in unique_files(root, "record.json"): # the same cells _urdfs saw, symlinks includedtry:data = json.loads(rec.read_text())except (OSError, ValueError):diff --git a/harness/bench/data/coupled/README.md b/harness/bench/data/coupled/README.mdindex 7008a8a0..40720acb 100644--- a/harness/bench/data/coupled/README.md+++ b/harness/bench/data/coupled/README.md@@ -7,7 +7,10 @@ Ten one-input linkages (`bench/prompts/coupled_v1.yaml`), baseline round onlyone-input mechanism to declare its coupling, the skeleton emits `<mimic>`.* **nomimic** — the same tree with two edits and nothing else: the `mimic` field typed to`None` so the planner cannot fill it, and the paragraph that asks for it removed from- `prompts/tracks/plan_articulated.j2`.+ `codeverse/prompts/tracks/plan_articulated.j2`. That tree predates the `bench run`+ change that reports an all-unjudged run as an error, which is why `base_nomimic.jsonl`'s+ umbrella row reads `score_final: null, status: plateau, errors: ""` — the lost pair+ behind "9 paired prompts" below.python bench/coupling_stats.py <mimic_dir> <nomimic_dir> --per-promptpython bench/paired_compare.py <mimic_dir> --against <nomimic_dir>@@ -40,6 +43,15 @@ model a concept it lacks; it is turning something it volunteers only in the obviinto a question it has to answer every time.**What this does not show.** Whether the poses the sampler now avoids were ever the-reason a mechanism scored badly: the `joint_sweep` gate fails at the same rate in both-arms (5/10 vs 4/10, 26 vs 23 ERROR findings). The gate finds overlaps in reachable poses-just as it found them in unreachable ones.+reason a mechanism scored badly: the `joint_sweep` gate's failure rate is not detectably+different between the arms at n = 10 (5/10 vs 4/10, Wilson 0.24–0.76 vs 0.17–0.69; 26 vs+23 ERROR findings) — which is not the same as "the same rate". The gate finds overlaps+in reachable poses just as it found them in unreachable ones. The rows in this directory+carry score / cost / status only; the mechanical counts above were read from the two arms'+`artifacts/robot.urdf` files, which are not in the tree.++**Caveat (2026-09-04).** Both arms were rendered before the fix in+`spatial/joints_export.robot_scene`: the per-pose GLBs behind the articulation sheet posed+every `<mimic>` follower at rest, so the judge scored sheets in which the coupled links did+not move. The declaring / one-input counts come from the URDFs and stand; the score row and+the sweep-gate row need a re-run on the corrected export.diff --git a/harness/bench/data/plan_stage/README.md b/harness/bench/data/plan_stage/README.mdindex 5269733a..181b339b 100644--- a/harness/bench/data/plan_stage/README.md+++ b/harness/bench/data/plan_stage/README.md@@ -16,8 +16,9 @@ number whose data is not in the tree is not reproducible.`plan_once` runs the plan stage WITHOUT `Track.run`, so there is no run ledger and theworkspace is deleted: these rows are the record, and each carries its own `cost_usd` (thescript prints the total). `--keep-failed DIR` keeps the workspace of a call that produced-no plan, which is how the `parent == child` class below can be read. Rows recorded before-2026-09-03 carry no `started_at` / `tree_commit`; later ones do.+no plan, which is how the `parent == child` class below can be read. The `restart_*` and+`trigger_*` rows (2026-09-02/03) carry no `started_at` / `tree_commit`; `coupled_plan.jsonl`+and everything recorded after it do (plus `tree_dirty` when the tree had uncommitted edits).## The trigger, narrowed (2026-09-03)diff --git a/harness/bench/paired_compare.py b/harness/bench/paired_compare.pyindex 81d48e45..00c43252 100644--- a/harness/bench/paired_compare.py+++ b/harness/bench/paired_compare.py@@ -266,13 +266,30 @@ def rows_from_bench_run(out_dir: Path, arm: str) -> list[CellResult]:if not line.strip():continueraw = json.loads(line)+ # a bench-run row records no build flag: a cell with a verdict was built and judged,+ # one without (score None, passed None) was not — so `build_ok` here means "judged",+ # and `gen_cost_usd` is the run's WHOLE cost (plan + loop judge), as the field saysrows.append(CellResult(prompt_id=raw["id"], arm=arm, tier=raw.get("tier", ""),score=raw.get("score_final"), status=raw.get("status", ""),- build_ok=raw.get("score_final") is not None,+ passed=raw.get("passed"), build_ok=raw.get("passed") is not None,gen_cost_usd=float(raw.get("cost_usd") or 0.0), kind="harness"))return rows+def arm_names(a: Path, b: Path) -> tuple[str, str]:+ """Two distinct labels for two battery directories: the basenames, or — when those+ collide (``x/out`` vs ``y/out``) — enough of the path to tell them apart. Two arms+ with one name would silently pair every cell with itself."""+ a, b = a.resolve(), b.resolve()+ if a == b:+ raise SystemExit(f"--against names the same battery as out_dir: {a}")+ pa, pb = list(a.parts), list(b.parts)+ depth = 1+ while depth < min(len(pa), len(pb)) and pa[-depth:] == pb[-depth:]:+ depth += 1+ return "/".join(pa[-depth:]), "/".join(pb[-depth:])++def main(argv: list[str] | None = None) -> int:ap = argparse.ArgumentParser(description=__doc__.split("\n\n")[0])ap.add_argument("out_dir", help="a compare_backends output directory (holds results.jsonl)")@@ -282,9 +299,10 @@ def main(argv: list[str] | None = None) -> int:ns = ap.parse_args(argv)out = Path(ns.out_dir)if ns.against is not None:- rows = rows_from_bench_run(out, out.name) + rows_from_bench_run(ns.against, ns.against.name)- stats = [paired(latest_cells(rows), out.name, ns.against.name)]- md = render_markdown(stats, f"{out.name} vs {ns.against.name}")+ name_a, name_b = arm_names(out, ns.against)+ rows = rows_from_bench_run(out, name_a) + rows_from_bench_run(ns.against, name_b)+ stats = [paired(latest_cells(rows), name_a, name_b)]+ md = render_markdown(stats, f"{name_a} vs {name_b}")(out / "paired.md").write_text(md)print(md)return 0diff --git a/harness/bench/plan_stage_bench.py b/harness/bench/plan_stage_bench.pyindex e0eacdfe..d564f27c 100644--- a/harness/bench/plan_stage_bench.py+++ b/harness/bench/plan_stage_bench.py@@ -107,6 +107,12 @@ def tree_provenance(tree: Path, codeverse_file: str) -> dict[str, str]:capture_output=True, text=True, check=False, timeout=30)if proc.returncode == 0:out["tree_commit"] = proc.stdout.strip()+ # an arm made of "the same commit plus two uncommitted edits" would otherwise carry+ # the other arm's commit and read as identical code+ dirty = subprocess.run(["git", "-C", str(tree), "status", "--porcelain", "--untracked-files=no"],+ capture_output=True, text=True, check=False, timeout=30)+ if dirty.returncode == 0 and dirty.stdout.strip():+ out["tree_dirty"] = f"{len(dirty.stdout.splitlines())} modified file(s)"except (OSError, subprocess.SubprocessError): # a tree that is not a checkout is finepassreturn out@@ -138,9 +144,12 @@ def run_one(battery, item, backends, label: str, rep: int, provenance: dict[str,"seconds": round(time.time() - started, 1), **(provenance or {}),**_plan_shape(root / "ws"), **_stats(root / "ws")}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- kind = "planning" if "PlanningError" in error else "provider"+ # name what it was, by the same rule the report classifies the row: a provider block+ # says nothing about the code under test, everything else (a validation failure, a+ # budget ceiling) is a loss worth reading+ from bench.plan_stage_report import outcome++ kind = "provider" if outcome(row) == "provider" else "planning"keep_failed.mkdir(parents=True, exist_ok=True)shutil.move(str(root), str(keep_failed / f"{kind}_{item.id}_r{rep}"))else:@@ -172,7 +181,7 @@ def main(argv: list[str] | None = None) -> int:import codeversefrom bench._jsonl import seal_for_append # after the path insert: `python bench/x.py`- from bench.run_bench import Battery # puts bench/ on sys.path, not the tree+ from bench.run_bench import Batteryfrom codeverse.config import get_settingsif not Path(codeverse.__file__).resolve().is_relative_to(ns.tree.resolve()):raise SystemExit(f"--tree {ns.tree} but `codeverse` imported from {codeverse.__file__}: "diff --git a/harness/bench/session_stats.py b/harness/bench/session_stats.pyindex 6caa253a..12cf44d7 100644--- a/harness/bench/session_stats.py+++ b/harness/bench/session_stats.py@@ -18,42 +18,35 @@ from __future__ import annotationsimport argparseimport jsonimport statistics+import sysfrom collections import Counterfrom pathlib import Path+sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) # `python bench/session_stats.py` from the repo root++from codeverse.flywheel.record import unique_files # noqa: E402+#: gemini-cli names an MCP tool ``mcp_<server>_<tool>``; ours is the ``3dcv`` server.MCP_PREFIX = "mcp_3dcv_"-#: run-layout directories that hold a SUB-workspace (a scene asset candidate, a rejected-#: candidate): their sessions belong to that sub-run, not to the battery cell above them,-#: and ``flywheel.record.find_runs`` skips them for the same reason.-SUBRUN_DIRS = frozenset({"_cand", "_assets"})+++def _stdouts(root: Path) -> list[Path]:+ """Every session's ``stdout.json`` under ``root``, once per file on disk — the walk is+ ``flywheel.record.unique_files`` (follows the ``telemetry/trajectories`` symlink and+ collapses it; skips sub-workspaces), so no count here can double by layout."""+ return [p for p in unique_files(root, "stdout.json") if "trajectories" in p.parts]def _killed(root: Path) -> int:"""Sessions whose ``stdout.json`` is empty: the CLI died or was killed before printingits stats block. They carry no numbers, so they are not sessions for the rates above —but they are not nothing either, and a battery with many of them was a bad window."""- return sum(1 for p in root.rglob("stdout.json", recurse_symlinks=True)- if "trajectories" in p.parts and not SUBRUN_DIRS & set(p.parts) and p.stat().st_size <= 2)+ return sum(1 for p in _stdouts(root) if p.stat().st_size <= 2)def _sessions(root: Path) -> list[Path]:- """Every ``stdout.json`` under ``root``, once per file on disk.-- ``run/telemetry/trajectories`` is a symlink to ``run/trajectories``, so the walk has- to say what it does about symlinks rather than inherit it: ``recurse_symlinks=True``- reaches both paths and the resolve-dedupe collapses them. Walking with the default- (no descent into symlinked directories) would give the same answer here by accident,- and would silently double every number the day a battery is laid out differently.- """- seen: dict[Path, Path] = {}- for p in sorted(root.rglob("stdout.json", recurse_symlinks=True)):- if "trajectories" not in p.parts or SUBRUN_DIRS & set(p.parts):- continue- if p.stat().st_size <= 2:- continue # the CLI was killed before printing its stats: not a session's worth- seen.setdefault(p.resolve(), p)- return sorted(seen.values())+ """The sessions with a stats block (a killed one is counted by :func:`_killed`)."""+ return [p for p in _stdouts(root) if p.stat().st_size > 2]def tool_rates(sessions: list[Path]) -> tuple[Counter, Counter]:@@ -109,11 +102,7 @@ def token_rates(sessions: list[Path]) -> dict[str, float]:def round_costs(root: Path) -> list[float]:"""Generator dollars per round, from the run records (judging is billed elsewhere)."""out: list[float] = []- seen: set[Path] = set()- for rec in root.rglob("record.json", recurse_symlinks=True):- if rec.resolve() in seen or SUBRUN_DIRS & set(rec.parts):- continue- seen.add(rec.resolve())+ for rec in unique_files(root, "record.json"):try:rounds = (json.loads(rec.read_text()) or {}).get("rounds") or []except (OSError, ValueError):diff --git a/harness/codeverse/cost/reconstruct.py b/harness/codeverse/cost/reconstruct.pyindex 5e4aaaca..76a991d0 100644--- a/harness/codeverse/cost/reconstruct.py+++ b/harness/codeverse/cost/reconstruct.py@@ -38,6 +38,7 @@ from codeverse.contracts.common import Usagefrom codeverse.contracts.run import RunIdfrom codeverse.cost.ledger import price_callfrom codeverse.cost.types import CallCost, Role, Stage, role_for_stage, stage_for_label+from codeverse.flywheel.record import SUBRUN_DIRSfrom codeverse.proc import read_json_or_none, read_jsonl_lenientlog = logging.getLogger(__name__)@@ -434,7 +435,7 @@ def find_runs(root: str | Path) -> list[Path]:out: list[Path] = []for path in sorted(base.rglob("record.json")):rel = path.parent.relative_to(base).parts- if any(p in ("_assets", "_cand") for p in rel):+ if SUBRUN_DIRS & set(rel):continued = path.parentif d.name == "run" and (d.parent / "cell.json").is_file():@@ -445,7 +446,7 @@ def find_runs(root: str | Path) -> list[Path]:d = cell.parentif str(d) in known or (d / "run" / "record.json").is_file():continue- if any(p in ("_assets", "_cand") for p in d.relative_to(base).parts):+ if SUBRUN_DIRS & set(d.relative_to(base).parts):continueout.append(d)return outdiff --git a/harness/codeverse/flywheel/_git.py b/harness/codeverse/flywheel/_git.pyindex b196889a..444b1697 100644--- a/harness/codeverse/flywheel/_git.py+++ b/harness/codeverse/flywheel/_git.py@@ -15,6 +15,7 @@ adds :data:`~codeverse.workspace.GIT_SAFE_DIFF_FLAGS`.from __future__ import annotationsimport subprocess+from collections.abc import Collectionfrom pathlib import Pathfrom codeverse.workspace import GIT_SAFE_DIFF_FLAGS, GIT_SAFE_FLAGS, Workspace, git_safe_env@@ -30,8 +31,11 @@ class GitReadError(RuntimeError):"""A git read (ls-tree / cat-file / diff) failed or the commit does not exist."""-def _run_stdin(ws: Workspace, stdin: bytes, *args: str) -> subprocess.CompletedProcess[bytes]:- """:func:`_run` with input on stdin (``cat-file --batch`` reads its object list there)."""+def _run(ws: Workspace, *args: str, stdin: bytes | None = None) -> subprocess.CompletedProcess[bytes]:+ """One sanitised git invocation; ``stdin`` feeds ``cat-file --batch`` its object list.++ Every way the call can fail — no git binary, a timeout, a non-zero exit — is one+ :class:`GitReadError`, so a caller catches one thing."""try:proc = subprocess.run(["git", *GIT_SAFE_FLAGS, *args], cwd=ws.root, capture_output=True, check=False,@@ -40,20 +44,8 @@ def _run_stdin(ws: Workspace, stdin: bytes, *args: str) -> subprocess.CompletedPexcept (OSError, subprocess.SubprocessError) as e:raise GitReadError(f"git {' '.join(args)} in {ws.root}: {e}") from eif proc.returncode != 0:- raise GitReadError(f"git {' '.join(args)} in {ws.root}: {proc.stderr.decode('utf-8', errors='replace')[:400]}")- return proc---def _run(ws: Workspace, *args: str) -> subprocess.CompletedProcess[bytes]:- try:- proc = subprocess.run(- ["git", *GIT_SAFE_FLAGS, *args], cwd=ws.root, capture_output=True, check=False,- env=git_safe_env(), timeout=_GIT_TIMEOUT_S,- )- except subprocess.TimeoutExpired as e: # pragma: no cover - defensive- raise GitReadError(f"git {' '.join(args)} timed out in {ws.root}") from e- if proc.returncode != 0:- raise GitReadError(f"git {' '.join(args)} failed in {ws.root}: {proc.stderr.decode(errors='replace').strip()}")+ raise GitReadError(f"git {' '.join(args)} failed in {ws.root}: "+ f"{proc.stderr.decode('utf-8', errors='replace').strip()[:400]}")return proc@@ -85,14 +77,9 @@ def _keep(rel: str) -> bool:return bool(parts) and parts[0] in CODE_ROOTS and not any(p in _SKIP_PARTS for p in parts)-def list_files_at(ws: Workspace, commit: str) -> list[str]:- """Sorted repo-relative paths under the code roots at ``commit``."""- out = _run(ws, "ls-tree", "-r", "--name-only", "-z", commit, "--", *CODE_ROOTS).stdout- return sorted(p for p in out.decode("utf-8", errors="replace").split("\0") if p and _keep(p))---def read_tree_at(ws: Workspace, commit: str) -> dict[str, bytes]:- """``{repo-relative path: bytes}`` for every code file at ``commit`` (binary-safe).+def read_tree_at(ws: Workspace, commit: str, *, paths: Collection[str] | None = None) -> dict[str, bytes]:+ """``{repo-relative path: bytes}`` for every code file at ``commit`` (binary-safe);+ ``paths`` narrows it to those files, so a caller after two of forty streams two.``ls-tree`` + ``cat-file --batch``, never ``git archive``: archive renders contentthrough ``convert_to_working_tree``, so an agent-planted ``filter.<name>.smudge``@@ -114,10 +101,12 @@ def read_tree_at(ws: Workspace, commit: str) -> dict[str, bytes]:# `src/link.py -> model.py` comes back as a one-line file saying "model.py".if len(parts) < 3 or parts[1] != "blob" or parts[0] == "120000" or not _keep(path):continue+ if paths is not None and path not in paths:+ continueentries.append((parts[2], path))if not entries:return {}- proc = _run_stdin(ws, b"".join(f"{sha}\n".encode() for sha, _ in entries), "cat-file", "--batch")+ proc = _run(ws, "cat-file", "--batch", stdin=b"".join(f"{sha}\n".encode() for sha, _ in entries))files: dict[str, bytes] = {}buf, pos = proc.stdout, 0for _, path in entries:diff --git a/harness/codeverse/flywheel/record.py b/harness/codeverse/flywheel/record.pyindex 213daac9..d6f092f0 100644--- a/harness/codeverse/flywheel/record.py+++ b/harness/codeverse/flywheel/record.py@@ -312,6 +312,27 @@ RUN_SEARCH_DEPTH = 7#: subdirectories that mark a bench battery directory rather than a plain runs rootBATTERY_MARKERS = ("runs", "cells", "arms")+#: run-layout directories that hold a SUB-workspace (a scene asset candidate, a rejected+#: best-of-N candidate): their files belong to that sub-run, not to the run above them.+#: ``cost.reconstruct.find_runs`` and the bench survey scripts skip them by this one name.+SUBRUN_DIRS: frozenset[str] = frozenset({"_cand", "_assets"})+++def unique_files(root: Path | str, name: str) -> list[Path]:+ """Every file called ``name`` under ``root``, once per file on disk.++ Battery trees symlink each other's cells and every run has+ ``run/telemetry/trajectories -> run/trajectories``, so a walk must say what it does+ about symlinks: this one follows them (``recurse_symlinks=True``) and collapses the+ two paths of one file by its resolved path. Sub-workspaces (:data:`SUBRUN_DIRS`) are+ skipped. The one walker for every survey that counts sessions, records or artefacts —+ each hand-rolled copy of it has at some point counted a file twice."""+ seen: dict[Path, Path] = {}+ for p in sorted(Path(root).rglob(name, recurse_symlinks=True)):+ if SUBRUN_DIRS & set(p.parts):+ continue+ seen.setdefault(p.resolve(), p)+ return sorted(seen.values())def is_run_dir(p: Path) -> bool:diff --git a/harness/codeverse/flywheel/refine.py b/harness/codeverse/flywheel/refine.pyindex 197a0a36..6e5f7eaa 100644--- a/harness/codeverse/flywheel/refine.py+++ b/harness/codeverse/flywheel/refine.py@@ -31,7 +31,12 @@ from codeverse.contracts.artifacts import Severityfrom codeverse.contracts.run import RoundRecord, RunRecordfrom codeverse.flywheel._git import GitReadError, changed_files_between, diff_between, read_tree_atfrom codeverse.flywheel.pairs import MIN_PREFERENCE_DELTA-from codeverse.flywheel.record import effective_judgment, effective_score, iter_runs+from codeverse.flywheel.record import (+ BATTERY_MARKERS,+ effective_judgment,+ effective_score,+ iter_runs,+)from codeverse.workspace import Workspace#: rounds that answer a judgment. A texture or asset round is driven by its own pass, and@@ -108,9 +113,7 @@ def _transition(ws: Workspace, rec: RunRecord, prev: RoundRecord, cur: RoundRecoif with_code:def _text(commit: str, keep: list[str] | None) -> dict[str, str]:out = {}- for path, raw in read_tree_at(ws, commit).items():- if keep is not None and path not in keep:- continue+ for path, raw in read_tree_at(ws, commit, paths=keep).items():try:out[path] = raw.decode("utf-8")except UnicodeDecodeError:@@ -128,9 +131,9 @@ def _transition(ws: Workspace, rec: RunRecord, prev: RoundRecord, cur: RoundRecooutcome=outcome_of(delta, threshold), before_files=files_before, after_files=files_after)-#: path segments that are run LAYOUT, not a battery name (compare_backends and ab_plan-#: bury their runs this deep)-_LAYOUT_DIRS = frozenset({"cells", "runs", "arms"})+#: path segments that are run LAYOUT, not a battery name — the same markers ``iter_runs``+#: discovers batteries by+_LAYOUT_DIRS = frozenset(BATTERY_MARKERS)def _identity(root: Path, found: Any) -> tuple[str, str]:diff --git a/harness/codeverse/languages/urdf/__init__.py b/harness/codeverse/languages/urdf/__init__.pyindex 8fa72c50..337da0e8 100644--- a/harness/codeverse/languages/urdf/__init__.py+++ b/harness/codeverse/languages/urdf/__init__.py@@ -258,20 +258,10 @@ def _lint_mimics(joints: list[ET.Element], out: list[GateFinding]) -> None:specs.append(MimicSpec(key=jname, name=jname, movable=movable, target=src or None,multiplier=mult, offset=off, lower=lo, upper=hi))known = sorted({el.get("name", "") for el in joints if el.get("name")})- # An instanced driver emits <driver>_1 .. _n and the skeleton binds followers to _1- # only, so _2..n stay independent inputs and the sweep drives them: real for the- # mechanism (each instance has its own coupling to declare), silent until now.- instanced = {n.rsplit("_", 1)[0] for n in known if n.rsplit("_", 1)[-1].isdigit()}- for spec in specs:- base = (spec.target or "").rsplit("_", 1)- if len(base) == 2 and base[1] == "1" and base[0] in instanced:- siblings = sorted(n for n in known if n.startswith(f"{base[0]}_") and n != spec.target)- if siblings:- out.append(_f(Severity.WARN, f"joint '{spec.name}': follows '{spec.target}' only; "- f"{', '.join(siblings)} stay independent inputs and the "- "sweep drives them separately", target=spec.name,- fix="give each instance its own <mimic>, or make the followers "- "follow one shared driver"))+ # NOT checked here: whether a follower of `<driver>_1` should also follow `_2..n`.+ # Only the skeleton knows which `_N` names are instances of one plan joint (an agent+ # names joints `hinge_1` / `hinge_2` by hand all the time), so that note is written+ # where the instancing happens — compute_urdf_frames — as a comment in the file.for i in mimic_issues(specs):j, t = i.joint, i.targetif i.kind == "immobile":@@ -550,6 +540,7 @@ class JointRow:upper: float | Nonerest: float = 0.0 # plan rest value the limits were shifted by (0 → limits == plan limits)mimic: tuple[str, float, float] | None = None # (driving joint, multiplier, offset)+ mimic_note: str = "" # written beside the <mimic> as a comment (an instanced driver's other copies)@dataclass@@ -632,7 +623,12 @@ def compute_urdf_frames(plan: ArticulatedPlan) -> UrdfFrames:target, mult, off = jr.mimicif f"{target}_1" not in emitted:raise ValueError(f"joint {jr.name}: mimic target {target!r} was not emitted; joints are {sorted(emitted)}")- joints[i] = replace(jr, mimic=(f"{target}_1", mult, off))+ # the other instances stay independent inputs the sweep drives on their own; say so+ # in the file, here where the instancing is known, rather than guessing from names+ others = sorted(n for n in emitted if n.startswith(f"{target}_") and n != f"{target}_1")+ joints[i] = replace(jr, mimic=(f"{target}_1", mult, off),+ mimic_note=f"follows {target}_1 only; {', '.join(others)} stay independent inputs "+ "(add a <mimic> per instance if they move together)")# link frames: root at origin, others at their pivotfor name, p, center in parts:@@ -647,7 +643,8 @@ def compute_urdf_frames(plan: ArticulatedPlan) -> UrdfFrames:cf = links[jr.child].frame_xyzfixed.append(JointRow(name=jr.name, type=jr.type, parent=jr.parent, child=jr.child,origin_xyz=tuple(c - p for c, p in zip(cf, pf, strict=True)), axis=jr.axis,- lower=jr.lower, upper=jr.upper, rest=jr.rest, mimic=jr.mimic))+ lower=jr.lower, upper=jr.upper, rest=jr.rest, mimic=jr.mimic,+ mimic_note=jr.mimic_note))return UrdfFrames(robot_name=to_snake(plan.object_name), root=root, links=links, joints=fixed)@@ -685,7 +682,8 @@ def render_urdf(frames: UrdfFrames) -> str:if jr.mimic is not None:src, mult, off = jr.mimiclines.append(f' <mimic joint="{src}" multiplier="{_fmt(mult)}" offset="{_fmt(off)}"/>'- " <!-- driven: the sweep moves the driver, this joint follows -->")+ f" <!-- driven: the sweep moves the driver, this joint follows"+ f"{'; ' + jr.mimic_note if jr.mimic_note else ''} -->")lines.append(" </joint>")lines.append("</robot>")return "\n".join(lines) + "\n"diff --git a/harness/codeverse/spatial/joints_export.py b/harness/codeverse/spatial/joints_export.pyindex b9a6b830..a617562f 100644--- a/harness/codeverse/spatial/joints_export.py+++ b/harness/codeverse/spatial/joints_export.py@@ -22,7 +22,7 @@ import trimeshfrom codeverse.contracts.artifacts import RenderSetfrom codeverse.conventions import OBJECT_VIEWS_QUICK, ViewPresetfrom codeverse.spatial._render_common import out_directory-from codeverse.spatial.joints_model import Joint, Robot, fk+from codeverse.spatial.joints_model import Joint, Robot, fk, resolve_qfrom codeverse.spatial.joints_poses import limit_posesfrom codeverse.spatial.render import render_glbfrom codeverse.spatial.sheet import contact_sheet@@ -56,8 +56,11 @@ def robot_node_name(robot: Robot) -> str:def robot_scene(robot: Robot, pose: dict[str, float] | None = None, *, joint_extras_on: bool = True) -> trimesh.Scene:"""Build the trimesh.Scene (hierarchical, Y-up) for ``robot`` at ``pose``."""- pose = pose or {}- T = fk(robot, pose) # validates joint names+ fk(robot, pose or {}) # validates joint names+ # the RESOLVED pose: a <mimic> follower moves with its driver in the export too, not+ # only in fk. The sheet the judge sees and the sweep's collision check are the same+ # mechanism only if both pose it the same way (review, 2026-09-04: they did not).+ pose = resolve_q(robot, pose or {})scene = trimesh.Scene(base_frame=SCENE_BASE_FRAME) # never a link name (a link 'world' would close a cycle)robot_node = robot_node_name(robot)meta = {"links": robot.link_order(), "frame": "y_up_pos_z_front", "pose": dict(pose), "units": "meters"}@@ -83,7 +86,6 @@ def robot_scene(robot: Robot, pose: dict[str, float] | None = None, *, joint_extscene.add_geometry(piece.copy(), node_name=f"{name}__{i}", geom_name=f"{name}__{i}", parent_node_name=name,transform=np.eye(4))scene.metadata.update(meta)- del Treturn scenediff --git a/harness/codeverse/workspace.py b/harness/codeverse/workspace.pyindex 5b945a0e..fcff4fdb 100644--- a/harness/codeverse/workspace.py+++ b/harness/codeverse/workspace.py@@ -56,12 +56,15 @@ _GITIGNORE_LINES = ()-#: prepended to every git argv run against a run workspace: an agent-planted hook,-#: fsmonitor or unnamed external diff driver never runs, and the GLOBAL attributes file-#: cannot name one either. ``-c`` outranks ``.git/config``, so these hold even in a-#: repository the agent has written to.+#: prepended to every git argv run against a run workspace: an agent-planted hook or+#: fsmonitor never runs, and the GLOBAL attributes file cannot name a driver either.+#: ``-c`` outranks ``.git/config``, so these hold even in a repository the agent has+#: written to. ``diff.external`` is deliberately NOT here: ``-c diff.external=`` sets+#: it to the empty string, which git tries to EXECUTE (``fatal: external diff died``) on+#: any diff that forgets ``GIT_SAFE_DIFF_FLAGS`` — and ``--no-ext-diff`` there is what+#: neutralises a planted driver in the first place.GIT_SAFE_FLAGS = ("-c", "core.hooksPath=/dev/null", "-c", "core.fsmonitor=false",- "-c", "core.attributesFile=/dev/null", "-c", "diff.external=")+ "-c", "core.attributesFile=/dev/null")#: added to every git command that RENDERS file content (diff / show / log -p). A#: NAMED driver — ``.gitattributes`` "*.bin diff=x" plus ``[diff "x"] textconv``/``command``#: in .git/config, both agent-writable — is not reachable by ``-c``, and ``--no-ext-diff``diff --git a/harness/docs/COST.md b/harness/docs/COST.mdindex ae08c5fe..37e51ccd 100644--- a/harness/docs/COST.md+++ b/harness/docs/COST.md@@ -1483,8 +1483,8 @@ link, while `sweep_findings` downgrades small rest overlaps and hinge gaps to WA**Measured after the fix** (`bench/out/wave2_lean`, the same battery and config as the`aa_articulated` A/A above, 2026-09-03). Both columns are printed by-`bench/session_stats.py aa_articulated wave2_lean`, which reads each session's own stats-block and each round's recorded `usage`:+`python bench/session_stats.py bench/out/aa_articulated bench/out/wave2_lean`, which reads+each session's own stats block and each round's recorded `usage`:| per generator request | before (`aa_articulated`) | after (`wave2_lean`) ||---|--:|--:|@@ -1493,7 +1493,7 @@ block and each round's recorded `usage`:| MCP tool calls reported as errors | 26.6 % (482 / 1 814) | **1.3 %** (25 / 1 863) || cache hit | 69 % | **90 %** || uncached prompt tokens per request | 38 521 | **13 480** (−65 %) |-| generator $ per round | mean 1.900, median 1.572 | **mean 1.242, median 0.950** (−35 % / −40 %) |+| generator $ per round (median; the script prints medians only) | 1.572 | **0.950** (−40 %) |**Correction (2026-09-03), and what it does NOT explain.** The after column first read1.4 % (48 / 3 480), 13 736 uncached tokens and median \$0.967 over "108 sessions / 5 082diff --git a/harness/docs/DECISIONS.md b/harness/docs/DECISIONS.mdindex 8bceb3e0..fca0c31e 100644--- a/harness/docs/DECISIONS.md+++ b/harness/docs/DECISIONS.md@@ -723,8 +723,8 @@ written) that were accepted because the code works that way and the tests pin itthree templates, and the measurement above is the record of what it was worth. Tore-run it, restore the branch commit named in docs/PAPER_WRITING.md §9.3.* **Reading an agent's repo is a sandbox boundary, and `git archive` is not inside it.**- Every flywheel read of a workspace already ran under `GIT_SAFE_FLAGS` (five `-c`- overrides — hooks, fsmonitor, the global attributes file, `diff.external` — plus no+ Every flywheel read of a workspace already ran under `GIT_SAFE_FLAGS` (three `-c`+ overrides — hooks, fsmonitor, the global attributes file — plus nosystem/global config from `git_safe_env`; `.git/config` itself is still read in full,which is the whole reason the tests plant there) and `--no-ext-diff --no-textconv` fordiffs, because a@@ -751,11 +751,17 @@ written) that were accepted because the code works that way and the tests pin itrecomputes all of it from the recorded URDFs (both counts are properties of the file).The score effect on the three coupled prompts is inside the noise band at n=2 per side,as expected; the pose count is the readout that resolves. What does NOT resolve, and- is recorded so nobody claims it: the `joint_sweep` gate fails 30 % of the coupled- prompts' rounds with couplings (11/37) against 31 % without (12/39), and the spread- across pre-mimic batteries (19–31 %) is wider than that difference. Fewer poses, all- reachable — but the gate still finds overlaps in them, and the two arms are not the- same artefacts measured twice (a pre-mimic plan declares no coupling at all).+ is recorded so nobody claims it: the `joint_sweep` gate's failure rate is not+ detectably different with couplings (11/37, 30 %) and without (12/39, 31 %) — a hand+ count, no script prints the per-prompt subset — and the spread across pre-mimic+ batteries (19–31 %) is wider than that difference. Fewer poses, all reachable — but+ the gate still finds overlaps in them, and the two arms are not the same artefacts+ measured twice (a pre-mimic plan declares no coupling at all). Caveat (2026-09-04):+ every judge- and gate-side readout above was produced before+ `spatial/joints_export.robot_scene` resolved `<mimic>` followers — the sheets the judge+ saw posed them at rest while the sweep posed them through `fk`. The pose counts come+ from the URDFs and stand; the scores and gate rates need a re-run on the corrected+ export.## Rejected / deferreddiff --git a/harness/docs/INTERFACES.md b/harness/docs/INTERFACES.mdindex 0d2f9b6b..593c72b4 100644--- a/harness/docs/INTERFACES.md+++ b/harness/docs/INTERFACES.md@@ -531,15 +531,20 @@ from codeverse.flywheel.refine import build_refine, transitions, RefineTransitio# (threshold: pairs.MIN_PREFERENCE_DELTA); dropped rows carry the reason (no_predecessor / no_commit /# predecessor_build_failed / predecessor_unjudged / git_read_failed / duplicate_run)from codeverse.flywheel._git import read_tree_at, diff_between, changed_files_between, commit_exists, GitReadError- # read_tree_at(ws, commit) -> {path: bytes} via ls-tree + cat-file --batch — NEVER `git archive`, which- # renders content through a planted filter.<name>.smudge and has no --no-filters (tests/flywheel_cli)+ # read_tree_at(ws, commit, *, paths=None) -> {path: bytes} via ls-tree + cat-file --batch — NEVER+ # `git archive`, which renders content through a planted filter.<name>.smudge and has no --no-filters+ # (tests/flywheel_cli); symlinks (mode 120000) are skipped; `paths` reads only those files+from codeverse.flywheel.record import unique_files, SUBRUN_DIRS, BATTERY_MARKERS+ # unique_files(root, name) -> [Path]: every file called `name` under root ONCE per file on disk (follows+ # the run/telemetry/trajectories symlink and collapses it; skips SUBRUN_DIRS = {_cand, _assets}) — the+ # one walker behind bench/session_stats.py, bench/coupling_stats.py and cost.reconstruct.find_runs# diff_between(ws, before, after, *, max_bytes=None) -> (text, untruncated size, was_truncated)# changed_files_between(ws, before, after) -> [path]; commit_exists(ws, commit) -> bool# both under GIT_SAFE_DIFF_FLAGS (--no-ext-diff --no-textconv) on top of workspace.GIT_SAFE_FLAGSfrom codeverse.workspace import GIT_SAFE_FLAGS, GIT_SAFE_DIFF_FLAGS, git_safe_env# every read of an agent-written repo goes through these. They do NOT disable .git/config —- # git reads it in full; `-c` only OVERRIDES five keys (hooksPath, fsmonitor, attributesFile,- # diff.external, plus the diff flags), which is why a NAMED filter./diff. driver in .git/config+ # git reads it in full; `-c` only OVERRIDES three keys (hooksPath, fsmonitor, attributesFile)+ # and the diff flags cover ext-diff/textconv, which is why a NAMED filter./diff. driver in .git/config# is still live and why read_tree_at avoids every content-rendering command. git_safe_env drops# the SYSTEM and GLOBAL config (GIT_CONFIG_NOSYSTEM, GIT_CONFIG_GLOBAL=/dev/null) and the# inherited environment (HOME, PATH, GIT_TERMINAL_PROMPT)diff --git a/harness/docs/PAPER_WRITING.md b/harness/docs/PAPER_WRITING.mdindex 822d328d..14a7b2ea 100644--- a/harness/docs/PAPER_WRITING.md+++ b/harness/docs/PAPER_WRITING.md@@ -2,8 +2,8 @@Everything a paper about this harness would need in one file: what the system is, what wasbuilt, every experiment with its setup and numbers, the null results, the mechanism findings,-the methodology, and a claim → evidence index. Written 2026-09-03 over the work of-2026-08-25 → 09-03; each number names the run directory that produced it.+the methodology, and a claim → evidence index. Written 2026-09-03/04 over the work of+2026-08-25 → 09-04; each number names the run directory that produced it.**This file is the LEDGER, not a second copy of the measurements.** Each entry says whatwas claimed, which script recomputes it, which data it reads and what its status is; the@@ -152,7 +152,7 @@ They are recorded so nobody re-runs them expecting a different answer.|---|---|--:|--:|---|---|---|| **Plan-time geometry re-ask** (`CV3D_PLAN_GEOMETRY`, D49) | `compare_art_v4` pf vs pf0 | 14 | +0.064 | ±0.25 | 6/6/2 | ships **OFF** || **Pro planner** (`gemini-3.1-pro` vs `3.7-flash`) | `compare_art_v4` pp vs pf | 13 | +0.090 | ±0.23 | 9/2/2 | keep flash: 2–10× plan cost, 5/14 cells lost to provider limits |-| **Deterministic repairs** (`CV3D_AXIS_REPAIR`) | `ab_repairs`, plan pinned | 12 | −0.039 | ±0.105 | 2/5/5 | ships **OFF**; the axis flip fired in 1 of 12 cells |+| **Deterministic repairs** (`CV3D_ART_REPAIRS`, a bundle since removed; its axis flip lives on as upstream's `CV3D_AXIS_REPAIR`, ON by default) | `ab_repairs`, plan pinned | 12 | −0.039 | ±0.105 | 2/5/5 | the bundle does not ship; the axis flip fired in 1 of 12 cells || **Fewer turns** (`CV3D_FEWER_TURNS`) | `ab_fewer_turns`, plan pinned | 14 | +0.015 | ±0.126 | 6/5/3 | ships **OFF**; −12 % tool calls, $/cell unchanged || **Lean prompt** (`CV3D_LEAN_PROMPT`) | `wave2_lean`, plan pinned | 12 | +0.030 | ±0.076 | 8/3/1 | ships **OFF**; −45.7 % generate prompt chars, $3.51 vs $3.66 per cell; code removed 2026-09-03 in review (D52); the numbers stand, the second prompt path does not. |@@ -200,11 +200,11 @@ requires a collapsed plan, and a restart no longer spends one of the two validatslots). Three arms in ONE window, 700 calls,`bench/data/plan_stage/trigger_{off,wide,narrow}.jsonl`:-| arm | judged | `PlanningError` | rate | dangling-link class | `parent == child` class |-|---|--:|--:|--:|--:|--:|-| restart off | 140 | 4 | 2.9 % | 3 | 1 |-| trigger as measured above | 275 | 6 | 2.2 % | 4 | 2 |-| trigger narrowed | 276 | 5 | 1.8 % | **0** | 4 (+1 budget ceiling) |+| arm | judged | losses | rate | `dangling_link` | `parent_eq_child` | other |+|---|--:|--:|--:|--:|--:|--:|+| restart off | 140 | 4 | 2.9 % | 3 | 1 | 0 |+| trigger as measured above | 275 | 6 | 2.2 % | 4 | 2 | 0 |+| trigger narrowed | 276 | 5 | 1.8 % | **0** | 4 | 1 (budget ceiling) |**No pair separates on the overall rate** (Fisher 0.45–0.75) — and this window's owncontrol loses 2.9 %, not 4.7 %, so the headline above is a property of its window as much@@ -233,10 +233,9 @@ paper needs from this section:* **The fault.** `spatial/mcp_server.py` returned `is_error = not obs.ok`, and `obs.ok` isthe tool's **verdict**, so a joint sweep that ran correctly and reported a penetration- reached the model as a *broken call* it then retried — 62 % of 1 445 sweep calls and- 23 % of 2 144 builds, against a harness gate failure rate of 19 %. The rate replicates- across five recorded batteries (sweep 55–66 %, build 20–28 %,- `bench/session_stats.py`), so it is the mechanism and not one window.+ reached the model as a *broken call* it then retried. The per-tool rates are COST §30's+ first table; they replicate across five recorded batteries (`bench/session_stats.py`),+ so it is the mechanism and not one window.* **The amplifier.** gemini-cli's *error* path stringifies the whole result, so a 275 kBarticulation sheet arrives as ≈261 k prompt tokens of base64 text instead of ≈516 as aninline image (≈507×), escaping the vendor's own truncation. ~10 % of requests carried@@ -247,8 +246,8 @@ paper needs from this section:* **The change.** `Observation.failed` ("the tool could not run") beside `ok` (theverdict); MCP `is_error` is `failed` alone; every affected tool leads its text with theverdict; the MCP boundary bounds text characters, image count and encoded image bytes.-* **The readout** (`bench/session_stats.py aa_articulated wave2_lean`, both columns- printed by the script): calls reported as errors **26.6 % → 1.3 %**, cache+* **The readout** (`python bench/session_stats.py bench/out/aa_articulated bench/out/wave2_lean`,+ both columns printed by the script): calls reported as errors **26.6 % → 1.3 %**, cache**69 % → 90 %**, uncached prompt tokens per request **38 521 → 13 480**, generatordollars per round median **1.572 → 0.950**. The residual 1.3 % are genuine`Observation.error` cases. An earlier hand-computed after column (1.4 %, 13 736,@@ -290,7 +289,25 @@ properties of the file):| casement window | 6 | 7 | 6 |**8 of 14 prompts** declared a coupling at all (98 of 176 built URDFs); across those the-median goes **6 → 3** driven joints, and 24 URDFs are fully one-input.+median goes **6 → 3** driven joints, and 24 URDFs are fully one-input. (The absolute+counts in this table and this line are per URDF *file*, taken before `coupling_stats.py`+was made per-run on 2026-09-04 — each run holds the file three times, so they are about+3× the run counts; the medians and the 8-of-14 are unaffected. Not recomputed: the+corpus is not in the tree.) The mechanisms the support was built for — umbrella, step+ladder, folding workbench — are the ones that collapse to 1–2. The pre-mimic batteries+(`aa_articulated`, `compare_art_v4_pf0`) contain **zero** couplings, so nothing else on+the battery changed shape. The score effect on the three coupled prompts is inside the+noise band at n = 2 per side (umbrella 0.35/0.65 → 0.54/0.64, scissor 0.46/0.54 →+0.49/0.60, workbench 0.91/0.60 → 0.60/0.60); the **pose count is the readout that+resolves.**++**Caveat on every judge- and gate-side number in this section (2026-09-04).** Until the+fix in `spatial/joints_export.robot_scene`, the per-pose GLBs behind the articulation+sheet posed every `<mimic>` follower at rest — only `fk` (and so the collision sweep)+resolved the coupling. The mechanical counts above come from the URDFs and stand; the+score readouts and the `joint_sweep` gate rates below were produced on sheets where the+followers did not move, and need a re-run on the corrected export before either is cited+as evidence for or against `<mimic>`.**A battery built for the question** (`coupled_v1`, ten one-input linkages, 2026-09-04)separates what the planner does from what the agent does. Plan stage alone, 200 calls:@@ -299,7 +316,9 @@ one-input mechanisms collapse to a single degree of freedom and the branching onpram's fold hinge driving handle, seat back and two leg pairs) declare 3 of 8. Then twobuild-and-judge arms, baseline round only, differing by two edits — the `mimic` fieldtyped to `None` so the planner cannot fill it, and the paragraph asking for it removed-from the plan prompt (`bench/data/coupled/`):+from `codeverse/prompts/tracks/plan_articulated.j2` (`bench/data/coupled/`; the nomimic+umbrella cell scored nothing — no verdict in any round, the shape `bench run` now reports+as an error — so the score row has nine pairs, not ten):| readout | planner may declare | planner may not ||---|--:|--:|@@ -318,25 +337,21 @@ mechanisms on the battery, and nothing else. Making the coupling a plan field iteaching a concept the model lacks; it turns something it volunteers in the obvious casesinto a question it answers every time.-What this still does not show: the `joint_sweep` gate fails at the same rate in both arms,-so the poses the sampler now avoids are not demonstrably the ones that were costing-score.--**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,-`wave2_lean`) against 31 % without them (12 of 39, `aa_articulated`; `ab_fewer_turns` 19 %-of 37, `compare_art_v4_pf0` 25 % of 8 — the spread across pre-mimic batteries is wider than-the before/after difference). The sampler drives fewer joints and every pose it drives is-reachable, but the gate still finds links overlapping in them. The comparison is also-confounded at the source: a pre-mimic URDF declares no couplings at all, so the two arms-are not the same artefacts measured twice. What can be said is the mechanical claim (which-poses are sampled); the claim that the gate's findings became *truer* is not measured, and-this readout does not support it. The mechanisms the-support was built for — umbrella, step ladder, folding workbench — are the ones that collapse-to 1–2. The pre-mimic batteries (`aa_articulated`, `compare_art_v4_pf0`) contain **zero**-couplings, so nothing else on the battery changed shape. The score effect on the three coupled prompts is inside the noise band-at n = 2 per side (umbrella 0.35/0.65 → 0.54/0.64, scissor 0.46/0.54 → 0.49/0.60, workbench-0.91/0.60 → 0.60/0.60); the **pose count is the readout that resolves.**+**What is NOT shown: that the sweep gate's failure rate moved.** Two comparisons, both+null and both too small to be equivalence claims. On `coupled_v1` the gate fails 5/10+rounds with the coupling declared against 4/10 without (Wilson 0.24–0.76 vs 0.17–0.69, a+hand count over the two arms' records). Across batteries, on the eight coupled prompts,+it fails 30 % of the rounds with couplings declared (11 of 37, `wave2_lean`) against 31 %+without (12 of 39, `aa_articulated`; `ab_fewer_turns` 19 % of 37, `compare_art_v4_pf0`+25 % of 8 — the spread across pre-mimic batteries is wider than the before/after+difference). Neither number is printed by a script: `coupling_stats.py --per-prompt`+reports the gate per battery, not per prompt subset, and the batteries are not in the+tree. The sampler drives fewer joints and every pose it drives is reachable, but the gate+still finds links overlapping in them — and the cross-battery comparison is confounded at+the source, since a pre-mimic URDF declares no couplings at all. What can be said is the+mechanical claim (which poses are sampled); "not detectably different at this n" is what+the gate data carries, and the claim that the gate's findings became *truer* is not+measured.### 5.4 Provider-failure accounting@@ -398,7 +413,7 @@ instructions nor a diff.plausible levers landed inside that band; none of them is thereby shown to do nothing.3. **The changes that mattered were found by counting loss events, not by scoring artefacts.**Planner mortality 4.7 % → 0.7 % (p = 0.0067); retried tool calls 26.6 % → 1.3 %; uncached- tokens −64 %; dollars per round −40 %; driven joints per sampled pose on a coupled+ tokens −65 %; dollars per round −40 %; driven joints per sampled pose on a coupledmechanism 6 → 3 (1 on the umbrella and the step ladder). Every one of these is invisible to the judge mean at this n.4. **The biggest single defect was in the harness's own plumbing**, not in the model or theprompt: one line mapping a tool's verdict to a protocol error cost a quarter of all tool@@ -460,7 +475,7 @@ data the repo does not carry; they are marked in the caveat column.| lean prompt | +0.030 ±0.076, $3.51 vs $3.66 | `wave2_lean` | plan pinned || planner mortality | 4.7 % → 0.7 %, Fisher p = 0.0067, n = 560 calls | `bench/data/plan_stage/restart_{on,off}.jsonl` (in the repo) | plan stage only, both arms same window || tool calls reported as errors | 26.6 % → 1.3 % | `aa_articulated` vs `wave2_lean` stats envelopes | same battery/config, different weather |-| cache hit | 69 % → 89 % | same | same |+| cache hit | 69 % → 90 % | same | same || uncached tokens per request | 38 521 → 13 480 (main-role) | same | same || generator $ per round | median 1.572 → 0.950 | round records of both runs | same || base64 amplification | 261 k tokens vs 516 for one 275 kB sheet | measured on a recorded blob + vendor bundle | arithmetic + matching recorded prompt jumps; **no repo script** |@@ -504,7 +519,7 @@ a test enforces by grepping the tree; a switch nothing reads once produced "keep| switch | what it does | default | why ||---|---|---|---|| `CV3D_PLAN_GEOMETRY` | plan-time geometry re-ask (attachment gap, hinge pivot, swept collision) | **off** | +0.064 ±0.25, no measurable gain (§4) |-| `CV3D_PLAN_RESTART` | re-sample a collapsed plan (one top-level part **and** dangling links) from the original request | **on**, kill switch | 4.7 % → 0.7 % planner mortality, p = 0.0067 (§5.1); narrowed 2026-09-03 and re-measured three-arm: dangling-link deaths 3/140 off vs 0/275, p = 0.038 |+| `CV3D_PLAN_RESTART` | re-sample a collapsed plan (one top-level part **and** dangling links) from the original request | **on**, kill switch | 4.7 % → 0.7 % planner mortality, p = 0.0067 (§5.1); narrowed 2026-09-03 and re-measured three-arm: dangling-link deaths 3/140 off vs 0/276, p = 0.038 (exploratory, after three null overall-rate tests — §5.1) || `CV3D_AXIS_REPAIR` (upstream, `tracks/articulated_object.py`) | axis flip on a reversed joint + buried-link check | **on** (upstream default; the A/B ran it against off) | −0.039 ±0.105, fired 1/12 (§4) || `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) |diff --git a/harness/docs/RUNBOOK.md b/harness/docs/RUNBOOK.mdindex 1105e62a..bd6566f5 100644--- a/harness/docs/RUNBOOK.md+++ b/harness/docs/RUNBOOK.md@@ -171,10 +171,13 @@ python -m codeverse.judges.calibration runs/<slug> [runs/<slug2> …] --model ge```**Two arms at once need separate `CV3D_CACHE_DIR`, not just separate `--out`.** Thebrowser daemon advertises its endpoint in `CACHE_DIR/browser_<backend>.json` and a newer-daemon supersedes an older one, so two worktrees sharing a cache end up on ONE browser:-the arm that did not launch it renders through a server rooted in the other tree, its GLB-is outside that root, and `render_glb` returns "produced no result" — on one side only,-looking like random flakiness (2026-09-04). Give each arm its own cache dir; the render+daemon supersedes an older one (`runtime_js/browser_daemon.cjs`), so two worktrees sharing+a cache fight over ONE browser, and `render_glb` returns "produced no result" on one side+only, looking like random flakiness (2026-09-04). The mechanism is not confirmed: each+render serves its GLB from its own process (`render_glb.mjs` `serveDirs`), so it is not a+server-root mismatch; the likely cause is the superseded daemon exiting while the other+arm's render is still in flight on its browser, which is a race in shared code that a+separate cache dir avoids rather than fixes. Give each arm its own cache dir; the rendercache separates with it, which an A/B wants anyway.Also halve each arm's `--parallel`: two arms at 3 workers is six concurrent renders, and adiff --git a/harness/tests/compare_bench/test_bench_shared.py b/harness/tests/compare_bench/test_bench_shared.pyindex 4689d483..cb474874 100644--- a/harness/tests/compare_bench/test_bench_shared.py+++ b/harness/tests/compare_bench/test_bench_shared.py@@ -124,4 +124,4 @@ def test_two_bench_run_batteries_pair_by_prompt(tmp_path: Path) -> None:st = paired(latest_cells(rows), "arm_a", "arm_b")assert st.n == 3 and st.mean_delta == pytest.approx(0.0667, abs=1e-3)assert st.wins == 2 and st.losses == 0 and st.ties == 1- assert st.verdict in {"supported", "unsupported", "too few pairs"}+ assert st.verdict == "unsupported" # CI [-0.077, +0.21] crosses zero at n = 3diff --git a/harness/tests/compare_bench/test_session_stats.py b/harness/tests/compare_bench/test_session_stats.pyindex b305d32d..9ae2380f 100644--- a/harness/tests/compare_bench/test_session_stats.py+++ b/harness/tests/compare_bench/test_session_stats.py@@ -69,6 +69,9 @@ def test_a_killed_session_is_counted_as_killed_not_as_a_session(tmp_path: Path)dead = run / "trajectories" / "refine_r01"dead.mkdir(parents=True)(dead / "stdout.json").write_text("")+ # the telemetry symlink reaches the dead session too: killed must not double either+ (run / "telemetry").mkdir()+ (run / "telemetry" / "trajectories").symlink_to(run / "trajectories", target_is_directory=True)assert len(_sessions(tmp_path)) == 1 and _killed(tmp_path) == 1calls, _ = tool_rates(_sessions(tmp_path))diff --git a/harness/tests/urdf_joints/test_mimic.py b/harness/tests/urdf_joints/test_mimic.pyindex b38701df..c4f196c1 100644--- a/harness/tests/urdf_joints/test_mimic.py+++ b/harness/tests/urdf_joints/test_mimic.py@@ -299,11 +299,25 @@ EXTRA_RUNNER = """ <link name="runner2"><visual><geometry><mesh filename="meshe</robot>"""-def test_the_lint_says_when_only_the_first_instance_of_a_driver_is_followed(tmp_path):+def test_the_skeleton_says_when_only_the_first_instance_of_a_driver_is_followed():"""The skeleton binds a coupling to ``<driver>_1``, so with an INSTANCED driver theother instances stay independent inputs and the sweep drives them separately. The- emitter's comment said so; the file that ships did not, so the over-driving was silent.+ file that ships says so, beside the ``<mimic>`` — written where the instancing is+ known, because a lint cannot tell an instance from a joint an agent named ``hinge_2``."""+ from codeverse.languages.urdf import compute_urdf_frames++ d = _plan()+ d["parts"][1]["instances"] = 2+ d["joints"][1]["mimic"] = {"joint": "DrawerSlide", "multiplier": 0.5}+ urdf = render_urdf(compute_urdf_frames(ArticulatedPlan.model_validate(d)))+ line = next(ln for ln in urdf.splitlines() if "<mimic joint=" in ln)+ assert "follows drawer_slide_1 only; drawer_slide_2 stay independent inputs" in line+++def test_the_lint_does_not_mistake_hand_named_joints_for_instances(tmp_path):+ """``hinge_1`` / ``hinge_2`` named by an agent are two joints, not one instanced+ driver: a follower of ``hinge_1`` must not be told to couple ``hinge_2`` too."""from codeverse.workspace import Workspaceurdf = (RIB.replace('joint name="runner_slide"', 'joint name="runner_slide_1"')@@ -313,9 +327,40 @@ def test_the_lint_says_when_only_the_first_instance_of_a_driver_is_followed(tmp_(ws.src / "model.py").write_text("import bpy\n")(ws.src / "robot.urdf").write_text(urdf)- warns = [f for f in lint_workspace(ws).findings if "stay independent inputs" in f.message]- assert len(warns) == 1 and warns[0].target == "rib_a_hinge"- assert "runner_slide_2" in warns[0].message and warns[0].severity.value == "warn"+ findings = lint_workspace(ws).findings+ assert not [f for f in findings if "independent inputs" in f.message]+ assert not [f for f in findings if "mimic" in f.message and f.severity.value == "error"]+++def test_the_exported_pose_glb_moves_the_followers_like_fk_does(tmp_path):+ """The articulation sheet and the sweep must pose ONE mechanism: ``urdf_to_glb`` posed+ the followers at rest (it read the raw pose dict, not the resolved one) while+ ``sweep_collisions`` posed them through ``fk`` — the judge scored a closed umbrella+ over a sweep that reported its open ribs colliding (review, 2026-09-04)."""+ import numpy as np+ import trimesh++ from codeverse.spatial.joints_export import ZUP_TO_YUP, urdf_to_glb++ robot = _robot(tmp_path)+ q = {"runner_slide": 0.3}++ def rib_a_world(glb):+ scene = trimesh.load(glb, force="scene")+ node = next(n for n in scene.graph.nodes_geometry if scene.graph[n][1] == "rib_a")+ T, _ = scene.graph[node]+ return trimesh.transform_points([scene.geometry["rib_a"].centroid], T)[0]++ rest = rib_a_world(urdf_to_glb(robot, tmp_path / "rest.glb", {}))+ posed = rib_a_world(urdf_to_glb(robot, tmp_path / "posed.glb", q))+ assert not np.allclose(rest, posed), "rib_a did not follow runner_slide in the exported scene"+ # and it lands exactly where fk puts that point: undo the export's Y-up, move the rest+ # centroid by fk's rib_a motion for the same q, re-apply Y-up+ T0, T1 = fk(robot, {})["rib_a"], fk(robot, q)["rib_a"]+ rest_zup = trimesh.transform_points([rest], np.linalg.inv(ZUP_TO_YUP))[0]+ moved_zup = trimesh.transform_points([rest_zup], T1 @ np.linalg.inv(T0))[0]+ expected = trimesh.transform_points([moved_zup], ZUP_TO_YUP)[0]+ assert np.allclose(posed, expected, atol=1e-6), (posed, expected)def test_a_self_mimic_says_it_names_itself(tmp_path):