Official Codebase of 3DCodeVerse
Python
scene: no best-of-N — an explicit --candidates N>1 is refused, a profile's is 1, and the record names the width that ran (F1)
gaoypeng173755271506
diff --git a/eval/bench/prompts/teaser_v1_scene.yaml b/eval/bench/prompts/teaser_v1_scene.yamlindex 727c1be3..06d2e714 100644--- a/eval/bench/prompts/teaser_v1_scene.yaml+++ b/eval/bench/prompts/teaser_v1_scene.yaml@@ -118,7 +118,7 @@ prompts:# pale-blue frame with no ripples, no reflections and no koi.# CLI flags used, not expressible in this schema:-# --candidates 2+# --candidates 2 (a no-op on a scene — it wrote n_candidates=2 and ran one baseline; refused since 2026-09-22)# --profile quality- id: tsr_scn_temple_night_v2tier: hard@@ -177,7 +177,7 @@ prompts:# an open truss frame in a pine forest — so refining could not make it an interior.# CLI flags used, not expressible in this schema:-# --candidates 2+# --candidates 2 (a no-op on a scene — it wrote n_candidates=2 and ran one baseline; refused since 2026-09-22)# --profile quality- id: tsr_scn_boat_workshop_v2tier: hard@@ -239,7 +239,7 @@ prompts:# wet-asphalt ShaderMaterial the prompt is about never existed.# CLI flags used, not expressible in this schema:-# --candidates 2+# --candidates 2 (a no-op on a scene — it wrote n_candidates=2 and ran one baseline; refused since 2026-09-22)# --profile quality- id: tsr_scn_neon_alley_v2tier: harddiff --git a/harness/codeverse3d/cli/main.py b/harness/codeverse3d/cli/main.pyindex 3551bcf6..bd5e121c 100644--- a/harness/codeverse3d/cli/main.py+++ b/harness/codeverse3d/cli/main.py@@ -41,7 +41,7 @@ from codeverse3d.cli.flywheel_cmd import flywheel_appfrom codeverse3d.cli.skills_cmd import skills_appfrom codeverse3d.cli.texture_cmd import texture_appfrom codeverse3d.config import get_settings-from codeverse3d.contracts.common import TRACK_LANGUAGES, Budget, Language, Track+from codeverse3d.contracts.common import TRACK_INFO, TRACK_LANGUAGES, Budget, Language, Trackfrom codeverse3d.contracts.spec import Constraints, ReferenceImage, RunOptions, Spec@@ -340,7 +340,7 @@ def make(language = TRACK_LANGUAGES[track][0]run_slug = C.make_slug(prompt, track.value, language.value, slug)settings = get_settings()- texture_arg = texture # the dial folds the profile in below; remember what the USER asked+ texture_arg, candidates_arg = texture, candidates # the dial folds the profile in below; remember what the USER asked# ONE resolver for the whole dial, so `--profile X` and `C3D_PROFILE=X` land the same# values (they used to disagree on candidates + texture); an explicit flag beats both.dial = C.resolve_dial(@@ -366,6 +366,10 @@ def make(f"--texture is for object tracks; {track.value} runs have no GLB to texture{hint}")texture = False # profile-implied: quality simply has no texture pass on this track+ if candidates > 1 and not TRACK_INFO[track].best_of_n: # the same rule for best-of-N+ if candidates_arg:+ raise _no_best_of_n(track)+ candidates = 1backends = settings.backends(generator=generator, planner=planner, judge=judge, captioner=captioner)@@ -468,6 +472,11 @@ def _ground_in_reference(spec: Spec, ws, *, n_views: int) -> Spec:return grounded+def _no_best_of_n(track: Track) -> C.CliError:+ return C.CliError(f"--candidates is for tracks whose baseline is one session; a {track.value} run "+ "writes its baseline in its pre-round stages")++def _run_track(spec: Spec, ws, *, resume: bool, candidates: int | None = None, force: bool = False,pick: bool = True) -> None:from codeverse3d.cost.instrument import run_ledger@@ -599,6 +608,8 @@ def resume(# the run mutex, before the spec is rewritten (a budget raise is a mutation)with C.mutating(ws, what=f"3dcode resume {ws.root.name}"):spec = C.load_spec(ws)+ if candidates and candidates > 1 and not TRACK_INFO[spec.track].best_of_n:+ raise _no_best_of_n(spec.track)if (spec.options.profile): # the dial the run was created with (judge samples, montage px, turn cap)diff --git a/harness/codeverse3d/contracts/common.py b/harness/codeverse3d/contracts/common.pyindex b6566b1a..f0dfc28b 100644--- a/harness/codeverse3d/contracts/common.py+++ b/harness/codeverse3d/contracts/common.py@@ -52,13 +52,15 @@ class TrackInfo(BaseModel):rubric: str = Field(description="rubric name under judges/rubrics/, e.g. 'static_object_v1'")label: str = Field(description="human label for galleries / captions / reports")+ best_of_n: bool = Field(default=True, description="the baseline is one session that --candidates N can run N "+ "times side by side (a scene writes its baseline in the pre-round stages: no)")#: one registry row per trackTRACK_INFO: dict[Track, TrackInfo] = {Track.STATIC_OBJECT: TrackInfo(rubric="static_object_v1", label="3D Objects"),Track.ARTICULATED_OBJECT: TrackInfo(rubric="articulated_v1", label="Articulated Objects"),- Track.SCENE: TrackInfo(rubric="scene_v1", label="3D Scenes"),+ Track.SCENE: TrackInfo(rubric="scene_v1", label="3D Scenes", best_of_n=False),Track.GRAPHICS: TrackInfo(rubric="shader_v2", label="Procedural Graphics"),}diff --git a/harness/codeverse3d/tracks/lifecycle.py b/harness/codeverse3d/tracks/lifecycle.pyindex 0b1ac016..08c127ca 100644--- a/harness/codeverse3d/tracks/lifecycle.py+++ b/harness/codeverse3d/tracks/lifecycle.py@@ -21,7 +21,7 @@ from typing import Anyfrom codeverse3d.config import Settings, get_settingsfrom codeverse3d.contracts.artifacts import GateReport-from codeverse3d.contracts.common import Track+from codeverse3d.contracts.common import TRACK_INFO, Trackfrom codeverse3d.contracts.plan import Planfrom codeverse3d.contracts.run import RoundRecord, RunRecord, RunStatusfrom codeverse3d.contracts.spec import Spec@@ -390,7 +390,10 @@ class BaseTrack:def _resolve_candidates(self, spec: Spec, settings: Settings) -> int:"""Best-of-N width: constructor (CLI --candidates) > ``spec.options.candidates``- (the persisted carrier — spec.json travels with the run) > settings default."""+ (the persisted carrier — spec.json travels with the run) > settings default. 1 on a+ track without best-of-N (``TrackInfo.best_of_n``): the record names the width that ran."""+ if not TRACK_INFO[self.track].best_of_n:+ return 1n = self._n_candidatesif n is None:n = spec.options.candidatesdiff --git a/harness/docs/INTERFACES.md b/harness/docs/INTERFACES.mdindex e4c9e04a..d368ab28 100644--- a/harness/docs/INTERFACES.md+++ b/harness/docs/INTERFACES.md@@ -26,7 +26,7 @@ file was reconciled against it on 2026-08-23 (waves 2–3 + fix batch 1).## core (contracts · config · proc)```python-from codeverse3d.contracts.common import TRACK_INFO, TrackInfo # {Track: TrackInfo(rubric, label)} — THE track registry+from codeverse3d.contracts.common import TRACK_INFO, TrackInfo # {Track: TrackInfo(rubric, label, best_of_n)} — THE track registryfrom codeverse3d.contracts.common import ENTRY_FILE, code_file, LANGUAGE_LABEL # {Language: "src/<entry>"}; code_file(lang) -> "code.<ext>"from codeverse3d.contracts.spec import RunOptions # Spec.options: candidates (int|None, ≥1), texture (bool)GateFinding.as_line(with_gate=False, with_severity=False, with_target=False, with_hint=True) -> str@@ -461,7 +461,8 @@ must-acceptance`; gate authors set `GateFinding.data["kind"]` so caps match precfrom codeverse3d.tracks import get_trackrec = get_track(spec.track, **options).run(spec, ws, resume=False) -> RunRecord # Δ kwargs forwarded to the constructor:# services=, judge=, agent=, model=, runtime=, policy=RoundPolicy, settings=, planner_model=, n_candidates=-# (CLI --candidates > spec.options.candidates > settings.default_candidates); StaticObject | Articulated | Scene | Graphics+# (CLI --candidates > spec.options.candidates > settings.default_candidates; 1 where not TRACK_INFO[track].best_of_n: scene)+# StaticObject | Articulated | Scene | GraphicsBaseTrack.run(spec, ws, *, resume=False, force=False) -> RunRecord # get_track returns a tracks.lifecycle.BaseTrackfrom codeverse3d.orchestrator import RoundPolicy, build_refine_instructions, compact_instructions, gate_error_countRoundPolicy(max_rounds=4, max_refine_tasks=6, max_instructions_per_task=6, parallel_min_tasks=2,diff --git a/harness/docs/RUNBOOK.md b/harness/docs/RUNBOOK.mdindex f4c1957b..b5869465 100644--- a/harness/docs/RUNBOOK.md+++ b/harness/docs/RUNBOOK.md@@ -61,7 +61,9 @@ run does exactly N, each built on the one before it, unless the clock or a hardstops it; there is no pass / plateau / regression stop since 2026-09-22),`--candidates N` (best-of-N baseline: N parallel candidates in `<ws>/_cand/`,quick-judged, the highest quick score kept (fewer gate errors on a tie); multiplies baseline-cost ≈ N; default from `settings.default_candidates`), `--texture` (texture the PICKED round+cost ≈ N; default from `settings.default_candidates`; object and graphics tracks only —+a scene writes its baseline in its stages, so `--candidates N>1` is refused there and a+profile's best-of-2 runs one), `--texture` (texture the PICKED roundafter the run; see §6), `--no-pick` (package nothing: no `deliverable/`, no `selection.json` —`3dcode pick` later), `--max-minutes`, `--dim height=0.45`, `--must`,`--must-not`, `--style`, `--tag`, `--seed`, `--slug`, `--runs-dir`, `--force`,diff --git a/harness/tests/flywheel_cli/test_cli.py b/harness/tests/flywheel_cli/test_cli.pyindex 0c5fcb16..041ae672 100644--- a/harness/tests/flywheel_cli/test_cli.py+++ b/harness/tests/flywheel_cli/test_cli.py@@ -483,6 +483,30 @@ def test_texture_is_not_offered_on_tracks_that_have_no_glb(tmp_path: Path):assert not texture_requested(stale.model_copy(update={"track": Track.GRAPHICS}))+def test_best_of_n_is_not_offered_on_a_scene(tmp_path: Path):+ """F1: a scene writes its baseline in its stages, so --candidates N was a silent no-op that+ recorded n_candidates=N. Explicit: refused. Profile-implied: 1. The record: the width that ran."""+ from codeverse3d.config import get_settings+ from codeverse3d.contracts.common import Track+ from codeverse3d.tracks.scene import SceneTrack++ runs = tmp_path / "runs"+ r = runner.invoke(app, ["make", "a kitchen", "--track", "scene", "--candidates", "2",+ "--no-run", "--runs-dir", str(runs), "--slug", "scn2"])+ assert r.exit_code == 1 and "--candidates" in r.output and not (runs / "scn2").exists()+ r = runner.invoke(app, ["make", "a kitchen", "--track", "scene", "--profile", "quality",+ "--no-run", "--runs-dir", str(runs), "--slug", "scnq"])+ assert r.exit_code == 0+ spec = Spec.model_validate(json.loads((runs / "scnq" / "spec.json").read_text()))+ assert spec.options.candidates == 1+ r = runner.invoke(app, ["resume", "scnq", "--runs-dir", str(runs), "--candidates", "2"])+ assert r.exit_code == 1 and "--candidates" in r.output+ # a scene spec recorded before the fix (options.candidates=2) runs, and records, one+ stale = spec.model_copy(update={"options": spec.options.model_copy(update={"candidates": 2})})+ assert SceneTrack(n_candidates=2)._resolve_candidates(stale, get_settings()) == 1+ assert spec.track is Track.SCENE++# --------------------------------------------------- render must not publish the wrong rounddef _round_guard_ws(tmp_path: Path, *, tree: int, best: int | None = None):"""A workspace whose render tree sits at `tree` (an old record may still name a `best`)."""