Skip to content

Official Codebase of 3DCodeVerse

Python

planner: a crashing geometry check is logged (plan.geometry_error) and skipped, never a lost plan; 1 mm floor on the sweep depth

ziyaoa07efcc2cd4b
diff --git a/harness/codeverse/tracks/plan_checks.py b/harness/codeverse/tracks/plan_checks.py
index 9b9200ac..faff1530 100644
--- a/harness/codeverse/tracks/plan_checks.py
+++ b/harness/codeverse/tracks/plan_checks.py
@@ -195,7 +195,7 @@ def geometry_complaints(plan: Any) -> list[str]:
exclude = {c} | {k for k in boxes if c in _ancestors(k, parent_of)}
if j.type == "prismatic":
exclude.add(p)
- min_depth = min(COLLISION_MIN_M, 0.5 * min(cb.hi[i] - cb.lo[i] for i in range(3)))
+ 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
diff --git a/harness/codeverse/tracks/planner.py b/harness/codeverse/tracks/planner.py
index 62eabce5..c8e293e7 100644
--- a/harness/codeverse/tracks/planner.py
+++ b/harness/codeverse/tracks/planner.py
@@ -780,7 +780,13 @@ def plan_with_usage[P: BaseModel](spec: Spec, model_id: str, plan_model: type[P]
if geo_reasked < MAX_GEOMETRY_REASKS and getattr(result, "joints", None) and geometry_check_enabled():
from codeverse.tracks.plan_checks import plan_geometry_complaint
- geo = plan_geometry_complaint(result)
+ 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:
diff --git a/harness/tests/orchestrator_tracks/test_planner_geometry_reask.py b/harness/tests/orchestrator_tracks/test_planner_geometry_reask.py
index ffa95fa8..36c348cc 100644
--- a/harness/tests/orchestrator_tracks/test_planner_geometry_reask.py
+++ b/harness/tests/orchestrator_tracks/test_planner_geometry_reask.py
@@ -91,3 +91,19 @@ def test_every_moving_joint_gets_an_articulation_acceptance_item(tmp_ws):
p = plan(_spec(), "fake:planner", ArticulatedPlan, tmp_ws, model=model, runtime=FakeRuntime(Language.URDF_BLENDER))
ids = [a.id for a in p.acceptance]
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