Official Codebase of 3DCodeVerse
Python
spatial: the joint_sweep tool reports the round's joint_sweep gate
gaoypengff40097b047f
diff --git a/harness/codeverse3d/spatial/joints.py b/harness/codeverse3d/spatial/joints.pyindex a0eb83f8..e4ebff9a 100644--- a/harness/codeverse3d/spatial/joints.py+++ b/harness/codeverse3d/spatial/joints.py@@ -7,7 +7,8 @@ Import from here::* :mod:`codeverse3d.spatial.joints_model` — ``Robot``/``Link``/``Joint``, ``load_urdf``,``fk``, ``pose_samples``, ``limit_poses``, URDF frame math.* :mod:`codeverse3d.spatial.joints_sweep` — ``sweep_collisions`` (FCL + trimesh),- ``sweep_findings`` (→ GateFindings), ``motion_direction_check``.+ ``sweep_findings`` (→ GateFindings), ``sweep_gate`` (THE ``joint_sweep`` verdict),+ ``motion_direction_check``.* :mod:`codeverse3d.spatial.joints_export` — ``urdf_to_glb`` (hierarchical GLB with jointextras), ``render_poses`` (+ ``articulation_sheet.png``)."""@@ -30,21 +31,23 @@ from codeverse3d.spatial.joints_model import ()from codeverse3d.spatial.joints_poses import limit_poses, pose_label, pose_samplesfrom codeverse3d.spatial.joints_sweep import (+ SWEEP_GATE,MotionCheck,Overlap,SweepReport,SweepSummary,aggregate_findings,buried_links,+ find_urdf,motion_direction_check,- summary_text,sweep_collisions,sweep_findings,+ sweep_gate,)__all__ = [- "ARTICULATION_SHEET_NAME", "ZUP_TO_YUP", "Joint", "Link", "MotionCheck", "Overlap", "Robot", "SweepReport",- "SweepSummary", "UrdfError", "fk", "limit_poses",+ "ARTICULATION_SHEET_NAME", "SWEEP_GATE", "ZUP_TO_YUP", "Joint", "Link", "MotionCheck", "Overlap", "Robot", "SweepReport",+ "SweepSummary", "UrdfError", "fk", "find_urdf", "limit_poses","link_world_meshes", "load_urdf", "motion_direction_check", "pose_label", "pose_samples", "render_poses",- "aggregate_findings", "buried_links", "robot_scene", "summary_text", "sweep_collisions", "sweep_findings", "urdf_to_glb",+ "aggregate_findings", "buried_links", "robot_scene", "sweep_collisions", "sweep_findings", "sweep_gate", "urdf_to_glb",]diff --git a/harness/codeverse3d/spatial/joints_sweep.py b/harness/codeverse3d/spatial/joints_sweep.pyindex 65b8f7fc..01099f41 100644--- a/harness/codeverse3d/spatial/joints_sweep.py+++ b/harness/codeverse3d/spatial/joints_sweep.py@@ -2,22 +2,32 @@direction. Collision bodies live in :mod:`joints_collide` (FCL for the booleancollide / distance queries; deterministic per-island containment for thepenetration depth — FCL's mesh-mesh contact depths are per-triangle artefacts).+:func:`sweep_gate` is THE ``joint_sweep`` verdict: the round's gate and the tool's."""from __future__ import annotations+import loggingimport math+import time+from pathlib import Pathfrom typing import Anyimport numpy as npimport trimeshfrom pydantic import BaseModel, Field-from codeverse3d.contracts.artifacts import GateFinding, Severity+from codeverse3d.contracts.artifacts import GateFinding, GateReport, Severityfrom codeverse3d.conventions import CONTACT_GAP_Mfrom codeverse3d.spatial import joints_collide as collide-from codeverse3d.spatial.joints_model import Robot, UrdfError, fk-from codeverse3d.spatial.joints_poses import pose_label+from codeverse3d.spatial.joints_model import Robot, UrdfError, fk, load_urdf+from codeverse3d.spatial.joints_poses import pose_label, pose_samples+from codeverse3d.workspace import Workspace++log = logging.getLogger(__name__)++#: the articulated track's gate id — every finding this module emits carries it+SWEEP_GATE = "joint_sweep"# ------------------------------------------------------------------ report types@@ -191,7 +201,7 @@ def _summarise(per_pose: list[PoseReport], n_links: int, islands: dict[str, int]def sweep_findings(report: SweepReport, *, rest_max_m: float = 0.005, hinge_clearance_m: float = 0.01) -> list[GateFinding]:"""Turn a sweep report into gate findings (ERROR for rest penetration > ``rest_max_m``,overlaps in moved poses and floating links beyond ``hinge_clearance_m``; WARN otherwise)."""- gate = "articulation"+ gate = SWEEP_GATEout: list[GateFinding] = []for pr in report.per_pose:for o in pr.overlaps:@@ -316,7 +326,7 @@ def buried_links(robot: Robot, *, samples: int = BURIED_SAMPLES, fraction: floatcontinueif frac >= fraction:out.append(GateFinding(- gate="articulation", severity=Severity.ERROR, target=name,+ gate=SWEEP_GATE, severity=Severity.ERROR, target=name,message=f"link '{name}' lies entirely inside '{other}' at rest ({frac * 100:.0f}% of its surface): "f"it can neither be seen nor move",fix_hint=f"move '{name}' outside '{other}' (or cut a pocket in '{other}' where it sits) so the part "@@ -326,6 +336,46 @@ def buried_links(robot: Robot, *, samples: int = BURIED_SAMPLES, fraction: floatreturn out+# ------------------------------------------------------------------ the gate+def find_urdf(ws: Workspace) -> Path | None:+ """The built ``artifacts/robot.urdf``, else the authored ``src/robot.urdf``."""+ for cand in (ws.artifacts / "robot.urdf", ws.src / "robot.urdf"):+ if cand.is_file():+ return cand+ return None+++def sweep_gate(ws: Workspace) -> tuple[GateReport, Robot | None]:+ """THE ``joint_sweep`` verdict on the built robot, and the robot (None when none loaded).++ Every pose of :func:`pose_samples` collided, the findings one per link pair+ (:func:`aggregate_findings`, D50), plus :func:`buried_links`. The round's gate+ (``tracks/articulated_object.default_joint_sweep``, which adds the pose renders) and+ the ``joint_sweep`` tool both report exactly this, so the agent's check and the+ round's can no longer disagree (until 2026-09-22 the tool failed any overlap past+ 2 mm and any gap, the gate had a 5 mm rest / 30 mm hinge WARN band and buried links).+ """+ urdf = find_urdf(ws)+ if urdf is None:+ return GateReport.of(SWEEP_GATE, [GateFinding(+ gate=SWEEP_GATE, severity=Severity.ERROR, target="robot.urdf", message="no robot.urdf found after build",+ fix_hint="write src/robot.urdf (native URDF) referencing meshes/<link>.glb for every link")]), None+ t0 = time.time()+ try:+ robot = load_urdf(urdf, ws.artifacts / "meshes")+ report = sweep_collisions(robot, pose_samples(robot))+ except UrdfError as e:+ return GateReport.of(SWEEP_GATE, [GateFinding(+ gate=SWEEP_GATE, severity=Severity.ERROR, target="robot.urdf", message=f"URDF sweep failed: {e}",+ fix_hint="fix robot.urdf so every link has a mesh under meshes/<link>.glb and joints form one tree")]), None+ findings = aggregate_findings(sweep_findings(report))+ try:+ findings += buried_links(robot)+ except Exception as e: # noqa: BLE001 — an extra check never fails the gate+ log.warning("buried-link check failed: %s", e)+ return GateReport.of(SWEEP_GATE, findings, duration_ms=int((time.time() - t0) * 1000)), robot++# ------------------------------------------------------------------ motion direction_DIRS: dict[str, tuple[float, float, float]] = {"+x": (1, 0, 0), "-x": (-1, 0, 0), "+y": (0, 1, 0), "-y": (0, -1, 0), "+z": (0, 0, 1), "-z": (0, 0, -1),@@ -390,23 +440,3 @@ def motion_direction_check(robot: Robot, joint: str, expected: str, *, probe: flmessage=((f"{joint} (driven by {drive})" if driven_by is not None else f"{joint}")+ f": child '{j.child}' moves {tuple(round(float(v),3) for v in d)} for q={probe:+.3g}; "f"expected {expected} ({'ok' if ok else 'WRONG — flip the axis sign or swap limits'})"))---def summary_text(report: SweepReport) -> str:- """Compact human/LLM-readable summary of a sweep."""- s = report.summary- lines = [f"pose sweep: {s.n_poses} poses, {s.n_links} links, backend={s.backend}"]- if s.max_penetration_m > 0:- lines.append(f"max penetration {s.max_penetration_m*1000:.1f} mm at pose {s.worst_pose} between {s.worst_pair}; overlapping poses: {s.overlapping_poses}")- else:- lines.append("no overlaps deeper than tolerance in any pose")- if s.floating_links:- lines.append(f"floating links (not touching the grounded assembly): {s.floating_links}")- multi = {k: v for k, v in s.link_islands.items() if v > 1}- if multi:- lines.append(f"links made of several disconnected islands: {multi}")- return "\n".join(lines)---def report_numbers(report: SweepReport) -> dict[str, Any]:- return report.summary.model_dump(mode="json")diff --git a/harness/codeverse3d/spatial/tools.py b/harness/codeverse3d/spatial/tools.pyindex 47d830bf..1221fd66 100644--- a/harness/codeverse3d/spatial/tools.py+++ b/harness/codeverse3d/spatial/tools.py@@ -24,14 +24,8 @@ from codeverse3d.spatial.contract import check_contract as _check_contractfrom codeverse3d.spatial.contract import planned_joinsfrom codeverse3d.spatial.frame_metrics import frame_summary_textfrom codeverse3d.spatial.joints_export import ARTICULATION_SHEET_NAME, render_poses-from codeverse3d.spatial.joints_model import UrdfError, load_urdf-from codeverse3d.spatial.joints_poses import limit_poses, pose_samples-from codeverse3d.spatial.joints_sweep import (- SweepReport,- report_numbers,- summary_text,- sweep_collisions,-)+from codeverse3d.spatial.joints_poses import limit_poses+from codeverse3d.spatial.joints_sweep import sweep_gatefrom codeverse3d.spatial.measure import GlbLoadError, measure_glb, measure_summary_tablefrom codeverse3d.spatial.observe import (build_failure_lines,@@ -427,26 +421,8 @@ def _iou_verdict(res: dict[str, Any]) -> str:# ===================================================================== articulationclass JointSweepArgs(BaseModel):- joints: list[str] = Field(default=[], description="joint names to sweep (empty = all)")- n_samples: int = Field(default=8, ge=2, le=32, description="poses per joint across its range")---def _sweep_verdict(report: SweepReport) -> tuple[bool, str]:- """(passed, headline) of a collision sweep — the ONE place that decides both.-- The headline leads the observation because a sweep that finds a penetration is a- RESULT, not a tool error (62% of 1445 recorded joint_sweep calls answered FAIL):- without it the model reads 'pose sweep: 12 poses…' and has to infer the verdict.- """- s = report.summary- reasons = []- if s.max_penetration_m > report.tol_m:- reasons.append(f"penetration {s.max_penetration_m * 1000:.1f} mm > tolerance {report.tol_m * 1000:.1f} mm")- if s.floating_links:- reasons.append(f"{len(s.floating_links)} floating link(s): {', '.join(s.floating_links[:6])}")- if reasons:- return False, "JOINT SWEEP: FAIL — " + "; ".join(reasons) + " (the sweep ran; fix the links below)"- return True, "JOINT SWEEP: PASS — no penetration beyond tolerance, every link attached"+ joints: list[str] = Field(default=[], description="joints whose limit poses to RENDER (empty = all); "+ "the collision check always covers every joint")def _poses_for(robot, joints: list[str] | None) -> list[tuple[str, dict[str, float]]] | None:@@ -461,31 +437,31 @@ def _poses_for(robot, joints: list[str] | None) -> list[tuple[str, dict[str, floreturn [(label, q) for label, q in limit_poses(robot) if label == "rest" or label.split("@")[0] in want]-@tool("joint_sweep", JointSweepArgs, "Sweep URDF joints through their ranges: self-collision / limit findings for ALL joints, "- "plus pose renders. Pass joints=[...] for the joints you changed — rendering every joint's poses is the slow part "- "(three views per pose); the collision check always covers the whole robot.",+@tool("joint_sweep", JointSweepArgs, "The round's joint_sweep gate on the built URDF — every joint through its range, "+ "one finding per link pair (overlap, unattached, buried) with its fix — plus pose renders. Pass joints=[...] for "+ "the joints you changed — rendering every joint's poses is the slow part (three views per pose); the collision "+ "check always covers the whole robot.",tracks=(Track.ARTICULATED_OBJECT.value,), cost_hint="slow")def joint_sweep(ctx: ToolContext, args: JointSweepArgs) -> Observation:- """``joints`` narrows the RENDER to those joints' limit poses (plus rest). The collision+ """The round's own verdict (``joints_sweep.sweep_gate``) — until 2026-09-22 the tool ran a+ second sweep with its own rules and could pass what the round then failed, or the reverse.++ ``joints`` narrows the RENDER to those joints' limit poses (plus rest). The collisionsweep still covers every joint — a change to one joint can collide with another, andthat check is cheap. Rendering is not: every pose is a GLB export plus three views, soa 10-joint object renders ~63 images per call, and agents call this 3-8 times a round.Measured 2026-08-25: articulated rounds ran a median 1007 s against 497 s for staticobjects, with the agent session — mostly waiting on sweeps — as the whole difference."""ws = ctx.workspace- urdf = ws.artifacts / "robot.urdf"- if not urdf.is_file():+ if not (ws.artifacts / "robot.urdf").is_file():return Observation.error("joint_sweep: artifacts/robot.urdf not found — run `build` first")- try:- robot = load_urdf(urdf, ws.artifacts / "meshes")- report = sweep_collisions(robot, pose_samples(robot, n_random=args.n_samples, seed=0))- except UrdfError as e:- return Observation.error(f"joint_sweep: {e}")- out_dir = tool_out_dir(ctx, "joints")- render_poses(robot, out_dir, poses=_poses_for(robot, args.joints or None))- ok, headline = _sweep_verdict(report)- return Observation(ok=ok, text=f"{headline}\n{summary_text(report)}", numbers=report_numbers(report),- images=[str(out_dir / ARTICULATION_SHEET_NAME)])+ report, robot = sweep_gate(ws)+ images: list[str] = []+ if robot is not None:+ out_dir = tool_out_dir(ctx, "joints")+ render_poses(robot, out_dir, poses=_poses_for(robot, args.joints or None))+ images.append(str(out_dir / ARTICULATION_SHEET_NAME))+ return gate_observation(report, images=images)# ===================================================================== scenesdiff --git a/harness/codeverse3d/tracks/articulated_object.py b/harness/codeverse3d/tracks/articulated_object.pyindex c4d7d798..279af1b0 100644--- a/harness/codeverse3d/tracks/articulated_object.py+++ b/harness/codeverse3d/tracks/articulated_object.py@@ -34,8 +34,6 @@ from codeverse3d.workspace import Workspacelog = logging.getLogger(__name__)-SWEEP_GATE = "joint_sweep"-class ArticulatedPipeline(ObjectPipeline):"""Object gates + joint sweep; object views + pose views."""@@ -91,6 +89,8 @@ class ArticulatedPipeline(ObjectPipeline):return rsdef judge_context(self, ws: Workspace, plan: Plan | None, round_index: int, build: BuildResult, gates: list[GateReport]) -> str:+ from codeverse3d.spatial.joints import SWEEP_GATE+report = next((g for g in gates if g.gate == SWEEP_GATE), None)motion = next((g for g in gates if g.gate == MOTION_GATE), None)lines = ["Articulation sheet: the pose_* views show the object at rest, each joint at its lower and upper limit."]@@ -121,32 +121,15 @@ def default_joint_sweep(ws: Workspace, plan: Plan | None, out_dir: Path) -> tupl# the Services.joint_sweep signature: it is the interface's information, and the test# double (tests/orchestrator_tracks/fakes.py) synthesises its poses and findings from# plan.joints because it has no URDF to read.- """Adapter to ``codeverse3d.spatial.joints``: load → pose samples →- ``sweep_collisions`` → ``sweep_findings`` (gate) and ``render_poses`` (pose views ++ """The round's ``joint_sweep`` gate — ``spatial.joints.sweep_gate``, the verdict the+ ``joint_sweep`` tool reports too — and ``render_poses`` (pose views +``articulation_sheet.png`` for the judge)."""from codeverse3d.spatial import joints- urdf = _find_urdf(ws)- if urdf is None:- return GateReport(gate=SWEEP_GATE, passed=False, findings=[GateFinding(- gate=SWEEP_GATE, severity=Severity.ERROR, target="robot.urdf", message="no robot.urdf found after build",- fix_hint="write src/robot.urdf (native URDF) referencing meshes/<link>.glb for every link")]), []- t0 = time.time()- try:- robot = joints.load_urdf(urdf, ws.artifacts / "meshes")- report = joints.sweep_collisions(robot, joints.pose_samples(robot))- except joints.UrdfError as e:- return GateReport(gate=SWEEP_GATE, passed=False, findings=[GateFinding(- gate=SWEEP_GATE, severity=Severity.ERROR, target="robot.urdf", message=f"URDF sweep failed: {e}",- fix_hint="fix robot.urdf so every link has a mesh under meshes/<link>.glb and joints form one tree")]), []- findings = [f.model_copy(update={"gate": SWEEP_GATE})- for f in joints.aggregate_findings(joints.sweep_findings(report))]- try:- findings += [f.model_copy(update={"gate": SWEEP_GATE}) for f in joints.buried_links(robot)]- except Exception as e: # noqa: BLE001 — an extra check never fails the gate- log.warning("buried-link check failed: %s", e)- gate = GateReport.of(SWEEP_GATE, findings, duration_ms=int((time.time() - t0) * 1000))+ gate, robot = joints.sweep_gate(ws)views: list[RenderView] = []+ if robot is None:+ return gate, viewsout_dir.mkdir(parents=True, exist_ok=True)try:for label, rs in joints.render_poses(robot, out_dir):@@ -159,7 +142,7 @@ def default_joint_sweep(ws: Workspace, plan: Plan | None, out_dir: Path) -> tupl# 2026-08-26: 330 s in render_glb.mjs with three articulated runs sharing the# browser) used to raise out of gates() and fail the run before its first round.log.warning("pose renders failed; the sweep gate stands without a sheet: %s", e)- gate.findings.append(GateFinding(gate=SWEEP_GATE, severity=Severity.WARN, target="poses",+ gate.findings.append(GateFinding(gate=joints.SWEEP_GATE, severity=Severity.WARN, target="poses",message=f"pose renders failed ({str(e)[:160]}); the judge sees no articulation sheet this round",fix_hint="nothing to fix in the code: a render timeout under load"))sheet = out_dir / joints.ARTICULATION_SHEET_NAME@@ -168,13 +151,6 @@ def default_joint_sweep(ws: Workspace, plan: Plan | None, out_dir: Path) -> tuplreturn gate, views-def _find_urdf(ws: Workspace) -> Path | None:- for cand in (ws.artifacts / "robot.urdf", ws.src / "robot.urdf"):- if cand.is_file():- return cand- return None--# ===================================================================== planned-motion gateMOTION_GATE = "motion_direction"@@ -373,7 +349,7 @@ def default_motion_checks(ws: Workspace, plan: Plan | None) -> GateReport | Nonereturn Nonefrom codeverse3d.spatial import joints as sj- urdf = _find_urdf(ws)+ urdf = sj.find_urdf(ws)if urdf is None:return Nonet0 = time.time()diff --git a/harness/docs/ARCHITECTURE.md b/harness/docs/ARCHITECTURE.mdindex 40674004..161df361 100644--- a/harness/docs/ARCHITECTURE.md+++ b/harness/docs/ARCHITECTURE.md@@ -132,7 +132,8 @@ codeverse3d/contract.py (authoring-frame hints), sections.py (the cross_section tool and theD48 judge slices: one matplotlib section renderer), silhouette.py, probes.py,complexity.py (objective complexity vector -> Measurement.extra, eval/docs/COMPLEXITY.md),- joints*.py + joints_collide.py (deterministic penetration), registry.py,+ joints*.py + joints_collide.py (deterministic penetration; joints_sweep.sweep_gate is+ THE joint_sweep verdict — the round's gate and the tool's), registry.py,tools.py (every @tool registration since 2026-08-28; every import is a plainone — codeverse3d.languages is imported inside the tool bodies),mcp_server.py (MCP name: 3dcode).diff --git a/harness/docs/INTERFACES.md b/harness/docs/INTERFACES.mdindex c6e4cb9e..85e97b75 100644--- a/harness/docs/INTERFACES.md+++ b/harness/docs/INTERFACES.md@@ -337,8 +337,12 @@ cross_section(glb, axis, at, out_png, *, parts=None) -> Observation # the tool# the SELECTED parts' bbox; loops / filled area / hollow ratio + the same renderer's image (overlaps plain, never# hatched); a plane that cuts nothing answers in text with no imagefrom codeverse3d.spatial.joints import load_urdf, fk, sweep_collisions, urdf_to_glb, render_poses # RESERVED_LINK_NAMES={'world'}+from codeverse3d.spatial.joints import sweep_gate, find_urdf, SWEEP_GATE+sweep_gate(ws) -> (GateReport "joint_sweep", Robot | None) # THE verdict (Δ 2026-09-22): pose_samples → sweep_collisions →+ # aggregate_findings(sweep_findings) + buried_links. tracks/articulated_object.default_joint_sweep (the round's gate,+ # + pose renders) and the joint_sweep TOOL (spatial/tools.py: gate_observation of it + a narrowed pose sheet) both+ # report exactly this; the tool used to run its own sweep (fail on any overlap > 2 mm or any gap, no buried links)from codeverse3d.spatial.joints_collide import components # (names, edges) -> list[set[str]]: THE union-find (connectivity + sweep)-# the joint_sweep TOOL body lives in spatial/tools.py (no joint_sweep_observation helper; render_poses takes no renderer=)# joints_collide.py: deterministic penetration (oriented islands + fixed-direction parity ray test; python-fcl is a# core dependency, the trimesh fallback is deterministic too)from codeverse3d.spatial.gl_render import GlHost, GlResult, GlHostError, write_contact_sheet, write_gifdiff --git a/harness/tests/urdf_joints/test_export.py b/harness/tests/urdf_joints/test_export.pyindex fe2264f3..5d144553 100644--- a/harness/tests/urdf_joints/test_export.py+++ b/harness/tests/urdf_joints/test_export.py@@ -99,8 +99,8 @@ def test_multi_material_link_keeps_materials(tmp_path):def test_joint_sweep_tool_offline(tmp_path, monkeypatch):- """The ``joint_sweep`` tool body lives in spatial.tools: collision sweep over every- joint, renders narrowed to ``joints`` (+ rest) through ``render_poses``."""+ """The ``joint_sweep`` tool reports the round's gate (``sweep_gate``) over every joint;+ its renders are narrowed to ``joints`` (+ rest) through ``render_poses``."""import codeverse3d.spatial.tools as tsfrom codeverse3d.spatial.registry import ToolContext, get_toolfrom codeverse3d.workspace import Workspace@@ -118,9 +118,9 @@ def test_joint_sweep_tool_offline(tmp_path, monkeypatch):return []monkeypatch.setattr(ts, "render_poses", fake_render_poses)- obs = get_tool("joint_sweep").call(ctx, {"joints": ["hinge"], "n_samples": 5})- assert obs.ok and obs.numbers["max_penetration_m"] == 0.0- assert obs.text.startswith("JOINT SWEEP: PASS")+ obs = get_tool("joint_sweep").call(ctx, {"joints": ["hinge"]})+ assert obs.ok and obs.numbers["errors"] == 0+ assert obs.text.startswith("joint_sweep: PASS")assert rendered == [["rest", "hinge@upper"]] and obs.images[0].endswith(ARTICULATION_SHEET_NAME) # lower=0 dedupes into restobs = get_tool("joint_sweep").call(ctx, {})assert rendered[-1] is None # empty joints = the full sheet (render_poses default)@@ -129,8 +129,10 @@ def test_joint_sweep_tool_offline(tmp_path, monkeypatch):def test_joint_sweep_penetration_is_a_verdict_not_an_mcp_error(tmp_path, monkeypatch):"""A sweep that finds a penetration RAN: ``failed`` stays False (63% of 1404 recordedjoint_sweep calls answered FAIL, and each one reported as an MCP error bought a retry- at ~117k prompt tokens), and the FAIL verdict leads the text."""+ at ~117k prompt tokens), and the FAIL verdict leads the text. The verdict is the+ round's: the tool and ``sweep_gate`` say the same thing about the same robot."""import codeverse3d.spatial.tools as ts+ from codeverse3d.spatial.joints import sweep_gatefrom codeverse3d.spatial.registry import ToolContext, get_toolfrom codeverse3d.workspace import Workspacefrom tests.urdf_joints.conftest import write_prims_robot@@ -142,9 +144,10 @@ def test_joint_sweep_penetration_is_a_verdict_not_an_mcp_error(tmp_path, monkeypctx = ToolContext(workspace=ws, language="urdf_blender", track="articulated_object")obs = get_tool("joint_sweep").call(ctx, {})assert not obs.ok and not obs.failed- assert obs.text.startswith("JOINT SWEEP: FAIL — penetration ") and "tolerance" in obs.text- assert "pose sweep:" in obs.text # the detail the agent acts on is still there- assert obs.numbers["max_penetration_m"] > 0.1+ assert obs.text.startswith("joint_sweep: FAIL — 1 error(s)")+ assert "links 'body|door' overlap in 2 of the sampled poses" in obs.text and "fix:" in obs.text+ gate, _ = sweep_gate(ws)+ assert not gate.passed and [f.message for f in gate.errors][0] in obs.textdef test_robot_named_like_a_link_keeps_frame_and_placement(tmp_path):diff --git a/harness/tests/urdf_joints/test_sweep.py b/harness/tests/urdf_joints/test_sweep.pyindex c63bc91b..87f20880 100644--- a/harness/tests/urdf_joints/test_sweep.py+++ b/harness/tests/urdf_joints/test_sweep.py@@ -10,7 +10,6 @@ from codeverse3d.spatial.joints import (load_urdf,motion_direction_check,pose_samples,- summary_text,sweep_collisions,sweep_findings,)@@ -28,7 +27,6 @@ def test_good_design_has_no_overlaps(tmp_path):assert rep.summary.max_penetration_m == 0.0assert rep.summary.floating_links == []assert rep.per_pose[0].n_contacts == 1 # door touches body at rest- assert "no overlaps" in summary_text(rep)assert sweep_findings(rep) == []diff --git a/harness/tests/urdf_joints/test_sweep_degrade.py b/harness/tests/urdf_joints/test_sweep_degrade.pyindex d0b1317e..ed3626ac 100644--- a/harness/tests/urdf_joints/test_sweep_degrade.py+++ b/harness/tests/urdf_joints/test_sweep_degrade.py@@ -13,16 +13,11 @@ def test_pose_render_failure_keeps_the_measured_sweep(tmp_path, monkeypatch):render_poses with three articulated runs sharing the browser; gates() raised and the runwas recorded failed before its first round."""import codeverse3d.tracks.articulated_object as art+ from codeverse3d.contracts.artifacts import GateReportfrom codeverse3d.spatial import joints- urdf = tmp_path / "src" / "robot.urdf"- urdf.parent.mkdir(parents=True)- urdf.write_text("<robot/>")ws = SimpleNamespace(artifacts=tmp_path / "artifacts", src=tmp_path / "src")- monkeypatch.setattr(joints, "load_urdf", lambda u, meshes: "robot")- monkeypatch.setattr(joints, "pose_samples", lambda robot: [])- monkeypatch.setattr(joints, "sweep_collisions", lambda robot, poses: "report")- monkeypatch.setattr(joints, "sweep_findings", lambda report: [])+ monkeypatch.setattr(joints, "sweep_gate", lambda ws_: (GateReport.of(joints.SWEEP_GATE), "robot"))def boom(robot, out_dir):raise RenderError("render_glb failed: node script render_glb.mjs timed out after 330s")