Skip to content

Official Codebase of 3DCodeVerse

Python

cleanup: two closed experiments leave the tree — plan-time geometry re-ask (D49), zone fan-out control arm (D70)

gaoypeng04a19004b907
diff --git a/harness/CLAUDE.md b/harness/CLAUDE.md
index d4f4c57c..b3335d79 100644
--- a/harness/CLAUDE.md
+++ b/harness/CLAUDE.md
@@ -101,8 +101,8 @@ cd /home/yipeng/3dcodeverse/harness
python -m codeverse.addons.calibration runs/<slug>... --model gemini:gemini-3.1-pro-preview --n 3 --out out/
python bench/complexity_report.py bench/out --recursive # score-vs-complexity + $/complexity point (docs/COMPLEXITY.md)
python bench/compare_backends.py --prompts bench/prompts/compare_v1.yaml --arms harness:gemini-cli:gemini-3.6-flash,oneshot:claude-code --judge gemini:gemini-3.1-pro-preview --out bench/out/compare_v1
-python -m pytest tests -q -m "not live" # 3 060 tests, ~65 s (real Blender + headless Chrome + CadQuery)
-python -m pytest tests -q -m "not live and not blender and not node" # pure python: 2 451 tests, ~40 s
+python -m pytest tests -q -m "not live" # 3 042 tests, ~65 s (real Blender + headless Chrome + CadQuery)
+python -m pytest tests -q -m "not live and not blender and not node" # pure python: 2 433 tests, ~40 s
# (the counts drift every commit — `--collect-only` is the answer, not a number in this file)
# both run PARALLEL by default (pytest-xdist, -n auto --dist worksteal, in pyproject addopts).
# A nested pytest inside a test MUST pass -n0 or it forks another full set of workers.
diff --git a/harness/codeverse/config.py b/harness/codeverse/config.py
index e5362604..550d3c91 100644
--- a/harness/codeverse/config.py
+++ b/harness/codeverse/config.py
@@ -178,10 +178,6 @@ SEED_RECIPES_ENV = "CV3D_SEED_RECIPES"
#: pack description in both prompts). OFF by default: it adds an image-model call per
#: run, and whether it earns that is a measurement nobody has made yet.
SCENE_TEXTURES_ENV = "CV3D_SCENE_TEXTURES"
-#: ONE session authors every zone of a scene (the whole world, one author) instead of the
-#: two-small-zones-per-session fan-out. ON since the fixed-judge confirmation of the session
-#: that is told its window and asked for full density (D70); `off` is the fan-out control.
-ONE_WORLD_SESSION_ENV = "CV3D_ONE_WORLD_SESSION"
_TRUE_WORDS = frozenset({"1", "on", "true", "yes", "y"})
_FALSE_WORDS = frozenset({"0", "off", "false", "no", "n"})
@@ -232,32 +228,6 @@ def scene_textures_enabled() -> bool:
return env_flag(SCENE_TEXTURES_ENV, False)
-def one_world_session_enabled() -> bool:
- """Do all of a scene's zones go to ONE session? ``$CV3D_ONE_WORLD_SESSION``, else ON.
-
- Measured 2026-09-08 under one fixed judge (gemini-3.1-pro-preview, n=2, the brief's
- must_have list), both sides ``codex:gpt-6-astra@low``: a bare one-file scene — one author,
- no plan, no lib, no assets — scored 0.894 on the clockmaker's workshop and 0.82 on the boat
- workshop, while the harness's round 0 of the same briefs, its zones written by separate
- sessions of at most two small zones each, sat at 0.17 and 0.30–0.57 ("not enclosed",
- "stove 3.6 m instead of 1.15", "skiff floating 1.2 m above its trestles") and needed two
- refine rounds to reach 0.60–0.93. The day's tally over 43 judged rounds put floating /
- scale / interpenetration (28), missing planned content (23) and cameras (21) at the top —
- the defects that appear between authors, not within one. With this on, every zone brief
- goes to one session that owns every zone file (the env, the assets and the heroes keep
- their own stages), with a session window scaled to the zone count. Measured on the
- same three briefs (loop 17, in-loop judge): round 0 0.17 → 0.69, 0.51 → 0.58, 0.44 →
- 0.43; best round 0.75 → 0.82 PASS, 0.73 → 0.60, 0.60 → 0.77 PASS. The first fixed-judge
- confirmation (cmp_scene4) did NOT reproduce it — 0.60 / 0.60 / 0.54 vs the bare one-shot
- 0.81 / 0.83 / 0.60 — because that session finished four zones in five minutes as a
- block-out. With the batch header stating the window and asking for each zone's full
- density (loop 18: round 0 0.81 / 0.60 / 0.88, two passes), the second confirmation
- (cmp_scene5, fixed judge) reads harness 0.89 / 0.89 (both PASS at round 0) vs one-shot
- 0.92 / 0.77 on boat / clockmaker. On by default; ``off`` is the fan-out control.
- """
- return env_flag(ONE_WORLD_SESSION_ENV, True)
-
-
def seed_recipes_enabled() -> bool:
"""Is recipe seeding (``tracks/graphics.py:seed_recipes``) on for THIS call? ``$CV3D_SEED_RECIPES``
when it is set, else ``Settings.limits.seed_recipes`` (default ON)."""
diff --git a/harness/codeverse/tracks/plan_checks.py b/harness/codeverse/tracks/plan_checks.py
deleted file mode 100644
index 333a1f17..00000000
--- a/harness/codeverse/tracks/plan_checks.py
+++ /dev/null
@@ -1,226 +0,0 @@
-"""Plan-time geometry checks for articulated plans (2026-08-28).
-
-The planner's boxes, pivots and axes are enough to catch the three mistakes that cost
-compare_art_v3 its low scores — a pivot nowhere near the part it turns, a child that does
-not touch the link it attaches to, and a part that sweeps through a neighbour over its
-joint range — BEFORE any code is written. Each mistake found here is a re-ask of the
-planner (:data:`codeverse.tracks.planner.MAX_GEOMETRY_REASKS`), not a gate on a build
-that already cost a round.
-
-Everything is axis-aligned-box arithmetic on the plan's own numbers. The checks are
-deliberately conservative: the moving part's own subtree and any link whose box CONTAINS
->= ``HOUSING_FRACTION`` of the moving part at rest (a cabinet around a drawer, a frame around a sash) are never
-collision candidates, and only a real intersection (>= ``COLLISION_MIN_M`` on every axis,
-or half the part's thickness for thin parts) counts.
-A false complaint costs one re-ask; a missed one costs nothing that the joint sweep does
-not still catch.
-"""
-
-from __future__ import annotations
-
-import math
-from dataclasses import dataclass
-from typing import Any
-
-from codeverse.conventions import to_snake
-
-#: a hinge line must lie within this margin of BOTH the child's and the parent's box
-PIVOT_TOL_M = 0.025
-#: a child's box must come within this gap of its parent's box (touching = 0)
-ATTACH_GAP_M = 0.015
-#: a swept box must overlap a neighbour by at least this on EVERY axis to count as a collision
-COLLISION_MIN_M = 0.02
-#: a link whose box holds at least this share of the moving part at rest is its housing
-#: (cabinet around a drawer, frame around a sash) and is never a collision candidate
-HOUSING_FRACTION = 0.8
-#: points sampled per box axis when posing a part (5³ = 125 points; a point, unlike the
-#: axis-aligned box of a rotated part, is never an over-approximation)
-SAMPLES_PER_AXIS = 5
-#: at most this many complaints per re-ask (the worst first)
-MAX_COMPLAINTS = 6
-
-Vec = tuple[float, float, float]
-
-
-@dataclass(frozen=True)
-class Box:
- lo: Vec
- hi: Vec
-
- @classmethod
- def from_bbox(cls, bbox: Any) -> Box:
- c, e = bbox.center, bbox.extents
- return cls(tuple(c[i] - e[i] / 2 for i in range(3)), tuple(c[i] + e[i] / 2 for i in range(3))) # type: ignore[arg-type]
-
- def corners(self) -> list[Vec]:
- return [(x, y, z) for x in (self.lo[0], self.hi[0]) for y in (self.lo[1], self.hi[1]) for z in (self.lo[2], self.hi[2])]
-
- def samples(self, n: int = SAMPLES_PER_AXIS) -> list[Vec]:
- """An n×n×n lattice over the box (corners, edges, faces and interior)."""
- axes = [[self.lo[i] + (self.hi[i] - self.lo[i]) * k / (n - 1) for k in range(n)] for i in range(3)]
- return [(x, y, z) for x in axes[0] for y in axes[1] for z in axes[2]]
-
- def depth_of_point(self, p: Vec) -> float:
- """How far inside the box ``p`` lies (distance to the nearest face); <= 0 outside."""
- return min(min(p[i] - self.lo[i], self.hi[i] - p[i]) for i in range(3))
-
- def center(self) -> Vec:
- return tuple((self.lo[i] + self.hi[i]) / 2 for i in range(3)) # type: ignore[return-value]
-
- def gap_to(self, other: Box) -> float:
- """Largest per-axis separation (0 when the boxes touch or overlap)."""
- return max(0.0, *[max(self.lo[i] - other.hi[i], other.lo[i] - self.hi[i]) for i in range(3)])
-
- def dist_to_point(self, p: Vec) -> float:
- return math.sqrt(sum(max(self.lo[i] - p[i], 0.0, p[i] - self.hi[i]) ** 2 for i in range(3)))
-
- def overlap_depth(self, other: Box) -> float:
- """Smallest per-axis overlap (a true intersection depth); <= 0 when they do not intersect."""
- return min(min(self.hi[i], other.hi[i]) - max(self.lo[i], other.lo[i]) for i in range(3))
-
- def contains(self, other: Box, slack: float = 0.0) -> bool:
- return all(self.lo[i] - slack <= other.lo[i] and other.hi[i] <= self.hi[i] + slack for i in range(3))
-
- def volume(self) -> float:
- return math.prod(max(self.hi[i] - self.lo[i], 0.0) for i in range(3))
-
- def fraction_inside(self, other: Box) -> float:
- """Share of this box's volume that lies inside ``other`` (1 = fully housed).
- A degenerate (zero-volume) box falls back to containment with ``PIVOT_TOL_M`` slack."""
- v = self.volume()
- if v <= 0.0:
- return 1.0 if other.contains(self, slack=PIVOT_TOL_M) else 0.0
- inter = math.prod(max(min(self.hi[i], other.hi[i]) - max(self.lo[i], other.lo[i]), 0.0) for i in range(3))
- return inter / v
-
-
-def _rotate(p: Vec, axis: Vec, pivot: Vec, angle: float) -> Vec:
- """Rodrigues rotation of ``p`` about the unit ``axis`` through ``pivot``."""
- ax, ay, az = axis
- n = math.sqrt(ax * ax + ay * ay + az * az) or 1.0
- ax, ay, az = ax / n, ay / n, az / n
- vx, vy, vz = p[0] - pivot[0], p[1] - pivot[1], p[2] - pivot[2]
- c, s = math.cos(angle), math.sin(angle)
- dot = ax * vx + ay * vy + az * vz
- cx, cy, cz = ay * vz - az * vy, az * vx - ax * vz, ax * vy - ay * vx
- rx = vx * c + cx * s + ax * dot * (1 - c)
- ry = vy * c + cy * s + ay * dot * (1 - c)
- rz = vz * c + cz * s + az * dot * (1 - c)
- return (pivot[0] + rx, pivot[1] + ry, pivot[2] + rz)
-
-
-def _posed_points(box: Box, joint: Any, q: float) -> list[Vec]:
- pts = box.samples()
- if joint.type in ("revolute", "continuous"):
- return [_rotate(c, tuple(joint.axis), tuple(joint.pivot), q) for c in pts]
- if joint.type == "prismatic":
- ax = tuple(joint.axis)
- n = math.sqrt(sum(a * a for a in ax)) or 1.0
- d = tuple(a / n * q for a in ax)
- return [(p[0] + d[0], p[1] + d[1], p[2] + d[2]) for p in pts]
- return pts
-
-
-def _spins_in_place(box: Box, joint: Any) -> bool:
- """True when the joint axis passes through the part's core (a wheel on its axle, a lead
- screw, a mirror in a yoke): the part turns where it is and sweeps nothing new."""
- ax = tuple(joint.axis)
- n = math.sqrt(sum(a * a for a in ax)) or 1.0
- ax = (ax[0] / n, ax[1] / n, ax[2] / n)
- c, pv = box.center(), tuple(joint.pivot)
- v = (c[0] - pv[0], c[1] - pv[1], c[2] - pv[2])
- t = sum(v[i] * ax[i] for i in range(3))
- off = math.sqrt(max(sum((v[i] - t * ax[i]) ** 2 for i in range(3)), 0.0))
- return off <= 0.5 * min(box.hi[i] - box.lo[i] for i in range(3))
-
-
-def _ancestors(link: str, parent_of: dict[str, str]) -> set[str]:
- out: set[str] = set()
- cur = parent_of.get(link)
- while cur is not None and cur not in out:
- out.add(cur)
- cur = parent_of.get(cur)
- return out
-
-
-def geometry_complaints(plan: Any) -> list[str]:
- """Numbered, specific complaints about an :class:`ArticulatedPlan`'s geometry ([] = fine)."""
- parts = {to_snake(p.name): p for p in getattr(plan, "parts", [])}
- joints = list(getattr(plan, "joints", []) or [])
- if not parts or not joints:
- return []
- boxes = {k: Box.from_bbox(p.bbox) for k, p in parts.items()}
- parent_of = {to_snake(j.child): to_snake(j.parent) for j in joints}
- out: list[tuple[float, str]] = [] # (severity score, text)
-
- for j in joints:
- c, p = to_snake(j.child), to_snake(j.parent)
- if c not in boxes or p not in boxes:
- continue
- cb, pb = boxes[c], boxes[p]
- # A. attachment: the child's box must reach its parent's box
- gap = cb.gap_to(pb)
- if gap > ATTACH_GAP_M:
- out.append((gap, f"joint {j.name}: link {j.child} is {gap * 1000:.0f} mm away from its parent {j.parent} "
- f"(boxes do not touch) — move or enlarge {j.child} so it meets {j.parent}, or attach it "
- f"to the link it really sits on"))
- if j.type == "fixed":
- continue
- # B. hinge placement: the pivot of a revolute / continuous joint lies where the two
- # links meet. (A prismatic pivot is only the child frame's origin — anywhere on
- # the rail is legal — so it is not checked.)
- pv = tuple(j.pivot)
- if j.type in ("revolute", "continuous"):
- dc, dp = cb.dist_to_point(pv), pb.dist_to_point(pv)
- if dc > PIVOT_TOL_M or dp > PIVOT_TOL_M:
- far = j.child if dc > dp else j.parent
- out.append((max(dc, dp), f"joint {j.name}: pivot {[round(x, 3) for x in pv]} is {max(dc, dp) * 1000:.0f} mm "
- f"from {far}'s box (hinge lines sit where the two links meet) — "
- f"put the pivot on the shared edge of {j.parent} and {j.child}"))
- if _spins_in_place(cb, j):
- continue # turns where it is: nothing to sweep
- # C. swept collision. The child's box is posed at q=lower/upper as a point lattice
- # and tested against every link that is neither carried by the child (its
- # subtree), a housing round it (>= HOUSING_FRACTION of it at rest), interlocked
- # with it at rest (they already intersect — crossing scissor arms, folded ribs,
- # a screw through a jaw: the joint sweep measures the real meshes later), nor —
- # for a slide — the parent it runs in/on. The parent of a hinge IS a candidate
- # when it does not house the child: a door must not swing through its cabinet.
- # Thin parts count at half their thickness.
- qs = [j.lower, j.upper] if j.type in ("revolute", "prismatic") else [math.pi / 2, math.pi]
- exclude = {c} | {k for k in boxes if c in _ancestors(k, parent_of)}
- if j.type == "prismatic":
- exclude.add(p)
- min_depth = max(0.001, min(COLLISION_MIN_M, 0.5 * min(cb.hi[i] - cb.lo[i] for i in range(3))))
- for other, ob in boxes.items():
- if other in exclude or cb.fraction_inside(ob) >= HOUSING_FRACTION or cb.overlap_depth(ob) >= min_depth:
- continue
- worst_q, worst_depth = None, 0.0
- for q in qs:
- if abs(q) < 1e-9:
- continue
- depth = max(ob.depth_of_point(pt) for pt in _posed_points(cb, j, q))
- if depth > worst_depth:
- worst_q, worst_depth = q, depth
- if worst_q is not None and worst_depth >= min_depth:
- unit = "rad" if j.type != "prismatic" else "m"
- out.append((worst_depth, f"joint {j.name}: at q={worst_q:.2f} {unit} link {j.child} sweeps "
- f"{worst_depth * 1000:.0f} mm deep into {parts[other].name} — shorten "
- f"{j.child} on that side, move the pivot, or reduce the range "
- f"[{j.lower}, {j.upper}] so the motion clears {parts[other].name}"))
- out.sort(key=lambda t: -t[0])
- return [t for _, t in out[:MAX_COMPLAINTS]]
-
-
-def plan_geometry_complaint(plan: Any) -> str:
- """"" when the plan's geometry is consistent; otherwise the re-ask text."""
- items = geometry_complaints(plan)
- if not items:
- return ""
- return ("Your plan is valid but its geometry contradicts itself. Fix EXACTLY these problems (move boxes, pivots "
- "or ranges; keep every part and joint) and return the full corrected plan JSON again (same schema):\n- "
- + "\n- ".join(items))
-
-
-__all__ = ["ATTACH_GAP_M", "COLLISION_MIN_M", "HOUSING_FRACTION", "MAX_COMPLAINTS", "PIVOT_TOL_M", "SAMPLES_PER_AXIS", "Box", "geometry_complaints",
- "plan_geometry_complaint"]
diff --git a/harness/codeverse/tracks/plan_features.py b/harness/codeverse/tracks/plan_features.py
index a27ba867..53c3f89f 100644
--- a/harness/codeverse/tracks/plan_features.py
+++ b/harness/codeverse/tracks/plan_features.py
@@ -61,9 +61,6 @@ def pin_plan_blockers(variant_env: dict[str, str]) -> list[str]:
#: honest by tests/orchestrator_tracks/test_plan_features.py, which greps the tree.
LIVE_SWITCHES: dict[str, str] = {
"CV3D_PLAN_BRIEF": "codeverse/tracks/planner.py", # brief.py merged in, 2026-08-28
- # plan-time geometry re-ask for articulated plans (tracks/plan_checks.py); plan-side,
- # so an A/B over it can never --pin-plan. Off by default (A/B 2026-08-28: no gain).
- "CV3D_PLAN_GEOMETRY": "codeverse/tracks/planner.py",
# re-sample a degenerate plan from the original prompt instead of editing it in context
"CV3D_PLAN_RESTART": "codeverse/tracks/planner.py",
"CV3D_SCOPED_PARTS": "codeverse/tracks/depth.py",
diff --git a/harness/codeverse/tracks/planner.py b/harness/codeverse/tracks/planner.py
index 48ac3562..0803e01a 100644
--- a/harness/codeverse/tracks/planner.py
+++ b/harness/codeverse/tracks/planner.py
@@ -563,9 +563,6 @@ P = TypeVar("P", bound=BaseModel)
#: different failures and get separate chances (see ``plan_with_usage``).
MAX_VALIDATION_REASKS = 2 # was 1: compare_art_v2 lost 5 of 14 articulated prompts at this gate (2026-08-25)
MAX_QUALITY_REASKS = 1
-#: a plan whose boxes / pivots / ranges contradict each other (tracks/plan_checks.py) is
-#: re-asked with the numbers; after this many it ships anyway and the joint sweep decides
-MAX_GEOMETRY_REASKS = 2
#: a validation failure whose plan is DEGENERATE (joints naming links the plan never lists)
#: is answered by re-sampling from the original prompt instead of editing the broken answer
#: in context; at most this many times per plan. Measured 2026-09-02: 3-4 % of plan calls
@@ -573,18 +570,6 @@ MAX_GEOMETRY_REASKS = 2
MAX_PLAN_RESTARTS = 1
#: kill-switch for that restart (default ON, mirrors CV3D_AXIS_REPAIR)
PLAN_RESTART_ENV = "CV3D_PLAN_RESTART"
-#: ``CV3D_PLAN_GEOMETRY=1`` turns the geometry re-ask ON (registered in
-#: tracks/plan_features.LIVE_SWITCHES). OFF by default since the 2026-08-28 A/B
-#: (compare_art_v4 pf vs pf0, n = 14): score Δ +0.064 [−0.188, +0.315], wins 6/6/2,
-#: final gate errors 0.00 vs 0.25, round-0 sweep targets 0.54 vs 0.25 — no measurable
-#: gain for 7/14 re-asks; the plan-loop rule (docs/PLAN_LOOP.md) keeps such a change off.
-PLAN_GEOMETRY_ENV = "CV3D_PLAN_GEOMETRY"
-
-
-def geometry_check_enabled() -> bool:
- from codeverse.config import env_flag # ONE flag vocabulary (review-3 S4)
-
- return env_flag(PLAN_GEOMETRY_ENV, False)
#: Output room for the plan call, sized from the plan budget. A deep plan is much longer
#: JSON than a flat one AND Gemini 3.x bills its thinking against the same ceiling, so the
#: flat 24 000 that served 8 box-parts truncates a 12-part plan with sub-parts —
@@ -861,9 +846,9 @@ def plan_with_usage[P: BaseModel](spec: Spec, model_id: str, plan_model: type[P]
tokens = plan_tokens(budget, max_output_tokens)
thinking = "medium"
wait_scale = 1.0
- geo_reasked = 0
- for attempt in range(2 + MAX_VALIDATION_REASKS + MAX_QUALITY_REASKS + MAX_GEOMETRY_REASKS
- + MAX_PLAN_RESTARTS):
+ # 4 = the first call + truncation retries; it was 2 + the geometry re-ask's 2 (D49, code
+ # removed 2026-09-21) — the total is kept so a default run has the attempts it always had
+ for attempt in range(4 + MAX_VALIDATION_REASKS + MAX_QUALITY_REASKS + MAX_PLAN_RESTARTS):
req = ChatRequest(messages=messages, system=system, response_schema=schema, temperature=temperature,
thinking=thinking, max_output_tokens=tokens, label=f"planner{'-retry' if attempt else ''}",
max_wait_s=plan_wait_s(tokens, guard, scale=wait_scale))
@@ -947,22 +932,6 @@ def plan_with_usage[P: BaseModel](spec: Spec, model_id: str, plan_model: type[P]
target_parts=budget.target_parts, complaint=complaint[:400])
messages = messages + [_echo(raw, resp.text), ChatMessage.user(complaint)]
continue
- if geo_reasked < MAX_GEOMETRY_REASKS and getattr(result, "joints", None) and geometry_check_enabled():
- from codeverse.tracks.plan_checks import plan_geometry_complaint
-
- try:
- geo = plan_geometry_complaint(result)
- except Exception as e: # noqa: BLE001 — a pre-check must never cost the plan
- geo = ""
- log.warning("plan geometry check failed (%s); skipping", e)
- if events is not None:
- events.emit("plan.geometry_error", attempt=attempt, error=str(e)[:300])
- if geo:
- geo_reasked += 1
- if events is not None:
- events.emit("plan.geometry", attempt=attempt, reask=geo_reasked, complaint=geo[:600])
- messages = messages + [_echo(raw, resp.text), ChatMessage.user(geo)]
- continue
normalised = list(getattr(result, "normalisations", None) or [])
if normalised and events is not None:
events.emit("plan.normalised", attempt=attempt, n=len(normalised), items=normalised[:8])
@@ -1108,9 +1077,9 @@ def normalise_names[P: BaseModel](plan_obj: P) -> P:
return plan_obj
-__all__ = ["MAX_GEOMETRY_REASKS", "MAX_PLAN_RESTARTS", "MAX_QUALITY_REASKS", "MAX_VALIDATION_REASKS",
- "PLAN_GEOMETRY_ENV", "PLAN_RESTART_ENV", "PLAN_TOKENS_MAX", "PlanningError", "add_acceptance_item",
+__all__ = ["MAX_PLAN_RESTARTS", "MAX_QUALITY_REASKS", "MAX_VALIDATION_REASKS",
+ "PLAN_RESTART_ENV", "PLAN_TOKENS_MAX", "PlanningError", "add_acceptance_item",
"articulation_acceptance", "build_system_prompt", "build_user_prompt", "default_event_stats",
- "ensure_acceptance", "geometry_check_enabled", "missing_link_names", "normalise_names", "plan",
+ "ensure_acceptance", "missing_link_names", "normalise_names", "plan",
"degenerate_plan", "plan_example", "plan_tokens", "plan_with_usage", "restart_enabled",
"restart_note"]
diff --git a/harness/codeverse/tracks/scene.py b/harness/codeverse/tracks/scene.py
index 6d8da5a2..de7a5417 100644
--- a/harness/codeverse/tracks/scene.py
+++ b/harness/codeverse/tracks/scene.py
@@ -26,7 +26,7 @@ import time
from collections.abc import Sequence
from typing import Any
-from codeverse.config import one_world_session_enabled, scene_textures_enabled
+from codeverse.config import scene_textures_enabled
from codeverse.contracts.artifacts import (
BuildResult,
GateFinding,
@@ -75,10 +75,6 @@ log = logging.getLogger(__name__)
SCENE_TIMES: tuple[float, float] = (0.0, 1.5)
MAX_CONSOLE_ERRORS = 8
-#: a zone placing at most this many assets is small enough to share a session
-SMALL_ZONE_CONTENTS = 3
-#: how many small zones may share one session (file ownership stays disjoint)
-MAX_ZONES_PER_BATCH = 2
#: cookbook chapters inlined into the env / zone prompts (the sessions never call
#: read_cookbook on their own — measured on scenes_v1: 0 of 20 sessions did)
ENV_RECIPES: tuple[str, ...] = (
@@ -351,8 +347,8 @@ class SceneTrack(BaseTrack):
def _zones_stage(self, ctx: RunContext) -> dict[str, Any]:
plan: ScenePlan = ctx.plan # type: ignore[assignment]
t0 = time.time()
- # one author for the whole world (config.one_world_session_enabled) or the fan-out
- batches = [list(plan.zones)] if one_world_session_enabled() else plan_zone_batches(list(plan.zones))
+ # one author for the whole world (D70; the fan-out control arm was removed 2026-09-21)
+ batches = [list(plan.zones)]
if any(len(b) > 1 for b in batches):
ctx.events.emit("zones.batched", batches=[[z.name for z in b] for b in batches])
@@ -391,7 +387,7 @@ class SceneTrack(BaseTrack):
return out
def _zone_task(self, ctx: RunContext, batch: list[ZonePlan]) -> GenerationTask:
- """One task for one zone, or for a batch of small zones that shares a session.
+ """One task for one zone, or for every zone of the scene in one session (D70).
A batched task exclusively owns every file it lists, so ``files_hint``
attribution and the refine fan-out stay file-disjoint."""
@@ -411,20 +407,17 @@ class SceneTrack(BaseTrack):
if len(batch) == 1:
prompt, label = briefs[0], f"zone_{to_snake(names[0])}"
else:
- whole = len(batch) == len(plan.zones)
window_min = ctx.budget.timeout_s(ZONE_TIMEOUT_S * len(batch), floor_s=180) // 60
header = (f"# {len(batch)} zone modules in ONE session — write ALL of: {', '.join(files)}\n\n"
f"You own exactly these files and nothing else. {len(batch)} complete zone briefs follow, "
"separated by a horizontal rule; implement each one in its own file exactly as its brief says. "
- + ("These are EVERY zone of the scene and you are its one author: keep scale, materials and "
- "placement coherent across them — nothing floats, nothing interpenetrates a neighbour, every "
- "content at the plan's size, and the zones meet at their shared edges as one place. "
- f"This session's window is {len(batch)} zones' worth ({window_min} min): build EACH zone to "
- "its brief's full density counts and dressing before you finish — one author measured "
- "2026-09-08 finished four zones in 5 minutes as a block-out (\"missing stove\", \"shelves "
- "missing\", \"primitive tools\") and scored 0.32 where the brief-by-brief fan-out reached 0.60. "
- if whole else
- "They are small neighbouring zones, so keep their styling consistent and do not build into each other. ")
+ + "These are EVERY zone of the scene and you are its one author: keep scale, materials and "
+ "placement coherent across them — nothing floats, nothing interpenetrates a neighbour, every "
+ "content at the plan's size, and the zones meet at their shared edges as one place. "
+ f"This session's window is {len(batch)} zones' worth ({window_min} min): build EACH zone to "
+ "its brief's full density counts and dressing before you finish — one author measured "
+ "2026-09-08 finished four zones in 5 minutes as a block-out (\"missing stove\", \"shelves "
+ "missing\", \"primitive tools\") and scored 0.32 where the brief-by-brief fan-out reached 0.60. "
+ "The recipes printed in the first brief apply to every zone in this session.\n")
prompt = header + "\n\n---\n\n".join(briefs)
label = "zones_" + "_".join(to_snake(n) for n in names)
@@ -551,31 +544,6 @@ def _touched(path: Any, since: float) -> bool:
return False
-def plan_zone_batches(zones: list[ZonePlan], *, small_max: int = SMALL_ZONE_CONTENTS,
- max_per_batch: int = MAX_ZONES_PER_BATCH) -> list[list[ZonePlan]]:
- """Group consecutive SMALL zones (≤ ``small_max`` asset placements) into shared
- sessions; big zones keep a session of their own.
-
- Plan order is preserved, so a batch is always a pair of neighbours and the
- batching is deterministic (stage-hash stable across resumes)."""
- batches: list[list[ZonePlan]] = []
- pending: list[ZonePlan] = []
- for z in zones:
- if len(z.contents) > small_max:
- if pending:
- batches.append(pending)
- pending = []
- batches.append([z])
- continue
- pending.append(z)
- if len(pending) >= max_per_batch:
- batches.append(pending)
- pending = []
- if pending:
- batches.append(pending)
- return batches
-
-
def census_gate_report(build: BuildResult) -> GateReport | None:
"""Turn scene census error lists (console/shader) into a gate, when present."""
c = build.census or {}
diff --git a/harness/docs/ARCHITECTURE.md b/harness/docs/ARCHITECTURE.md
index 2003bc77..ed45d544 100644
--- a/harness/docs/ARCHITECTURE.md
+++ b/harness/docs/ARCHITECTURE.md
@@ -191,9 +191,6 @@ codeverse/
can be A/B'd alone, + pin_plan_blockers() deciding when two arms may share
one plan — docs/EVAL.md §8.1),
depth.py,
- plan_checks.py (plan-time geometry checks on an ArticulatedPlan — attachment,
- pivot placement, swept-box collision over the joint range — fed back to the
- planner as a re-ask before any code is written),
skills_hook.py (the round's view of codeverse/skills: attach before generating,
probe reads after — a no-op unless CV3D_SKILLS is on)
record/ what every run WRITES: record.py (finalize_record, load_record, iter_runs,
@@ -426,7 +423,7 @@ in-loop option with `n_samples ≥ 2` for decisions.
plan (structured output, one re-ask) → skeleton (buildable placeholder) → materialise workspace
[scene only] assets (parallel; both kinds climb one ladder — single-shot → check → one repair → agent; blender_glb heroes get a sub-workspace with the static planner's parts + asset_v1 judge + one re-judged fix pass, undone when worse; a degraded asset verdict leaves
score None / judged False, emits asset.judge_degraded and skips the fix pass)
- → env → zones (parallel) → assemble (deterministic scene.js)
+ → env → zones (ONE session owns every zone file, D70) → assemble (deterministic scene.js)
round 0 "baseline": generate → build_with_repair → measure → gates → render → post-render gates → judge
(object tracks, ≥ 8 plan parts, a language with one file per part, an agent backend: the baseline FANS OUT
per part — phase 0 = one scoped session per attachment subtree (its parts + the planned boxes of the
diff --git a/harness/docs/PAPER_WRITING.md b/harness/docs/PAPER_WRITING.md
index 0e7d69e4..36a31adf 100644
--- a/harness/docs/PAPER_WRITING.md
+++ b/harness/docs/PAPER_WRITING.md
@@ -150,7 +150,7 @@ They are recorded so nobody re-runs them expecting a different answer.
| lever | battery / method | n pairs | Δ | 2 SE | sign | disposition |
|---|---|--:|--:|---|---|---|
-| **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** |
+| **Plan-time geometry re-ask** (`CV3D_PLAN_GEOMETRY`, D49) | `compare_art_v4` pf vs pf0 | 14 | +0.064 | ±0.25 | 6/6/2 | shipped **OFF**; code removed 2026-09-21 (D49), the numbers stand |
| **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_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 |
@@ -562,7 +562,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_GEOMETRY` | plan-time geometry re-ask (attachment gap, hinge pivot, swept collision) | **off** | +0.064 ±0.25, no measurable gain (§4); **removed from the tree 2026-09-21** (D49) |
| `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`. |
diff --git a/harness/docs/SKILLS_LEDGER.md b/harness/docs/SKILLS_LEDGER.md
index 429ba9cf..59faf85a 100644
--- a/harness/docs/SKILLS_LEDGER.md
+++ b/harness/docs/SKILLS_LEDGER.md
@@ -203,6 +203,8 @@ own kind so the router's rows fire as written. The zone fan-out attaches **once*
the worker, because three parallel sessions share one workspace and would race the same
`AGENTS.md`. `tests/skills/test_delivery_reaches_the_session.py` now holds every
agent-driving module to the hook, pins the per-stage kinds, and pins the fan-out placement.
+(Since D70 the zones stage is ONE session; the fan-out arm was removed 2026-09-21 and the
+test now pins one attach before that one session.)
**What I expect it to do.** `dark_or_flat_frames` is **4.38 per run on the first gated
round with 0 of 8 runs clean** — the largest untouched headroom in the library, sitting in
diff --git a/harness/tests/orchestrator_tracks/test_cost_latency.py b/harness/tests/orchestrator_tracks/test_cost_latency.py
index 1011e4f9..d7968215 100644
--- a/harness/tests/orchestrator_tracks/test_cost_latency.py
+++ b/harness/tests/orchestrator_tracks/test_cost_latency.py
@@ -17,7 +17,7 @@ from codeverse.proc import EventLog
from codeverse.tracks.common import RunContext, generate_for, single_shot_agent_id, single_shot_ctx
from codeverse.tracks.generation import GenerationTask
from codeverse.tracks.planner import plan_example
-from codeverse.tracks.scene import SceneTrack, plan_zone_batches, zone_file
+from codeverse.tracks.scene import SceneTrack
from codeverse.tracks.scene_assets import (
asset_api_summary,
check_threejs_asset,
@@ -99,7 +99,6 @@ def test_dedupe_is_a_no_op_for_unrelated_assets_and_reaches_the_zone_prompt():
assert "buildSteppingStone(THREE, { variant: 1 })" in api and "merged variant" in api
-# ----------------------------------------------------------------------------- zone batching
def _zone(name: str, n: int) -> ZonePlan:
from codeverse.contracts.plan import BBox
@@ -107,20 +106,6 @@ def _zone(name: str, n: int) -> ZonePlan:
contents=[f"A{i}" for i in range(n)])
-def test_small_zones_share_a_session_and_big_ones_keep_the_fan_out():
- zones = [_zone("Small1", 2), _zone("Small2", 1), _zone("Big", 6), _zone("Small3", 3)]
- batches = plan_zone_batches(zones)
- assert [[z.name for z in b] for b in batches] == [["Small1", "Small2"], ["Big"], ["Small3"]]
- # deterministic: the same plan always batches the same way (stage hash stability)
- assert plan_zone_batches(zones) == batches
- assert zone_file(zones[0]) == "src/zones/small1.js"
-
- zones = [_zone(f"Z{i}", i % 5) for i in range(9)]
- batches = plan_zone_batches(zones)
- files = [zone_file(z) for b in batches for z in b]
- assert sorted(files) == sorted({zone_file(z) for z in zones}) and len(files) == 9
-
-
# ----------------------------------------------------------------------------- single-shot assets
def test_single_shot_needs_a_chat_model_not_a_coding_agent():
assert single_shot_agent_id("gemini-cli:gemini-3.6-flash", "gemini:gemini-3.6-flash") == "single-shot:gemini:gemini-3.6-flash"
diff --git a/harness/tests/orchestrator_tracks/test_one_world_session.py b/harness/tests/orchestrator_tracks/test_one_world_session.py
index 5436f36b..84604730 100644
--- a/harness/tests/orchestrator_tracks/test_one_world_session.py
+++ b/harness/tests/orchestrator_tracks/test_one_world_session.py
@@ -1,5 +1,5 @@
-"""D70: one author for the whole world — `CV3D_ONE_WORLD_SESSION` sends every zone to ONE
-session whose window scales with the zone count (2026-09-08).
+"""D70: one author for the whole world — every zone goes to ONE session whose window
+scales with the zone count (2026-09-08; the fan-out control arm was removed 2026-09-21).
Measured under one fixed judge with codex:gpt-6-astra@low on both sides: a bare one-file
scene scored 0.894 (clockmaker) and 0.82 (boat) while the harness's round 0, its zones
@@ -7,7 +7,6 @@ written by separate sessions of at most two small zones, sat at 0.17 and 0.30-0.
"""
from __future__ import annotations
-from codeverse.config import one_world_session_enabled
from codeverse.contracts.common import Language, Track
from codeverse.contracts.plan import ScenePlan
from codeverse.orchestrator import RunState
@@ -19,27 +18,15 @@ from tests.orchestrator_tracks.conftest import make_spec
from tests.orchestrator_tracks.fakes import FakeRuntime, FakeServices
-def test_the_switch_is_read_at_call_time_and_on_by_default(monkeypatch):
- monkeypatch.delenv("CV3D_ONE_WORLD_SESSION", raising=False)
- assert one_world_session_enabled() is True # D70: confirmed under the fixed judge with the density header
- monkeypatch.setenv("CV3D_ONE_WORLD_SESSION", "off")
- assert one_world_session_enabled() is False # the fan-out control
- monkeypatch.setenv("CV3D_ONE_WORLD_SESSION", "garbage")
- assert one_world_session_enabled() is False # a typo in a bench command is the control, never a crash
-
-
def test_a_whole_world_batch_owns_every_zone_file_and_gets_a_window_per_zone(tmp_path, settings):
base = ScenePlan.model_validate(plan_example(Track.SCENE))
- # three zones: a pair is then NOT the whole world (the example plan has two)
plan = base.model_copy(update={"zones": [*base.zones, base.zones[0].model_copy(update={"name": "Extra"})]})
ws = Workspace(tmp_path / "runs" / "s").create()
track = SceneTrack(services=FakeServices(), settings=settings, runtime=FakeRuntime(Language.SCENE_THREEJS))
ctx = track.build_context(make_spec(Track.SCENE, Language.SCENE_THREEJS, max_minutes=600.0), ws, EventLog(ws.events_path), RunState())
ctx.plan = plan
whole = track._zone_task(ctx, list(plan.zones))
- pair = track._zone_task(ctx, list(plan.zones[:2]))
assert whole.files_hint == [zone_file(z) for z in plan.zones] and whole.edit_only
- assert whole.timeout_s == ZONE_TIMEOUT_S * len(plan.zones) and pair.timeout_s == ZONE_TIMEOUT_S * 2
+ assert whole.timeout_s == ZONE_TIMEOUT_S * len(plan.zones)
assert "you are its one author" in whole.prompt and "nothing floats" in whole.prompt
assert f"window is {len(plan.zones)} zones' worth ({ZONE_TIMEOUT_S * len(plan.zones) // 60} min)" in whole.prompt
- assert "one author" not in pair.prompt and "small neighbouring zones" in pair.prompt
diff --git a/harness/tests/orchestrator_tracks/test_planner_geometry_reask.py b/harness/tests/orchestrator_tracks/test_planner_geometry_reask.py
index 672f8966..09114702 100644
--- a/harness/tests/orchestrator_tracks/test_planner_geometry_reask.py
+++ b/harness/tests/orchestrator_tracks/test_planner_geometry_reask.py
@@ -1,15 +1,13 @@
-"""The planner re-asks on a geometrically inconsistent articulated plan (tracks/plan_checks.py)."""
+"""Articulated planner paths that outlived the plan-time geometry re-ask (D49, code removed
+2026-09-21): the articulation acceptance items and the validation re-ask's wording."""
from __future__ import annotations
import copy
-import pytest
-
from codeverse.contracts.common import Language, Track
from codeverse.contracts.plan import ArticulatedPlan
-from codeverse.proc import EventLog
-from codeverse.tracks.planner import MAX_GEOMETRY_REASKS, plan, plan_example
+from codeverse.tracks.planner import plan, plan_example
from tests.orchestrator_tracks.conftest import make_spec
from tests.orchestrator_tracks.fakes import FakeChatModel, FakeRuntime
@@ -18,64 +16,10 @@ def _good() -> dict:
return copy.deepcopy(plan_example(Track.ARTICULATED_OBJECT))
-def _bad() -> dict:
- d = _good()
- j = d["joints"][0]
- j.update(type="revolute", pivot=[0.9, -0.02, 0.45], lower=0.0, upper=1.0) # a hinge 700 mm outside the cabinet
- return d
-
-
def _spec():
return make_spec(track=Track.ARTICULATED_OBJECT, language=Language.URDF_BLENDER, prompt="a desk drawer unit")
[email protected](autouse=True)
-def _geometry_on(monkeypatch):
- from codeverse.tracks.planner import PLAN_GEOMETRY_ENV
-
- monkeypatch.setenv(PLAN_GEOMETRY_ENV, "1")
-
-
-def test_geometry_complaint_reasks_then_accepts(tmp_ws):
- answers = [_bad(), _good()]
- model = FakeChatModel(lambda req: answers.pop(0))
- events = EventLog(tmp_ws.events_path)
- p = plan(_spec(), "fake:planner", ArticulatedPlan, tmp_ws, model=model, events=events,
- runtime=FakeRuntime(Language.URDF_BLENDER))
- assert isinstance(p, ArticulatedPlan) and len(model.requests) == 2
- reask = model.requests[1].messages[-1].text
- assert "geometry contradicts itself" in reask and "DrawerSlide" in reask and "pivot" in reask
- kinds = [e["event"] for e in events.read()]
- assert "plan.geometry" in kinds and "plan.done" in kinds
-
-
-def test_geometry_reasks_are_capped_and_the_plan_ships(tmp_ws):
- model = FakeChatModel(lambda req: _bad())
- p = plan(_spec(), "fake:planner", ArticulatedPlan, tmp_ws, model=model, runtime=FakeRuntime(Language.URDF_BLENDER))
- assert isinstance(p, ArticulatedPlan)
- assert len(model.requests) == 1 + MAX_GEOMETRY_REASKS == 3
- assert all("geometry contradicts" in r.messages[-1].text for r in model.requests[1:])
-
-
-def test_static_plans_skip_the_geometry_check(tmp_ws):
- from codeverse.contracts.plan import StaticPlan
- from tests.orchestrator_tracks.test_generation_planner_repair import _valid_plan_dict
-
- model = FakeChatModel(lambda req: _valid_plan_dict())
- plan(make_spec(), "fake:planner", StaticPlan, tmp_ws, model=model, runtime=FakeRuntime(Language.THREEJS))
- assert len(model.requests) == 1
-
-
-def test_switch_off_skips_the_geometry_reask(tmp_ws, monkeypatch):
- from codeverse.tracks.planner import PLAN_GEOMETRY_ENV, geometry_check_enabled
-
- monkeypatch.delenv(PLAN_GEOMETRY_ENV, raising=False)
- assert not geometry_check_enabled() # off unless asked for (A/B 2026-08-28: no measurable gain)
- model = FakeChatModel(lambda req: _bad())
- p = plan(_spec(), "fake:planner", ArticulatedPlan, tmp_ws, model=model, runtime=FakeRuntime(Language.URDF_BLENDER))
- assert isinstance(p, ArticulatedPlan) and len(model.requests) == 1
-
-
def test_every_moving_joint_gets_an_articulation_acceptance_item(tmp_ws):
from codeverse.tracks.planner import articulation_acceptance
@@ -103,22 +47,6 @@ def test_every_moving_joint_gets_an_articulation_acceptance_item(tmp_ws):
assert ids.count("art_drawer") == 1 and ids.count("art_lid") == 1
-def test_a_crashing_geometry_check_never_costs_the_plan(tmp_ws, monkeypatch):
- import codeverse.tracks.plan_checks as pc
-
- def boom(plan_obj):
- raise RuntimeError("synthetic")
-
- monkeypatch.setattr(pc, "plan_geometry_complaint", boom)
- model = FakeChatModel(lambda req: _bad())
- events = EventLog(tmp_ws.events_path)
- p = plan(_spec(), "fake:planner", ArticulatedPlan, tmp_ws, model=model, events=events,
- runtime=FakeRuntime(Language.URDF_BLENDER))
- assert isinstance(p, ArticulatedPlan) and len(model.requests) == 1
- kinds = [e["event"] for e in events.read()]
- assert "plan.geometry_error" in kinds and "plan.done" in kinds
-
-
def test_validation_reask_names_the_missing_parts_when_the_plan_is_thin(tmp_ws):
"""A thin plan whose joints stay INSIDE the part list: the in-context re-ask still owns
it (a plan that also references links it never lists is a restart — see
diff --git a/harness/tests/plan_checks/__init__.py b/harness/tests/plan_checks/__init__.py
deleted file mode 100644
index e69de29b..00000000
diff --git a/harness/tests/plan_checks/test_geometry.py b/harness/tests/plan_checks/test_geometry.py
deleted file mode 100644
index 4d2b6d7a..00000000
--- a/harness/tests/plan_checks/test_geometry.py
+++ /dev/null
@@ -1,189 +0,0 @@
-"""Plan-time geometry checks (tracks/plan_checks.py) on synthetic articulated plans."""
-
-import math
-
-from codeverse.contracts.artifacts import GateFinding, Severity
-from codeverse.contracts.common import Track
-from codeverse.contracts.plan import ArticulatedPlan
-from codeverse.spatial.joints_sweep import MAX_PAIR_FINDINGS, aggregate_findings
-from codeverse.tracks.plan_checks import (
- ATTACH_GAP_M,
- COLLISION_MIN_M,
- HOUSING_FRACTION, # noqa: I001
- PIVOT_TOL_M,
- Box,
- geometry_complaints,
- plan_geometry_complaint,
-)
-from codeverse.tracks.planner import plan_example
-
-
-def _part(name, center, extents, attach_to=None, **kw):
- return {"name": name, "role": f"{name} of the cabinet", "description": f"{name} body",
- "bbox": {"center": list(center), "extents": list(extents)}, "attach_to": attach_to, "material": "wood", **kw}
-
-
-def _weld(name, parent, child):
- return {"name": name, "type": "fixed", "parent": parent, "child": child, "axis": [0, 0, 1],
- "pivot": [0, 0, 0], "lower": 0.0, "upper": 0.0, "rest": 0.0, "motion": "rigid"}
-
-
-def _cabinet_with_door(pivot=(-0.2, -0.25, 0.3), axis=(0, 0, 1), lower=-math.pi / 2, upper=0.0, extra=(), welds=()):
- parts = [
- _part("Cabinet", (0, 0, 0.3), (0.4, 0.5, 0.6)),
- # door hangs on the cabinet's front-left edge (x=-0.2, y=-0.25)
- _part("Door", (0, -0.26, 0.3), (0.4, 0.02, 0.6), attach_to="Cabinet"),
- *extra,
- ]
- return ArticulatedPlan.model_validate({
- "object_name": "SideCabinet", "summary": "a cabinet with one hinged door", "root_link": "Cabinet",
- "overall_bbox": {"center": [0, -0.05, 0.3], "extents": [0.6, 0.7, 0.6]}, "parts": parts,
- "joints": [{"name": "DoorHinge", "type": "revolute", "parent": "Cabinet", "child": "Door",
- "axis": list(axis), "pivot": list(pivot), "lower": lower, "upper": upper,
- "rest": 0.0, "motion": "the door swings open to the front-left"}, *welds],
- })
-
-
-def test_example_and_good_door_are_clean():
- assert geometry_complaints(ArticulatedPlan.model_validate(plan_example(Track.ARTICULATED_OBJECT))) == []
- assert plan_geometry_complaint(_cabinet_with_door()) == ""
-
-
-def test_pivot_far_from_both_links_is_a_complaint():
- plan = _cabinet_with_door(pivot=(0.5, -0.25, 0.3)) # 300 mm right of the cabinet
- items = geometry_complaints(plan)
- assert len(items) == 1 and "pivot" in items[0] and "DoorHinge" in items[0]
- assert "300 mm" in items[0]
-
-
-def _plan(parts, joints, root="Base"):
- return ArticulatedPlan.model_validate({
- "object_name": "Rig", "summary": "test rig", "root_link": root,
- "overall_bbox": {"center": [0, 0, 0.5], "extents": [1.5, 1.5, 1.5]}, "parts": parts, "joints": joints})
-
-
-def _joint(name, typ, parent, child, axis, pivot, lower, upper):
- return {"name": name, "type": typ, "parent": parent, "child": child, "axis": list(axis), "pivot": list(pivot),
- "lower": lower, "upper": upper, "rest": 0.0, "motion": "moves"}
-
-
-def test_telescoping_leg_and_spinning_wheel_are_not_collisions():
- # a lower leg sliding 400 mm up INTO its upper leg (prismatic: the parent is never a candidate)
- plan = _plan([_part("Base", (0, 0, 1.0), (0.1, 0.1, 0.1)),
- _part("UpperLeg", (0, 0, 0.7), (0.04, 0.04, 0.6), attach_to="Base"),
- _part("LowerLeg", (0, 0, 0.25), (0.03, 0.03, 0.5), attach_to="UpperLeg")],
- [_joint("UpperWeld", "fixed", "Base", "UpperLeg", (0, 0, 1), (0, 0, 0.95), 0, 0),
- _joint("LegSlide", "prismatic", "UpperLeg", "LowerLeg", (0, 0, 1), (0, 0, 0.5), 0.0, 0.4)])
- assert geometry_complaints(plan) == []
- # a wheel spinning on an axle through its centre, flanked by a fork it would "sweep" as a box
- plan = _plan([_part("Base", (0, 0, 0.3), (0.1, 0.1, 0.1)),
- _part("Fork", (0, 0, 0.15), (0.12, 0.02, 0.3), attach_to="Base"),
- _part("Wheel", (0, -0.03, 0.05), (0.1, 0.04, 0.1), attach_to="Fork")],
- [_joint("ForkWeld", "fixed", "Base", "Fork", (0, 0, 1), (0, 0, 0.25), 0, 0),
- _joint("Axle", "continuous", "Fork", "Wheel", (0, 1, 0), (0, -0.03, 0.05), 0, 0)])
- assert geometry_complaints(plan) == []
-
-
-def test_parts_interlocked_at_rest_are_left_to_the_joint_sweep():
- # two crossing scissor arms whose boxes already intersect at rest
- plan = _plan([_part("Base", (0, 0, 0.05), (0.3, 0.1, 0.1)),
- _part("ArmA", (0, 0, 0.3), (0.3, 0.02, 0.4), attach_to="Base"),
- _part("ArmB", (0, 0.01, 0.3), (0.3, 0.02, 0.4), attach_to="ArmA")],
- [_joint("ArmAHinge", "revolute", "Base", "ArmA", (0, 1, 0), (-0.15, 0, 0.1), -0.8, 0.8),
- _joint("Scissor", "revolute", "ArmA", "ArmB", (0, 1, 0), (0, 0, 0.3), -0.8, 0.8)])
- assert not any("sweeps" in i and "ArmB" in i and "ArmA" in i for i in geometry_complaints(plan))
-
-
-def _with_knob(y):
- return _cabinet_with_door(extra=[_part("Knob", (0, y, 0.3), (0.03, 0.03, 0.03), attach_to="Door")],
- welds=[_weld("KnobWeld", "Door", "Knob")])
-
-
-def test_floating_child_is_a_complaint():
- items = geometry_complaints(_with_knob(-0.40)) # 115 mm in front of the door face
- assert len(items) == 1 and "Knob" in items[0] and "away from its parent Door" in items[0]
- assert geometry_complaints(_with_knob(-0.285)) == [] # touching the door face
-
-
-def test_door_swinging_into_its_own_cabinet_is_a_complaint():
- """+90° about +z takes the door (which lies along +x from the hinge) to +y: into the carcass."""
- items = geometry_complaints(_cabinet_with_door(lower=0.0, upper=math.pi / 2))
- assert len(items) == 1 and "sweeps" in items[0] and "into Cabinet" in items[0] and "q=1.57 rad" in items[0]
-
-
-def _with_wall(x):
- wall = _part("Wall", (x, -0.45, 0.3), (0.06, 0.4, 0.6), attach_to="Cabinet")
- return _cabinet_with_door(extra=[wall], welds=[_weld("WallWeld", "Cabinet", "Wall")])
-
-
-def test_door_swinging_into_a_side_wall_is_a_complaint():
- # a wall slab standing outside the cabinet's left face, where the open door (−90°) ends up
- items = geometry_complaints(_with_wall(-0.23))
- assert len(items) == 1 and "sweeps" in items[0] and "into Wall" in items[0], items
- # the same wall on the right face (door never reaches it) is fine
- assert geometry_complaints(_with_wall(0.23)) == []
-
-
-def test_drawer_inside_cabinet_is_not_a_collision():
- """A housing that holds the moving part at rest is never a collision candidate — even
- when the drawer front stands 20 mm proud of the carcass."""
- plan = ArticulatedPlan.model_validate(plan_example(Track.ARTICULATED_OBJECT))
- assert geometry_complaints(plan) == []
- d = plan_example(Track.ARTICULATED_OBJECT)
- drawer = next(p for p in d["parts"] if p["name"] == "Drawer")
- drawer["bbox"]["center"][1] -= 0.02 # front proud of the cabinet
- plan = ArticulatedPlan.model_validate(d)
- cab, drw = (Box.from_bbox(next(p for p in plan.parts if p.name == n).bbox) for n in ("Cabinet", "Drawer"))
- assert HOUSING_FRACTION <= drw.fraction_inside(cab) < 1.0
- assert geometry_complaints(plan) == []
-
-
-def test_complaint_text_is_a_reask_with_numbers():
- text = plan_geometry_complaint(_cabinet_with_door(pivot=(0.5, -0.25, 0.3)))
- assert text.startswith("Your plan is valid but its geometry contradicts itself")
- assert "same schema" in text and "- joint DoorHinge" in text
-
-
-def test_box_arithmetic():
- a = Box((0, 0, 0), (1, 1, 1))
- b = Box((0.9, 0.9, 0.9), (2, 2, 2))
- assert a.gap_to(b) == 0.0 and abs(a.overlap_depth(b) - 0.1) < 1e-9
- c = Box((1.1, 0, 0), (2, 1, 1))
- assert abs(c.gap_to(a) - 0.1) < 1e-9 and a.overlap_depth(c) < 0
- assert abs(a.dist_to_point((2, 0.5, 0.5)) - 1.0) < 1e-9
- assert ATTACH_GAP_M < COLLISION_MIN_M < PIVOT_TOL_M
-
-
-# ------------------------------------------------------------------ sweep aggregation
-def _pen(a, b, depth, pose, sev=Severity.ERROR):
- return GateFinding(gate="articulation", severity=sev, target=f"{a}|{b}", message=f"{a}/{b} {depth}",
- fix_hint="shrink", data={"kind": "penetration", "pose": pose, "depth_m": depth})
-
-
-def test_aggregate_merges_poses_per_pair_and_ranks_by_depth():
- fs = [_pen("door", "wall", 0.004, {"hinge": 0.5}), _pen("door", "wall", 0.031, {"hinge": 1.5}),
- _pen("door", "wall", 0.002, {}), _pen("lid", "box", 0.010, {"lid_j": 1.0}),
- GateFinding(gate="articulation", severity=Severity.ERROR, target="leg", message="floating",
- data={"kind": "unattached", "pose": {}, "gap_m": 0.05})]
- out = aggregate_findings(fs)
- assert [f.target for f in out] == ["leg", "door|wall", "lid|box"] # gap 0.05 > 0.031 > 0.010
- dw = out[1]
- assert dw.data["n_poses"] == 3 and dw.data["max_depth_m"] == 0.031
- assert "3 of the sampled poses" in dw.message and "31.0 mm" in dw.message and "hinge=1.50" in dw.message
- assert "1 at rest" in dw.message
- assert all(f.severity == Severity.ERROR for f in out)
-
-
-def test_aggregate_caps_errors_and_summarises_the_rest():
- fs = [_pen(f"p{i}", "base", 0.001 * (i + 1), {"j": 1.0}) for i in range(MAX_PAIR_FINDINGS + 3)]
- out = aggregate_findings(fs)
- errors = [f for f in out if f.severity == Severity.ERROR]
- warns = [f for f in out if f.severity == Severity.WARN]
- assert len(errors) == MAX_PAIR_FINDINGS and errors[0].target == f"p{MAX_PAIR_FINDINGS + 2}|base"
- assert len(warns) == 1 and warns[0].data["kind"] == "penetration_summary" and "3 more" in warns[0].message
-
-
-def test_aggregate_keeps_single_and_warn_findings():
- fs = [_pen("a", "b", 0.001, {}, sev=Severity.WARN)]
- assert aggregate_findings(fs) == fs
- assert aggregate_findings([]) == []
diff --git a/harness/tests/skills/test_delivery_reaches_the_session.py b/harness/tests/skills/test_delivery_reaches_the_session.py
index a85fc708..063d3202 100644
--- a/harness/tests/skills/test_delivery_reaches_the_session.py
+++ b/harness/tests/skills/test_delivery_reaches_the_session.py
@@ -38,14 +38,10 @@ def scene_run(tmp_path, monkeypatch):
from tests.orchestrator_tracks.test_tracks import _planner, _scene_writer
monkeypatch.setenv("CV3D_SKILLS", "1")
- # this run PROVES the fan-out is skill-safe (one attach serving two zone sessions): pin the
- # fan-out whatever D70's knob defaults to
- monkeypatch.setenv("CV3D_ONE_WORLD_SESSION", "off")
plan = ScenePlan.model_validate(plan_example(Track.SCENE))
plan.assets = [a for a in plan.assets if a.kind == "threejs"]
for z in plan.zones:
z.contents = [c for c in z.contents if c in {a.name for a in plan.assets}]
- z.contents *= 4 # force two zone batches: one attach must serve both sessions
spec = make_spec(Track.SCENE, Language.SCENE_THREEJS, max_rounds=0,
prompt="a small harbour at dusk")
ws = Workspace(tmp_path / "runs" / "harbour_skills")
@@ -58,7 +54,7 @@ def scene_run(tmp_path, monkeypatch):
def test_every_scene_generation_stage_gets_skills_before_its_sessions(scene_run) -> None:
- """One real run proves routing, ordering, fan-out safety and telemetry together."""
+ """One real run proves routing, ordering and telemetry together."""
rec, agent, ws = scene_run
events = EventLog(ws.events_path).read()
attachments = [e for e in events if e.get("event") == "skills.attached"]
@@ -84,8 +80,8 @@ def test_every_scene_generation_stage_gets_skills_before_its_sessions(scene_run)
attach_at = events.index(by_kind[kind])
generated_at = [i for i, event in enumerate(events) if belongs(kind, event)]
assert generated_at and all(attach_at < i for i in generated_at), kind
- assert sum(belongs("zone", event) for event in events) == 2
- assert Counter(job.kind for job in agent.jobs) >= Counter({"env": 1, "zone": 2, "compose": 1})
+ assert sum(belongs("zone", event) for event in events) == 1 # D70: one session owns every zone file
+ assert Counter(job.kind for job in agent.jobs) >= Counter({"env": 1, "zone": 1, "compose": 1})
telemetry_path = ws.root / "telemetry" / "skills.jsonl"
assert telemetry_path.is_file()
diff --git a/harness/tests/urdf_joints/test_sweep.py b/harness/tests/urdf_joints/test_sweep.py
index 6322250f..324e3398 100644
--- a/harness/tests/urdf_joints/test_sweep.py
+++ b/harness/tests/urdf_joints/test_sweep.py
@@ -4,7 +4,7 @@ from __future__ import annotations
import pytest
-from codeverse.contracts.artifacts import Severity
+from codeverse.contracts.artifacts import GateFinding, Severity
from codeverse.spatial.joints import (
UrdfError,
load_urdf,
@@ -14,6 +14,7 @@ from codeverse.spatial.joints import (
sweep_collisions,
sweep_findings,
)
+from codeverse.spatial.joints_sweep import MAX_PAIR_FINDINGS, aggregate_findings
from tests.urdf_joints.conftest import (
write_carcass_drawer_robot,
write_mesh_robot,
@@ -172,3 +173,38 @@ def test_joints_argument_narrows_the_render_to_those_joints(monkeypatch, tmp_pat
assert len(narrowed) == 3, "rest + hinge@lower + hinge@upper, nothing from slide or knob"
typo = ts._poses_for(_Robot(), ["hinge_typo"])
assert [lbl for lbl, _ in typo] == ["rest"], "an unknown joint yields a visibly wrong sheet, not the full one"
+
+
+# ------------------------------------------------------------------ sweep aggregation
+def _pen(a, b, depth, pose, sev=Severity.ERROR):
+ return GateFinding(gate="articulation", severity=sev, target=f"{a}|{b}", message=f"{a}/{b} {depth}",
+ fix_hint="shrink", data={"kind": "penetration", "pose": pose, "depth_m": depth})
+
+
+def test_aggregate_merges_poses_per_pair_and_ranks_by_depth():
+ fs = [_pen("door", "wall", 0.004, {"hinge": 0.5}), _pen("door", "wall", 0.031, {"hinge": 1.5}),
+ _pen("door", "wall", 0.002, {}), _pen("lid", "box", 0.010, {"lid_j": 1.0}),
+ GateFinding(gate="articulation", severity=Severity.ERROR, target="leg", message="floating",
+ data={"kind": "unattached", "pose": {}, "gap_m": 0.05})]
+ out = aggregate_findings(fs)
+ assert [f.target for f in out] == ["leg", "door|wall", "lid|box"] # gap 0.05 > 0.031 > 0.010
+ dw = out[1]
+ assert dw.data["n_poses"] == 3 and dw.data["max_depth_m"] == 0.031
+ assert "3 of the sampled poses" in dw.message and "31.0 mm" in dw.message and "hinge=1.50" in dw.message
+ assert "1 at rest" in dw.message
+ assert all(f.severity == Severity.ERROR for f in out)
+
+
+def test_aggregate_caps_errors_and_summarises_the_rest():
+ fs = [_pen(f"p{i}", "base", 0.001 * (i + 1), {"j": 1.0}) for i in range(MAX_PAIR_FINDINGS + 3)]
+ out = aggregate_findings(fs)
+ errors = [f for f in out if f.severity == Severity.ERROR]
+ warns = [f for f in out if f.severity == Severity.WARN]
+ assert len(errors) == MAX_PAIR_FINDINGS and errors[0].target == f"p{MAX_PAIR_FINDINGS + 2}|base"
+ assert len(warns) == 1 and warns[0].data["kind"] == "penetration_summary" and "3 more" in warns[0].message
+
+
+def test_aggregate_keeps_single_and_warn_findings():
+ fs = [_pen("a", "b", 0.001, {}, sev=Severity.WARN)]
+ assert aggregate_findings(fs) == fs
+ assert aggregate_findings([]) == []