Official Codebase of 3DCodeVerse
Python
record: no import of tracks or judges — tracks stamp their sampling, a Judgment says it is degraded
gaoypeng48b083b54363
diff --git a/eval/docs/EVAL.md b/eval/docs/EVAL.mdindex 2f6f95d1..3ddeee02 100644--- a/eval/docs/EVAL.md+++ b/eval/docs/EVAL.md@@ -24,7 +24,7 @@ fooling ourselves. Tools: `bench/run_bench.py`, `bench/compare_backends.py`,items, so harness and one-shot are judged alike).3. **Scores are code-computed.** Weighted criteria, floors, caps from gate findings,`passed = overall ≥ threshold ∧ no floor ∧ all must-acceptance`; the ledger is in- `Judgment.raw` (ScoreBreakdown). Degraded verdicts (`is_degraded`) are re-run, not+ `Judgment.raw` (ScoreBreakdown). Degraded verdicts (`Judgment.degraded`) are re-run, notcounted.4. **Stratified batteries.** Prompts are fixed YAML with ids, tiers (easy/medium/hard)and categories; report per tier, never only the mean.diff --git a/harness/codeverse3d/addons/calibration.py b/harness/codeverse3d/addons/calibration.pyindex 8abb1ec1..249b5a3d 100644--- a/harness/codeverse3d/addons/calibration.py+++ b/harness/codeverse3d/addons/calibration.py@@ -34,7 +34,6 @@ from codeverse3d.contracts.artifacts import Judgment, RenderSetfrom codeverse3d.contracts.run import RoundRecord, RunRecordfrom codeverse3d.contracts.spec import Specfrom codeverse3d.judges.base import JudgeInput-from codeverse3d.judges.rubrics import is_degradedfrom codeverse3d.judges.vlm_judge import VlmJudgefrom codeverse3d.record.record import RecordError, load_recordfrom codeverse3d.workspace import Workspace@@ -252,7 +251,7 @@ def _judge_case(case: RoundCase, judge: VlmJudge, geometry: RenderSet | None, oucaps=[c["rule"] for c in raw.get("caps", {}).get("caps_applied", [])],passed=j.passed, n_used=j.n_samples, geometry_views=inp.geometry_views is not None,cost_usd=j.usage.cost_usd, duration_s=round(time.time() - t0, 1), summary=j.summary,- error=j.summary if is_degraded(j) else "",+ error=j.summary if j.degraded else "",)diff --git a/harness/codeverse3d/contracts/artifacts.py b/harness/codeverse3d/contracts/artifacts.pyindex 44ba1920..8bc1dc72 100644--- a/harness/codeverse3d/contracts/artifacts.py+++ b/harness/codeverse3d/contracts/artifacts.py@@ -2,6 +2,7 @@from __future__ import annotations+import jsonfrom collections.abc import Sequencefrom enum import StrEnumfrom typing import Any, Literal@@ -216,3 +217,14 @@ class Judgment(BaseModel):score_std: float = 0.0usage: Usage = Field(default_factory=Usage)raw: str = ""++ @property+ def degraded(self) -> bool:+ """A judge glitch (an outage, an unparseable verdict), never a score: its 0.0 must not+ reach a pick or a refine plan (``judges.rubrics.degraded_judgment`` writes one)."""+ if self.summary.startswith("judge_error:"):+ return True+ try:+ return json.loads(self.raw).get("status") == "degraded"+ except (json.JSONDecodeError, AttributeError, TypeError):+ return Falsediff --git a/harness/codeverse3d/contracts/run.py b/harness/codeverse3d/contracts/run.pyindex 161e42bb..faeb1702 100644--- a/harness/codeverse3d/contracts/run.py+++ b/harness/codeverse3d/contracts/run.py@@ -254,10 +254,10 @@ class RoundRecord(BaseModel):class RoleSettings(BaseModel):"""Resolved model settings for ONE role of a run (planner/generator/judge/…).- ``source`` says where the sampling knobs came from: ``spec`` (frozen on the- Spec), ``default`` (the harness default, read from the call site's typed- defaults) or ``unknown`` (the call site hard-codes it per task — the value- is left empty rather than guessed)."""+ ``source`` says where the sampling knobs came from: ``run`` (stamped by the track as it+ ran, ``record.extra["sampling"]``) or ``spec`` (only the model is known — a vendor CLI owns+ its knobs; the values are left empty rather than guessed). Records before 2026-09-22 say+ ``default`` (read off the call sites' signature defaults)."""role: strmodel: str = ""diff --git a/harness/codeverse3d/judges/rubrics.py b/harness/codeverse3d/judges/rubrics.pyindex ee7d8b6b..392b0d62 100644--- a/harness/codeverse3d/judges/rubrics.py+++ b/harness/codeverse3d/judges/rubrics.py@@ -957,13 +957,3 @@ def degraded_judgment(usage=usage,raw=json.dumps(breakdown, ensure_ascii=False),)---def is_degraded(j: Judgment) -> bool:- """True when a Judgment is a judge glitch rather than a score."""- if j.summary.startswith("judge_error:"):- return True- try:- return json.loads(j.raw).get("status") == "degraded"- except (json.JSONDecodeError, AttributeError, TypeError):- return Falsediff --git a/harness/codeverse3d/judges/vlm_judge.py b/harness/codeverse3d/judges/vlm_judge.pyindex 3f672a9b..3dde046c 100644--- a/harness/codeverse3d/judges/vlm_judge.py+++ b/harness/codeverse3d/judges/vlm_judge.py@@ -111,7 +111,7 @@ class VlmJudge:self.rubric: Rubric = rubric if isinstance(rubric, Rubric) else load_rubric(rubric)# Every sample of one call normally sees the montages and tiles in a different order# (shuffle_seed below), so score_std is a view-ORDER robustness figure — the number- # cost/routing.JUDGE_NOISE was tabulated from. fixed_order sends the identical+ # docs/COST.md §8's judge noise was tabulated from. fixed_order sends the identical# prompt n times: the re-judge σ of the model itself, which is what the loop's# stop thresholds and the pairwise margin are actually keyed to (audit 2026-08-30;# brilliana measured 0.013 vs 0.035 between the two on 512 calls).diff --git a/harness/codeverse3d/models/gemini.py b/harness/codeverse3d/models/gemini.pyindex d37dd2ea..d64f4880 100644--- a/harness/codeverse3d/models/gemini.py+++ b/harness/codeverse3d/models/gemini.py@@ -35,6 +35,9 @@ from codeverse3d.contracts.chat import (TextPart,)from codeverse3d.contracts.common import Usage+from codeverse3d.cost.context import AttemptRecord, attempt_sink+from codeverse3d.cost.ledger import record_call+from codeverse3d.cost.types import Role, Stagefrom codeverse3d.models.base import ModelErrorfrom codeverse3d.models.parts import Stopwatch, attempt_timeout_s, image_bytes, retry_budget_sfrom codeverse3d.models.pricing import estimate_cost, per_image_usd@@ -468,14 +471,8 @@ class GeminiModel:place a budget guard can see that money) and feeds the ledger's per-attempt sinkwhen the metering layer installed one (``cost.instrument.MeteredChatModel``).Captured once per logical call so a hedge loser landing later, in its own thread,- still reports through it. Imported lazily: the models package must not import- the cost package at module level (``cost.ledger`` imports ``models.pricing``)."""- try:- from codeverse3d.cost.context import AttemptRecord, attempt_sink-- sink = attempt_sink()- except Exception: # pragma: no cover - accounting must never break a call- AttemptRecord = sink = None+ still reports through it."""+ sink = attempt_sink()def on_attempt(t: _Try, no: int, discarded: bool) -> None:if t.err is None:@@ -588,15 +585,9 @@ def _is_model_missing(err: ModelError) -> bool:def _record(usage: Usage, n_images: int) -> None:"""One ledger row per image batch (the image model is not a ChatModel, so- ``models.registry`` cannot meter it). Never raises."""- try:- from codeverse3d.cost import record_call- from codeverse3d.cost.types import Role, Stage-- record_call(usage, stage=Stage.TEXTURE, role=Role.IMAGE, label="image",- backend="gemini-image", model=usage.model, n_calls=max(1, n_images))- except Exception: # noqa: BLE001 - accounting must never break a texture pass- pass+ ``models.registry`` cannot meter it). ``record_call`` never raises."""+ record_call(usage, stage=Stage.TEXTURE, role=Role.IMAGE, label="image",+ backend="gemini-image", model=usage.model, n_calls=max(1, n_images))class GeminiImageModel:diff --git a/harness/codeverse3d/record/record.py b/harness/codeverse3d/record/record.pyindex 95037ced..72ee90ab 100644--- a/harness/codeverse3d/record/record.py+++ b/harness/codeverse3d/record/record.py@@ -121,11 +121,7 @@ def effective_judgment(r: RoundRecord):"""The round's judgment, or ``None`` when it is a degraded (judge-outage)verdict — the flywheel must treat those as 'no score', never as a 0.0."""j = r.judgment- if j is None:- return None- from codeverse3d.judges.rubrics import is_degraded-- return None if is_degraded(j) else j+ return None if j is None or j.degraded else jdef effective_score(r: RoundRecord) -> float | None:diff --git a/harness/codeverse3d/record/telemetry.py b/harness/codeverse3d/record/telemetry.pyindex e9bceae2..f5a0f447 100644--- a/harness/codeverse3d/record/telemetry.py+++ b/harness/codeverse3d/record/telemetry.py@@ -19,7 +19,6 @@ succeed: every builder degrades to "what could be read".from __future__ import annotationsimport hashlib-import inspectimport jsonimport loggingfrom typing import Any@@ -62,41 +61,6 @@ def backend_kind(model_id: str) -> str:return model_id.split(":", 1)[0] if ":" in model_id else model_id-def _sig_default(fn: Any, name: str) -> Any:- try:- param = inspect.signature(fn).parameters[name]- except (TypeError, ValueError, KeyError): # pragma: no cover - defensive- return None- return None if param.default is inspect.Parameter.empty else param.default---def _judge_defaults() -> dict[str, Any]:- try:- from codeverse3d.judges.vlm_judge import VlmJudge- except Exception: # pragma: no cover - sub-package missing- return {}- init = VlmJudge.__init__- return {"temperature": _sig_default(init, "temperature"), "thinking": _sig_default(init, "thinking"),- "n_samples": _sig_default(init, "n_samples")}---def _planner_defaults(record: RunRecord) -> dict[str, Any]:- """The temperature THIS track plans at (``planner.plan_temperature``: graphics 0.5, the rest 0.4)."""- from codeverse3d.tracks.planner import plan_temperature-- return {"temperature": plan_temperature(record.spec.track)}---def _generator_defaults(model_id: str) -> dict[str, Any]:- """HISTORICAL shim, read-only: CLI agents own their sampling knobs and only the- in-process ``api-agent`` (deleted 2026-08-28) exposed ours. The constants reproduce- its shipped defaults so a pre-deletion record still reports what it ran with; they- configure nothing."""- if backend_kind(model_id) != "api-agent":- return {}- return {"temperature": 0.3, "thinking": "low"}--def _rubric_name(record: RunRecord) -> str:name = str(record.extra.get("rubric") or "")if name:@@ -121,23 +85,21 @@ def rubric_hash(name: str) -> str:def _role_settings(record: RunRecord) -> list[RoleSettings]:+ """The model per role from the spec; the sampling knobs from what the track stamped as it+ ran (``record.extra["sampling"]``: the planner's temperature, the judge's temperature /+ thinking / samples). A vendor CLI owns its own knobs, and a record written before+ 2026-09-22 carries none: left empty, never guessed."""b = record.spec.backends- plan_d, judge_d = _planner_defaults(record), _judge_defaults()- spec: list[tuple[str, str, dict[str, Any]]] = [- ("planner", b.planner, plan_d),- ("generator", b.generator, _generator_defaults(b.generator)),- ("judge", b.judge, judge_d),- ("captioner", b.captioner, {}),- ]+ sampling = record.extra.get("sampling") or {}roles: list[RoleSettings] = []- for role, model_id, defaults in spec:- temperature = defaults.get("temperature")+ for role, model_id in (("planner", b.planner), ("generator", b.generator), ("judge", b.judge),+ ("captioner", b.captioner)):+ knobs = sampling.get(role) or {}+ temperature = knobs.get("temperature")roles.append(RoleSettings(- role=role, model=model_id, backend=backend_kind(model_id),- thinking=str(defaults.get("thinking") or ""),+ role=role, model=model_id, backend=backend_kind(model_id), thinking=str(knobs.get("thinking") or ""),temperature=float(temperature) if isinstance(temperature, (int, float)) else None,- n_samples=defaults.get("n_samples") if role == "judge" else None,- source="default" if defaults else "spec",+ n_samples=knobs.get("n_samples") if role == "judge" else None, source="run" if knobs else "spec",))return rolesdiff --git a/harness/codeverse3d/texturing/generate.py b/harness/codeverse3d/texturing/generate.pyindex b238afd3..ce3f66e2 100644--- a/harness/codeverse3d/texturing/generate.py+++ b/harness/codeverse3d/texturing/generate.py@@ -30,7 +30,6 @@ from codeverse3d.contracts.plan import AcceptanceItem, StaticPlanfrom codeverse3d.contracts.spec import Specfrom codeverse3d.conventions import OBJECT_VIEWS_QUICK, ViewPresetfrom codeverse3d.judges.base import JudgeInput, plan_summary-from codeverse3d.judges.rubrics import is_degradedfrom codeverse3d.proc import fan_out, unique_tmp#: seam score above which a texture is considered NOT tileable (after make_tileable)@@ -353,7 +352,7 @@ def judge_gate(res.judgment_before, res.judgment_after = jb, jares.usage = jb.usage + ja.usageres.duration_s = round(time.time() - t0, 2)- if is_degraded(jb) or is_degraded(ja):+ if jb.degraded or ja.degraded:res.reason = "judge degraded on one side — not shipped"return resres.overall_before, res.overall_after = float(jb.overall), float(ja.overall)diff --git a/harness/codeverse3d/tracks/lifecycle.py b/harness/codeverse3d/tracks/lifecycle.pyindex 2ca015be..7414c75d 100644--- a/harness/codeverse3d/tracks/lifecycle.py+++ b/harness/codeverse3d/tracks/lifecycle.py@@ -47,6 +47,7 @@ from codeverse3d.tracks.candidates import run_best_of_nfrom codeverse3d.tracks.common import RunContext, Servicesfrom codeverse3d.tracks.generation import GenerationTask, single_shot_model_idfrom codeverse3d.tracks.planner import plan as run_planner+from codeverse3d.tracks.planner import plan_temperaturefrom codeverse3d.tracks.prompting import (base_prompt_context,language_system_prompt,@@ -628,7 +629,8 @@ class BaseTrack:cands = ctx.ws.root / "rounds" / "candidates.json" # best-of-N summary: the file is the one copyextra: dict[str, Any] = {"stop_reason": status.value, "rubric": ctx.rubric, "budget": ctx.budget.summary(),"n_candidates": ctx.policy.n_candidates,- "candidates": ctx.ws.read_json(cands) if cands.is_file() else None}+ "candidates": ctx.ws.read_json(cands) if cands.is_file() else None,+ "sampling": self.sampling(ctx.judge)}if ctx.extra.get("finalise_rebuild_failed"):extra["finalise_rebuild_failed"] = ctx.extra["finalise_rebuild_failed"]if ctx.extra.get("aborted_rounds"):@@ -659,6 +661,14 @@ class BaseTrack:extra=extra,)+ def sampling(self, judge: Any) -> dict[str, dict[str, Any]]:+ """``record.extra["sampling"]``: the knobs this run's API roles sampled with — the+ planner's temperature (``plan_temperature``: graphics 0.5, the rest 0.4) and the judge's+ own temperature / thinking / samples. The settings snapshot reads it."""+ knobs = {k: getattr(judge, k) for k in ("temperature", "thinking", "n_samples")+ if isinstance(getattr(judge, k, None), (int, float, str))}+ return {"planner": {"temperature": plan_temperature(self.track)}, **({"judge": knobs} if knobs else {})}+@staticmethoddef _prior_record_fields(ws: Workspace) -> tuple[dict[str, Any], dict[str, str]]:"""``(extra, prompt_hashes)`` of the record.json a previous session wrotediff --git a/harness/codeverse3d/tracks/scene_assets.py b/harness/codeverse3d/tracks/scene_assets.pyindex ad7cedfe..a346b473 100644--- a/harness/codeverse3d/tracks/scene_assets.py+++ b/harness/codeverse3d/tracks/scene_assets.py@@ -35,7 +35,6 @@ from codeverse3d.contracts.common import Language, Trackfrom codeverse3d.contracts.plan import AssetPlan, BBox, PartPlan, ScenePlan, StaticPlanfrom codeverse3d.contracts.spec import Constraints, Specfrom codeverse3d.conventions import OBJECT_VIEWS_QUICK, to_pascal, to_snake-from codeverse3d.judges.rubrics import is_degradedfrom codeverse3d.languages.scene_threejs import asset_filefrom codeverse3d.orchestrator import BudgetExceededfrom codeverse3d.proc import fan_out, read_json_or_none, write_json_atomic, write_text_atomic@@ -631,7 +630,7 @@ def _judge_and_fix(ctx: RunContext, asset: AssetPlan, result: AssetResult, rendeevents.emit("asset.judge_failed", asset=asset.name, error=f"{type(e).__name__}: {e}")return Nonewrite_json_atomic(d / "judge.json", verdict.model_dump(mode="json")) # replayable, like a round's judge/rNN.json- if is_degraded(verdict):+ if verdict.degraded:# a degraded verdict is no verdict: score stays None and `judged` False, and the# fix pass is skipped (its improvement_plan is empty by construction).events.emit("asset.judge_degraded", asset=asset.name)diff --git a/harness/codeverse3d/tracks/steps.py b/harness/codeverse3d/tracks/steps.pyindex c85f88a7..bd3fdfc5 100644--- a/harness/codeverse3d/tracks/steps.py+++ b/harness/codeverse3d/tracks/steps.py@@ -40,7 +40,6 @@ from codeverse3d.contracts.plan import AcceptanceItem, Planfrom codeverse3d.contracts.run import RoundRecord, StepTimefrom codeverse3d.cost.tally import Tally, tally, timedfrom codeverse3d.judges.base import round_input-from codeverse3d.judges.rubrics import is_degradedfrom codeverse3d.orchestrator import BudgetExceededfrom codeverse3d.proc import fan_outfrom codeverse3d.record.deliverable import keep_round_artifacts@@ -406,7 +405,7 @@ def _judge(ctx: RunContext, pipeline: RoundPipeline, index: int, build: BuildResnotes.append(f"judge failed: {type(e).__name__}: {e}")return Nonectx.ws.write_json(ctx.ws.judge_path(index), judgment)- if is_degraded(judgment):+ if judgment.degraded:# a glitch, never a score: keep the raw verdict on disk, but do not let 0.0# poison a pick or a refine plan (judges/rubrics.degraded_judgment contract)ctx.events.emit("judge.degraded", round=index, error=judgment.summary[:300],diff --git a/harness/docs/INTERFACES.md b/harness/docs/INTERFACES.mdindex 1231fb84..cdebfae6 100644--- a/harness/docs/INTERFACES.md+++ b/harness/docs/INTERFACES.md@@ -416,7 +416,7 @@ build_judge_messages(inp, rubric, *, …, extra_images=None (PREpended: referenc# provenance_elicitation appends one sentence to the DEFECT CHECKLIST bullet. Defaults build the byte-identical# pre-D48 payload; judge_prompt_hash(rubric) is unchanged either way (per-round content stays outside the hash)connectivity_error_pairs(gates) -> list[(a, b)] # the gate's ERROR penetration pairs via finding.target/data.other-from codeverse3d.judges.rubrics import is_degraded, aggregate_samples, SCORING_VERSION # ScoreBreakdown adds defects,+from codeverse3d.judges.rubrics import aggregate_samples, SCORING_VERSION # (Judgment.degraded: a glitch, not a score) ScoreBreakdown adds defects,# defect_votes (majority; a defect tie → absent, an acceptance tie → representative sample, D36 as amended# 2026-08-30), tie_broken, defect_penalty, overall_after_defects, overridden (defects the measured-absent# veto switched off), scoring_version (= SCORING_VERSION, 2; older records carry 0), judge_prompt_hash (D37);diff --git a/harness/docs/RUN_LAYOUT.md b/harness/docs/RUN_LAYOUT.mdindex 669024cd..171a87b8 100644--- a/harness/docs/RUN_LAYOUT.md+++ b/harness/docs/RUN_LAYOUT.md@@ -124,12 +124,12 @@ produces no diff.seed; texture flag; rubric name **and its content hash**; prompt / cookbookhashes; tool versions (python, blender, node, three, chrome, puppeteer);harness version + git sha; key-pool size; **price-table hash**; resolved- render and limit settings. Sampling values are read from the call sites'- typed defaults (`VlmJudge.__init__`, `tracks/planner.plan_temperature(track)`, and- `record/telemetry.py::_generator_defaults` — a historical shim that- configures nothing, kept so old records still read back); a- value a call site hard-codes per task is left empty with `source` saying so,- never guessed.+ render and limit settings. Sampling values are what the track stamped as it ran,+ `record.extra["sampling"]` (the planner's `plan_temperature(track)`, the judge's own+ temperature / thinking / samples; `source="run"`) — a vendor CLI owns its knobs, and a+ record written before 2026-09-22 carries no stamp, so they are left empty, never guessed+ (they were read off the call sites' signature defaults, which reported the default judge+ sample count whatever the run used).* **`cost.jsonl`** — THE ledger: one priced row per model call or CLI session, in the**`codeverse3d.cost` ledger format** (`CallCost`: tokens, unit prices, priceprovenance, stage, role, outcome), written by the metered models and agents while thediff --git a/harness/tests/flywheel_cli/test_run_layout_cli.py b/harness/tests/flywheel_cli/test_run_layout_cli.pyindex a0ae7972..4a9e61e2 100644--- a/harness/tests/flywheel_cli/test_run_layout_cli.py+++ b/harness/tests/flywheel_cli/test_run_layout_cli.py@@ -127,14 +127,25 @@ def test_telemetry_summarises_the_runs_own_ledger(fake_run):def test_the_settings_snapshot_records_the_temperature_the_track_planned_at(tmp_path):"""The planner row reported ``planner.plan()``'s default 0.4 for every run — a default- no track uses: each passes its own ``plan_temperature``, and graphics plans at 0.5."""+ no track uses: each passes its own ``plan_temperature``, and graphics plans at 0.5. The+ track stamps what it ran with (``record.extra["sampling"]``), the judge's knobs too; a+ record without the stamp leaves them empty instead of guessing."""+ from types import SimpleNamespace+from codeverse3d.contracts.common import Languagefrom codeverse3d.record.telemetry import settings_snapshot+ from codeverse3d.tracks.graphics import GraphicsTrack+ from codeverse3d.tracks.static_object import StaticObjectTrack- for language, want in ((Language.GLSL_SHADER, 0.5), (Language.BLENDER, 0.4)):+ judge = SimpleNamespace(temperature=0.2, thinking="low", n_samples=3)+ for language, track, want in ((Language.GLSL_SHADER, GraphicsTrack(), 0.5),+ (Language.BLENDER, StaticObjectTrack(), 0.4)):_ws, rec = make_fake_run(tmp_path / language.value, language=language)- planner = next(r for r in settings_snapshot(rec).roles if r.role == "planner")- assert (planner.temperature, planner.source) == (want, "default"), language+ assert next(r for r in settings_snapshot(rec).roles if r.role == "planner").temperature is None+ rec.extra["sampling"] = track.sampling(judge)+ roles = {r.role: r for r in settings_snapshot(rec).roles}+ assert (roles["planner"].temperature, roles["planner"].source) == (want, "run"), language+ assert (roles["judge"].temperature, roles["judge"].thinking, roles["judge"].n_samples) == (0.2, "low", 3)def test_rejected_texture_pass_is_not_delivered_or_linked(fake_run):diff --git a/harness/tests/judges/test_live.py b/harness/tests/judges/test_live.pyindex cc0d001f..ec02ff37 100644--- a/harness/tests/judges/test_live.py+++ b/harness/tests/judges/test_live.py@@ -13,7 +13,6 @@ from codeverse3d.config import get_settingsfrom codeverse3d.contracts.artifacts import RenderSetfrom codeverse3d.contracts.plan import AcceptanceItemfrom codeverse3d.judges.base import JudgeInput-from codeverse3d.judges.rubrics import is_degradedfrom codeverse3d.judges.vlm_judge import VlmJudgefrom tests.judges.conftest import make_measurement, make_renders, make_spec@@ -71,7 +70,7 @@ def test_live_vlm_judge_two_samples(tmp_path):print(f"\nLIVE source={source}\noverall={j.overall} std={j.score_std} passed={j.passed} n={j.n_samples}"f"\nscores={j.scores}\nacceptance={j.acceptance_results}\ncaps={raw.get('caps')}\nsample_errors={raw.get('sample_errors')}"f"\nusage={j.usage}\nsummary={j.summary}\nplan={[i.instruction for i in j.improvement_plan]}")- assert not is_degraded(j), j.summary+ assert not j.degraded, j.summaryassert j.n_samples == 2 and raw["sample_errors"] == [] # parsed first tryassert 0.0 < j.overall < 1.0assert set(j.scores) == {c.id for c in judge.rubric.criteria}@@ -92,7 +91,7 @@ def test_live_judge_separates_crafted_from_crude(tmp_path):gd, cd = json.loads(good.raw), json.loads(crude.raw)print(f"\nLIVE stool overall={good.overall} uncapped={gd['overall_uncapped']} defects={[d for d, o in gd['defects'].items() if o]}"f"\nLIVE crude overall={crude.overall} uncapped={cd['overall_uncapped']} defects={[d for d, o in cd['defects'].items() if o]}")- assert not is_degraded(good) and not is_degraded(crude)+ assert not good.degraded and not crude.degradedassert good.overall - crude.overall >= 0.25assert any(cd["defects"].values()) # the crude drawing trips the checklist@@ -124,5 +123,5 @@ def test_live_reference_judge(tmp_path):j = ReferenceJudge(MODEL, cache_dir=tmp_path / "cache").judge(inp)raw = json.loads(j.raw)print(f"\nLIVE reference overall={j.overall} passed={j.passed} scores={j.scores}\nsummary={j.summary}\nusage={j.usage}")- assert not is_degraded(j) and raw["sample_errors"] == []+ assert not j.degraded and raw["sample_errors"] == []assert j.scores["silhouette_match"] >= 0.95 # reference is the render itselfdiff --git a/harness/tests/judges/test_vlm_judge.py b/harness/tests/judges/test_vlm_judge.pyindex 2696a880..90dd83ed 100644--- a/harness/tests/judges/test_vlm_judge.py+++ b/harness/tests/judges/test_vlm_judge.py@@ -3,7 +3,7 @@ import jsonimport pytestfrom codeverse3d.contracts.artifacts import GateFinding, GateReport, Severity-from codeverse3d.judges.rubrics import is_degraded, load_rubric+from codeverse3d.judges.rubrics import load_rubricfrom codeverse3d.judges.vlm_judge import VlmJudgefrom codeverse3d.models.base import ModelErrorfrom tests.judges.conftest import FakeChatModel, good_reply, image_parts@@ -137,7 +137,7 @@ def test_degraded_after_exhausting_attempts(judge_input, cache_dir):model = FakeChatModel(default=ModelError("boom", retryable=True))j = _judge(model, cache_dir=cache_dir).judge(judge_input)assert not j.passed and j.overall == 0.0 and j.summary.startswith("judge_error:")- assert is_degraded(j) and json.loads(j.raw)["status"] == "degraded"+ assert j.degraded and json.loads(j.raw)["status"] == "degraded"assert len(model.requests) == 3 # max_attemptsassert j.n_samples == 0@@ -154,7 +154,7 @@ def test_partial_samples_still_score(judge_input, cache_dir):def test_non_retryable_error_stops_at_once(judge_input, cache_dir):model = FakeChatModel(default=ModelError("bad request", retryable=False))j = _judge(model, cache_dir=cache_dir).judge(judge_input)- assert is_degraded(j) and len(model.requests) == 1+ assert j.degraded and len(model.requests) == 1def test_base_judge_rejects_measured_rubric(judge_input, cache_dir):@@ -212,7 +212,7 @@ def test_judge_prompt_hash_is_recorded_in_every_verdict(judge_input, cache_dir):assert raw["rubric_hash"] == R.content_hash() and raw["judge_prompt_hash"] != raw["rubric_hash"]# a degraded verdict carries it too, so a glitch is still attributable to a protocold = _judge(FakeChatModel([ModelError("down", retryable=False)]), cache_dir=cache_dir).judge(judge_input)- assert is_degraded(d) and json.loads(d.raw)["judge_prompt_hash"] == judge_prompt_hash(R)+ assert d.degraded and json.loads(d.raw)["judge_prompt_hash"] == judge_prompt_hash(R)assert _judge(FakeChatModel([]), cache_dir=cache_dir).prompt_hash == judge_prompt_hash(R)@@ -280,7 +280,7 @@ def test_a_sample_stops_when_its_budget_is_spent(judge_input, cache_dir, monkeypmodel = FakeChatModel(default=spent)j = _judge(model, cache_dir=cache_dir).judge(judge_input)- assert is_degraded(j) and len(model.requests) == 1, "max_attempts=3, but the budget is gone"+ assert j.degraded and len(model.requests) == 1, "max_attempts=3, but the budget is gone"assert "sample budget" in j.summary# the budget is a dial: a caller that can afford more gets the attempts backmodel = FakeChatModel(default=spent)