Skip to content

Official Codebase of 3DCodeVerse

Python

planner: a plan that echoes the schema's placeholders is re-asked as such, not for the validator's first symptom

ziyaob6acd1f47b44
diff --git a/harness/codeverse/tracks/planner.py b/harness/codeverse/tracks/planner.py
index b9078f87..446d646d 100644
--- a/harness/codeverse/tracks/planner.py
+++ b/harness/codeverse/tracks/planner.py
@@ -642,6 +642,25 @@ def _with_note(msg: ChatMessage, note: str) -> ChatMessage:
return ChatMessage.user(msg.text + note, images=images)
+_PLACEHOLDERS = {"string", "str", "name", "text", "..."}
+
+
+def _schema_echo(raw: dict[str, Any]) -> str:
+ """"" or what in ``raw`` is a JSON-schema placeholder (``"name": "string"``) rather than content.
+
+ compare_art_v4_pf0 (2026-08-28): flash answered a casement-window brief with a plan
+ whose joint was ``{"name": "string", "axis": [0, 0, 0], ...}`` and failed the zero-axis
+ validator three times; the re-ask echoed 'zero axis', which was not the problem."""
+ bad: list[str] = []
+ if str(raw.get("object_name", "")).strip().lower() in _PLACEHOLDERS:
+ bad.append("object_name")
+ for key in ("parts", "joints", "zones", "assets", "passes"):
+ for i, item in enumerate(raw.get(key) or []):
+ if isinstance(item, dict) and str(item.get("name", "")).strip().lower() in _PLACEHOLDERS:
+ bad.append(f"{key}[{i}].name")
+ return ", ".join(bad[:6])
+
+
def _thin_plan_note(raw: Any, budget: PlanBudget) -> str:
"""A second line for the validation re-ask when the invalid plan is also far too small.
@@ -794,6 +813,10 @@ def plan_with_usage[P: BaseModel](spec: Spec, model_id: str, plan_model: type[P]
try:
if not isinstance(raw, dict):
raise ValueError(f"planner returned {type(raw).__name__}, expected a JSON object")
+ echoed = _schema_echo(raw)
+ if echoed:
+ raise ValueError(f"the plan echoes the schema's placeholders instead of describing the object: {echoed}. "
+ "Write the REAL plan: actual part names, real numbers, a unit axis for every joint.")
result = plan_model.model_validate(raw)
except (ValidationError, ValueError) as e:
last_error = str(e)[:4000]
diff --git a/harness/tests/orchestrator_tracks/test_planner_geometry_reask.py b/harness/tests/orchestrator_tracks/test_planner_geometry_reask.py
index 498aa6fc..f93ebdbe 100644
--- a/harness/tests/orchestrator_tracks/test_planner_geometry_reask.py
+++ b/harness/tests/orchestrator_tracks/test_planner_geometry_reask.py
@@ -118,3 +118,15 @@ def test_validation_reask_names_the_missing_parts_when_the_plan_is_thin(tmp_ws):
assert isinstance(p, ArticulatedPlan) and len(model.requests) == 2
reask = model.requests[1].messages[-1].text
assert "failed validation" in reask and "lists only 1 part(s)" in reask and "needs about" in reask
+
+
+def test_schema_echo_is_named_in_the_reask(tmp_ws):
+ echo = _good()
+ echo["joints"][0]["name"] = "string"
+ echo["joints"][0]["axis"] = [0, 0, 0]
+ answers = [echo, _good()]
+ model = FakeChatModel(lambda req: answers.pop(0))
+ p = plan(_spec(), "fake:planner", ArticulatedPlan, tmp_ws, model=model, runtime=FakeRuntime(Language.URDF_BLENDER))
+ assert isinstance(p, ArticulatedPlan) and len(model.requests) == 2
+ reask = model.requests[1].messages[-1].text
+ assert "echoes the schema" in reask and "joints[0].name" in reask and "zero axis" not in reask