Official Codebase of 3DCodeVerse
Python
budget: money stops being a ceiling; 3.7-flash becomes the default generator
gaoypeng5be2450d1977
diff --git a/harness/CLAUDE.md b/harness/CLAUDE.mdindex 2040295f..db19485e 100644--- a/harness/CLAUDE.md+++ b/harness/CLAUDE.md@@ -63,7 +63,13 @@ push, with `set -o pipefail` so a `| tail` cannot swallow a red exit. The versidrops workspace MCP servers), `codex` 0.147+ (MCP needs`default_tools_approval_mode="approve"`), `claude` 2.1, `agy` 1.1 — the last three runon local subscriptions: test lightly. No Anthropic/OpenAI API keys here.-- Main test model: `gemini-3.7-flash` (lenient judge; needs the defect checklist for+- Main test model: `gemini-3.7-flash` — and since 2026-08-28 it is also the DEFAULT+ generator (`gemini-cli:gemini-3.7-flash`), verified live through the harness on both+ vendor paths: gemini-cli completes and is not silently substituted, and `agy` 1.1.22+ lists and serves `gemini-3.7-flash-{high,medium,low}`. A BARE `gemini -m ...` is+ substituted down to 3.5-flash — the harness's per-session system settings file is+ what prevents that, so never judge model availability with a raw CLI probe.+ (lenient judge; needs the defect checklist forrange). Judge default `gemini-3.1-pro-preview` (`Settings.default_judge`; tracks usen_samples=1); flash + `--n 3` is the cheap fallback, pro for calibration/eval.- Live runs under `runs/` (`e2e_*`): read-only reference material; never modify.@@ -79,7 +85,7 @@ cd /home/yipeng/3dcodeverse/harness3dcodeverse make "..." --profile economy|balanced|quality # one dial: models, judge n, rounds, candidates, texture, ceilings (--profile == CV3D_PROFILE)3dcodeverse make "..." --track static_object --language threejs --generator gemini-cli:gemini-3.7-flash3dcodeverse make "..." --track articulated_object --language urdf_blender-3dcodeverse make "..." --track scene --language scene_threejs --rounds 2 --max-usd 3+3dcodeverse make "..." --track scene --language scene_threejs --rounds 2 # --max-usd is OFF by default (0 = no ceiling); cost is still recorded3dcodeverse make "neon rain on a window" --track graphics --language glsl_shader3dcodeverse make "..." --image ref.png --candidates 3 --rounds 2 --dim height=0.45 --must "three legs" --texture --no-run3dcv resume <slug> · 3dcv status <slug> · 3dcv render <slug> [--mode wire] · 3dcv judge <slug> [--model ... --n 3]diff --git a/harness/codeverse/cli/main.py b/harness/codeverse/cli/main.pyindex 4e7b700c..38936ddb 100644--- a/harness/codeverse/cli/main.py+++ b/harness/codeverse/cli/main.py@@ -104,7 +104,7 @@ def run_cmd(judge: Annotated[str | None, typer.Option("--judge", help="fixed judge model for the whole battery")] = None,parallel: Annotated[int, typer.Option("--parallel", min=1)] = 4,rounds: Annotated[int, typer.Option("--rounds", min=0)] = 4,- max_usd: Annotated[float, typer.Option("--max-usd")] = 5.0,+ max_usd: Annotated[float, typer.Option("--max-usd", help="0 = no ceiling (cost is still recorded)")] = 0.0,max_minutes: Annotated[float, typer.Option("--max-minutes", help="wall-clock budget per run; size it to the weather ""(RUNBOOK 7.x: 120 in a 503 storm, else runs burn the hour with no judged round)")] = 60.0,limit: Annotated[int | None, typer.Option("--limit")] = None,diff --git a/harness/codeverse/contracts/common.py b/harness/codeverse/contracts/common.pyindex fe2a00f9..8dd65a64 100644--- a/harness/codeverse/contracts/common.py+++ b/harness/codeverse/contracts/common.py@@ -133,13 +133,18 @@ class Budget(BaseModel):The ceilings are non-negative by construction. A negative one is not a smallbudget, it is an unrunnable one: ``BudgetGuard.ok()`` is False before a single- token is spent, the first charge raises ``BudgetExceeded: cost $0.001 exceeds- max_usd $-2.50``, and ``grant_grace`` cannot lift a hard ceiling back above zero —+ token is spent and ``grant_grace`` cannot lift a hard ceiling back above zero —so the workspace and the git-committed spec are created for a run that can only die.++ ``max_usd = 0`` means NO MONEY CEILING, and that is the default (owner, 2026-08-28:+ "先不计成本,就是run就好了"). Cost is still measured on every call — the ledger,+ `3dcv cost`, the run record and the bench economics are untouched; money simply+ stops being a thing that can end a run. Pass ``--max-usd`` to put the ceiling back.+ Time still bounds a run: that is ``max_minutes``, and without it nothing ends."""max_rounds: int = Field(default=4, ge=0)- max_usd: float = Field(default=5.0, ge=0)+ max_usd: float = Field(default=0.0, ge=0, description="0 = no ceiling (cost is still recorded)")max_minutes: float = Field(default=60.0, ge=0)max_repair_attempts: int = Field(default=3, ge=0) # per build failure before escalating@@ -150,7 +155,7 @@ class Backends(BaseModel):* API chat models: ``gemini:gemini-3.7-flash`` · ``anthropic:claude-sonnet-5``· ``openai:gpt-5.6-sol``* Coding agents: ``gemini-cli:gemini-3.7-flash`` · ``claude-code:sonnet``- · ``codex:gpt-5.6-sol`` · ``agy:gemini-3.6-flash-high``+ · ``codex:gpt-5.6-sol`` · ``agy:gemini-3.7-flash-high``The coding agent is always a VENDOR agent: the harness supplies the workspace, theprompt and its 3D tools (over MCP) and reads the result. The in-process@@ -159,7 +164,7 @@ class Backends(BaseModel):"""planner: str = "gemini:gemini-3.7-flash"- generator: str = "gemini-cli:gemini-3.6-flash"+ generator: str = "gemini-cli:gemini-3.7-flash"# The judge drives the refine loop: the pro tier has ~3x lower sample noise than# flash (calibration 2026-08-23: std 0.03 vs 0.08-0.12) for ~$0.07 per verdict.judge: str = "gemini:gemini-3.1-pro-preview"diff --git a/harness/codeverse/cost/profiles.py b/harness/codeverse/cost/profiles.pyindex 977ce17c..be2e699a 100644--- a/harness/codeverse/cost/profiles.py+++ b/harness/codeverse/cost/profiles.py@@ -66,7 +66,7 @@ class Profile:# NOT reduced by any profile — the score effect is inside the# judge's own noise in both directions (docs/COST.md §14)#: budget ceilings a run of this shape should not need to exceed- max_usd: float = 5.0+ max_usd: float = 0.0 # 0 = no ceiling; cost is still recordedmax_minutes: float = 60.0#: measured expectation (docs/COST.md) — reported by ``3dcv cost profiles``expected_usd: float = 0.0@@ -109,7 +109,7 @@ PROFILES: dict[str, Profile] = {# the instrument's noise do not license a payload cut worth a fifth of a cent, so the# experiment is recorded as INCONCLUSIVE in docs/COST.md §14 and the budget is unchanged.judge_max_px=1024, judge_montages=3, judge_detail_crops=2,- max_usd=1.50, max_minutes=30.0,+ max_usd=0.0, max_minutes=30.0,expected_usd=0.30,expected_score="graphics 0.81 median (5/6 passed); objects clear the gates less often ""— a one-shot flash generator scored 0.14 on compare_v1's hard cells",@@ -118,26 +118,26 @@ PROFILES: dict[str, Profile] = {),"balanced": Profile(name="balanced",- generator="gemini-cli:gemini-3.6-flash",+ generator="gemini-cli:gemini-3.7-flash",planner="gemini:gemini-3.7-flash",judge="gemini:gemini-3.1-pro-preview",captioner="gemini:gemini-3.7-flash",rounds=4, candidates=1, judge_samples=1, max_turns=0, texture=False,judge_max_px=1024, judge_montages=3, judge_detail_crops=2,- max_usd=5.0, max_minutes=60.0,+ max_usd=0.0, max_minutes=60.0,expected_usd=1.47,expected_score="0.835 mean on compare_v1, 36/61 runs passed ($2.50 per passing artifact)",note="today's defaults — the arm every number in docs/COST.md was measured on",),"quality": Profile(name="quality",- generator="gemini-cli:gemini-3.6-flash",+ generator="gemini-cli:gemini-3.7-flash",planner="gemini:gemini-3.7-flash",judge="gemini:gemini-3.1-pro-preview",captioner="gemini:gemini-3.7-flash",rounds=4, candidates=2, judge_samples=3, max_turns=0, texture=True,judge_max_px=1024, judge_montages=3, judge_detail_crops=2,- max_usd=8.0, max_minutes=90.0,+ max_usd=0.0, max_minutes=90.0,expected_usd=3.20,expected_score="best-of-2 lifted the stool baseline 0.563 → 0.612 and the texture pass ""0.686 → 0.701; judge σ 0.017 at n=3",diff --git a/harness/codeverse/orchestrator.py b/harness/codeverse/orchestrator.pyindex b32287c4..bd3e57b0 100644--- a/harness/codeverse/orchestrator.py+++ b/harness/codeverse/orchestrator.py@@ -1008,7 +1008,9 @@ class BudgetGuard:"""Raise ``BudgetExceeded`` if any hard ceiling has been crossed."""spent = self.billed_usdelapsed = self.elapsed_minutes()- if spent > self.hard_usd:+ # max_usd == 0 means no money ceiling (the default since 2026-08-28); cost is+ # still accumulated above, so every report and the ledger still know what it cost.+ if self.budget.max_usd > 0 and spent > self.hard_usd:raise BudgetExceeded(f"cost ${spent:.3f} exceeds max_usd ${self.hard_usd:.2f}",spent_usd=spent,@@ -1033,7 +1035,7 @@ class BudgetGuard:"""Reason string when the soft sub-budget is used up, else ``""``."""usd, minutes = self.soft_limits()spent, elapsed = self.billed_usd, self.elapsed_minutes()- if spent > usd:+ if self.budget.max_usd > 0 and spent > usd:return f"cost ${spent:.3f} exceeds soft cap ${usd:.2f} ({self.soft_fraction:.0%} of ${self.budget.max_usd:.2f})"if elapsed > minutes:return f"elapsed {elapsed:.1f} min exceeds soft cap {minutes:.1f} min ({self.soft_fraction:.0%} of {self.budget.max_minutes:.1f})"diff --git a/harness/codeverse/tracks/lifecycle.py b/harness/codeverse/tracks/lifecycle.pyindex 6f03598d..e20248b3 100644--- a/harness/codeverse/tracks/lifecycle.py+++ b/harness/codeverse/tracks/lifecycle.py@@ -709,9 +709,10 @@ class BaseTrack:already stopping on budget."""if rounds or ctx.state.completed_rounds or ctx.plan is None:return # nothing was built yet (the PLAN itself blew the budget) → nothing to salvage- if not ctx.budget.ok() and ctx.budget.spent.cost_usd > ctx.budget.hard_usd * 2:- return # runaway spend: do not throw good money after bad- grace_usd = max(0.15, ctx.spec.budget.max_usd * 0.10)+ cap = ctx.spec.budget.max_usd+ if cap > 0 and not ctx.budget.ok() and ctx.budget.spent.cost_usd > ctx.budget.hard_usd * 2:+ return # runaway spend against a real ceiling: do not throw good money after bad+ grace_usd = max(0.15, cap * 0.10)grace_min = max(5.0, ctx.spec.budget.max_minutes * 0.15)ctx.budget.grant_grace(usd=grace_usd, minutes=grace_min)ctx.events.emit("budget.salvage", reason="no round completed before the budget stop",diff --git a/harness/docs/COST.md b/harness/docs/COST.mdindex b051202a..caf61306 100644--- a/harness/docs/COST.md+++ b/harness/docs/COST.md@@ -1159,6 +1159,13 @@ burned earlier the same morning.## 25. `max_usd` guards money, and a subscription costs none+> **Since 2026-08-28 the money guard is OFF by default** (`max_usd = 0` in `Budget` and+> in every profile, owner's call: run first, count later). Nothing below stops being+> true — every call is still priced into `telemetry/cost.jsonl`, `3dcv cost` and the+> run record — but money can no longer END a run. `--max-usd <n>` puts the ceiling+> back, and everything in this section then applies exactly as written. What still+> bounds a run is `max_minutes`.+`Usage.cost_usd` answers *"what would these tokens cost at list price?"*. That is theright number for a report, a $/complexity point, or a flywheel record — it is comparableacross backends and independent of who is paying. It is the wrong number to hand adiff --git a/harness/tests/cost/test_profiles.py b/harness/tests/cost/test_profiles.pyindex 53d3b13a..1b466fec 100644--- a/harness/tests/cost/test_profiles.py+++ b/harness/tests/cost/test_profiles.py@@ -46,7 +46,8 @@ def test_balanced_is_todays_defaults():s = Settings()assert (p.generator, p.planner, p.judge) == (s.default_generator, s.default_planner, s.default_judge)assert p.rounds == 4 and p.candidates == s.default_candidates and p.judge_samples == 1- assert p.max_usd == 5.0 and p.max_minutes == 60.0 and p.judge_max_px == 1024+ # max_usd 0 = no money ceiling (owner, 2026-08-28); cost is still recorded on every call+ assert p.max_usd == 0.0 and p.max_minutes == 60.0 and p.judge_max_px == 1024def test_economy_is_single_shot_flash_and_two_rounds_with_no_turn_cap_of_its_own():@@ -156,7 +157,7 @@ def test_make_profile_writes_the_whole_shape_onto_the_spec(tmp_path: Path):assert r.exit_code == 0, r.outputspec = json.loads((runs / "pot" / "spec.json").read_text())assert spec["options"] == {"candidates": 2, "texture": True, "profile": "quality"}- assert spec["budget"]["max_rounds"] == 4 and spec["budget"]["max_usd"] == 8.0+ assert spec["budget"]["max_rounds"] == 4 and spec["budget"]["max_usd"] == 0.0assert spec["backends"]["judge"] == "gemini:gemini-3.1-pro-preview"@@ -180,7 +181,7 @@ def test_no_profile_flag_leaves_the_defaults_alone(tmp_path: Path):# the resolved dial is recorded whichever way it was named, so `3dcv resume`# reproduces it; with no flag and no env that dial is the default, balancedassert spec["options"]["profile"] == "balanced" and spec["options"]["texture"] is False- assert spec["budget"]["max_rounds"] == 4 and spec["budget"]["max_usd"] == 5.0+ assert spec["budget"]["max_rounds"] == 4 and spec["budget"]["max_usd"] == 0.0def test_judge_samples_reach_the_round_policy_only_when_a_profile_asks(tmp_path: Path):@@ -234,17 +235,17 @@ def test_the_flag_and_the_env_var_resolve_to_the_same_dial(name, monkeypatch):"judge": "gemini:gemini-3.7-flash", "judge_samples": 2,"rounds": 2, "candidates": 1, "texture": False,"judge_max_px": 1024, "judge_montages": 3, "judge_detail_crops": 2,- "agent_max_turns": 0, "max_usd": 1.50, "max_minutes": 30.0}),- ("balanced", {"generator": "gemini-cli:gemini-3.6-flash",+ "agent_max_turns": 0, "max_usd": 0.0, "max_minutes": 30.0}),+ ("balanced", {"generator": "gemini-cli:gemini-3.7-flash","judge": "gemini:gemini-3.1-pro-preview", "judge_samples": 1,"rounds": 4, "candidates": 1, "texture": False,"judge_max_px": 1024, "judge_montages": 3, "judge_detail_crops": 2,- "agent_max_turns": 0, "max_usd": 5.0, "max_minutes": 60.0}),- ("quality", {"generator": "gemini-cli:gemini-3.6-flash",+ "agent_max_turns": 0, "max_usd": 0.0, "max_minutes": 60.0}),+ ("quality", {"generator": "gemini-cli:gemini-3.7-flash","judge": "gemini:gemini-3.1-pro-preview", "judge_samples": 3,"rounds": 4, "candidates": 2, "texture": True,"judge_max_px": 1024, "judge_montages": 3, "judge_detail_crops": 2,- "agent_max_turns": 0, "max_usd": 8.0, "max_minutes": 90.0}),+ "agent_max_turns": 0, "max_usd": 0.0, "max_minutes": 90.0}),],)def test_each_profile_resolves_to_its_documented_dial(name, expected, monkeypatch):