Skip to content

Official Codebase of 3DCodeVerse

Python

fewer_turns: deleted — OFF since COST §29 and its follow-up never ran

gaoypeng301700d933b7
diff --git a/harness/codeverse3d/config.py b/harness/codeverse3d/config.py
index b6c58882..cd8968e9 100644
--- a/harness/codeverse3d/config.py
+++ b/harness/codeverse3d/config.py
@@ -91,14 +91,6 @@ class Limits(BaseModel):
"which is what ships: a 28-turn cap cost $0.02 more and 0.205 of a score point in its "
"own A/B — docs/COST.md §17 — so no profile sets one; name it here if you want one).",
)
- fewer_turns: bool = Field(
- default=False,
- description="fold the cheap gates into `build`, report a per-file lint verdict from "
- "write_file / edit_file, inline the files a refine task edits, and ask the baseline "
- "session for every file in its first turn (docs/COST.md §29). OFF until the A/B "
- "reads out; `C3D_FEWER_TURNS=1` (read at call time by `fewer_turns_enabled`) is "
- "what `eval/bench/ab_plan.py --variant-env` flips.",
- )
seed_recipes: bool = Field(
default=True,
description="graphics / glsl_shader: paste the cookbook recipes the brief calls for "
@@ -170,12 +162,10 @@ class Judge(BaseModel):
"Slice render is local CPU; no profile touches this dial (the channel measured ≤ $0).")
-#: The fewer-turns switch (docs/COST.md §29). Read at CALL time by
-#: :func:`fewer_turns_enabled`, never only through the cached Settings: ``eval/bench/ab_plan.py``
+#: The recipe-seeding switch (Limits.seed_recipes). Read at CALL time by
+#: :func:`seed_recipes_enabled`, never only through the cached Settings: ``eval/bench/ab_plan.py``
#: differs its arms by environment alone, and a value frozen at first ``get_settings()``
#: would hand the variant the control's behaviour (the CQ-5 lesson, tracks/plan_features.py).
-FEWER_TURNS_ENV = "C3D_FEWER_TURNS"
-#: The recipe-seeding switch (Limits.seed_recipes); same call-time contract as FEWER_TURNS_ENV.
SEED_RECIPES_ENV = "C3D_SEED_RECIPES"
#: wire the scene texture pack into the scene loop (a stage before env/zones, and the
#: pack description in both prompts). OFF by default: it adds an image-model call per
@@ -210,12 +200,6 @@ def env_flag(env: str, fallback: bool) -> bool:
return fallback
-def fewer_turns_enabled() -> bool:
- """Is the fewer-turns bundle on for THIS call? ``$C3D_FEWER_TURNS`` when it is set,
- else ``Settings.limits.fewer_turns``."""
- return env_flag(FEWER_TURNS_ENV, get_settings().limits.fewer_turns)
-
-
def scene_textures_enabled() -> bool:
"""Is the scene texture stage on for THIS call? ``$C3D_SCENE_TEXTURES``, else off.
@@ -249,7 +233,6 @@ class Settings(BaseSettings):
"C3D_MAX_IN_FLIGHT": ("rate", "max_in_flight"),
# the spelling every doc and gpu_launch.cjs use; only C3D_RENDER__GPU was read
"C3D_RENDER_GPU": ("render", "gpu"),
- FEWER_TURNS_ENV: ("limits", "fewer_turns"),
SEED_RECIPES_ENV: ("limits", "seed_recipes"),
}
diff --git a/harness/codeverse3d/prompts/tracks/assemble_static.j2 b/harness/codeverse3d/prompts/tracks/assemble_static.j2
index 3111e1a6..749c5578 100644
--- a/harness/codeverse3d/prompts/tracks/assemble_static.j2
+++ b/harness/codeverse3d/prompts/tracks/assemble_static.j2
@@ -26,7 +26,7 @@ Overall bbox: {{ overall_bbox }}
2. Run `build`. Fix every build/lint error. An error inside a part file that stops the whole build
IS yours to fix — make the smallest change that makes it build.
3. Run `measure`. Compare each measured part box with the table above.
-4. {% if turn_discipline is defined and turn_discipline %}Read the CONNECTIVITY and CONTRACT sections of the `build` result (it runs both checks for you){% else %}Run `check_connectivity` and `check_contract`{% endif %}. Every ERROR must be gone before you finish:
+4. Run `check_connectivity` and `check_contract`. Every ERROR must be gone before you finish:
- a **floating** part → move it (or its neighbour) so the surfaces overlap by 2–5 mm;
- an **interpenetrating** pair → pull one back to its plan box;
- a **missing** part → the builder was not called, or it built under a parent Empty
@@ -47,10 +47,6 @@ Overall bbox: {{ overall_bbox }}
## Tools
{{ tool_cards }}
{% endif %}
-{% if turn_discipline is defined and turn_discipline %}
-
-{{ turn_discipline }}
-{% endif %}
## Output
{{ output_format }}
diff --git a/harness/codeverse3d/prompts/tracks/generate_static.j2 b/harness/codeverse3d/prompts/tracks/generate_static.j2
index f4c7580d..1b41210b 100644
--- a/harness/codeverse3d/prompts/tracks/generate_static.j2
+++ b/harness/codeverse3d/prompts/tracks/generate_static.j2
@@ -79,10 +79,6 @@ Construction notes per part:
## Tools available to you
{{ tool_cards }}
{% endif %}
-{% if turn_discipline is defined and turn_discipline %}
-
-{{ turn_discipline }}
-{% endif %}
## Output
{{ output_format }}
diff --git a/harness/codeverse3d/prompts/tracks/generate_static_part.j2 b/harness/codeverse3d/prompts/tracks/generate_static_part.j2
index 484ab2f6..75e7e173 100644
--- a/harness/codeverse3d/prompts/tracks/generate_static_part.j2
+++ b/harness/codeverse3d/prompts/tracks/generate_static_part.j2
@@ -61,10 +61,6 @@ Run `build` after writing your files and fix every error it reports before you f
compiles the WHOLE object, so an error in someone else's file is not yours to fix — fix only errors
that name your files.
{% endif %}
-{% if turn_discipline is defined and turn_discipline %}
-
-{{ turn_discipline }}
-{% endif %}
## Output
{{ output_format }}
diff --git a/harness/codeverse3d/prompts/tracks/refine_object.j2 b/harness/codeverse3d/prompts/tracks/refine_object.j2
index 5290fe12..9f54c2f8 100644
--- a/harness/codeverse3d/prompts/tracks/refine_object.j2
+++ b/harness/codeverse3d/prompts/tracks/refine_object.j2
@@ -62,13 +62,6 @@ Files in scope: {% for f in files %}`{{ f }}`{% if not loop.last %}, {% endif %}
{{ tool_cards }}
Run `build` after editing and fix any error before finishing.
{% endif %}
-{% if turn_discipline is defined and turn_discipline %}
-
-## Turn discipline (every tool call is a full round trip — spend as few as you can)
-- Make the edits first (the files above are current), then call `build` once; it already runs
- check_connectivity and check_contract — read its CONNECTIVITY / CONTRACT sections instead of
- calling those tools. Do not read a file back after writing or editing it.
-{% endif %}
## Output
{{ output_format }}
diff --git a/harness/codeverse3d/spatial/mcp_server.py b/harness/codeverse3d/spatial/mcp_server.py
index 8dd108a9..2bb9196e 100644
--- a/harness/codeverse3d/spatial/mcp_server.py
+++ b/harness/codeverse3d/spatial/mcp_server.py
@@ -186,7 +186,7 @@ def make_server(ctx: ToolContext):
defs = {t.name: t for t in list_tools(track=ctx.track, language=ctx.language)}
async def on_list_tools(_req_ctx: Any, _params: Any) -> types.ListToolsResult:
- tools = [types.Tool(name=t.name, description=f"({t.cost_hint}) {t.describe()}", input_schema=t.schema())
+ tools = [types.Tool(name=t.name, description=f"({t.cost_hint}) {t.description}", input_schema=t.schema())
for t in defs.values()]
return types.ListToolsResult(tools=tools)
@@ -220,7 +220,7 @@ def main(argv: list[str] | None = None) -> int:
return 2
ctx = build_context(ws, track=ns.track, language=ns.language, round_index=ns.round_index)
if ns.list:
- print(json.dumps([{"name": t.name, "description": t.describe(), "schema": t.schema()} for t in list_tools(track=ctx.track, language=ctx.language)], indent=1))
+ print(json.dumps([{"name": t.name, "description": t.description, "schema": t.schema()} for t in list_tools(track=ctx.track, language=ctx.language)], indent=1))
return 0
asyncio.run(serve_stdio(ctx))
return 0
diff --git a/harness/codeverse3d/spatial/registry.py b/harness/codeverse3d/spatial/registry.py
index fc6f1b3d..b6c6b9db 100644
--- a/harness/codeverse3d/spatial/registry.py
+++ b/harness/codeverse3d/spatial/registry.py
@@ -102,15 +102,6 @@ class ToolDef:
tracks: tuple[str, ...] = () # empty = all
languages: tuple[str, ...] = () # empty = all
cost_hint: str = "fast" # fast | slow
- #: optional call-time suffix for the description (a switch-dependent sentence, e.g.
- #: "includes CONNECTIVITY / CONTRACT" when C3D_FEWER_TURNS is on). Returns "" for none.
- describe_extra: Callable[[], str] | None = None
-
- def describe(self) -> str:
- """The description the agent sees NOW: the static text plus the switch-dependent
- suffix, so a tool card / native tool spec tracks the tool's real behaviour."""
- extra = self.describe_extra() if self.describe_extra is not None else ""
- return f"{self.description} {extra.strip()}" if extra and extra.strip() else self.description
def schema(self) -> dict[str, Any]:
"""JSON schema of the arguments object (for native tool calling / MCP)."""
@@ -122,7 +113,7 @@ class ToolDef:
"""Prompt card: name, one-line purpose, args with descriptions."""
props = self.schema().get("properties", {})
req = set(self.schema().get("required", []))
- lines = [f"- `{self.name}` ({self.cost_hint}): {self.describe()}"]
+ lines = [f"- `{self.name}` ({self.cost_hint}): {self.description}"]
for k, v in props.items():
typ = v.get("type", "any")
d = v.get("description", "")
@@ -159,7 +150,6 @@ def tool(
tracks: tuple[str, ...] = (),
languages: tuple[str, ...] = (),
cost_hint: str = "fast",
- describe_extra: Callable[[], str] | None = None,
) -> Callable[[Callable[[ToolContext, Any], Observation]], Callable[[ToolContext, Any], Observation]]:
def deco(fn: Callable[[ToolContext, Any], Observation]) -> Callable[[ToolContext, Any], Observation]:
sig = inspect.signature(fn)
@@ -167,8 +157,7 @@ def tool(
raise TypeError(f"tool {name}: fn must be fn(ctx, args)")
if name in _REGISTRY:
raise ValueError(f"tool {name} registered twice")
- _REGISTRY[name] = ToolDef(name, args_model, description, fn, tracks, languages, cost_hint,
- describe_extra)
+ _REGISTRY[name] = ToolDef(name, args_model, description, fn, tracks, languages, cost_hint)
return fn
return deco
diff --git a/harness/codeverse3d/spatial/tools.py b/harness/codeverse3d/spatial/tools.py
index 5d360e49..d6e6407d 100644
--- a/harness/codeverse3d/spatial/tools.py
+++ b/harness/codeverse3d/spatial/tools.py
@@ -15,7 +15,7 @@ from typing import Any
from pydantic import BaseModel, Field
-from codeverse3d.config import fewer_turns_enabled, get_settings
+from codeverse3d.config import get_settings
from codeverse3d.contracts.artifacts import RENDER_MODES, BuildResult, GateReport, Measurement
from codeverse3d.contracts.common import Language, Track
from codeverse3d.conventions import OBJECT_VIEWS, OBJECT_VIEWS_QUICK
@@ -117,49 +117,6 @@ def _gl_gate_verdict(numbers: dict[str, Any]) -> list[str]:
return [f"FRAME GATE: FAIL — {n} error(s) listed below (the code ran; fix the frames, do not re-run blind)"]
-#: what `build` says about itself when the gates ride along (docs/COST.md §29): the agent
-#: must not spend two more round trips asking for what the build observation already holds.
-_BUILD_INCLUDES_CHECKS = ("On success it ALSO runs check_connectivity and check_contract and reports them "
- "under CONNECTIVITY / CONTRACT — do not call those two tools separately.")
-_FOLDED_MAX_FINDINGS = 6
-_FOLDED_SECTION_CHARS = 900 # per section, errors first — two sections + the table fit the build limit
-
-
-def _folded_checks(ctx: ToolContext, glb: Path, m: Measurement, language: str) -> tuple[list[str], dict[str, Any]]:
- """The connectivity + contract gates as they would appear from their own tools, folded
- into the build observation: (lines, numbers). Each gate is a few hundred ms on a
- built GLB; each as a separate tool call was a 4 s round trip carrying the whole
- context (docs/COST.md §29). Same checkers, same gate JSON files, same formatter."""
- ws = ctx.workspace
- lines: list[str] = []
- numbers: dict[str, Any] = {}
- verdicts: list[str] = []
-
- def fold(name: str, report: GateReport) -> None:
- ws.write_json(ws.gates_dir(ctx.round_index) / f"{name.lower()}_tool.json", report)
- obs = gate_observation(report, title=name, max_findings=_FOLDED_MAX_FINDINGS)
- n_err = int(obs.numbers["errors"])
- lines.append(truncate(obs.text, _FOLDED_SECTION_CHARS))
- numbers[f"{name.lower()}_errors"] = n_err
- verdicts.append(f"{name.lower()} " + ("PASS" if report.passed else f"FAIL ({n_err} error(s))"))
-
- plan = load_plan(ws.plan_path) if ws.plan_path.is_file() else None
- conn = _check_connectivity(glb, language=language, planned_edges=planned_joins(plan, m))
- fold("CONNECTIVITY", conn)
- if plan is not None:
- contract = _check_contract(m, plan, language=language)
- fold("CONTRACT", contract)
- passed = conn.passed and contract.passed
- else:
- lines.append("CONTRACT: skipped — no plan.json in the workspace")
- passed = conn.passed
- numbers["checks_passed"] = passed
- tail = ("no separate check_connectivity / check_contract call is needed" if passed
- else "fix the ERRORs listed under CONNECTIVITY / CONTRACT below, then build again")
- summary = "CHECKS: " + " · ".join(verdicts) + " — " + tail
- return [summary, *lines], numbers
-
-
_STDERR_TAIL_LINES = 25
_LINT_WARNS_SHOWN = 10
@@ -193,8 +150,7 @@ def _build_failed(ctx: ToolContext, br: BuildResult, warns: list[str]) -> Observ
"error_file": error_file_display(br.error_file, ws.root), "error_line": br.error_line})
-@tool("build", NoArgs, "Lint + build the code in src/ with the language runtime, export artifacts/object.glb and measure it. Call after every edit.", cost_hint="slow",
- describe_extra=lambda: _BUILD_INCLUDES_CHECKS if fewer_turns_enabled() else "")
+@tool("build", NoArgs, "Lint + build the code in src/ with the language runtime, export artifacts/object.glb and measure it. Call after every edit.", cost_hint="slow")
def build(ctx: ToolContext, args: NoArgs) -> Observation:
# ToolDef.call stamps Observation.duration_ms for every tool — no timing here
from codeverse3d.languages import get_runtime
@@ -239,15 +195,6 @@ def build(ctx: ToolContext, args: NoArgs) -> Observation:
census_warn = br.census.get("warnings") if isinstance(br.census, dict) else None
if census_warn:
lines.append("build warnings:\n" + "\n".join(f"- {sanitize_text(str(w), ws.root)}" for w in list(census_warn)[:10]))
- if m is not None and fewer_turns_enabled():
- try:
- folded, folded_numbers = _folded_checks(ctx, Path(br.glb_path), m, language)
- except (ToolUsageError, ValueError, OSError) as e: # a broken plan.json must not hide a good build
- folded, folded_numbers = [f"CHECKS: skipped ({type(e).__name__}: {e})"], {}
- # errors first (house rule): the verdict and both sections right under BUILD OK, so
- # the head/tail truncation eats the middle of the measurement table, never a gate error
- lines[1:1] = folded
- numbers.update(folded_numbers)
return text_observation(lines, ok=ok, failed=broken, numbers=numbers, limit=3000)
diff --git a/harness/codeverse3d/tracks/graphics.py b/harness/codeverse3d/tracks/graphics.py
index d76c8103..77ae64ea 100644
--- a/harness/codeverse3d/tracks/graphics.py
+++ b/harness/codeverse3d/tracks/graphics.py
@@ -401,7 +401,7 @@ class GraphicsTrack(BaseTrack):
prompt = render(self.refine_template, **graphics_prompt_context(
ctx, round_index=index, tasks=[t.line() for t in group.tasks], targets=group.targets, files=files,
judge_summary=judge_digest(last), frame_notes=frame_stats_text(ctx.ws),
- current_files=refine_inline_files(ctx, files, scoped=False)))
+ current_files=refine_inline_files(ctx, files)))
ctx.record_prompt("refine", prompt)
return GenerationTask(label="refine", prompt=prompt, system=self.system_prompt(ctx), files_hint=files, round=index,
kind="refine", temperature=0.5, thinking="medium", owns_entry=True,
diff --git a/harness/codeverse3d/tracks/lifecycle.py b/harness/codeverse3d/tracks/lifecycle.py
index ced6406b..361313f9 100644
--- a/harness/codeverse3d/tracks/lifecycle.py
+++ b/harness/codeverse3d/tracks/lifecycle.py
@@ -241,7 +241,7 @@ class BaseTrack:
lint = next((g for g in last.gates if g.gate.startswith("lint")), GateReport(gate="lint", passed=True))
report = format_error_report(last.build, lint, ctx.cookbook_text) if last.build else "build did not run"
prompt = render(self.generate_template, **self.generate_context(
- ctx, skeleton_files=refine_inline_files(ctx, files, scoped=False), previous_error=report))
+ ctx, skeleton_files=refine_inline_files(ctx, files), previous_error=report))
return GenerationTask(label="rebuild", prompt=prompt, system=self.system_prompt(ctx), files_hint=files, round=index,
kind="rebuild", temperature=0.7, thinking="high")
diff --git a/harness/codeverse3d/tracks/plan_features.py b/harness/codeverse3d/tracks/plan_features.py
index 3d3c5c9d..536d8cc7 100644
--- a/harness/codeverse3d/tracks/plan_features.py
+++ b/harness/codeverse3d/tracks/plan_features.py
@@ -20,8 +20,7 @@ PLAN_FEATURES_ENV = "C3D_PLAN_FEATURES"
#: pin costs one noisy A/B, pinning wrongly costs a confident wrong answer
#: (eval/docs/EVAL.md §8.1 measured it — the A/A's worst pair differed 1 part vs 10).
GENERATION_SIDE_ENV: frozenset[str] = frozenset({"C3D_SKILLS", "C3D_SKILLS_MAX", "C3D_SKILLS_UNVERIFIED",
- "C3D_SKILLS_ONLY", "C3D_REFERENCE_DIFF",
- "C3D_FEWER_TURNS", "C3D_SEED_RECIPES"})
+ "C3D_SKILLS_ONLY", "C3D_REFERENCE_DIFF", "C3D_SEED_RECIPES"})
def pin_plan_blockers(variant_env: dict[str, str]) -> list[str]:
@@ -49,10 +48,6 @@ LIVE_SWITCHES: dict[str, str] = {
"C3D_SKILLS_MAX": "codeverse3d/skills/config.py",
"C3D_SKILLS_UNVERIFIED": "codeverse3d/skills/config.py",
"C3D_SKILLS_ONLY": "codeverse3d/skills/config.py",
- # fewer turns (docs/COST.md §29): build folds the gates in, write_file lints, the refine
- # prompt inlines its files, the baseline prompt asks for every file in turn 1. One
- # switch, read at call time by config.fewer_turns_enabled; acts after planning.
- "C3D_FEWER_TURNS": "codeverse3d/config.py",
"C3D_SEED_RECIPES": "codeverse3d/config.py",
# wire the scene texture pack into the scene loop: a stage before env/zones, and the
# pack description (texturing.plan.texture_pack_prompt) in both prompts. OFF by
@@ -72,6 +67,7 @@ LIVE_SWITCHES: dict[str, str] = {
DEAD_SWITCHES: dict[str, str] = {
PLAN_FEATURES_ENV: "none of its six features was ever implemented; nothing reads this variable",
"C3D_DETAIL_ROUNDS": "the surface-detail round went with the judgement stops that offered it (2026-09-22)",
+ "C3D_FEWER_TURNS": "the fewer-turns bundle was deleted after its A/B read out flat (2026-09-22, COST §29)",
}
diff --git a/harness/codeverse3d/tracks/prompting.py b/harness/codeverse3d/tracks/prompting.py
index 03d453b5..64162eb5 100644
--- a/harness/codeverse3d/tracks/prompting.py
+++ b/harness/codeverse3d/tracks/prompting.py
@@ -13,7 +13,6 @@ from collections.abc import Sequence
from pathlib import Path
from typing import TYPE_CHECKING, Any
-from codeverse3d.config import fewer_turns_enabled
from codeverse3d.contracts.chat import ImagePart
from codeverse3d.contracts.common import HARNESS_OWNED_SRC, Language, Track, is_harness_owned
from codeverse3d.contracts.plan import Plan, StaticPlan
@@ -304,9 +303,6 @@ def base_prompt_context(ctx: RunContext, **extra: Any) -> dict[str, Any]:
"detail_budget": detail_budget_text(ctx),
"root_link": getattr(plan, "root_link", "") if plan else "",
"reference_note": reference_note(ctx),
- # a string, "" when off: templates render it with one {% if %} and stay byte-identical
- # for the control arm
- "turn_discipline": TURN_DISCIPLINE if (fewer_turns_enabled() and not ctx.single_shot) else "",
# The want -> call table for the effect library that ships in every
# scene_threejs workspace (D51). "" for every other language (no such file), so
# the templates that carry it stay byte-identical elsewhere.
@@ -447,26 +443,10 @@ def skeleton_files(ctx: RunContext, max_chars: int = MAX_SKELETON_CHARS) -> dict
)
-def refine_inline_files(ctx: RunContext, rels: Sequence[str], *, scoped: bool) -> dict[str, str]:
- """The files a refine task may edit, inlined for the prompt — or ``{}``.
-
- Single-shot always gets them (it has no read tool). An agent session gets them only
- under ``fewer_turns`` and only when the task is scoped to ≤ ``INLINE_MAX_FILES`` files
- totalling ≤ ``INLINE_MAX_CHARS`` — measured: a refine session spends 5.2 of its 24
- turns on read_file, mostly on the files the task just named. Larger sets are NOT
- truncated into the prompt (a half file is worse than a read): they stay on disk.
- """
- if ctx.single_shot:
- return current_files(ctx, rels)
- if not (fewer_turns_enabled() and scoped) or not rels or len(rels) > INLINE_MAX_FILES:
- return {}
- paths = [ctx.ws.root / r for r in rels]
- if not all(p.is_file() for p in paths):
- return {}
- if sum(p.stat().st_size for p in paths) > INLINE_MAX_CHARS:
- return {}
- files = current_files(ctx, rels, max_chars=INLINE_MAX_CHARS + 1)
- return files if sum(len(t) for t in files.values()) <= INLINE_MAX_CHARS else {}
+def refine_inline_files(ctx: RunContext, rels: Sequence[str]) -> dict[str, str]:
+ """The files a refine task may edit, inlined for the prompt — single-shot only (it has
+ no read tool); an agent session reads them itself, so it gets ``{}``."""
+ return current_files(ctx, rels) if ctx.single_shot else {}
def current_files(
@@ -541,23 +521,6 @@ def measurement_vs_plan(
return "\n".join(lines + gate_lines)
-#: fewer_turns (docs/COST.md §29): the baseline session hit the 60-turn cap in every measured
-#: run — 22.5 write_file + 8 build + 7.5 read_file + 4.6 check_connectivity + 4.1 check_contract
-#: per session, each a 4 s round trip re-sending a 35–70 k context. The cap itself is NOT the
-#: lever (§17: a 28-turn cap cost 0.205 of a score point); the block asks for fewer, fuller turns.
-TURN_DISCIPLINE = """## Turn discipline (every tool call is a full round trip — spend as few as you can)
-- FIRST reply: write EVERY file listed under "Files you must produce" as multiple `write_file`
- calls in that same reply, then call `build` once. Do not write one file per turn.
-- `build` already runs check_connectivity and check_contract: read its CONNECTIVITY / CONTRACT
- sections, fix what they list, build again. Do not call those two tools separately.
-- Do not read a file back after writing or editing it: `build` reports what is wrong with it.
-- Call `render_sheet` once before you finish; `measure` at most once."""
-
-#: the refine prompt inlines the files a scoped task edits when they are few and small, so the
-#: session's first turn is the edit, not a read_file (fewer_turns, docs/COST.md §29)
-INLINE_MAX_FILES = 3
-INLINE_MAX_CHARS = 12_000
-
AGENT_OUTPUT_RULES = """HOW TO FINISH (agent mode): edit files under src/ only (and public/ for compiled assets).
Before you finish you MUST run the `build` tool and fix every error it reports; then run `measure`
(objects) or `scene_probe` (scenes) once and compare the numbers with the plan. Do not write
diff --git a/harness/codeverse3d/tracks/scene.py b/harness/codeverse3d/tracks/scene.py
index 9d2d5d42..c004b7cd 100644
--- a/harness/codeverse3d/tracks/scene.py
+++ b/harness/codeverse3d/tracks/scene.py
@@ -423,7 +423,7 @@ class SceneTrack(BaseTrack):
prompt = render("tracks/scene_refine.j2", **self._ctx(ctx, recipes=refine_recipes(ctx, files), round_index=index, tasks=lines,
targets=group.targets, files=files, edit_only_these=parallel,
judge_summary=judge_digest(last),
- current_files=refine_inline_files(ctx, files, scoped=False)))
+ current_files=refine_inline_files(ctx, files)))
ctx.record_prompt("scene_refine", prompt)
# parallel groups are file-disjoint by plan_refine_groups: enforce the split they promised
return GenerationTask(label=f"refine_{group.label}" if parallel else "refine", prompt=prompt, system=self.system_prompt(ctx),
@@ -445,7 +445,7 @@ class SceneTrack(BaseTrack):
prompt = render("tracks/scene_refine.j2", **self._ctx(ctx, recipes="", round_index=index, tasks=[report], targets=["build"],
files=files, edit_only_these=False,
judge_summary="(no judgment: the scene did not build — fix the errors above first)",
- current_files=refine_inline_files(ctx, files, scoped=False)))
+ current_files=refine_inline_files(ctx, files)))
ctx.record_prompt("scene_refine", prompt)
return GenerationTask(label="rebuild", prompt=prompt, system=self.system_prompt(ctx), files_hint=files, round=index,
kind="rebuild", temperature=0.7, thinking="high",
diff --git a/harness/codeverse3d/tracks/static_object.py b/harness/codeverse3d/tracks/static_object.py
index 097c1dc9..0cf8ab4a 100644
--- a/harness/codeverse3d/tracks/static_object.py
+++ b/harness/codeverse3d/tracks/static_object.py
@@ -302,9 +302,7 @@ class StaticObjectTrack(BaseTrack):
edit_only_these=scoped,
judge_summary=judge_digest(last),
measurement_notes=measurement_vs_plan(last, ctx.plan, ctx.language),
- # single-shot: always; agent session: under fewer_turns, when the scoped
- # set is ≤ 3 files / ≤ 12 k chars — the first turn is then the edit
- current_files=refine_inline_files(ctx, files, scoped=scoped),
+ current_files=refine_inline_files(ctx, files), # single-shot only
),
)
ctx.record_prompt("refine", prompt)
diff --git a/harness/docs/COST.md b/harness/docs/COST.md
index b0d10ff2..09b1f399 100644
--- a/harness/docs/COST.md
+++ b/harness/docs/COST.md
@@ -1389,6 +1389,13 @@ caps refine fan-out per round and inlines the whole part set under a size budget
turn-discipline prompt on its own, since "finish in fewer turns" is where the must-item misses
come from.
+**Deleted 2026-09-22 (owner).** The switch stayed OFF and the follow-up never ran, so the whole
+bundle went: `C3D_FEWER_TURNS` / `Limits.fewer_turns`, the checks folded into `build`, the
+turn-discipline block in four templates, and the refine prompt's inlined files for agent
+sessions (single-shot still gets them: it has no read tool). The OFF prompts render byte for
+byte as before. The mechanical half never outlived the api-agent anyway: `write_file` was
+that agent's tool.
+
## 30. A tool's FAIL verdict is not an MCP error (2026-09-02)
`spatial/mcp_server.py` returned `is_error = not obs.ok`, and `obs.ok` was the tool's
diff --git a/harness/tests/orchestrator_tracks/conftest.py b/harness/tests/orchestrator_tracks/conftest.py
index b8f214ee..7f3ec68e 100644
--- a/harness/tests/orchestrator_tracks/conftest.py
+++ b/harness/tests/orchestrator_tracks/conftest.py
@@ -24,8 +24,7 @@ def no_brief_expansion(monkeypatch) -> None:
Also clear the global Settings cache around each test: ``get_settings()`` is an
``lru_cache`` singleton that snapshots ``C3D_*`` env vars at first construction, so
whichever test happens to touch it first bakes ITS monkeypatched env into every later
- test in the worker — ``test_fewer_turns`` failed alone and passed in file order for
- exactly this reason."""
+ test in the worker."""
from codeverse3d.config import get_settings
monkeypatch.setenv("C3D_PLAN_BRIEF", "off")
diff --git a/harness/tests/orchestrator_tracks/test_fewer_turns.py b/harness/tests/orchestrator_tracks/test_fewer_turns.py
deleted file mode 100644
index 217da57d..00000000
--- a/harness/tests/orchestrator_tracks/test_fewer_turns.py
+++ /dev/null
@@ -1,152 +0,0 @@
-"""The fewer-turns switch inlines owned files and adds prompt discipline."""
-
-from __future__ import annotations
-
-from codeverse3d.config import FEWER_TURNS_ENV, Settings, fewer_turns_enabled, get_settings
-from codeverse3d.contracts.artifacts import BuildResult, Judgment
-from codeverse3d.contracts.common import Language
-from codeverse3d.contracts.run import RoundRecord
-from codeverse3d.orchestrator import RefineTask, TaskGroup
-from codeverse3d.tracks.plan_features import LIVE_SWITCHES
-from codeverse3d.tracks.prompting import INLINE_MAX_CHARS, INLINE_MAX_FILES, TURN_DISCIPLINE
-
-from .conftest import make_spec
-from .fakes import FakeAgent, FakeRuntime, FakeServices
-
-
-def _round(i: int, score: float) -> RoundRecord:
- return RoundRecord(index=i, kind="refine", build=BuildResult(ok=True, language="blender"), commit=f"c{i}",
- judgment=Judgment(rubric="r", scores={}, overall=score, passed=score >= 0.8))
-
-
-SEAT = "import bpy\n\n\ndef build_seat():\n return bpy.context.object # SEAT-BODY\n"
-LEG = "import bpy\n\n\ndef build_leg():\n return bpy.context.object # LEG-BODY\n"
-
-
-def _ctx(tmp_path, plan, settings, *, language=Language.BLENDER, agent_id="fake-agent:m"):
- from codeverse3d.orchestrator import RunState
- from codeverse3d.proc import EventLog
- from codeverse3d.tracks.static_object import StaticObjectTrack
- from codeverse3d.workspace import Workspace
-
- ws = Workspace(tmp_path / "runs" / "d").create()
- track = StaticObjectTrack(services=FakeServices(), agent=FakeAgent(lambda job: None), settings=settings,
- runtime=FakeRuntime(language))
- ctx = track.build_context(make_spec(language=language, generator=agent_id), ws, EventLog(ws.events_path), RunState(slug="d"))
- ctx.plan = plan
- return track, ctx
-
-
-def _group(files):
- return TaskGroup(tasks=[RefineTask(target="Seat", kind="geometry", instruction="thicken the seat", priority=2, files=list(files))],
- files=list(files))
-
-
-def _write(ws, files):
- for rel, body in files.items():
- p = ws.root / rel
- p.parent.mkdir(parents=True, exist_ok=True)
- p.write_text(body)
-
-
-# --------------------------------------------------------------------------- the switch
-def test_switch_contract(monkeypatch):
- monkeypatch.delenv(FEWER_TURNS_ENV, raising=False)
- assert not fewer_turns_enabled()
- for raw in ("1", "on", "true", "YES"):
- monkeypatch.setenv(FEWER_TURNS_ENV, raw)
- assert fewer_turns_enabled()
- for raw in ("off", "maybe"):
- monkeypatch.setenv(FEWER_TURNS_ENV, raw)
- assert not fewer_turns_enabled()
-
- monkeypatch.setenv(FEWER_TURNS_ENV, "on")
- assert Settings().limits.fewer_turns is True
- monkeypatch.delenv(FEWER_TURNS_ENV)
- get_settings.cache_clear()
- assert Settings().limits.fewer_turns is False
- monkeypatch.setenv("C3D_LIMITS__FEWER_TURNS", "true")
- assert Settings().limits.fewer_turns is True
- assert LIVE_SWITCHES[FEWER_TURNS_ENV] == "codeverse3d/config.py"
-
-
-# --------------------------------------------------------------------------- refine: the files ride along
-def test_refine_prompt_inlines_a_small_scoped_file_set(tmp_path, chair_plan, settings, monkeypatch):
- monkeypatch.setenv(FEWER_TURNS_ENV, "1")
- track, ctx = _ctx(tmp_path, chair_plan, settings)
- files = {"src/parts/seat.py": SEAT, "src/parts/leg.py": LEG}
- _write(ctx.ws, files)
- task = track._refine_task(ctx, _group(files), _round(1, 0.6), 2, parallel=False)
- assert task.edit_only and task.files_hint == list(files)
- assert "SEAT-BODY" in task.prompt and "LEG-BODY" in task.prompt
- assert "--- src/parts/seat.py ---" in task.prompt and "--- src/parts/leg.py ---" in task.prompt
- assert "do NOT read_file them first" in task.prompt and "return each edited file COMPLETE" not in task.prompt
- assert "## Turn discipline" in task.prompt
-
-
-def test_refine_prompt_inlines_nothing_when_off_or_too_big(tmp_path, chair_plan, settings, monkeypatch):
- monkeypatch.delenv(FEWER_TURNS_ENV, raising=False)
- track, ctx = _ctx(tmp_path, chair_plan, settings)
- files = {"src/parts/seat.py": SEAT, "src/parts/leg.py": LEG}
- _write(ctx.ws, files)
- off = track._refine_task(ctx, _group(files), _round(1, 0.6), 2, parallel=False).prompt
- assert "SEAT-BODY" not in off and "Current file contents" not in off and "Turn discipline" not in off
- monkeypatch.setenv(FEWER_TURNS_ENV, "1")
- many = {f"src/parts/p{i}.py": SEAT for i in range(INLINE_MAX_FILES + 1)}
- _write(ctx.ws, many)
- assert "SEAT-BODY" not in track._refine_task(ctx, _group(many), _round(1, 0.6), 2, parallel=False).prompt
- big = {"src/parts/big.py": "import bpy\n" + "# " + "x" * INLINE_MAX_CHARS + "\n"}
- _write(ctx.ws, big)
- p = track._refine_task(ctx, _group(big), _round(1, 0.6), 2, parallel=False).prompt
- assert "Current file contents" not in p # not truncated INTO the prompt: left on disk
- # an unscoped group (target "overall") keeps the whole tree and inlines nothing
- whole = track._refine_task(ctx, TaskGroup(tasks=[RefineTask(target="overall", kind="geometry", instruction="x", priority=2)]),
- _round(1, 0.6), 2, parallel=False)
- assert not whole.edit_only and "Current file contents" not in whole.prompt
-
-
-def test_single_shot_refine_still_inlines_regardless_of_the_switch(tmp_path, chair_plan, settings, monkeypatch):
- monkeypatch.delenv(FEWER_TURNS_ENV, raising=False)
- track, ctx = _ctx(tmp_path, chair_plan, settings, agent_id="single-shot:fake:m")
- files = {"src/parts/seat.py": SEAT}
- _write(ctx.ws, files)
- p = track._refine_task(ctx, _group(files), _round(1, 0.6), 2, parallel=False).prompt
- assert "SEAT-BODY" in p and "return each edited file COMPLETE" in p and "Turn discipline" not in p
-
-
-# --------------------------------------------------------------------------- baseline: every file in turn one
-def test_baseline_prompt_carries_the_turn_discipline_block(tmp_path, chair_plan, settings, monkeypatch):
- monkeypatch.setenv("C3D_SCOPED_PARTS", "off")
- monkeypatch.setenv(FEWER_TURNS_ENV, "1")
- track, ctx = _ctx(tmp_path, chair_plan, settings)
- (task,) = track.baseline_tasks(ctx)
- assert task.label == "baseline" and TURN_DISCIPLINE in task.prompt
- assert "write EVERY file" in task.prompt and "do not call those two tools separately".lower() in task.prompt.lower()
- assert task.prompt.index("## Turn discipline") < task.prompt.index("## Output")
- monkeypatch.delenv(FEWER_TURNS_ENV)
- get_settings.cache_clear() # setenv baked fewer_turns=True into the cached Settings; the fallback must not read it
- (off,) = _ctx(tmp_path / "off", chair_plan, settings)[0].baseline_tasks(_ctx(tmp_path / "off", chair_plan, settings)[1])
- assert "Turn discipline" not in off.prompt
- # single-shot has no tools to discipline
- monkeypatch.setenv(FEWER_TURNS_ENV, "1")
- t2, c2 = _ctx(tmp_path / "ss", chair_plan, settings, agent_id="single-shot:fake:m")
- assert "Turn discipline" not in t2.baseline_tasks(c2)[0].prompt
-
-
-def test_scoped_baseline_and_assembly_prompts_carry_it_too(tmp_path, settings, monkeypatch):
- from .test_generation_depth import big_plan
-
- monkeypatch.delenv("C3D_SCOPED_PARTS", raising=False)
- monkeypatch.setenv(FEWER_TURNS_ENV, "1")
- track, ctx = _ctx(tmp_path, big_plan(), settings, language=Language.THREEJS)
- tasks = track.baseline_tasks(ctx)
- assert len(tasks) >= 3
- assert all("## Turn discipline" in t.prompt for t in tasks)
- assemble = tasks[-1].prompt
- assert "Read the CONNECTIVITY and CONTRACT sections of the `build` result" in assemble
- assert "Run `check_connectivity` and `check_contract`" not in assemble
- monkeypatch.delenv(FEWER_TURNS_ENV)
- get_settings.cache_clear() # setenv baked fewer_turns=True into the cached Settings; the fallback must not read it
- t2, c2 = _ctx(tmp_path / "off", big_plan(), settings, language=Language.THREEJS)
- off = t2.baseline_tasks(c2)[-1].prompt
- assert "Run `check_connectivity` and `check_contract`" in off and "Turn discipline" not in off
diff --git a/harness/tests/spatial_tools/test_tools.py b/harness/tests/spatial_tools/test_tools.py
index 3e7b4ccc..630f2fdd 100644
--- a/harness/tests/spatial_tools/test_tools.py
+++ b/harness/tests/spatial_tools/test_tools.py
@@ -469,7 +469,7 @@ def test_load_plan_recognises_graphics_plan(tmp_ws: Workspace) -> None:
assert isinstance(loaded, GraphicsPlan) and loaded.title == "Neon rain"
-# --------------------------------------------------------------------------- fewer_turns: build folds the gates in
+# --------------------------------------------------------------------------- the gate tools on a stool
def _stool_plan_with_missing_backrest() -> StaticPlan:
return StaticPlan(object_name="Stool", summary="s", overall_bbox=BBox(center=(0, 0, 0.225), extents=(0.4, 0.4, 0.45)),
parts=[PartPlan(name="Seat", role="r", description="d", bbox=BBox(center=(0, 0, 0.43), extents=(0.4, 0.4, 0.04))),
@@ -495,59 +495,6 @@ def test_connectivity_tool_resolves_instance_names_like_the_track_does(stool_ctx
assert {row[3] for row in ledger["planned"] if row[0] == "Leg_3"} == {"open"} # the 5 mm floating leg
-def test_build_folds_connectivity_and_contract_in_when_fewer_turns(stool_ctx: ToolContext, monkeypatch: pytest.MonkeyPatch) -> None:
- """docs/COST.md §29: ~25 check_connectivity + ~19 check_contract calls per run, each a 4 s
- round trip for a < 0.5 s check. With the switch on, one build observation carries both."""
- monkeypatch.setenv("C3D_FEWER_TURNS", "1")
- ws = stool_ctx.workspace
- ws.write_json(ws.plan_path, _stool_plan_with_missing_backrest())
- _patch_runtime(monkeypatch, _FakeRuntime(glb=ws.artifacts / "object.glb"))
- obs = get_tool("build").call(stool_ctx, {})
- assert obs.ok and obs.text.startswith("BUILD OK") # the build itself succeeded
- head, verdict = obs.text.splitlines()[:2]
- assert verdict.startswith("CHECKS: connectivity FAIL") and "contract FAIL" in verdict and "build again" in verdict
- assert "CONNECTIVITY: FAIL" in obs.text and "Leg_3" in obs.text # the floating leg, with its fix hint
- assert "CONTRACT: FAIL" in obs.text and "Backrest" in obs.text and "missing" in obs.text
- assert "fix:" in obs.text
- assert obs.numbers["connectivity_errors"] >= 1 and obs.numbers["contract_errors"] >= 1
- assert obs.numbers["checks_passed"] is False
- assert len(obs.text) <= 3000 # the existing build limit holds
- gates = ws.gates_dir(stool_ctx.round_index)
- assert (gates / "connectivity_tool.json").is_file() and (gates / "contract_tool.json").is_file()
- # the separate tools still exist for an agent that insists
- assert {"check_connectivity", "check_contract"} <= {t.name for t in list_tools()}
-
-
-def test_build_folded_checks_pass_on_a_solid_stool(tmp_ws: Workspace, solid_stool_glb: Path, monkeypatch: pytest.MonkeyPatch) -> None:
- monkeypatch.setenv("C3D_FEWER_TURNS", "on")
- (tmp_ws.artifacts / "object.glb").write_bytes(solid_stool_glb.read_bytes())
- tmp_ws.spec_path.write_text(json.dumps({"id": "t", "track": "static_object", "language": "blender", "prompt": "a stool"}))
- ctx = ToolContext(workspace=tmp_ws, language="blender", track="static_object")
- _patch_runtime(monkeypatch, _FakeRuntime(glb=tmp_ws.artifacts / "object.glb"))
- obs = get_tool("build").call(ctx, {})
- verdict = obs.text.splitlines()[1]
- assert verdict.startswith("CHECKS: connectivity PASS") and "no separate check_connectivity" in verdict
- assert "CONTRACT: skipped — no plan.json" in obs.text # no plan → no contract, said so
- assert obs.numbers["checks_passed"] is True and "contract_errors" not in obs.numbers
-
-
-def test_build_card_and_observation_are_unchanged_when_fewer_turns_is_off(stool_ctx: ToolContext, monkeypatch: pytest.MonkeyPatch) -> None:
- monkeypatch.delenv("C3D_FEWER_TURNS", raising=False)
- ws = stool_ctx.workspace
- ws.write_json(ws.plan_path, _stool_plan_with_missing_backrest())
- _patch_runtime(monkeypatch, _FakeRuntime(glb=ws.artifacts / "object.glb"))
- obs = get_tool("build").call(stool_ctx, {})
- assert "CONNECTIVITY" not in obs.text and "CONTRACT" not in obs.text and "CHECKS:" not in obs.text
- assert "checks_passed" not in obs.numbers
- card_off = get_tool("build").card()
- description = get_tool("build").description
- assert "check_connectivity" not in card_off
- monkeypatch.setenv("C3D_FEWER_TURNS", "1")
- card_on = get_tool("build").card()
- assert "do not call those two tools separately" in card_on and card_on.startswith(card_off.splitlines()[0][:40])
- assert get_tool("build").description == description # the static text never changes
-
-
def test_a_failed_build_tells_the_agent_WHY_not_to_build_again(tmp_ws):
"""After a failed build the GLB is absent (staging publishes nothing), and the
old order reported 'does not exist yet — run `build` first' to an agent that had