Official Codebase of 3DCodeVerse
Python
joint_sweep: the tool and the gate find the URDF by one rule, the built artifacts/robot.urdf
gaoypengb0535a8dc48b
diff --git a/harness/codeverse3d/spatial/joints_sweep.py b/harness/codeverse3d/spatial/joints_sweep.pyindex a6f513f8..1acb1ddb 100644--- a/harness/codeverse3d/spatial/joints_sweep.py+++ b/harness/codeverse3d/spatial/joints_sweep.py@@ -336,11 +336,14 @@ def buried_links(robot: Robot, *, samples: int = BURIED_SAMPLES, fraction: float# ------------------------------------------------------------------ the gatedef 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+ """The BUILT ``artifacts/robot.urdf`` — or None, which means "run build first".++ Only the build's copy pairs with ``artifacts/meshes`` (a failed build invalidates both).+ The authored ``src/robot.urdf`` was a fallback until 2026-09-23: the round never reached+ it (its gates run on a green build only), and the tool refused before it; what it could+ do was sweep an edited URDF against the last build's meshes (review 2 C5)."""+ urdf = ws.artifacts / "robot.urdf"+ return urdf if urdf.is_file() else Nonedef sweep_gate(ws: Workspace) -> tuple[GateReport, Robot | None]:diff --git a/harness/codeverse3d/spatial/tools.py b/harness/codeverse3d/spatial/tools.pyindex 71fed36f..706fe01d 100644--- a/harness/codeverse3d/spatial/tools.py+++ b/harness/codeverse3d/spatial/tools.py@@ -26,7 +26,7 @@ from codeverse3d.spatial.contract import planned_joinsfrom codeverse3d.spatial.frame_metrics import frame_summary_textfrom codeverse3d.spatial.joints_export import ARTICULATION_SHEET_NAME, render_posesfrom codeverse3d.spatial.joints_poses import limit_poses-from codeverse3d.spatial.joints_sweep import sweep_gate+from codeverse3d.spatial.joints_sweep import find_urdf, sweep_gatefrom codeverse3d.spatial.measure import GlbLoadError, measure_glb, measure_summary_tablefrom codeverse3d.spatial.observe import (build_failure_lines,@@ -397,7 +397,7 @@ def joint_sweep(ctx: ToolContext, args: JointSweepArgs) -> Observation: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- if not (ws.artifacts / "robot.urdf").is_file():+ if find_urdf(ws) is None: # the gate's own rule: the built URDF onlyreturn Observation.error("joint_sweep: artifacts/robot.urdf not found — run `build` first")report, robot = sweep_gate(ws)images: list[str] = []diff --git a/harness/tests/urdf_joints/test_export.py b/harness/tests/urdf_joints/test_export.pyindex 6373b939..31f63d42 100644--- a/harness/tests/urdf_joints/test_export.py+++ b/harness/tests/urdf_joints/test_export.py@@ -107,6 +107,13 @@ def test_joint_sweep_penetration_is_a_verdict_not_an_mcp_error(tmp_path, monkeypassert "links 'body|door' overlap in 2 of the sampled poses" in obs.text and "fix:" in obs.textgate, _ = sweep_gate(ws)assert not gate.passed and [f.message for f in gate.errors][0] in obs.text+ # the tool and the gate share ONE urdf rule, the built copy: an authored src/robot.urdf with no+ # build behind it is "run build first" for both, never a sweep against the last build's meshes+ bare = Workspace(tmp_path / "bare").create()+ write_prims_robot(bare.src / "robot.urdf", axis_z=+1)+ obs = get_tool("joint_sweep").call(ToolContext(workspace=bare, language="urdf_blender", track="articulated_object"), {})+ gate, robot = sweep_gate(bare)+ assert "run `build` first" in obs.text and robot is None and [f.message for f in gate.errors] == ["no robot.urdf found after build"]def test_robot_named_like_a_link_keeps_frame_and_placement(tmp_path):