Official Codebase of 3DCodeVerse
Python
spatial: delete compare_silhouette, texture_pass and texture_preview — 0, 1 and 0 calls in 616 sessions
gaoypengb44576d28f55
diff --git a/harness/CLAUDE.md b/harness/CLAUDE.mdindex eaf5df6b..3c5f1b07 100644--- a/harness/CLAUDE.md+++ b/harness/CLAUDE.md@@ -6,7 +6,7 @@ Blender bpy · CadQuery · Three.js · URDF · GLSL / OpenGL, across four tracks(`static_object`, `articulated_object`, `scene`, `graphics`), with pluggablebackends. **The coding agent is always a VENDOR's** — gemini-cli / claude-code /codex / antigravity — and the harness supplies the workspace, the prompt and the-3D tools its track can use (over MCP; 19 in the registry, filtered per track — D48+3D tools its track can use (over MCP; 16 in the registry, filtered per track — D48review), then reads the result. The harness's OWN api use is planning,judging, single-shot file generation and the texture pass (Gemini/Anthropic/OpenAI).It does not implement an agent loop: the in-process `api-agent` was deleteddiff --git a/harness/README.md b/harness/README.mdindex 187cc118..66fe17bc 100644--- a/harness/README.md+++ b/harness/README.md@@ -12,8 +12,8 @@ renders, judges, refines, textures and records every run as data-flywheel materi`single-shot` generation on any chat model.* **Spatial tools** (direct, or over the MCP server `3dcode` for the agentic CLIs):build, measure, render_views/sheet, isolate, cross_section,- check_connectivity, check_contract, compare_silhouette, joint_sweep, shader_probe,- scene_probe, scene_views, gl_probe, gl_frames, texture_pass, texture_preview.+ check_connectivity, check_contract, compare_reference, joint_sweep, shader_probe,+ scene_probe, scene_views, check_placement, gl_probe, gl_frames.* **Judging:** rubric VLM judge (default `gemini-3.1-pro-preview`) on labelled 2×2montages with binary defect checklists; code-computed scores, floors and caps fromdeterministic gates; pairwise, ranking and reference judges; best-of-N candidates;diff --git a/harness/codeverse3d/addons/select.py b/harness/codeverse3d/addons/select.pyindex 948b7391..1ff2240a 100644--- a/harness/codeverse3d/addons/select.py+++ b/harness/codeverse3d/addons/select.py@@ -253,7 +253,7 @@ def _texture(ws: Workspace, rec: RunRecord, index: int, *, image_model: Any | Noevents = EventLog(ws.events_path)try:texture_pass(ws, rec.spec, rec.plan, model_id=rec.spec.backends.planner, image_model=image_model, judge=True,- judge_model_id=rec.spec.backends.judge, glb_in=glb, sheet=sheet, events=events, update_record=True)+ judge_model_id=rec.spec.backends.judge, glb_in=glb, sheet=sheet, events=events)except Exception as e: # noqa: BLE001 — a derived asset pack: the hand-over goes out without itlog.warning("texture pass failed on round %d: %s", index, e)events.emit("texture.failed", round=index, error=f"{type(e).__name__}: {e}")diff --git a/harness/codeverse3d/prompts/system/harness_contract.md b/harness/codeverse3d/prompts/system/harness_contract.mdindex 37c21b0d..0cf04531 100644--- a/harness/codeverse3d/prompts/system/harness_contract.md+++ b/harness/codeverse3d/prompts/system/harness_contract.md@@ -56,7 +56,7 @@ artifacts/ harness output (object.glb, renders/, gates/, measurement.json). REBefore declaring done you MUST look at what you built: `build` → `render_sheet` (14 views)→ `check_connectivity` → fix → `isolate` a doubtful part → `cross_section` for cavities-→ `compare_silhouette` if a reference image exists (each step whose tool is in your tool+→ `compare_reference` if a reference image exists (each step whose tool is in your toollist). Read the numbers (bbox, islands, tri count) and the images. "It should be fine"is not evidence; a render is.diff --git a/harness/codeverse3d/spatial/tool_common.py b/harness/codeverse3d/spatial/tool_common.pyindex cccafc49..c9faf61c 100644--- a/harness/codeverse3d/spatial/tool_common.py+++ b/harness/codeverse3d/spatial/tool_common.py@@ -46,18 +46,14 @@ def language_of(ctx: ToolContext) -> str:-def reference_path(ctx: ToolContext, index: int, *, tool: str) -> tuple[Path, dict]:- """``spec.references[index]`` as ``(absolute path, reference dict)``.-- Usage errors name ``tool`` in their example call (``compare_silhouette`` /- ``compare_reference`` share this lookup).- """+def reference_path(ctx: ToolContext, index: int) -> tuple[Path, dict]:+ """``spec.references[index]`` as ``(absolute path, reference dict)`` (``compare_reference``)."""refs = spec_dict(ctx).get("references") or []if not refs:raise ToolUsageError("the spec has no reference images — nothing to compare against")if index >= len(refs):raise ToolUsageError(f"reference_index {index} out of range (have {len(refs)})",- f"{tool}(reference_index=0)")+ "compare_reference(reference_index=0)")ref = refs[index]ref = ref if isinstance(ref, dict) else {"path": ref.path, "role": ref.role, "note": ref.note}p = Path(ref["path"])diff --git a/harness/codeverse3d/spatial/tools.py b/harness/codeverse3d/spatial/tools.pyindex 3517ed3d..47d830bf 100644--- a/harness/codeverse3d/spatial/tools.py+++ b/harness/codeverse3d/spatial/tools.py@@ -1,5 +1,5 @@"""Every spatial tool registered with ``@tool``, in sections: build / measure / gates /-sections · rendering · articulation · scenes · graphics · texturing · reference.+sections · rendering · articulation · scenes · graphics · reference.``import codeverse3d.spatial.tools`` registers all of them.House rules: observations are compact (errors first, fix hints attached), text@@ -18,8 +18,6 @@ from pydantic import BaseModel, Fieldfrom codeverse3d.config import fewer_turns_enabled, get_settingsfrom codeverse3d.contracts.artifacts import RENDER_MODES, BuildResult, GateReport, Measurementfrom codeverse3d.contracts.common import Language, Track-from codeverse3d.contracts.plan import StaticPlan-from codeverse3d.contracts.spec import Specfrom codeverse3d.conventions import OBJECT_VIEWS, OBJECT_VIEWS_QUICKfrom codeverse3d.spatial.connectivity import check_connectivity as _check_connectivityfrom codeverse3d.spatial.contract import check_contract as _check_contract@@ -71,7 +69,6 @@ from codeverse3d.spatial.tool_common import (reference_path,render_cache_dir,resolve_views,- spec_dict,tool_out_dir,)@@ -421,41 +418,13 @@ def isolate(ctx: ToolContext, args: IsolateArgs) -> Observation:def _iou_verdict(res: dict[str, Any]) -> str:- """Silhouette IoU → words, for compare_silhouette and compare_reference alike."""+ """Silhouette IoU → words (compare_reference)."""verdict = "good match" if res["iou"] >= 0.8 else "rough match" if res["iou"] >= 0.6 else "POOR match"if not res["reliable"]:verdict += " (IoU UNRELIABLE: background mask failed on one image — trust the pictures, not the number)"return verdict-class CompareSilhouetteArgs(BaseModel):- view: str = Field(default="front", description="view to render in silhouette mode")- reference_index: int = Field(default=0, ge=0, description="index into spec.references")---@tool("compare_silhouette", CompareSilhouetteArgs, "Silhouette IoU / aspect-ratio error between a rendered view and a reference image (+ diff image).",- tracks=_OBJECT_TRACKS, cost_hint="slow")-def compare_silhouette(ctx: ToolContext, args: CompareSilhouetteArgs) -> Observation:- glb = glb_path(ctx)- ref_path, _ref = reference_path(ctx, args.reference_index, tool="compare_silhouette")- if not ref_path.is_file():- return Observation.error(f"reference image {ref_path.name} not found")- if args.view not in VIEW_BY_NAME:- raise ToolUsageError(f"unknown view {args.view!r}; choose from {list(VIEW_BY_NAME)}", "compare_silhouette(view='front')")- preset = VIEW_BY_NAME[args.view]- rs = cached_render_glb(ctx, glb, views=[preset], mode="silhouette", size=512, sheet=False)- if not rs.views:- return Observation.error("compare_silhouette: renderer produced no view")- out_dir = render_cache_dir(ctx, glb, silhouette=args.view, ref=args.reference_index)- diff = out_dir / f"silhouette_diff_{args.view}_ref{args.reference_index}.png"- res = _compare_silhouette(rs.views[0].path, ref_path, diff_png=diff)- text = (f"silhouette '{args.view}' vs reference #{args.reference_index} ({ref_path.name}): IoU {res['iou']:.2f} → {_iou_verdict(res)}; "- f"aspect w/h render {res['render_aspect']:.2f} vs ref {res['ref_aspect']:.2f} (err {res['aspect_ratio_err']:.0%}). "- f"Diff image: red = reference only, blue = render only. " + fmt_numbers({k: v for k, v in res.items() if k != "diff_png_path"}))- images = image_budget([str(diff), rs.views[0].path])- return Observation(ok=True, text=text, numbers={"view": args.view, **res}, images=images)--# ===================================================================== articulationclass JointSweepArgs(BaseModel):joints: list[str] = Field(default=[], description="joint names to sweep (empty = all)")@@ -693,88 +662,6 @@ def gl_frames(ctx: ToolContext, args: GlFramesArgs) -> Observation:return text_observation(lines, ok=numbers.get("gate_errors", 0) == 0, numbers=numbers, images=images, limit=3000)-# ===================================================================== texturing-class TexturePassArgs(BaseModel):- judge: bool = Field(default=True, description="run the before/after VLM ship gate (False = ship on seam gate only)")- model: str = Field(default="", description="planner chat model id for the material plan (default: spec planner)")- size: int = Field(default=1024, ge=256, le=2048, description="texture size in px")---def _spec_plan(ctx: ToolContext) -> tuple[Spec, StaticPlan]:- try:- spec = Spec.model_validate(spec_dict(ctx))- except Exception as e: # pydantic ValidationError- raise ToolUsageError(f"spec.json missing or invalid: {e}") from e- plan = load_plan(ctx.workspace.plan_path)- if not isinstance(plan, StaticPlan):- raise ToolUsageError("texture_pass needs an object plan (StaticPlan / ArticulatedPlan)")- return spec, plan---@tool("texture_pass", TexturePassArgs,- "Text-to-image texturing of the built GLB: material plan (VLM) → tileable textures (image model) → "- "analytic UVs + PBR materials → artifacts/object_textured.glb, shipped only if the judge score does not drop.",- tracks=_OBJECT_TRACKS, cost_hint="slow")-def texture_pass_tool(ctx: ToolContext, args: TexturePassArgs) -> Observation:- from codeverse3d.texturing.run import texture_pass, texture_requested-- glb = glb_path(ctx)- spec, plan = _spec_plan(ctx)- if not texture_requested(spec):- # ONE owner for "does this run texture?" (codeverse3d.texturing.run.texture_requested).- # The tool is registered for every object track, so without this an agent could —- # and did — buy a texture pass in a run whose spec says texture: false.- raise ToolUsageError(- "this run did not ask for texturing (spec.options.texture is false), so the "- "texture pass is off; finish the geometry instead",- "3dcode make ... --texture # or `3dcode texture pass <slug>` after the run")- services = ctx.extra.get("texture_services") # the ONE injection point (TextureServices)- # update_record=False: during an agent session the control files have ONE owner- # (finalise); a mid-session record.json write is reverted by the tamper enforcement- # and fails the paid session — finalise collects the report into the record instead- rep = texture_pass(ctx.workspace, spec, plan, model_id=args.model or spec.backends.planner,- judge=args.judge, glb_in=glb, size=args.size, services=services,- update_record=False)- s = rep.summary()- root = ctx.workspace.root- lines = [- f"texture pass: {'SHIPPED' if rep.shipped else 'not shipped'} — {s['reason'] or 'ok'}",- f"textures: {s['n_textures']} generated ({', '.join(rep.plan.texture_ids()) or '-'}); seam failed: {s['seam_failed'] or 'none'}",- f"parts textured: {s['parts_textured']} / skipped: {len(rep.apply.parts_skipped) if rep.apply else 0}",- ]- if rep.gate is not None and rep.gate.overall_before is not None:- lines.append(f"judge before {rep.gate.overall_before:.3f} → after {rep.gate.overall_after:.3f} "- f"(Δ {rep.gate.delta:+.3f}; {rep.gate.materials_criterion} Δ {rep.gate.materials_delta:+.3f})")- if rep.glb_out:- lines.append(f"textured GLB: {rel_path(rep.glb_out, root)}")- lines.append(f"cost ${rep.usage.cost_usd:.4f}, {rep.duration_s:.0f}s")- images = []- if rep.gate is not None and rep.gate.renders_after and rep.gate.renders_after.contact_sheet:- images.append(rep.gate.renders_after.contact_sheet)- return text_observation(lines, numbers=s, images=images)---class TexturePreviewArgs(BaseModel):- views: list[str] = Field(default=list(_DEFAULT_VIEWS), description="view names")---@tool("texture_preview", TexturePreviewArgs,- "Render artifacts/object_textured.glb (after texture_pass) as a labelled contact sheet + list the generated textures.",- tracks=_OBJECT_TRACKS, cost_hint="slow")-def texture_preview(ctx: ToolContext, args: TexturePreviewArgs) -> Observation:- ws = ctx.workspace- glb = ws.artifacts / "object_textured.glb"- if not glb.is_file():- raise ToolUsageError("artifacts/object_textured.glb does not exist — run texture_pass first", "texture_pass()")- presets = resolve_views(args.views)- rs = cached_render_glb(ctx, glb, views=presets, mode="shaded", size=512, sheet=True)- tex_dir = ws.artifacts / "textures"- pngs = sorted(p.name for p in tex_dir.glob("*.png")) if tex_dir.is_dir() else []- text = f"textured GLB rendered ({len(rs.views)} views). textures: {', '.join(pngs) or 'none'}"- images = [rs.contact_sheet] if rs.contact_sheet else [v.path for v in rs.views]- return text_observation(text, numbers={"n_textures": len(pngs)}, images=images)--# ===================================================================== reference#: what the agent should compare, in the order that decides whether the object#: reads as the real thing (identity before polish)@@ -802,7 +689,7 @@ class CompareReferenceArgs(BaseModel):"you built the right thing: part inventory, counts, proportions, profiles.", tracks=_OBJECT_TRACKS, cost_hint="slow")def compare_reference(ctx: ToolContext, args: CompareReferenceArgs) -> Observation:glb = glb_path(ctx)- ref_path, ref = reference_path(ctx, args.reference_index, tool="compare_reference")+ ref_path, ref = reference_path(ctx, args.reference_index)if not ref_path.is_file():return Observation.error(f"reference image {ref_path.name} not found")if args.view not in VIEW_BY_NAME:diff --git a/harness/codeverse3d/texturing/run.py b/harness/codeverse3d/texturing/run.pyindex 94d26cfa..ce513d50 100644--- a/harness/codeverse3d/texturing/run.py+++ b/harness/codeverse3d/texturing/run.py@@ -19,7 +19,6 @@ from __future__ import annotationsimport loggingimport timefrom collections.abc import Sequence-from dataclasses import dataclassfrom pathlib import Pathfrom typing import Any@@ -55,19 +54,6 @@ TEXTURES_DIR = "textures"REPORT_NAME = "texturing.json"-@dataclass-class TextureServices:- """The injectable dependencies of :func:`texture_pass` in one bundle (tests and- the spatial tool pass fakes through a single ``ctx.extra['texture_services']``- key). Every field defaults to None = "build/use the real thing"."""-- image_model: Any | None = None- plan_model: Any | None = None- render: Any | None = None- cache_dir: Path | None = None- judge_obj: Any | None = None--class TextureReport(BaseModel):plan: TexturePlantextures: TextureSet@@ -148,9 +134,8 @@ def texture_requested(spec: Spec) -> bool:``Spec.options.texture`` is the switch; the legacy ``texture`` tag is stillhonoured because recorded specs carry it. Nothing else may turn texturing- on — an agent calling the ``texture_pass`` tool in a run that did not ask for- it is refused, and ``3dcode texture pass <slug>`` is an explicit user- instruction that does not go through here at all.+ on; ``3dcode texture pass <slug>`` is an explicit user instruction that does+ not go through here at all.The track scope belongs here too, for the same "one owner" reason: without it``--profile quality`` (which forces texture=True) made every scene and graphics run@@ -179,18 +164,15 @@ def texture_pass(plan_model: Any | None = None,render: Any | None = None,cache_dir: Path | None = None,- services: TextureServices | None = None,events: EventLog | None = None,- update_record: bool = True,normalise: bool = True,) -> TextureReport:"""Run the whole pass on ``ws``.``judge=False`` skips the before/after VLM gate (ship iff something wastextured and no seam failed); ``judge_obj`` replaces the constructed- ``VlmJudge`` (tests). ``services`` bundles the five injectable dependencies- (image_model / plan_model / render / cache_dir / judge_obj); explicit- keyword arguments win over the bundle. ``sheet`` is the contact sheet the material+ ``VlmJudge`` (tests; ``image_model`` / ``plan_model`` / ``render`` / ``cache_dir`` are+ the other injection points). ``sheet`` is the contact sheet the materialplanner looks at — the round being textured; the latest round's otherwise.``normalise=True`` first runs the deterministic material normaliser@@ -199,12 +181,6 @@ def texture_pass(plausible metallic/roughness numbers. It costs no model call, and the samebefore/after judge gate (BEFORE is always the untouched ``glb_in``) decideswhether the combined result ships."""- if services is not None:- image_model = image_model if image_model is not None else services.image_model- plan_model = plan_model if plan_model is not None else services.plan_model- render = render if render is not None else services.render- cache_dir = cache_dir if cache_dir is not None else services.cache_dir- judge_obj = judge_obj if judge_obj is not None else services.judge_objt0 = time.time()events = events or EventLog(ws.events_path)glb_in = Path(glb_in) if glb_in else ws.artifacts / "object.glb"@@ -256,7 +232,7 @@ def texture_pass(notes = report.notes # pydantic copied the list; keep appending to the report's ownif not keep:notes.append("no usable textures (all failed or seams too strong) — nothing applied")- return _finish(ws, report, t0, events, update_record)+ return _finish(ws, report, t0, events)# 4. apply — into staging: the canonical object_textured.glb exists on disk ONLY# when the pass ships (entering the stage also removes any earlier pass's file)@@ -269,14 +245,14 @@ def texture_pass(materials=report.apply.n_materials, warnings=len(report.apply.warnings))if not report.apply.parts_textured:notes.append("no part was textured")- return _finish(ws, report, t0, events, update_record)+ return _finish(ws, report, t0, events)# 5. gateif not judge:report.shipped = Truenotes.append("judge gate skipped (--no-judge): shipped on seam gate only")stage.promote()- return _finish(ws, report, t0, events, update_record)+ return _finish(ws, report, t0, events)gate_judge = judge_obj if judge_obj is not None else _make_judge(spec, rubric, judge_model_id)gate = judge_gate(spec, plan, glb_in, staged_glb, tex_dir / "gate", judge=gate_judge, measurement=_measure(glb_in),views=views, render=render)@@ -287,7 +263,7 @@ def texture_pass(cost_usd=round(gate.usage.cost_usd, 4))if report.shipped:stage.promote()- return _finish(ws, report, t0, events, update_record)+ return _finish(ws, report, t0, events)def _make_judge(spec: Spec, rubric: str | None, judge_model_id: str | None) -> Any:@@ -297,15 +273,14 @@ def _make_judge(spec: Spec, rubric: str | None, judge_model_id: str | None) -> An_samples=1, label="texture_gate")-def _finish(ws: Workspace, report: TextureReport, t0: float, events: EventLog, update_record: bool) -> TextureReport:+def _finish(ws: Workspace, report: TextureReport, t0: float, events: EventLog) -> TextureReport:report.duration_s = round(time.time() - t0, 2)if not report.shipped:# a pass that did not ship leaves NO canonical textured GLB — including one# left behind by an earlier shipped pass (the report keeps all its fields)ws.stage_artifacts(TEXTURED_GLB).invalidate()ws.write_json(ws.artifacts / TEXTURES_DIR / REPORT_NAME, report)- if update_record:- record_texturing(ws, report)+ record_texturing(ws, report)events.emit("texture.done", **report.summary())return reportdiff --git a/harness/codeverse3d/tracks/prompting.py b/harness/codeverse3d/tracks/prompting.pyindex a6334c86..03d453b5 100644--- a/harness/codeverse3d/tracks/prompting.py+++ b/harness/codeverse3d/tracks/prompting.py@@ -428,10 +428,11 @@ def reference_note(ctx: RunContext) -> str:if ctx.single_shot:lines.append("The images are attached to this message.")else:- tgt = next((r.path for r in refs if r.role == "target"), refs[0].path)+ tgt = next((r for r in refs if r.role == "target"), refs[0])lines.append(- f"Use the `compare_silhouette` tool (render_png=<your front render>, reference_png=`{tgt}`) "- "after building to check the outline, and `render_views` to look at your model."+ f"Use the `compare_reference` tool (reference_index={ctx.spec.references.index(tgt)}) after building "+ f"to put `{tgt.path}` beside your model (outline IoU + a side-by-side sheet), and `render_views` to "+ "look at your model.")return "\n".join(lines)diff --git a/harness/docs/ARCHITECTURE.md b/harness/docs/ARCHITECTURE.mdindex 3d0a6c0b..737cd0c5 100644--- a/harness/docs/ARCHITECTURE.md+++ b/harness/docs/ARCHITECTURE.md@@ -132,9 +132,9 @@ codeverse3d/D48 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,- tools.py (every @tool registration since 2026-08-28, the joint_sweep body included;- every import is a plain one — codeverse3d.languages / codeverse3d.texturing- are imported inside the tool bodies), mcp_server.py (MCP name: 3dcode).+ tools.py (every @tool registration since 2026-08-28; every import is a plain+ one — codeverse3d.languages is imported inside the tool bodies),+ mcp_server.py (MCP name: 3dcode).Render modes are contracts.artifacts.RENDER_MODES (shaded wire normals silhouetteclay — no 'depth'); build error_type spellings are languages/_common.MISSING_ENTRY("MissingEntryFile") and BUILD_TIMEOUT ("BuildTimeout") for every runtime@@ -372,11 +372,12 @@ summary:`@tool(name, ArgsModel, description, *, tracks=(), languages=(), cost_hint)` registers`fn(ctx, args) -> Observation` → (a) direct call from tracks, (b) the stdio MCPserver (name `3dcode`) for the vendor CLIs, (c) a native tool schema for any embedder-(`ToolDef.schema()`), (d) a prompt card. The 19 tools: `build`, `measure`,+(`ToolDef.schema()`), (d) a prompt card. The 16 tools: `build` (every track), `measure`,`render_views`, `render_sheet`, `isolate`, `cross_section`, `check_connectivity`,-`check_contract`, `check_placement`, `compare_silhouette`, `compare_reference`,-`joint_sweep` (articulated), `shader_probe`, `scene_probe`, `scene_views` (scene),-`gl_probe`, `gl_frames` (graphics), `texture_pass`, `texture_preview` (object tracks).+`check_contract`, `compare_reference` (object tracks), `joint_sweep` (articulated),+`shader_probe`, `scene_probe`, `scene_views`, `check_placement` (scene), `gl_probe`,+`gl_frames` (graphics). Texturing is not a tool: `3dcode pick --texture` or+`3dcode texture pass` after the run (2026-09-22: 1 call in 616 recorded sessions).An `Observation` carries two different answers: `ok` is the **verdict** and `failed`says the tool **could not run** (exception, missing artefact, unusable arguments).diff --git a/harness/docs/INTERFACES.md b/harness/docs/INTERFACES.mdindex 32f492a3..19105d38 100644--- a/harness/docs/INTERFACES.md+++ b/harness/docs/INTERFACES.md@@ -324,7 +324,7 @@ placement_findings(table, *, indoor=False) -> GateReport # gate "scene_placeme# messages carry the scene_v1 floating_part cap words; reads artifacts/census.json["placement"] (host_placement.mjs)placement_gate_safe(census, *, plan=None, layouts=None, unavailable=()) -> GateReport | None # round gate: None without a table, WARN on failure, never raises; `unavailable` = assets the stage could not build (not "missing planned contents")from codeverse3d.spatial.scene_placement import setting_text # (plan: dict | model) -> the indoor/outdoor setting line-from codeverse3d.spatial.silhouette import compare_silhouette+from codeverse3d.spatial.silhouette import compare_silhouette # the reference gate + compare_reference's IoU (no tool of its own)from codeverse3d.spatial.sections import judge_slices, SliceManifest, JUDGE_SLICE_PLANES # (D48)judge_slices(glb, error_pairs, out_dir, planes=("front_back","left_right")) -> SliceManifest # two vertical centre slices,# red hatch ONLY on error_pairs (the connectivity gate's ERROR penetration pairs), plain darkened blend otherwise,@@ -352,8 +352,8 @@ Observation{ok: VERDICT, failed: the tool could not run, text, numbers, images,from codeverse3d.spatial.mcp_server import observation_content, max_images_for, MAX_TEXT_CHARS# payload bound at the MCP boundary: text truncated; images 4 (ok) | 1 (FAIL verdict) | 0 (failed)import codeverse3d.spatial.tools # registers: build, measure, render_views, render_sheet, isolate, cross_section,- # check_connectivity, check_contract, compare_silhouette, joint_sweep [articulated], shader_probe, scene_probe,- # scene_views + check_placement [scene], gl_probe + gl_frames [graphics], texture_pass + texture_preview [object tracks]+ # check_connectivity, check_contract, compare_reference [object tracks], joint_sweep [articulated], shader_probe,+ # scene_probe, scene_views + check_placement [scene], gl_probe + gl_frames [graphics] — 16python -m codeverse3d.spatial.mcp_server --workspace <ws> [--track X] [--language Y] [--round N] [--list] # MCP name: 3dcode```@@ -535,11 +535,11 @@ generation prompts.from codeverse3d.texturing.run import texture_pass, texture_requested, load_reporttexture_requested(spec) -> bool # THE owner of "does this run texture?" (Spec.options.texture, or# the legacy "texture" tag). Asked by the CLI hand-over after the run (make/resume → addons.select.package(- # texture=…), which textures the PICKED round — Δ 2026-09-22, finalise no longer does) AND by the texture_pass spatial- # tool, which refuses in a run that did not ask — the tool is registered for every object track,- # so `texture: false` used to be bypassable from inside an agent session.-texture_pass(ws, spec, plan, *, model_id, image_model=None, judge=True, judge_model_id=None, rubric=None,- glb_in=None, views=OBJECT_VIEWS_QUICK, size=1024, ..., events=None, update_record=True) -> TextureReport+ # texture=…), which textures the PICKED round — Δ 2026-09-22, finalise no longer does). No agent session can+ # buy a pass: the texture_pass / texture_preview tools were deleted 2026-09-22.+texture_pass(ws, spec, plan, *, model_id, image_model=None, judge=True, judge_obj=None, judge_model_id=None, rubric=None,+ glb_in=None, sheet=None, views=OBJECT_VIEWS_QUICK, size=1024, plan_model=None, render=None, cache_dir=None,+ events=None, normalise=True) -> TextureReport # always writes record.json extra["texturing"] when a record exists# 1 vision call material plan (cacheable) → tileable textures (mirror cross-fade, seam_score ≤ 0.08) → world-metre UV# unwrap (planar/box/cylinder per part, tile_size_m) → artifacts/object_textured.glb → seam gate + before/after judge# gate (ship iff Δoverall ≥ −0.01 AND materials criterion improved); record.extra["texturing"], events texture.*diff --git a/harness/docs/RUNBOOK.md b/harness/docs/RUNBOOK.mdindex 660a2976..e1b4b87e 100644--- a/harness/docs/RUNBOOK.md+++ b/harness/docs/RUNBOOK.md@@ -285,8 +285,9 @@ world-metre UVs → `artifacts/object_textured.glb` → seam gate + before/aftergate (ships only when the score does not drop and the materials criterion improves).`record.extra["texturing"]` holds shipped/delta/cost; `3dcode texture show <slug>`prints it. Scenes: `3dcode texture scene-pack <slug>` writes 6–12 named tiles +-manifest under `public/textures/` for zone prompts. Object tracks' agents can also-call the `texture_pass` / `texture_preview` tools mid-session.+manifest under `public/textures/` for zone prompts. There is no texture tool in an+agent session (the `texture_pass` / `texture_preview` tools were deleted 2026-09-22:+one call in 616 recorded sessions).## 7. Benchmarksdiff --git a/harness/tests/flywheel_cli/test_select.py b/harness/tests/flywheel_cli/test_select.pyindex 4d52beeb..6ce737e0 100644--- a/harness/tests/flywheel_cli/test_select.py+++ b/harness/tests/flywheel_cli/test_select.py@@ -192,7 +192,7 @@ def test_a_scene_or_graphics_round_packages_from_its_own_commit_and_renders(tmp_def _fake_texture_pass(calls: list, *, shipped: bool = True, fail: bool = False):import codeverse3d.texturing.run as trun- def run(ws, spec, plan, *, glb_in, sheet, update_record, **kw):+ def run(ws, spec, plan, *, glb_in, sheet, **kw):calls.append((Path(glb_in), Path(sheet)))if fail:raise RuntimeError("image model down")@@ -200,8 +200,7 @@ def _fake_texture_pass(calls: list, *, shipped: bool = True, fail: bool = False)glb_in=str(glb_in), shipped=shipped)(ws.artifacts / trun.TEXTURED_GLB).write_bytes(b"glTF textured")ws.write_json(trun.report_path(ws), report)- if update_record:- trun.record_texturing(ws, report)+ trun.record_texturing(ws, report)return reportreturn rundiff --git a/harness/tests/install/test_hermetic.py b/harness/tests/install/test_hermetic.pyindex 8582d0f8..f364ae84 100644--- a/harness/tests/install/test_hermetic.py+++ b/harness/tests/install/test_hermetic.py@@ -18,7 +18,7 @@ KEY_ENVS = ("GEMINI_API_KEYS", "GEMINI_API_KEY", "GOOGLE_API_KEY", "GOOGLE_GENAI#: the two that PORT-2 caught; both are inside the offline (pure python) subsetCREDENTIAL_FREE = ("tests/models/test_health.py::test_probe_model_treats_a_503_as_final",- "tests/texturing/test_tools_cli.py::test_texture_pass_tool_runs_with_injected_fakes",+ "tests/texturing/test_tools_cli.py::test_texture_pass_runs_with_injected_fakes",)diff --git a/harness/tests/orchestrator_tracks/test_candidates_reference_motion.py b/harness/tests/orchestrator_tracks/test_candidates_reference_motion.pyindex ee7ded9e..c991acb4 100644--- a/harness/tests/orchestrator_tracks/test_candidates_reference_motion.py+++ b/harness/tests/orchestrator_tracks/test_candidates_reference_motion.py@@ -205,7 +205,7 @@ def test_reference_images_wire_judge_prompts_and_silhouette(tmp_path, chair_planassert any("silhouette IoU vs the reference image is 0.42" in i for i in rec.rounds[1].instructions)assert any("wider relative to its height" in i for i in rec.rounds[1].instructions)refine_prompt = model.requests[-1].messages[0].text- assert "## Reference images" in refine_prompt and "compare_silhouette" not in refine_prompt # single-shot: no tools+ assert "## Reference images" in refine_prompt and "compare_reference" not in refine_prompt # single-shot: no toolsdef test_reference_note_mentions_silhouette_tool_for_agents(tmp_path, chair_plan, settings):@@ -217,7 +217,7 @@ def test_reference_note_mentions_silhouette_tool_for_agents(tmp_path, chair_plantrack = StaticObjectTrack(services=FakeServices(silhouette_iou=0.8), agent=agent, planner_model=_planner(chair_plan.model_dump(mode="json")),settings=settings, runtime=FakeRuntime(Language.BLENDER))rec = track.run(spec, ws)- assert "compare_silhouette" in agent.jobs[0].prompt and str(ref) in agent.jobs[0].prompt+ assert "compare_reference" in agent.jobs[0].prompt and str(ref) in agent.jobs[0].promptgate = next(g for g in rec.rounds[0].gates if g.gate == "reference_silhouette")assert gate.findings[0].severity.value == "info" # IoU 0.8 is fine → no refine taskdiff --git a/harness/tests/orchestrator_tracks/test_likeness_routing.py b/harness/tests/orchestrator_tracks/test_likeness_routing.pyindex 3683570a..102239c9 100644--- a/harness/tests/orchestrator_tracks/test_likeness_routing.py+++ b/harness/tests/orchestrator_tracks/test_likeness_routing.py@@ -22,7 +22,7 @@ def test_graphics_note_asks_for_the_physics_not_a_silhouette(tmp_path):png.write_bytes(b"\x89PNG\r\n\x1a\n" + b"\x00" * 16)note = reference_note(_ctx(Track.GRAPHICS, [str(png)]))assert "REFERENCE PHOTOS (1)" in note and "evenly spaced bars is not a curtain" in note- assert "IoU" not in note and "compare_silhouette" not in note+ assert "IoU" not in note and "compare_reference" not in noteobj = reference_note(_ctx(Track.STATIC_OBJECT, [str(png)]))assert "IoU" in obj, "object tracks keep the silhouette contract"assert reference_note(_ctx(Track.GRAPHICS, [str(tmp_path / "gone.png")])) == ""diff --git a/harness/tests/spatial_tools/test_live_render.py b/harness/tests/spatial_tools/test_live_render.pyindex 3808f67e..c31ec870 100644--- a/harness/tests/spatial_tools/test_live_render.py+++ b/harness/tests/spatial_tools/test_live_render.py@@ -30,6 +30,6 @@ def test_render_views_and_silhouette_live(stool_ctx: ToolContext) -> None:spec = json.loads(stool_ctx.workspace.spec_path.read_text())spec["references"] = [{"path": "ref.png"}]stool_ctx.workspace.spec_path.write_text(json.dumps(spec))- cmp_ = get_tool("compare_silhouette").call(stool_ctx, {"view": "front"})+ cmp_ = get_tool("compare_reference").call(stool_ctx, {"view": "front"})assert cmp_.ok, cmp_.textassert cmp_.numbers["iou"] > 0.97 and cmp_.numbers["reliable"]diff --git a/harness/tests/spatial_tools/test_tools.py b/harness/tests/spatial_tools/test_tools.pyindex 1a9cf9d5..fce9bc90 100644--- a/harness/tests/spatial_tools/test_tools.py+++ b/harness/tests/spatial_tools/test_tools.py@@ -23,13 +23,12 @@ from codeverse3d.workspace import Workspace#: tools every workspace gets (no track/language restriction)CORE_TOOLS = {"build", "measure", "render_views", "render_sheet", "isolate", "cross_section", "check_connectivity",- "check_contract", "compare_silhouette", "compare_reference"}+ "check_contract", "compare_reference"}#: track- / language-scoped tools (documented; keep in sync when registering a new one)SCOPED_TOOLS = {"joint_sweep", # articulated_object"shader_probe", "scene_probe", "scene_views", "check_placement", # scene_threejs"gl_probe", "gl_frames", # graphics (glsl_shader / opengl_python)- "texture_pass", "texture_preview", # object tracks (texturing)}EXPECTED_TOOLS = CORE_TOOLS | SCOPED_TOOLS@@ -41,22 +40,18 @@ def test_registry_has_every_tool() -> None:f"missing {sorted(EXPECTED_TOOLS - registered)} — update CORE_TOOLS/SCOPED_TOOLS above")static_blender = {t.name for t in list_tools(track="static_object", language="blender")}assert "joint_sweep" not in static_blender and "gl_probe" not in static_blender- assert {"texture_pass", "texture_preview"} <= static_blenderscene = {t.name for t in list_tools(track="scene", language="scene_threejs")}assert "shader_probe" in scene- assert not {"texture_pass", "texture_preview"} & {t.name for t in list_tools(track="scene")}graphics = {t.name for t in list_tools(track="graphics", language="glsl_shader")}- assert {"gl_probe", "gl_frames"} <= graphics and "texture_pass" not in graphics and "scene_probe" not in graphics+ assert {"gl_probe", "gl_frames"} <= graphics and "scene_probe" not in graphics# V11a: the object-GLB toolset never reaches scene/graphics agents — their builds# never write artifacts/object.glb, so every one of these was a dead-end refusalobject_glb_tools = {"measure", "check_connectivity", "check_contract", "cross_section", "isolate",- "render_views", "render_sheet", "compare_silhouette", "compare_reference"}+ "render_views", "render_sheet", "compare_reference"}assert not object_glb_tools & scene and not object_glb_tools & graphicsassert "build" in scene and "build" in graphics # build itself stays universalarticulated = {t.name for t in list_tools(track="articulated_object", language="urdf_blender")}assert object_glb_tools | {"joint_sweep"} <= articulated # articulated keeps the object toolset- texture_card = get_tool("texture_pass").card()- assert "judge" in texture_card and "texture_pass" in texture_cardfor t in list_tools():assert t.schema()["type"] == "object" and t.description@@ -328,22 +323,6 @@ def test_render_sheet_and_isolate(stool_ctx: ToolContext, fake_renderer) -> Noneassert not obs.ok and "Leg_3" in obs.text-def test_compare_silhouette_tool(stool_ctx: ToolContext, fake_renderer) -> None:- obs = get_tool("compare_silhouette").call(stool_ctx, {})- assert not obs.ok and "no reference images" in obs.text- ref = stool_ctx.workspace.root / "ref.png"- im = Image.new("RGB", (300, 300), (250, 250, 250))- ImageDraw.Draw(im).rectangle([60, 60, 240, 240], fill=(20, 20, 20))- im.save(ref)- spec = json.loads(stool_ctx.workspace.spec_path.read_text())- spec["references"] = [{"path": "ref.png"}]- stool_ctx.workspace.spec_path.write_text(json.dumps(spec))- obs = get_tool("compare_silhouette").call(stool_ctx, {"view": "front"})- assert obs.ok and obs.numbers["iou"] > 0.95 and len(obs.images) == 2 and Path(obs.images[0]).is_file()- obs = get_tool("compare_silhouette").call(stool_ctx, {"reference_index": 3})- assert not obs.ok and "out of range" in obs.text--def test_scene_tools_with_fake_siblings(stool_ctx: ToolContext, monkeypatch: pytest.MonkeyPatch) -> None:import codeverse3d.spatial.tools as tsfrom codeverse3d.spatial.probes import SceneProbeResultdiff --git a/harness/tests/texturing/conftest.py b/harness/tests/texturing/conftest.pyindex 6e150b32..4fd5f19d 100644--- a/harness/tests/texturing/conftest.py+++ b/harness/tests/texturing/conftest.py@@ -116,9 +116,9 @@ class FakeJudge:class FakePlanModel:"""A ChatModel that answers the material-plan call — no credentials, no network.- ``TextureServices.plan_model`` is one of the five injectable dependencies, and a- test that leaves it None makes ``material_plan`` build a REAL model from the spec's- planner id: the test then only passes on a box that happens to have keys (PORT-2).+ ``texture_pass(plan_model=)`` is one of its five injection points, and a test that+ leaves it None makes ``material_plan`` build a REAL model from the spec's planner id:+ the test then only passes on a box that happens to have keys (PORT-2)."""id = "fake:plan"diff --git a/harness/tests/texturing/test_run.py b/harness/tests/texturing/test_run.pyindex 3a8806e1..c10b8f75 100644--- a/harness/tests/texturing/test_run.py+++ b/harness/tests/texturing/test_run.py@@ -9,7 +9,6 @@ from pathlib import Pathfrom codeverse3d.contracts.run import RunRecordfrom codeverse3d.texturing.run import (TextureReport,- TextureServices,latest_sheet,load_report,texture_pass,@@ -32,9 +31,8 @@ def test_texture_pass_ships_and_records(tmp_path, chair_glb, chair_spec, chair_pws = _ws(tmp_path, chair_glb, chair_spec, chair_plan)judge = FakeJudge([(0.70, {"materials": 0.6, "intent_fidelity": 0.8}), (0.73, {"materials": 0.75, "intent_fidelity": 0.8})])img = FakeImageModel(usd_per_image=0.05)- services = TextureServices(image_model=img, judge_obj=judge, render=fake_render,- cache_dir=tmp_path / "cache")- rep = texture_pass(ws, chair_spec, chair_plan, model_id="", services=services)+ rep = texture_pass(ws, chair_spec, chair_plan, model_id="", image_model=img, judge_obj=judge, render=fake_render,+ cache_dir=tmp_path / "cache")assert isinstance(rep, TextureReport) and rep.shipped and rep.delta == 0.03assert rep.plan.source == "default" and len(rep.textures.paths()) == 2assert (ws.artifacts / "object_textured.glb").is_file() and (ws.artifacts / "object.glb").read_bytes() == chair_glb.read_bytes()diff --git a/harness/tests/texturing/test_tools_cli.py b/harness/tests/texturing/test_tools_cli.pyindex 743f1168..58fd472a 100644--- a/harness/tests/texturing/test_tools_cli.py+++ b/harness/tests/texturing/test_tools_cli.py@@ -1,4 +1,4 @@-"""texture tools (registry) + `3dcode texture` CLI, offline."""+"""The texture pass with every dependency injected, and the `3dcode texture` CLI, offline."""from __future__ import annotations@@ -7,67 +7,32 @@ from pathlib import Pathfrom typer.testing import CliRunner-from codeverse3d.spatial.registry import ToolContext, get_tool-from codeverse3d.texturing.run import TextureServices+from codeverse3d.texturing.run import texture_passfrom codeverse3d.workspace import Workspacefrom tests.texturing.conftest import FakeImageModel, FakeJudge, FakePlanModel, fake_render-def _ws(tmp_path: Path, chair_glb, chair_spec, chair_plan, *, texture: bool = True) -> Workspace:+def _ws(tmp_path: Path, chair_glb, chair_spec, chair_plan) -> Workspace:ws = Workspace(tmp_path / "run").create()- # texturing.run.texture_requested is the ONE owner of "does this run texture?" —- # the tool refuses in a run whose spec says no, so the spec has to say yes here- spec = chair_spec.model_copy(update={"options": chair_spec.options.model_copy(update={"texture": texture})})- ws.write_json(ws.spec_path, spec)+ ws.write_json(ws.spec_path, chair_spec)ws.write_json(ws.plan_path, chair_plan)shutil.copy(chair_glb, ws.artifacts / "object.glb")return ws-def test_texture_pass_tool_runs_with_injected_fakes(tmp_path, chair_glb, chair_spec, chair_plan):+def test_texture_pass_runs_with_injected_fakes(tmp_path, chair_glb, chair_spec, chair_plan):+ """Every dependency injected, the spec's REAL planner id passed as ``model_id``: the pass must+ not build a model from it (tests/install/test_hermetic.py runs this with no keys at all)."""ws = _ws(tmp_path, chair_glb, chair_spec, chair_plan)judge = FakeJudge([(0.7, {"materials": 0.5}), (0.72, {"materials": 0.7})])- # plan_model too: without it material_plan builds a REAL model from the spec's- # planner id, so this "injected fakes" test only passed on a box that has keys.- services = TextureServices(image_model=FakeImageModel(), judge_obj=judge, render=fake_render,- plan_model=FakePlanModel(), cache_dir=tmp_path / "c")- ctx = ToolContext(workspace=ws, track="static_object", language="blender",- extra={"texture_services": services})- obs = get_tool("texture_pass").call(ctx, {"model": ""})- assert obs.ok, obs.text- assert "SHIPPED" in obs.text and obs.numbers["shipped"] is True and obs.images+ rep = texture_pass(ws, chair_spec, chair_plan, model_id=chair_spec.backends.planner, image_model=FakeImageModel(),+ plan_model=FakePlanModel(), judge_obj=judge, render=fake_render, cache_dir=tmp_path / "c")+ assert rep.shipped and rep.plan.source != "default"assert (ws.artifacts / "object_textured.glb").is_file()- # preview tool: cached_render_glb needs the real renderer; with a fake we only check the usage error path- obs2 = get_tool("texture_preview").call(ToolContext(workspace=Workspace(tmp_path / "empty").create()), {})- assert not obs2.ok and "texture_pass" in obs2.text---def test_texture_pass_tool_without_glb_is_usage_error(tmp_path, chair_spec, chair_plan):- ws = Workspace(tmp_path / "run").create()- ws.write_json(ws.spec_path, chair_spec)- ws.write_json(ws.plan_path, chair_plan)- obs = get_tool("texture_pass").call(ToolContext(workspace=ws), {})- assert not obs.ok and "build" in obs.text---def test_texture_pass_tool_refuses_when_the_run_did_not_ask_for_texturing(- tmp_path, chair_glb, chair_spec, chair_plan):- """`texture: false` must actually prevent the pass. The tool is registered for every- object track, so an agent used to be able to buy a texture pass inside any run- (docs/COST.md §15: the quality run paid for two)."""- ws = _ws(tmp_path, chair_glb, chair_spec, chair_plan, texture=False)- services = TextureServices(image_model=FakeImageModel(), judge_obj=FakeJudge([(0.7, {})]),- render=fake_render, cache_dir=tmp_path / "c")- obs = get_tool("texture_pass").call(- ToolContext(workspace=ws, track="static_object", language="blender",- extra={"texture_services": services}), {})- assert not obs.ok and "did not ask for texturing" in obs.text- assert not (ws.artifacts / "object_textured.glb").exists()def test_cli_texture_show_and_help(tmp_path, chair_glb, chair_spec, chair_plan):from codeverse3d.cli.main import app- from codeverse3d.texturing.run import texture_passws = _ws(tmp_path, chair_glb, chair_spec, chair_plan)texture_pass(ws, chair_spec, chair_plan, model_id="", image_model=FakeImageModel(), judge=False, render=fake_render,