Official Codebase of 3DCodeVerse
Python
tracks: the judge sample count is resolved in build_context — make and a bench battery judge at the same n
gaoypeng6080e3091f28
diff --git a/harness/codeverse3d/cli/_common.py b/harness/codeverse3d/cli/_common.pyindex 57bb1569..7a6294bb 100644--- a/harness/codeverse3d/cli/_common.py+++ b/harness/codeverse3d/cli/_common.py@@ -338,18 +338,3 @@ def resolve_dial()-def round_policy_options(spec: Spec, settings: Any | None = None) -> dict[str, Any]:- """``get_track(...)`` options the active profile implies.-- Only the judge sample count needs a ``RoundPolicy`` (rounds travel on- ``spec.budget``, best-of-N on ``spec.options``), so a run at the default- ``n=1`` gets **no** policy and keeps the track's own."""- settings = settings or get_settings()- samples = int(getattr(settings.judge, "samples", 1) or 1)- if samples <= 1:- return {}- from codeverse3d.orchestrator import RoundPolicy-- return {"policy": RoundPolicy(max_rounds=spec.budget.max_rounds, judge_samples=samples)}--diff --git a/harness/codeverse3d/cli/main.py b/harness/codeverse3d/cli/main.pyindex 97aa9fc8..6f464b24 100644--- a/harness/codeverse3d/cli/main.py+++ b/harness/codeverse3d/cli/main.py@@ -503,7 +503,6 @@ def _run_track(spec: Spec, ws, *, resume: bool, candidates: int | None = None, ffrom codeverse3d.tracks import get_trackoptions: dict = {"n_candidates": candidates} if candidates else {}- options.update(C.round_policy_options(spec))try:# already inside the run mutex (make / resume take it); every model call and# agent session of this run lands in telemetry/cost.jsonldiff --git a/harness/codeverse3d/tracks/lifecycle.py b/harness/codeverse3d/tracks/lifecycle.pyindex 3befa89f..77fbafcf 100644--- a/harness/codeverse3d/tracks/lifecycle.py+++ b/harness/codeverse3d/tracks/lifecycle.py@@ -442,7 +442,10 @@ class BaseTrack:# the active minutes keep counting, so a raised cap (--max-minutes / --rounds)# grants only the difference, never a fresh full capbudget.restore(BudgetSnapshot.model_validate(snap))- policy = self._policy or RoundPolicy(max_rounds=spec.budget.max_rounds)+ # the judge sample count is the settings' (a profile's), however the track was built:+ # `3dcode make` and a bench battery judge alike (N74; it was resolved in the CLI only)+ policy = self._policy or RoundPolicy(max_rounds=spec.budget.max_rounds,+ judge_samples=max(1, int(settings.judge.samples or 1)))policy = replace(policy, n_candidates=self._resolve_candidates(spec, settings))rubric = run_rubric(spec, self.rubric)ctx = RunContext(spec=spec, ws=ws, events=events, settings=settings, budget=budget, runtime=runtime,diff --git a/harness/docs/INTERFACES.md b/harness/docs/INTERFACES.mdindex 7d849c5d..c4b2e7a8 100644--- a/harness/docs/INTERFACES.md+++ b/harness/docs/INTERFACES.md@@ -474,7 +474,7 @@ run_stages(track, ctx, runner, stages) -> None; plan_stage_key(spec, track) ->StageRunner(ws, events, state=None, *, frozen=False) # frozen (rounds exist): a recorded stage is served whatever its keyfrom 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,- n_candidates=1, judge_samples=1) # lifecycle.build_context binds n_candidates with ONE dataclasses.replace+ n_candidates=1, judge_samples=1) # lifecycle.build_context: judge_samples = Settings.judge.samples (N74), n_candidates by ONE dataclasses.replace# Δ 2026-09-22 FIXED rounds: a run is the baseline + max_rounds refine rounds, EACH built on the round before# it; only the clock (BudgetGuard) or a hard failure ends it early. Gone with the judgement stops: StopPolicy /# StopDecision, pick_best_round, judge_sigma, best_score, last_gain, REWRITE_KIND / DETAIL_KIND /diff --git a/harness/tests/cost/test_profiles.py b/harness/tests/cost/test_profiles.pyindex 6e3adcf4..d5ff64a5 100644--- a/harness/tests/cost/test_profiles.py+++ b/harness/tests/cost/test_profiles.py@@ -84,18 +84,25 @@ def test_an_explicit_flag_beats_the_profile(tmp_path: Path):assert spec["backends"]["judge"] == "gemini:gemini-3.7-flash" # unstated → still the profile's-def test_judge_samples_reach_the_round_policy_only_when_a_profile_asks(tmp_path: Path):- from codeverse3d.cli import _common as C- from codeverse3d.contracts.common import Budget, Language, Track- from codeverse3d.contracts.spec import Spec-- spec = Spec(id="x", track=Track.STATIC_OBJECT, language=Language.BLENDER, prompt="p",- budget=Budget(max_rounds=3))- s = Settings()- assert C.round_policy_options(spec, s) == {} # n=1: the track keeps its own policy- s.apply_profile("quality", force=True)- opts = C.round_policy_options(spec, s)- assert opts["policy"].judge_samples == 3 and opts["policy"].max_rounds == 3+def test_the_track_judges_at_the_profiles_sample_count_however_it_was_built(tmp_path: Path):+ """N74: resolved in ``BaseTrack.build_context`` — a bench battery builds its track with no+ policy, and judged at n=1 under the quality profile while ``3dcode make`` judged at n=3."""+ from codeverse3d.contracts.common import Language+ from codeverse3d.orchestrator import RunState+ from codeverse3d.proc import EventLog+ from codeverse3d.tracks.static_object import StaticObjectTrack+ from codeverse3d.workspace import Workspace+ from tests.orchestrator_tracks.conftest import make_spec+ from tests.orchestrator_tracks.fakes import FakeRuntime, FakeServices++ ws = Workspace(tmp_path / "runs" / "d").create()+ for profile, samples in ((None, 1), ("quality", 3)):+ s = Settings(runs_dir=tmp_path / "runs", cache_dir=tmp_path / "cache")+ if profile:+ s.apply_profile(profile, force=True)+ track = StaticObjectTrack(services=FakeServices(), settings=s, runtime=FakeRuntime(Language.THREEJS))+ ctx = track.build_context(make_spec(language=Language.THREEJS), ws, EventLog(ws.events_path), RunState(slug="d"))+ assert ctx.policy.judge_samples == samples, profile# --------------------------------------------------------------- flag == env var