Official Codebase of 3DCodeVerse
Python
agy runs in Gemini-API mode only and defaults to gemini-4-argon (D103, owner's amendment)
gaoypeng899e156d6b94
diff --git a/eval/README.md b/eval/README.mdindex 0bb19bde..71596044 100644--- a/eval/README.md+++ b/eval/README.md@@ -17,9 +17,9 @@ ask one-shot from there (`llm/config.py: HARNESS_BATTERIES`).```bashcd evalpip install -e ../harness # once; both evaluations import codeverse3d-python -m bench.run_bench bench/prompts/static_objects_v1.yaml --generator agy:gemini-3.7-flash+python -m bench.run_bench bench/prompts/static_objects_v1.yaml --generator agy:gemini-4-argonpython -m bench.report bench/out/static_objects_v1 # rebuild report.md + report.html-python bench/compare_backends.py --prompts bench/prompts/compare_v1.yaml --arms harness:agy:gemini-3.7-flash,oneshot:gemini:gemini-3.7-flash --out bench/out/compare_v1+python bench/compare_backends.py --prompts bench/prompts/compare_v1.yaml --arms harness:agy:gemini-4-argon,oneshot:gemini:gemini-3.7-flash --out bench/out/compare_v1python -m llm.config # doctor for the LLM evaluation: tools and assets it can / cannot findpython -m pytest # the bench tests (offline)ruff check .diff --git a/eval/bench/_bare_agent.py b/eval/bench/_bare_agent.pyindex 25e43a8d..243c94d8 100644--- a/eval/bench/_bare_agent.py+++ b/eval/bench/_bare_agent.py@@ -2,7 +2,7 @@The strongest objection to the harness is not "a model asked once does worse" — it is "give the SAMEagent the SAME minutes and a Blender, and it does as well on its own". This arm answers that: the same-vendor CLI and model the harness drives (``agent:agy:gemini-3.7-flash``), the one-shot arm's+vendor CLI and model the harness drives (``agent:agy:gemini-4-argon``), the one-shot arm'sbrief and minimal contract, a shell with the machine's own tools (Blender, node + three + puppeteer,python + moderngl, glslangValidator) and the harness arm's wall clock. It gets no plan, no 3dcode MCPtools, no cookbook, no gates, no judge, no starter library and no deterministic repairs — the agentdiff --git a/eval/bench/compare_backends.py b/eval/bench/compare_backends.pyindex a53382ea..c9f71ab1 100644--- a/eval/bench/compare_backends.py+++ b/eval/bench/compare_backends.py@@ -1,7 +1,7 @@"""Harness vs raw one-shot generation under ONE fixed judge (methodology bench).python bench/compare_backends.py --prompts bench/prompts/compare_v1.yaml \\- --arms harness:agy:gemini-3.6-flash,harness:agy:gemini-3.7-flash,\\+ --arms harness:agy:gemini-3.6-flash,harness:agy:gemini-4-argon,\\oneshot:claude-code,oneshot:codex,oneshot:gemini:gemini-3.7-flash \\--judge gemini:gemini-3.1-pro-preview --out <dir> [--parallel 8] [--limit N]diff --git a/eval/bench/plan_stage_bench.py b/eval/bench/plan_stage_bench.pyindex 145d8c03..048fc991 100644--- a/eval/bench/plan_stage_bench.py+++ b/eval/bench/plan_stage_bench.py@@ -32,7 +32,7 @@ from pathlib import PathDEFAULT_BATTERY = "bench/prompts/articulated_v2.yaml"DEFAULT_PLANNER = "gemini:gemini-3.7-flash"-DEFAULT_GENERATOR = "agy:gemini-3.7-flash"+DEFAULT_GENERATOR = "agy:gemini-4-argon"DEFAULT_JUDGE = "gemini:gemini-3.1-pro-preview"diff --git a/eval/docs/EVAL.md b/eval/docs/EVAL.mdindex 1dcd42ed..1350a0f5 100644--- a/eval/docs/EVAL.md+++ b/eval/docs/EVAL.md@@ -59,9 +59,9 @@ deterministic contract check.```bashcd eval # was `3dcode bench run|report` until 2026-09-22: the launcher lives with the evaluation nowpython -m bench.run_bench bench/prompts/static_objects_v1.yaml \- --generator agy:gemini-3.7-flash --judge gemini:gemini-3.1-pro-preview \+ --generator agy:gemini-4-argon --judge gemini:gemini-3.1-pro-preview \--rounds 2 --parallel 4 --out bench/out/static_v1_apiagent-python -m bench.run_bench bench/prompts/static_objects_v1.yaml --generator agy:gemini-3.7-flash --judge gemini:gemini-3.1-pro-preview --out bench/out/static_v1_gemcli+python -m bench.run_bench bench/prompts/static_objects_v1.yaml --generator agy:gemini-4-argon --judge gemini:gemini-3.1-pro-preview --out bench/out/static_v1_gemclipython -m bench.report bench/out/static_v1_apiagent```Like every bench script it imports THIS tree's `codeverse3d` (`../harness`), so a battery@@ -98,7 +98,7 @@ cheaply.```bashpython bench/compare_backends.py --prompts bench/prompts/compare_v1.yaml \- --arms harness:agy:gemini-3.6-flash,harness:agy:gemini-3.7-flash,oneshot:claude-code,oneshot:codex,oneshot:gemini:gemini-3.7-flash,oneshot+repair:gemini:gemini-3.7-flash \+ --arms harness:agy:gemini-3.6-flash,harness:agy:gemini-4-argon,oneshot:claude-code,oneshot:codex,oneshot:gemini:gemini-3.7-flash,oneshot+repair:gemini:gemini-3.7-flash \--judge gemini:gemini-3.1-pro-preview --out bench/out/compare_v1 [--parallel 3] [--limit N] [--ids a,b][--rounds 3] [--loop-judge gemini:gemini-3.7-flash] [--repair-attempts 2] [--gen-timeout 900][--no-pairwise] [--no-resume] [--report-only]diff --git a/eval/docs/PAPER_WRITING.md b/eval/docs/PAPER_WRITING.mdindex 839df7b0..59dbb1fb 100644--- a/eval/docs/PAPER_WRITING.md+++ b/eval/docs/PAPER_WRITING.md@@ -590,7 +590,7 @@ cd eval # the bench scripts live here since 2026-09-22 (they were harness/benc# Google's models is `agy:*`, so a rerun is a new measurement, not a replay# the instrumentpython bench/ab_plan.py --prompts bench/prompts/articulated_v2.yaml --aa --pin-plan \- --generator agy:gemini-3.7-flash --judge gemini:gemini-3.1-pro-preview \+ --generator agy:gemini-4-argon --judge gemini:gemini-3.1-pro-preview \--n-samples 3 --rounds 3 --out bench/out/aa_articulated# a switch A/B (generation-side switches only; plan-side is refused for --pin-plan). The arm# measured in §4 was C3D_FEWER_TURNS=1, a switch deleted since; name a live Settings flag instead@@ -598,7 +598,7 @@ python bench/ab_plan.py --prompts bench/prompts/articulated_v2.yaml \--variant-env C3D_<SWITCH>=1 --pin-plan --out bench/out/<switch># harness vs one-shotpython bench/compare_backends.py --prompts bench/prompts/articulated_v2.yaml \- --arms harness:agy:gemini-3.7-flash,oneshot+repair:gemini:gemini-3.7-flash \+ --arms harness:agy:gemini-4-argon,oneshot+repair:gemini:gemini-3.7-flash \--judge gemini:gemini-3.1-pro-preview --judge-samples 3 --out bench/out/art# the loss-event channel: the plan stage alone, one row per callpython bench/plan_stage_bench.py --tree ../harness --label restart_on --reps 20 \diff --git a/eval/tests/test_bare_agent.py b/eval/tests/test_bare_agent.pyindex a8df860e..22c2398a 100644--- a/eval/tests/test_bare_agent.py+++ b/eval/tests/test_bare_agent.py@@ -26,9 +26,9 @@ def _spec(track: Track = Track.STATIC_OBJECT, language: Language = Language.BLENdef test_parse_agent_arm():- arm = parse_arm("agent:agy:gemini-3.7-flash")- assert arm.kind == "agent" and arm.target == "agy:gemini-3.7-flash"- assert arm.slug == "agent_agy_gemini-3.7-flash"+ arm = parse_arm("agent:agy:gemini-4-argon")+ assert arm.kind == "agent" and arm.target == "agy:gemini-4-argon"+ assert arm.slug == "agent_agy_gemini-4-argon"with pytest.raises(ValueError):parse_arm("agent:nope:model")@@ -65,12 +65,12 @@ def test_run_copies_the_deliverable_and_resumes(tmp_path, monkeypatch):monkeypatch.setattr("bench._bare_agent.get_coding_agent", lambda target: agent)eval_ws = Workspace(tmp_path / "eval").create()started = time.monotonic()- r = run_bare_agent(_spec(), "agy:gemini-3.7-flash", tmp_path, eval_ws, minutes=10)+ r = run_bare_agent(_spec(), "agy:gemini-4-argon", tmp_path, eval_ws, minutes=10)assert r.ok and (eval_ws.root / "src" / "model.py").read_text() == "import bpy\n"job = agent.jobs[0]assert job.spatial_tools is False and job.timeout_s == 600 and job.write_roots == ["src", "tmp"]assert started + 600 <= job.hard_deadline_s <= time.monotonic() + 600- run_bare_agent(_spec(), "agy:gemini-3.7-flash", tmp_path, eval_ws, minutes=10)+ run_bare_agent(_spec(), "agy:gemini-4-argon", tmp_path, eval_ws, minutes=10)assert len(agent.jobs) == 1 # a finished session is not re-rundiff --git a/eval/tests/test_bench_shared.py b/eval/tests/test_bench_shared.pyindex 857b5eff..6682ed4d 100644--- a/eval/tests/test_bench_shared.py+++ b/eval/tests/test_bench_shared.py@@ -29,8 +29,8 @@ def test_select_prompts_ids_tiers_limit():def test_spec_for_routes_through_settings_backends():b = _battery()s = rb.get_settings()- spec = spec_for(b, b.prompts[0], BenchOptions(generator="agy:gemini-3.7-flash"))- assert spec.backends.generator == "agy:gemini-3.7-flash"+ spec = spec_for(b, b.prompts[0], BenchOptions(generator="agy:gemini-4-argon"))+ assert spec.backends.generator == "agy:gemini-4-argon"# unset roles fall through to the settings defaults, not the Backends() literalsassert spec.backends.planner == s.default_planner and spec.backends.judge == s.default_judgeassert spec.backends.captioner == s.default_captionerdiff --git a/eval/tests/test_compare_matrix.py b/eval/tests/test_compare_matrix.pyindex 6ffd16d3..3a4dca8d 100644--- a/eval/tests/test_compare_matrix.py+++ b/eval/tests/test_compare_matrix.py@@ -58,9 +58,9 @@ def test_parse_arms():def test_spec_for_and_acceptance():b = Battery.load(BATTERY)opts = CompareOptions(judge="gemini:gemini-3.1-pro-preview", loop_judge="gemini:gemini-3.7-flash")- harness = spec_for(b, b.prompts[0], parse_arm("harness:agy:gemini-3.7-flash"), opts)+ harness = spec_for(b, b.prompts[0], parse_arm("harness:agy:gemini-4-argon"), opts)one = spec_for(b, b.prompts[0], parse_arm("oneshot:codex"), opts)- assert harness.backends.generator == "agy:gemini-3.7-flash" and harness.backends.judge == "gemini:gemini-3.7-flash"+ assert harness.backends.generator == "agy:gemini-4-argon" and harness.backends.judge == "gemini:gemini-3.7-flash"assert harness.budget.max_rounds == 3assert one.backends.generator == "single-shot:codex" and one.constraints.must_have == b.prompts[0].must_havediff --git a/harness/CLAUDE.md b/harness/CLAUDE.mdindex bddb4ef3..7964a8ca 100644--- a/harness/CLAUDE.md+++ b/harness/CLAUDE.md@@ -61,18 +61,14 @@ push, with `set -o pipefail` so a `| tail` cannot swallow a red exit. The versi(`spatial.node.run_node(three_hook=True)`) — `NODE_PATH` alone does not work;that hook is `module.registerHooks` on node ≥ 22.15, `module.register` below.The `graphics` track renders with moderngl (d3d12 GPU context, llvmpipe fallback).-- CLIs: `agy` 1.3.4 (Antigravity; gemini-cli was deleted in D103, 2026-10-13) — an `agy:gemini-*`- session runs in Gemini-API mode: one key from the shared pool, a per-session HOME carrying- `modelProvider: gemini` + the 3dcode MCP server, priced; without keys, or for a non-Gemini model,- it runs on the local subscription sign-in with no MCP. `codex` 0.147+ (MCP needs+- CLIs: `agy` 1.3.4 (Antigravity; gemini-cli was deleted in D103, 2026-10-13) — runs ONLY in+ Gemini-API mode (Gemini models only, keys required; no subscription sign-in): one key from the+ shared pool, a per-session HOME carrying `modelProvider: gemini` + the 3dcode MCP server, priced. `codex` 0.147+ (MCP needs`default_tools_approval_mode="approve"`) and `claude` 2.1 run on local subscriptions: testlightly. No Anthropic/OpenAI API keys here.-- Main test model: `gemini-3.7-flash` — also the DEFAULT generator, `agy:gemini-3.7-flash`- since 2026-10-13 (D103; `gemini-cli:` from 2026-08-28), verified live through agy's API mode- (which lists gemini-3.8/3.7/3.6-flash and 3.1-pro; the subscription sign-in no longer serves- 3.7-flash, so never judge model availability by a sign-in probe).- (lenient judge; needs the defect checklist for- range). Judge default `gemini-3.1-pro-preview` (`Settings.default_judge`; tracks use+- DEFAULT generator: `agy:gemini-4-argon` (D103, 2026-10-13; `gemini-cli:gemini-3.7-flash` before).+ `gemini-3.7-flash` stays the cheap API model (single-shot / economy, flash judge — lenient; needs+ the defect checklist for range). 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.- Every model call and vendor session is priced into the run's `telemetry/cost.jsonl` — the ONLY record of@@ -86,7 +82,7 @@ cd /home/yipeng/3dcodeverse/harness3dcodeverse doctor [--live] [--no-gpu] [--json]3dcodeverse make "a mid-century wooden dining chair" --track static_object --language blender3dcodeverse make "..." --profile economy|balanced|quality # one dial: models, judge n, rounds, candidates, texture, ceilings (--profile == C3D_PROFILE)-3dcodeverse make "..." --track static_object --language threejs --generator agy:gemini-3.7-flash+3dcodeverse make "..." --track static_object --language threejs --generator agy:gemini-4-argon3dcodeverse make "..." --track articulated_object --language urdf_blender3dcodeverse make "..." --track scene --language scene_threejs --rounds 2 --max-minutes 603dcodeverse make "neon rain on a window" --track graphics --language glsl_shaderdiff --git a/harness/codeverse3d/agents/backends.py b/harness/codeverse3d/agents/backends.pyindex 93abb412..bdcaf721 100644--- a/harness/codeverse3d/agents/backends.py+++ b/harness/codeverse3d/agents/backends.py@@ -18,7 +18,6 @@ import reimport shutilimport sqlite3import time-from functools import lru_cachefrom pathlib import Pathfrom typing import Any@@ -48,7 +47,6 @@ from codeverse3d.contracts.agent import AgentJob, AgentResultfrom codeverse3d.contracts.common import Usagefrom codeverse3d.models.pricing import EFFORTS, cache_write_surcharge, estimate_cost, openai_usagefrom codeverse3d.models.retry import KeyPool, KeyPoolExhausted-from codeverse3d.proc import run_subprocesslog = logging.getLogger(__name__)@@ -543,59 +541,8 @@ class CodexAgent(_CliAgent):# ===================================================================== antigravity-#: what a bare id is resolved to when agy offers only effort-suffixed spellings-DEFAULT_EFFORT = "medium"-_EFFORT_SUFFIXES = tuple(f"-{e}" for e in EFFORTS)---@lru_cache(maxsize=4)-def available_models(binary: str) -> tuple[str, ...]:- """The model ids ``agy models`` offers, or ``()`` when it cannot be reached.-- Cached: one lookup per binary per process, and only for an id that needs it.- """- try:- r = run_subprocess([binary, "models"], cwd=Path.cwd(), timeout_s=30.0)- except OSError as e: # pragma: no cover - defensive- log.debug("agy models unavailable: %s", e)- return ()- if r.returncode != 0:- return ()- ids = []- for line in r.stdout.splitlines():- head = line.split("\t", 1)[0].strip()- if head and " " not in head:- ids.append(head)- return tuple(ids)---def resolve_model(model: str, binary: str) -> str:- """Map a bare model id onto the effort-suffixed one agy actually accepts.-- agy 1.1.19 rejects ``--model gemini-3.7-flash`` outright ("requires --effort- (available: low, medium, high)") and equally rejects ``--effort`` for a model that- has none ("--effort is not supported for model claude-sonnet-4-6"), so the effort- cannot be a blanket flag — it belongs in the MODEL ID, which is the only spelling- ``agy models`` lists (gemini-3.7-flash-low/-medium/-high).-- A bare id agy DOES offer (claude-sonnet-4-6) is passed through untouched, and so is- anything we cannot check, so this can only turn a guaranteed failure into a run.- """- if not model or model.endswith(_EFFORT_SUFFIXES):- return model- offered = available_models(binary)- if not offered or model in offered:- return model- for effort in (DEFAULT_EFFORT, *EFFORTS):- if f"{model}-{effort}" in offered:- log.info("agy has no bare %r; using the %s-effort id %r", model, effort, f"{model}-{effort}")- return f"{model}-{effort}"- return model--def api_model_effort(model: str) -> tuple[str, str]:- """``gemini-3.7-flash-low`` → ``('gemini-3.7-flash', 'low')``; a bare id runs at- ``AGY_API_EFFORT`` — the agy spelling of an effort is accepted so either id works."""+ """``gemini-4-argon-low`` → ``('gemini-4-argon', 'low')``; a bare id runs at ``AGY_API_EFFORT``."""for effort in EFFORTS:if model.endswith(f"-{effort}"):return model[: -len(effort) - 1], effort@@ -614,8 +561,9 @@ AGY_LOG = "agy.log"AGY_CONVERSATIONS = Path(".gemini") / "antigravity-cli" / "conversations"#: agy's Gemini-API mode (1.2+, checked live on 1.3.4, 2026-10-13): ``modelProvider: "gemini"``#: in its settings plus ``GEMINI_API_KEY`` in the env — no sign-in, billed to the key, and the-#: catalogue is the API's (gemini-3.7-flash, 3.6-flash, 3.1-pro, …). Without the setting the-#: key alone is ignored and the CLI asks for a login.+#: catalogue is the API's. Without the setting the key alone is ignored and the CLI asks for a+#: login. It is the ONLY way the harness runs agy (owner, 2026-10-13): no subscription sign-in,+#: no non-Gemini model.AGY_SETTINGS = Path(".gemini") / "antigravity-cli" / "settings.json"AGY_API_SETTINGS = {"modelProvider": "gemini"}#: in API mode ``--model gemini-api://<id>`` sends ``<id>`` to the API verbatim — any model the@@ -623,8 +571,10 @@ AGY_API_SETTINGS = {"modelProvider": "gemini"}#: thinking level (low → 1, high → 3 in the CLI log, 2026-10-13)AGY_API_SCHEME = "gemini-api://"#: the effort an API-mode id without a ``-low/-medium/-high`` suffix runs at: the Gemini API's-#: own default thinking level, which every gemini-cli session ran at before agy replaced it+#: own default thinking levelAGY_API_EFFORT = "high"+#: the model an ``agy`` generator with no model runs (owner, 2026-10-13)+DEFAULT_AGY_MODEL = "gemini-4-argon"#: agy's ONLY MCP config is per user (``~/.gemini/config/mcp_config.json``, the shape#: ``agy mcp add`` writes) — so an API-key session gets a HOME of its own, and this file in itAGY_MCP_CONFIG = Path(".gemini") / "config" / "mcp_config.json"@@ -748,9 +698,8 @@ def agy_error(stderr: str) -> dict[str, Any]:return {}-def usage_from_agy(env: dict[str, Any], model: str, *, priced: bool) -> Usage:- """The envelope's tokens; priced at the Gemini list rate when the session ran on an API- key (``priced``), ``$0`` on a subscription sign-in, which exposes no USD. agy 1.3.4 splits+def usage_from_agy(env: dict[str, Any], model: str) -> Usage:+ """The envelope's tokens, priced at the Gemini list rate. agy 1.3.4 splitsneither way the pricing convention does: ``input_tokens`` EXCLUDES ``cache_read_tokens`` (alive 18-minute session, 2026-10-13: 582 179 input against 10 980 664 cache reads), so the totalprompt is their sum; and ``output_tokens`` CONTAINS ``thinking_tokens`` (``total == input +@@ -766,7 +715,7 @@ def usage_from_agy(env: dict[str, Any], model: str, *, priced: bool) -> Usage:thoughts_tokens=thinking,latency_ms=int(float(env.get("duration_seconds") or 0.0) * 1000),)- out.cost_usd = estimate_cost("gemini", model, out) if priced else 0.0+ out.cost_usd = estimate_cost("gemini", model, out)return out@@ -791,35 +740,29 @@ def _pool_outcome(end: SessionEnd, ok: bool, died: dict[str, Any]) -> str:class AntigravityAgent(_CliAgent):- """``agy:<model>``. A Gemini model with keys configured runs in Gemini-API mode: one pool key,- a HOME of its own under the cache dir holding the API-mode settings and the 3dcode MCP server- (deleted after the session; the tool trace is read out first), usage priced. Anything else —- a non-Gemini model agy serves (``claude-sonnet-4-6``), or no keys — runs on the machine's- subscription sign-in: real HOME, no MCP (the body documents the shell fallback), ``$0``."""+ """``agy:<gemini model>`` (default ``gemini-4-argon``), always in agy's Gemini-API mode: one+ pool key, a HOME of its own under the cache dir holding the API-mode settings and the 3dcode+ MCP server (deleted after the session; the tool trace is read out first), usage priced."""kind = "agy"cli_label = "agy"def __init__(self, model: str, binary: str | None = None):- self.model = model+ self.model = model or DEFAULT_AGY_MODELself.binary = binary or get_settings().binaries.agy_cli- @property- def api_mode(self) -> bool:- return self.model.startswith("gemini") and bool(get_settings().gemini_api_keys)+ def available(self) -> tuple[bool, str]:+ if not get_settings().gemini_api_keys:+ return False, "agy runs on Gemini API keys only: none configured (GEMINI_API_KEYS)"+ return super().available()def served_model(self) -> str:- """The model id the session is booked under: the API model in API mode, else the id- sent to agy (a bare one gains its effort suffix)."""- return api_model_effort(self.model)[0] if self.api_mode else resolve_model(self.model, self.binary)+ """The API model id the session is booked under (the effort suffix stripped)."""+ return api_model_effort(self.model)[0]def model_args(self) -> list[str]:- if not self.model:- return []- if self.api_mode:- name, effort = api_model_effort(self.model)- return ["--model", f"{AGY_API_SCHEME}{name}", "--effort", effort]- return ["--model", self.served_model()]+ name, effort = api_model_effort(self.model)+ return ["--model", f"{AGY_API_SCHEME}{name}", "--effort", effort]def build_argv(self, s: Session) -> list[str]:"""No ``--print``: agy reads the prompt from a piped stdin, byte for byte, and still@@ -832,7 +775,7 @@ class AntigravityAgent(_CliAgent):*self.model_args()]def build_home(self, s: Session) -> Path:- """A fresh HOME for one API-mode session: the API-mode settings and, when the job has+ """A fresh HOME for one session: the API-mode settings and, when the job hasspatial tools, the 3dcode MCP server — which keeps the REAL home (the harness reads itssettings, keys and caches from there)."""home = get_settings().cache_dir / "agy_homes" / f"{s.traj.dir.name}-{os.getpid()}-{time.time_ns()}"@@ -846,13 +789,12 @@ class AntigravityAgent(_CliAgent):(home / AGY_MCP_CONFIG).write_text(json.dumps({"mcpServers": servers}, indent=2))return home- def build_env(self, s: Session, *, key: str = "", home: Path | None = None) -> dict[str, str]:+ def build_env(self, s: Session, *, key: str, home: Path) -> dict[str, str]:env = hardened_env(s.ws, s.job)- if key and home is not None:- env["GEMINI_API_KEY"] = key- env["HOME"] = str(home)- # the agent's own shell inherits the fake HOME: keep puppeteer on the real Chrome cache- env.setdefault("PUPPETEER_CACHE_DIR", str(Path.home() / ".cache" / "puppeteer"))+ env["GEMINI_API_KEY"] = key+ env["HOME"] = str(home)+ # the agent's own shell inherits the fake HOME: keep puppeteer on the real Chrome cache+ env.setdefault("PUPPETEER_CACHE_DIR", str(Path.home() / ".cache" / "puppeteer"))return envdef _record_trace(self, s: Session, home: Path, conversation_id: str) -> int:@@ -876,32 +818,29 @@ class AntigravityAgent(_CliAgent):which takes a fresh key, the 429'd one cooling in the pool."""ok, why = self.available()s = begin_session(job, self.kind)- key, home = "", None+ home = Nonetry:if not ok:return failed(s, "error", why)- if self.api_mode:- pool = _key_pool()- try:- key = pool.session_key()- except KeyPoolExhausted as e: # every key throttled for the whole wait budget- return failed(s, "budget", f"Gemini key pool exhausted: {e}")- home = self.build_home(s)+ pool = _key_pool()+ try:+ key = pool.session_key()+ except KeyPoolExhausted as e: # every key throttled for the whole wait budget+ return failed(s, "budget", f"Gemini key pool exhausted: {e}")+ home = self.build_home(s)proc = invoke(s, self.build_argv(s), self.build_env(s, key=key, home=home), prompt=_compose_prompt_agy(s),- **({"model": self.model, "key_tail": key[-4:]} if key else {}))+ model=self.model, key_tail=key[-4:])ended = time.time()env = parse_agy_json(proc.stdout)- n_calls = self._record_trace(s, home or Path.home(), str((env or {}).get("conversation_id") or ""))+ n_calls = self._record_trace(s, home, str((env or {}).get("conversation_id") or ""))retries = agy_retries(s.traj.dir / AGY_LOG)served = self.served_model()- usage = usage_from_agy(env, served, priced=bool(key)) if env else Usage(backend=self.kind, model=served)+ usage = usage_from_agy(env, served) if env else Usage(backend=self.kind, model=served)usage.latency_ms = usage.latency_ms or int(proc.duration_s * 1000)text = str(env.get("response", "")) if env else proc.stdout.strip()errors: list[str] = []if env is None:s.notes.append("no JSON envelope from agy; usage unknown (zeros), response taken from plain stdout")- if not key:- s.notes.append("agy ran on the subscription sign-in: cost_usd=0")died = agy_error(proc.stderr)said = (json.dumps(died), str((env or {}).get("error") or ""), proc.stderr)ok = False@@ -916,8 +855,7 @@ class AntigravityAgent(_CliAgent):ok = Trueend = classify_end(proc, ok=ok, text=text, said=said, provider_retried=bool(retries) or bool(died.get("retryable")),provider_failed=bool(died.get("retryable")))- if key:- _key_pool().report(key, _pool_outcome(end, ok, died))+ pool.report(key, _pool_outcome(end, ok, died))usage.tool_calls = n_callsreturn finish_session(s, ok=ok, exit_reason=end.exit_reason, text=text, usage=usage, tool_calls=n_calls,diff --git a/harness/codeverse3d/agents/materialize.py b/harness/codeverse3d/agents/materialize.pyindex db560d20..2d5ec01f 100644--- a/harness/codeverse3d/agents/materialize.py+++ b/harness/codeverse3d/agents/materialize.py@@ -7,9 +7,7 @@ loaded twice.) MCP wiring — never a file in the workspace, which is agent-wri* claude-code → per-session ``trajectories/<label>_rNN/mcp.json`` (``agents/backends.py``)* codex → ``-c`` overrides (:func:`codex_mcp_overrides`, built per session by its backend)-* agy → in API mode, the ``mcp_config.json`` of the session's own HOME- (``AntigravityAgent.build_home``); on a subscription sign-in none — the body documents the- shell fallback.+* agy → the ``mcp_config.json`` of the session's own HOME (``AntigravityAgent.build_home``)Skills: the routed ``SKILL.md`` bundles are written per ROUND, not here — the set dependson the round's kind and the previous round's gate findings (``codeverse3d/skills``,@@ -74,12 +72,8 @@ def _tool_section(agent_kind: str, spatial_tools: bool, mcp_command: list[str],how = (f"Tools are exposed by the MCP server `{MCP_SERVER_NAME}`; their names appear as "f"`mcp__{MCP_SERVER_NAME}__<name>` (e.g. `mcp__{MCP_SERVER_NAME}__build`).")elif agent_kind == "agy":- how = (- f"Tools are exposed by the MCP server `{MCP_SERVER_NAME}`; call them by name and prefer them "- "over shell commands. If your tool list has no such server, call a tool from the shell instead:\n"- "`python -m codeverse3d.cli.main tools <name> --json '{\"arg\": \"value\"}'` "- "(run from the workspace root; prints the observation as text + JSON)."- )+ how = (f"Tools are exposed by the MCP server `{MCP_SERVER_NAME}`; call them by name and prefer them "+ "over shell commands.")else:how = f"Tools are exposed by the MCP server `{MCP_SERVER_NAME}` (command: `{' '.join(mcp_command)}`); call them by name."workflow = (diff --git a/harness/codeverse3d/agents/registry.py b/harness/codeverse3d/agents/registry.pyindex a6d11d8b..640ab6df 100644--- a/harness/codeverse3d/agents/registry.py+++ b/harness/codeverse3d/agents/registry.py@@ -44,7 +44,7 @@ KINDS = ("claude-code", "codex", "agy")def parse_agent_id(agent_id: str) -> tuple[str, str]:- """``agy:gemini-3.7-flash`` → ('agy', 'gemini-3.7-flash')."""+ """``agy:gemini-4-argon`` → ('agy', 'gemini-4-argon')."""if ":" not in agent_id:raise ValueError(f"agent id must be '<kind>:<model>', got {agent_id!r}")kind, model = agent_id.split(":", 1)diff --git a/harness/codeverse3d/cli/main.py b/harness/codeverse3d/cli/main.pyindex ca108b07..12fdaf6d 100644--- a/harness/codeverse3d/cli/main.py+++ b/harness/codeverse3d/cli/main.py@@ -240,7 +240,7 @@ def make(generator: Annotated[str | None,typer.Option(- help="agy:gemini-3.7-flash[-low|-medium|-high] | claude-code:... | codex:... | single-shot:gemini:..."+ help="agy:gemini-4-argon[-low|-medium|-high] | claude-code:... | codex:... | single-shot:gemini:..."),] = None,planner: Annotated[str | None, typer.Option()] = None,diff --git a/harness/codeverse3d/contracts/common.py b/harness/codeverse3d/contracts/common.pyindex b022b194..6cc2964c 100644--- a/harness/codeverse3d/contracts/common.py+++ b/harness/codeverse3d/contracts/common.py@@ -179,7 +179,7 @@ class Backends(BaseModel):* API chat models: ``gemini:gemini-3.7-flash`` · ``anthropic:claude-sonnet-5``· ``openai:gpt-5.6-sol``- * Coding agents: ``agy:gemini-3.7-flash`` (``-low``/``-medium``/``-high``) · ``claude-code:sonnet``+ * Coding agents: ``agy:gemini-4-argon`` (``-low``/``-medium``/``-high``; Gemini models only) · ``claude-code:sonnet``· ``codex:gpt-5.6-sol``The coding agent is always a VENDOR agent: the harness supplies the workspace, the@@ -189,7 +189,7 @@ class Backends(BaseModel):"""planner: str = "gemini:gemini-3.7-flash"- generator: str = "agy:gemini-3.7-flash"+ generator: str = "agy:gemini-4-argon"# 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/codeverse3d/cost/profiles.py b/harness/codeverse3d/cost/profiles.pyindex 6aaa8d62..994c3e40 100644--- a/harness/codeverse3d/cost/profiles.py+++ b/harness/codeverse3d/cost/profiles.py@@ -115,11 +115,10 @@ PROFILES: dict[str, Profile] = {expected_usd=1.47,expected_score="0.835 mean on compare_v1, 36/61 runs passed ($2.50 per passing artifact) ""— MEASURED ON gemini-cli:gemini-3.6-flash, not on this dial's generator",- note="today's defaults. The generator moved to 3.7-flash on 2026-08-28 and from gemini-cli "- "to agy on 2026-10-13 (D103), and these two expectations have NOT been re-measured on "- "either: docs/COST.md §12 puts the 3.7 CLI arm at $0.73/call against 3.6's $0.52 and "- "0.827 against 0.835, so expect this run to cost more and score about the same until a "- "battery says otherwise",+ note="today's defaults. The generator moved to 3.7-flash on 2026-08-28 and to "+ "agy:gemini-4-argon on 2026-10-13 (D103), and these two expectations have NOT been "+ "re-measured on it: argon lists at $2.00/$10.00 per M tokens against 3.6-flash's "+ "$0.75/$3.75, so expect this run to cost more until a battery says otherwise",),"quality": Profile(name="quality",@@ -133,11 +132,11 @@ PROFILES: dict[str, Profile] = {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 ""— MEASURED ON gemini-cli:gemini-3.6-flash, not on this dial's generator",- note="agy + pro judge n=3 + 4 rounds + best-of-2 + texture pass. The generator "- "moved to 3.7-flash on 2026-08-28 and to agy on 2026-10-13 (D103), and the $3.20 / score expectations above have NOT "- "been re-measured on it (same caveat as balanced: docs/COST.md §12 puts the 3.7 CLI "- "arm at $0.73/call vs 3.6's $0.52), so expect this dial to cost more and score about "- "the same until a battery says otherwise",+ note="agy:gemini-4-argon + pro judge n=3 + 4 rounds + best-of-2 + texture pass. The "+ "generator moved to agy:gemini-4-argon on 2026-10-13 (D103), and the $3.20 / score "+ "expectations above have NOT been re-measured on it (same caveat as balanced: argon "+ "lists at ~2.7x 3.6-flash's per-token price), so expect this dial to cost more until "+ "a battery says otherwise",),}diff --git a/harness/codeverse3d/cost/types.py b/harness/codeverse3d/cost/types.pyindex 452730e1..4de6c774 100644--- a/harness/codeverse3d/cost/types.py+++ b/harness/codeverse3d/cost/types.py@@ -133,7 +133,7 @@ _BACKEND_PROVIDER: dict[str, str] = {"openai": "openai","claude-code": "anthropic","anthropic": "anthropic",- "agy": "gemini", # Antigravity serves gemini models by default+ "agy": "gemini", # the harness runs agy on Gemini API keys only (D103)"antigravity": "gemini",}@@ -190,7 +190,7 @@ class CallCost(BaseModel):backend: str = ""provider: str = ""model: str = "" # bare model name, canonical (no provider prefix)- model_id: str = "" # as reported by the backend ("agy:gemini-3.7-flash")+ model_id: str = "" # as reported by the backend ("agy:gemini-4-argon")input_tokens: int = 0cached_tokens: int = 0diff --git a/harness/codeverse3d/doctor.py b/harness/codeverse3d/doctor.pyindex 104dfe75..013d8ec9 100644--- a/harness/codeverse3d/doctor.py+++ b/harness/codeverse3d/doctor.py@@ -277,9 +277,9 @@ def check_clis() -> list[Row]:okk, v = _ver(["git", "--version"])rows.append(("git", "OK" if okk else "FAIL", v))n = len(s.gemini_api_keys)- rows.append(("agy gemini mode", "OK" if n else "WARN",- f"API-key mode: {n}-key pool, 3dcode MCP, priced" if n- else "no Gemini keys: agy:gemini-* runs on the subscription sign-in, without the 3dcode MCP tools"))+ rows.append(("agy gemini keys", "OK" if n else "FAIL",+ f"{n}-key pool (Gemini-API mode, 3dcode MCP, priced)" if n+ else "no Gemini keys: agy runs on API keys only, so the default generator cannot run"))return rowsdiff --git a/harness/codeverse3d/tracks/common.py b/harness/codeverse3d/tracks/common.pyindex 54650a67..16b0f25a 100644--- a/harness/codeverse3d/tracks/common.py+++ b/harness/codeverse3d/tracks/common.py@@ -170,7 +170,7 @@ class RunContext:@propertydef agent_kind(self) -> str:- """``agy`` of ``agy:gemini-3.7-flash``."""+ """``agy`` of ``agy:gemini-4-argon``."""return self.agent_id.split(":", 1)[0]def record_prompt(self, name: str, text: str) -> None:diff --git a/harness/docs/ARCHITECTURE.md b/harness/docs/ARCHITECTURE.mdindex fd3da754..f4c516cd 100644--- a/harness/docs/ARCHITECTURE.md+++ b/harness/docs/ARCHITECTURE.md@@ -580,9 +580,8 @@ the since-deleted in-process `api-agent` and the since-removed pass / plateau stcamera-in-geometry can miss open-back enclosures.* threejs: textures are stripped on GLB export (the texture pass re-adds them as aderived pack); `userData.tick` cannot survive export.-* agy has no per-workspace MCP: in Gemini-API mode each session gets a HOME of its own with- the 3dcode server in it; on the subscription sign-in it has no MCP (shell fallback) and books- $0. A killed agy session books no usage (its tokens are in the envelope only). A killed codex session books an ESTIMATE+* agy has no per-workspace MCP: each session (Gemini-API mode, the only one the harness runs)+ gets a HOME of its own with the 3dcode server in it. A killed agy session books no usage (its tokens are in the envelope only). A killed codex session books an ESTIMATE(usage is per turn and `--ephemeral` leaves no rollout; `CodexEvents.estimated_usage` pricesthe stream it left, ledger `source="estimate"`, $ within 0.62–1.34× of actual on 356 recordedsessions); a killed claude-code session books itsdiff --git a/harness/docs/INSTALL.md b/harness/docs/INSTALL.mdindex 78e37b73..2ae12f6e 100644--- a/harness/docs/INSTALL.md+++ b/harness/docs/INSTALL.md@@ -361,12 +361,11 @@ export GEMINI_API_KEYS="key1,key2,key3" # e.g. in ~/.bashrc### 8.2 The coding-agent CLIs (`agy` required, the rest optional)The generator is always a vendor CLI: `--generator agy:… | claude-code:… | codex:…`.-Since 2026-10-13 (D103; gemini-cli was removed) the default is `agy:gemini-3.7-flash`, so **`agy` is-the one CLI a default run needs**. With Gemini keys configured (§8.1) an `agy:gemini-*` session runs-in **Gemini-API mode**: one key from the harness's own pool, the 3dcode MCP tools, priced at Gemini-list price — no sign-in. Without keys, or for a non-Gemini model (`agy:claude-sonnet-4-6`), it runs-on agy's own subscription sign-in, without the MCP tools, booked $0 (doctor row `agy gemini mode`).-The other two are needed only when you name them.+Since 2026-10-13 (D103; gemini-cli was removed) the default is `agy:gemini-4-argon`, so **`agy` is+the one CLI a default run needs**. The harness runs agy **only in Gemini-API mode**, so it needs+Gemini keys (§8.1): one key from the harness's own pool per session, the 3dcode MCP tools, priced at+Gemini list price — no sign-in, no non-Gemini model. Without keys an agy session fails at once+(doctor row `agy gemini keys`). The other two are needed only when you name them.```bash# agy (Antigravity CLI, 1.3.4 here): the Antigravity installer puts it in ~/.local/bin@@ -374,7 +373,7 @@ npm i -g @anthropic-ai/claude-code # claude (2.1.241 here)npm i -g @openai/codex # codex (0.149.0 here)```-`claude` and `codex` (and agy outside API mode) authenticate against your local subscription+`claude` and `codex` authenticate against your local subscription(their own `login` flows) — test lightly. The harness handles the per-CLI quirks for you(agy's per-session API-mode HOME, codex's MCP approval mode); what each one is and why it mustnot be undone: `docs/RUNBOOK.md` §3.@@ -454,7 +453,7 @@ Real output on this box (exit code 0; any FAIL row makes it exit 1):│ claude │ OK │ 2.1.241 (Claude Code) ││ codex │ OK │ codex-cli 0.149.0 ││ git │ OK │ git version 2.53.0 │-│ agy gemini mode │ OK │ API-key mode: 15-key pool, 3dcode MCP, priced │+│ agy gemini keys │ OK │ 15-key pool (Gemini-API mode, 3dcode MCP, priced) ││ mcp │ OK │ mcp + codeverse3d.spatial.mcp_server importable │└───────────────┴────────┴─────────────────────────────────────────────────────┘```@@ -490,7 +489,7 @@ that the keys work end to end):| `anthropic key` / `openai key` | WARN | not set | expected unless you use `anthropic:*` / `openai:*`; export the key to clear it || `agy` / `claude` / `codex` | WARN | CLI not on `PATH` | only that `--generator` is unavailable — but `agy` serves the default generator (§8.2) || `git` | FAIL | git missing | install git — run workspaces are git repos |-| `agy gemini mode` | WARN | no Gemini keys: `agy:gemini-*` runs on agy's subscription sign-in, without the 3dcode MCP tools, booked $0 | export `GEMINI_API_KEYS` (§8.1) for API-key mode (pool key, MCP, priced); the subscription sign-in no longer serves `gemini-3.7-flash` (2026-10-13) |+| `agy gemini keys` | FAIL | no Gemini keys: agy runs on API keys only, so the default generator cannot run | export `GEMINI_API_KEYS` (§8.1), or name a `claude-code:` / `codex:` generator || `mcp` | WARN | `mcp` package or the server module missing | `pip install -e 'harness[mcp]'`; only affects the agentic CLI backends || `gemini live call` (`--live`) | FAIL | key rejected / no network | check the key value and outbound access; a `503 … high demand` is transient, not an install problem || `in-flight slots` | WARN | every machine-wide slot is held right now (`busy n/n`), or `max_in_flight=0` switched the cap off | busy: other harness processes are mid-call and new calls wait for a slot (docs/COST.md §23) — nothing to fix unless it stays full; a slot is held only while a call is out and a killed process frees its slots at once. Off: unset `C3D_MAX_IN_FLIGHT` |diff --git a/harness/docs/INTERFACES.md b/harness/docs/INTERFACES.mdindex df838cfd..84667684 100644--- a/harness/docs/INTERFACES.md+++ b/harness/docs/INTERFACES.md@@ -228,16 +228,15 @@ it is what names the effect library without listing every module).Each session writes `trajectories/<label>_rNN/` (files: docs/RUN_LAYOUT.md); **Δ** a re-run of thesame label+round lands in `<label>.a2_rNN` (then `.a3` …) — the first attempt is never overwritten;`result.json` records `attempt` + `job_label`. Each session makes two git commits (`pre:`/`agent:<label>`).-agy specifics (**Δ D103**, which deleted the gemini-cli backend): `AntigravityAgent.api_mode` = model starts-with `gemini` AND Gemini keys are configured. API mode: one key per session from THE shared pool+agy specifics (**Δ D103**, which deleted the gemini-cli backend): Gemini-API mode only — no keys →+`available()` false; a bare `agy` runs `DEFAULT_AGY_MODEL` = `gemini-4-argon`. One key per session from THE shared pool(`models.gemini.shared_pool`, `pool.session_key()`, no in-flight slot), outcome reported back(`_pool_outcome`: 401/403/API_KEY_INVALID → dead, 429 → cooldown, 5xx, ok, skip); a fresh HOME under`<cache_dir>/agy_homes/` holds `.gemini/antigravity-cli/settings.json` = `{"modelProvider": "gemini"}` (withoutit agy ignores `GEMINI_API_KEY` and asks for a login) + the MCP config, and is deleted after the session (thetool trace is read from its conversation db first); argv `--model gemini-api://<bare id> --effort <e>`, effortfrom a `-low/-medium/-high` suffix, default `high`; usage priced at Gemini list price with-output = output − thinking, thoughts = thinking (agy's output already includes thinking). Subscription mode:-real HOME, no MCP, `cost_usd=0` (the ledger re-prices $0 rows at list price). KeyPoolExhausted never escapes+output = output − thinking, thoughts = thinking (agy's output already includes thinking). KeyPoolExhausted never escapes`run()` (→ `exit_reason=budget`). No retry loop in the backend: agy retries its own calls; a transientdeath goes to the round loop's one retry, which takes a fresh key.## languages/diff --git a/harness/docs/RUNBOOK.md b/harness/docs/RUNBOOK.mdindex ad7973fa..02b6dbab 100644--- a/harness/docs/RUNBOOK.md+++ b/harness/docs/RUNBOOK.md@@ -30,7 +30,7 @@ one home); each setting's default and description is its `Settings` field in# static object — Blender (default language, multi-file src/model.py + src/parts/*.py)3dcode make "a mid-century wooden dining chair" --track static_object --language blender3dcode make "a brass desk lamp" --track static_object --language cadquery-3dcode make "a classic park bench" --track static_object --language threejs --generator agy:gemini-3.7-flash+3dcode make "a classic park bench" --track static_object --language threejs --generator agy:gemini-4-argon# articulated object — bpy links + URDF3dcode make "a bedside cabinet with one hinged door and one drawer" --track articulated_object --language urdf_blender# scene — multi-file three.js + GLSL (+ optional bpy GLB assets chosen by the planner)@@ -65,19 +65,20 @@ round, then ≈ $0.36 / ~7 min per refine (give scenes `--max-minutes 60`).| id | what runs | notes ||---|---|---|-| `agy:gemini-3.7-flash` (default) | `agy --dangerously-skip-permissions --print-timeout … --output-format json --add-dir ws --log-file trajectories/<label>_rNN/agy.log --model gemini-api://gemini-3.7-flash --effort high`, prompt on stdin (no `--print`: `--print -` sends "-") | Gemini-API mode with keys: pool key, every spatial tool over MCP, priced; see gotchas below. Truncates a prompt past ~175 kB itself |+| `agy:gemini-4-argon` (default) | `agy --dangerously-skip-permissions --print-timeout … --output-format json --add-dir ws --log-file trajectories/<label>_rNN/agy.log --model gemini-api://gemini-4-argon --effort high`, prompt on stdin (no `--print`: `--print -` sends "-") | Gemini-API mode only (Gemini keys required, Gemini models only): pool key, every spatial tool over MCP, priced; see gotchas below. Truncates a prompt past ~175 kB itself || `single-shot:gemini:gemini-3.7-flash` | one structured-output call → multi-file envelope, no tools | fastest/cheapest; baseline for "raw model" deltas || `claude-code:<model>` | `claude -p --dangerously-skip-permissions --setting-sources project --settings '{"skillOverrides":…}' --mcp-config trajectories/<label>_rNN/mcp.json --strict-mcp-config …`, prompt on stdin, `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS=1` | local subscription — test lightly; no user setting source, so `~/.claude/settings.json` (effortLevel, hooks, env) does not reach a session || `codex:<model>[@<effort>]` | `codex exec --json -C ws --sandbox workspace-write -c model_reasoning_effort=high -c skills.bundled.enabled=false -c mcp_servers.3dcode.… -`, prompt on stdin | subscription; MCP tools need `default_tools_approval_mode="approve"` (harness passes it); reasoning effort is always stated (`Settings.agents.codex_reasoning_effort`, default `high`; `codex:gpt-5.6-sol@medium` per id, `""` to defer to `~/.codex/config.toml`) |-| `agy:<model>` (non-Gemini, e.g. `claude-sonnet-4-6`, or no keys) | same argv, `--model <id>` (a bare id gains agy's effort suffix) | subscription sign-in: no MCP (tools via `python -m codeverse3d.cli.main tools <name> --json …`), booked $0; the sign-in no longer serves `gemini-3.7-flash` (2026-10-13) || `gemini:* / anthropic:* / openai:*` | ChatModel for planner / judge / captioner / single-shot | Anthropic/OpenAI untested live here |### agy gotchas (handled by `agents/backends.py`; do not undo — D103)-* API mode (`AntigravityAgent.api_mode`: a `gemini*` model AND Gemini keys configured): one key+* API mode only (owner, 2026-10-13: no subscription sign-in, no Claude models; no keys →+ `available()` is false and the session fails at once). `agy` with no model = `gemini-4-argon`+ (`DEFAULT_AGY_MODEL`). One keyper session from THE shared pool (`KeyPool.session_key`, no in-flight slot) as `GEMINI_API_KEY`,its outcome reported back (429 → cooldown, 401/403/`API_KEY_INVALID` → dead, 5xx, ok, skip);other credential env stripped; KeyPoolExhausted → `exit_reason=budget`, never raised.-* Each API-mode session gets a fresh HOME under `<cache_dir>/agy_homes/…` holding+* Each session gets a fresh HOME under `<cache_dir>/agy_homes/…` holding`.gemini/antigravity-cli/settings.json` = `{"modelProvider": "gemini"}` (without it agy ignoresthe key and asks for a login) and `.gemini/config/mcp_config.json` with the `3dcode` server(agy has no per-workspace MCP; the server's `env.HOME` is the real home). The HOME is deleted@@ -88,8 +89,6 @@ round, then ≈ $0.36 / ~7 min per refine (give scenes `--max-minutes 60`).default `high` (the Gemini API's own default).* Cost: priced at Gemini list price; agy's `output_tokens` already include `thinking_tokens`, sooutput = output − thinking, thoughts = thinking (billed once).-* Subscription mode (non-Gemini model, or no keys): real HOME and sign-in, no MCP (AGENTS.md- documents the shell fallback), booked $0 by the backend (the ledger re-prices $0 rows).* No retry loop in the backend: agy retries its own model calls (≤ 30 s waits since 1.3.4, stopsat once on a spent daily quota); a transient death goes to the round loop's ONE transport retry,which takes a fresh key. There is no single-shot storm fallback (deleted in D103).@@ -298,7 +297,7 @@ python -m bench.run_bench bench/prompts/static_objects_v1.yaml --generator singlpython -m bench.report bench/out/static_objects_v1 # report.md + self-contained report.html (gallery)cd ../harnesspython ../eval/bench/compare_backends.py --prompts ../eval/bench/prompts/compare_v1.yaml \- --arms harness:agy:gemini-3.7-flash,oneshot:claude-code --judge gemini:gemini-3.1-pro-preview --out ../eval/bench/out/compare_v1+ --arms harness:agy:gemini-4-argon,oneshot:claude-code --judge gemini:gemini-3.1-pro-preview --out ../eval/bench/out/compare_v1```Results stream to `results.jsonl` (resumable). The batteries, the protocol and judgecalibration: `eval/docs/EVAL.md` (§2 lists the batteries).diff --git a/harness/tests/agents/test_antigravity.py b/harness/tests/agents/test_antigravity.pyindex befd8b97..71924356 100644--- a/harness/tests/agents/test_antigravity.py+++ b/harness/tests/agents/test_antigravity.py@@ -1,4 +1,4 @@-"""AntigravityAgent: envelope parsing, argv, fake binary, Gemini-API mode, live smoke."""+"""AntigravityAgent (Gemini-API mode only): envelope parsing, argv, fake binary, pool key, live smoke."""from __future__ import annotations@@ -8,11 +8,7 @@ from pathlib import Pathimport pytest-from codeverse3d.agents.backends import (- AntigravityAgent,- available_models,- resolve_model,-)+from codeverse3d.agents.backends import DEFAULT_AGY_MODEL, AntigravityAgentfrom codeverse3d.agents.cli_common import begin_sessionfrom codeverse3d.config import get_settingsfrom codeverse3d.contracts.agent import AgentJob@@ -20,9 +16,12 @@ from codeverse3d.workspace import Workspace@pytest.fixture(autouse=True)-def _subscription(monkeypatch, tmp_path):- """Every test here runs on the subscription sign-in unless it hands out keys itself."""- monkeypatch.setattr(get_settings(), "gemini_api_keys", [])+def _one_key(monkeypatch, tmp_path, request):+ """agy runs on API keys only: every test gets one key of its own (so its own pool — a 429+ in one test never cools another's key) and a cache dir for the session HOMEs."""+ if request.node.get_closest_marker("live"):+ return # the real pool and cache+ monkeypatch.setattr(get_settings(), "gemini_api_keys", [f"key-{request.node.name}"])monkeypatch.setattr(get_settings(), "cache_dir", tmp_path / "cache")ENVELOPE = {"conversation_id": "c1", "status": "SUCCESS", "response": "DONE\n", "duration_seconds": 3.0, "num_turns": 1,@@ -61,39 +60,15 @@ else:'''-#: `agy models` output, as agy 1.1.19 prints it: a model with reasoning efforts is-#: listed ONLY in its effort-suffixed spellings, one that has none is listed bare.-FAKE_AGY_MODELS = r"""-args = sys.argv[1:]-if args[:1] == ["models"]:- print("Fetching available models...")- print("gemini-3.7-flash-high\tGemini 3.7 Flash (High)")- print("gemini-3.7-flash-medium\tGemini 3.7 Flash (Medium)")- print("gemini-3.7-flash-low\tGemini 3.7 Flash (Low)")- print("claude-sonnet-4-6\tClaude Sonnet 4.6 (Thinking)")- sys.exit(0)-# agy 1.1.19 refuses a bare id that has efforts, and refuses --effort for one that has none-model = args[args.index("--model") + 1] if "--model" in args else ""-if model in ("gemini-3.7-flash",):- print(json.dumps({"conversation_id": "", "status": "ERROR", "response": "",- "error": 'invalid model selection (--model "%s" --effort ""): '- "--model %s requires --effort (available: low, medium, high)" % (model, model)}))- sys.exit(0)-os.makedirs("src", exist_ok=True)-open("src/hello.txt", "w").write("hi")-print(""" + repr(json.dumps(ENVELOPE)) + r""")-"""--def test_argv_sets_the_print_timeout_a_minute_past_the_session(tmp_ws: Workspace):- a = AntigravityAgent("gemini-3.6-flash-high", binary="agy")+ a = AntigravityAgent("gemini-4-argon-high", binary="agy")s = begin_session(AgentJob(workspace=str(tmp_ws.root), prompt="p", timeout_s=1800), "agy")argv = a.build_argv(s)assert argv[argv.index("--print-timeout") + 1] == "31m"def test_fake_run_json_and_text(tmp_ws: Workspace, fake_bin, monkeypatch):- a = AntigravityAgent("gemini-3.6-flash-high", binary=fake_bin("agy", FAKE_AGY))+ a = AntigravityAgent("gemini-4-argon-high", binary=fake_bin("agy", FAKE_AGY))res = a.run(AgentJob(workspace=str(tmp_ws.root), prompt="hello", label="a", timeout_s=30))assert res.ok and res.text.strip() == "DONE", res.errorsu = res.usage@@ -114,7 +89,7 @@ def test_the_retries_in_agys_own_log_are_its_provider_wait(tmp_ws: Workspace, fafrom codeverse3d.agents.backends import agy_retriesfrom codeverse3d.agents.cli_common import provider_wait- a = AntigravityAgent("gemini-3.6-flash-high", binary=fake_bin("agy", FAKE_AGY))+ a = AntigravityAgent("gemini-4-argon-high", binary=fake_bin("agy", FAKE_AGY))monkeypatch.setenv("FAKE_MODE", "retried")res = a.run(AgentJob(workspace=str(tmp_ws.root), prompt="hello", label="r", timeout_s=30))assert res.ok, res.errors@@ -128,7 +103,7 @@ def test_the_retries_in_agys_own_log_are_its_provider_wait(tmp_ws: Workspace, fadef test_agy_says_itself_whether_a_dead_turn_is_worth_a_retry(tmp_ws: Workspace, fake_bin, monkeypatch):- a = AntigravityAgent("gemini-3.6-flash-high", binary=fake_bin("agy", FAKE_AGY))+ a = AntigravityAgent("gemini-4-argon-high", binary=fake_bin("agy", FAKE_AGY))monkeypatch.setenv("FAKE_MODE", "died")res = a.run(AgentJob(workspace=str(tmp_ws.root), prompt="hello", label="d", timeout_s=30))assert not res.ok and res.exit_reason == "error" and res.transient and not res.quota@@ -140,35 +115,13 @@ def test_agy_says_itself_whether_a_dead_turn_is_worth_a_retry(tmp_ws: Workspace,def test_live_agy_tiny(tmp_ws: Workspace):if not shutil.which("agy"):pytest.skip("agy not installed")- a = AntigravityAgent("gemini-3.6-flash-low")+ a = AntigravityAgent("gemini-4-argon-low")res = a.run(AgentJob(workspace=str(tmp_ws.root), prompt="Use your file-writing tool to create src/hello.txt containing exactly 'hi'. Reply DONE.",timeout_s=300, label="live", spatial_tools=False))assert res.ok, res.errorsassert (tmp_ws.src / "hello.txt").read_text().strip() == "hi"-def test_an_unknown_model_and_an_unreachable_agy_are_passed_through(tmp_ws: Workspace, fake_bin):- """Resolution can only turn a guaranteed failure into a run, never the reverse."""- available_models.cache_clear()- binary = fake_bin("agy", FAKE_AGY_MODELS)- assert resolve_model("gemini-3.7-flash-low", binary) == "gemini-3.7-flash-low"- assert resolve_model("claude-sonnet-4-6", binary) == "claude-sonnet-4-6" # has no effort- assert resolve_model("some-future-model", binary) == "some-future-model"- available_models.cache_clear()- assert resolve_model("gemini-3.7-flash", "/nonexistent/agy") == "gemini-3.7-flash"---def test_the_run_uses_and_records_the_resolved_id(tmp_ws: Workspace, fake_bin):- """agy 1.1.19 refuses a bare id that has efforts: the run sends the effort-suffixed id."""- available_models.cache_clear()- a = AntigravityAgent("gemini-3.7-flash", binary=fake_bin("agy", FAKE_AGY_MODELS))-- res = a.run(AgentJob(workspace=str(tmp_ws.root), prompt="hello", label="a", timeout_s=60))-- assert res.ok and res.text.strip() == "DONE", res.errors- assert res.usage.model == "gemini-3.7-flash-medium"--#: agy in Gemini-API mode, as the harness drives it: everything it needs is in its own HOMEFAKE_AGY_API = r'''args = sys.argv[1:]@@ -188,24 +141,25 @@ print(''' + repr(json.dumps(ENVELOPE)) + r''')'''-def test_api_mode_runs_on_a_pool_key_in_a_home_of_its_own(tmp_ws: Workspace, fake_bin, monkeypatch):- """A Gemini model with keys configured: one pool key, agy's API-mode setting and the 3dcode MCP- server in a fresh HOME (gone afterwards), the model sent verbatim with its effort, usage priced."""+def test_a_session_runs_on_a_pool_key_in_a_home_of_its_own(tmp_ws: Workspace, fake_bin, monkeypatch):+ """One pool key, agy's API-mode setting and the 3dcode MCP server in a fresh HOME (gone+ afterwards), the model sent verbatim with its effort, usage priced."""from codeverse3d.agents import backends- monkeypatch.setattr(get_settings(), "gemini_api_keys", ["key-one"])- a = AntigravityAgent("gemini-3.7-flash-low", binary=fake_bin("agy", FAKE_AGY_API))- assert a.api_mode and a.served_model() == "gemini-3.7-flash"+ key = get_settings().gemini_api_keys[0]+ a = AntigravityAgent("gemini-4-argon-low", binary=fake_bin("agy", FAKE_AGY_API))+ assert a.served_model() == "gemini-4-argon"res = a.run(AgentJob(workspace=str(tmp_ws.root), prompt="hello", label="api", timeout_s=30, language="blender"))assert res.ok, res.errorsseen = json.loads((tmp_ws.src / "seen.json").read_text())- assert seen["key"] == "key-one" and seen["settings"] == {"modelProvider": "gemini"}- assert (seen["model"], seen["effort"]) == ("gemini-api://gemini-3.7-flash", "low")+ assert seen["key"] == key and seen["settings"] == {"modelProvider": "gemini"}+ assert (seen["model"], seen["effort"]) == ("gemini-api://gemini-4-argon", "low")server = seen["mcp"]["mcpServers"]["3dcode"]assert server["args"][:2] == ["-m", "codeverse3d.spatial.mcp_server"] and server["env"] == {"HOME": str(Path.home())}assert seen["home"] != str(Path.home()) and not Path(seen["home"]).exists() # deleted after the session- assert res.usage.model == "gemini-3.7-flash" and res.usage.cost_usd > 0- # a bare id runs at the API's own default effort+ assert res.usage.model == "gemini-4-argon" and res.usage.cost_usd > 0+ # a bare id runs at the API's own default effort; no model at all is argon+ assert AntigravityAgent("").model == DEFAULT_AGY_MODEL == "gemini-4-argon"assert AntigravityAgent("gemini-4-argon").model_args() == ["--model", "gemini-api://gemini-4-argon", "--effort", "high"]# a 429 cools the key in the shared poolmonkeypatch.setenv("FAKE_MODE", "429")@@ -215,7 +169,11 @@ def test_api_mode_runs_on_a_pool_key_in_a_home_of_its_own(tmp_ws: Workspace, fakassert json.loads((tmp_ws.src / "seen.json").read_text())["mcp"] == {"mcpServers": {}}-def test_a_model_agy_only_serves_on_the_subscription_never_takes_a_key(monkeypatch):- monkeypatch.setattr(get_settings(), "gemini_api_keys", ["key-one"])- assert not AntigravityAgent("claude-sonnet-4-6").api_mode- assert AntigravityAgent("gemini-3.7-flash").api_mode+def test_without_keys_agy_is_unavailable_and_never_starts(tmp_ws: Workspace, fake_bin, monkeypatch):+ """No subscription fallback (owner, 2026-10-13): no keys is a clear error, not a sign-in run."""+ monkeypatch.setattr(get_settings(), "gemini_api_keys", [])+ a = AntigravityAgent("gemini-4-argon", binary=fake_bin("agy", FAKE_AGY))+ ok, why = a.available()+ assert not ok and "API keys" in why+ res = a.run(AgentJob(workspace=str(tmp_ws.root), prompt="hello", label="nokey", timeout_s=30))+ assert not res.ok and res.exit_reason == "error" and not (tmp_ws.src / "hello.txt").exists()diff --git a/harness/tests/agents/test_cli_common.py b/harness/tests/agents/test_cli_common.pyindex 24bf9a63..82143d05 100644--- a/harness/tests/agents/test_cli_common.py+++ b/harness/tests/agents/test_cli_common.py@@ -199,7 +199,7 @@ _ENDINGS = {@pytest.mark.parametrize("ending", sorted(_ENDINGS))[email protected]("vendor", ["claude-code", "codex", "agy", "agy-api"])[email protected]("vendor", ["claude-code", "codex", "agy"])def test_every_cli_backend_ends_by_one_rule(tmp_ws: Workspace, fake_bin, monkeypatch, vendor, ending):"""N71: one ``classify_end`` — a kill with no provider evidence is not transient, and a spentusage limit or a 429 is ``budget``, whichever vendor's CLI said it."""@@ -211,16 +211,13 @@ def test_every_cli_backend_ends_by_one_rule(tmp_ws: Workspace, fake_bin, monkeypfrom codeverse3d.config import get_settingsmonkeypatch.setattr(cli_common, "IDLE_GRACE_S", 0.3)- monkeypatch.setattr(get_settings(), "gemini_api_keys", ["n71-key"])+ monkeypatch.setattr(get_settings(), "gemini_api_keys", [f"n71-key-{ending}"]) # agy's pool key, one per endingbody, want = _ENDINGS[ending]monkeypatch.setattr(get_settings(), "cache_dir", tmp_ws.root.parent / "cache")binary = fake_bin(vendor, "sys.stdin.read()\n" + body)agent = {"claude-code": lambda: ClaudeCodeAgent("m", binary=binary),"codex": lambda: CodexAgent("m", binary=binary, reasoning_effort=""),- "agy": lambda: AntigravityAgent("m", binary=binary), # subscription sign-in- "agy-api": lambda: AntigravityAgent("gemini-m", binary=binary)}[vendor]() # a pool key- if vendor == "agy":- monkeypatch.setattr(agent, "served_model", lambda: "m")+ "agy": lambda: AntigravityAgent("m", binary=binary)}[vendor]()res = agent.run(AgentJob(workspace=str(tmp_ws.root), prompt="p", label=ending, spatial_tools=False,timeout_s=1 if ending == "killed" else 30))assert (res.exit_reason, res.transient, res.quota) == wantdiff --git a/harness/tests/agents/test_materialize.py b/harness/tests/agents/test_materialize.pyindex 690d8560..50acb663 100644--- a/harness/tests/agents/test_materialize.py+++ b/harness/tests/agents/test_materialize.py@@ -88,7 +88,7 @@ def test_kind_specific_tool_hint_and_spatial_disabled_documents_absence(tmp_ws:assert "mcp__3dcode__" in (tmp_ws.root / "CLAUDE.md").read_text()_mat(tmp_ws, kind="agy")body = (tmp_ws.root / "AGENTS.md").read_text()- assert "MCP server `3dcode`" in body and "codeverse3d.cli.main tools" in body # API mode / sign-in fallback+ assert "MCP server `3dcode`" in body and "codeverse3d.cli.main tools" not in body # always MCP: no shell fallback_mat(tmp_ws, spatial=False)assert "No spatial tools are available" in (tmp_ws.root / "AGENTS.md").read_text()diff --git a/harness/tests/cost/test_profiles.py b/harness/tests/cost/test_profiles.pyindex b4a98bb8..f318bf8a 100644--- a/harness/tests/cost/test_profiles.py+++ b/harness/tests/cost/test_profiles.py@@ -133,12 +133,12 @@ def _dial_from_env(name: str, monkeypatch):"rounds": 2, "candidates": 1, "texture": False,"judge_max_px": 1024, "judge_montages": 5, "judge_detail_crops": 2,"agent_max_turns": 0, "max_minutes": 30.0}),- ("balanced", {"generator": "agy:gemini-3.7-flash",+ ("balanced", {"generator": "agy:gemini-4-argon","judge": "gemini:gemini-3.1-pro-preview", "judge_samples": 1,"rounds": 4, "candidates": 1, "texture": False,"judge_max_px": 1024, "judge_montages": 5, "judge_detail_crops": 2,"agent_max_turns": 0, "max_minutes": 60.0}),- ("quality", {"generator": "agy:gemini-3.7-flash",+ ("quality", {"generator": "agy:gemini-4-argon","judge": "gemini:gemini-3.1-pro-preview", "judge_samples": 3,"rounds": 4, "candidates": 2, "texture": True,"judge_max_px": 1024, "judge_montages": 5, "judge_detail_crops": 2,diff --git a/harness/tests/prompts/manifest.py b/harness/tests/prompts/manifest.pyindex ef2a35da..6e62c871 100644--- a/harness/tests/prompts/manifest.py+++ b/harness/tests/prompts/manifest.py@@ -90,7 +90,7 @@ from tests.orchestrator_tracks.fakes import ()MANIFEST = Path(__file__).with_name("manifest.json")-AGENT = "agy:gemini-3.7-flash" # the default generator (a vendor CLI; FakeAgent answers)+AGENT = "agy:gemini-4-argon" # the default generator (a vendor CLI; FakeAgent answers)SINGLE_SHOT = "single-shot:gemini:gemini-3.7-flash"#: what each track is asked forREQUESTS = {Track.STATIC_OBJECT: ("a mid-century wooden dining chair", Constraints(dimensions_m={"height": 0.82}, must_have=["armrests"])),