Skip to content

Official Codebase of 3DCodeVerse

Python

tests: orchestrator — delete tests the money removal left behind and fold near-twins

gaoypeng68559367adb5
diff --git a/harness/tests/orchestrator_tracks/test_cookbook_excerpt.py b/harness/tests/orchestrator_tracks/test_cookbook_excerpt.py
index 1cadcde5..49680307 100644
--- a/harness/tests/orchestrator_tracks/test_cookbook_excerpt.py
+++ b/harness/tests/orchestrator_tracks/test_cookbook_excerpt.py
@@ -8,7 +8,6 @@ sparkles. The selector hands over whole chapters, ranked by the brief, inside a
from __future__ import annotations
-from pathlib import Path
from types import SimpleNamespace
from codeverse3d.contracts.common import Language, Track
@@ -66,4 +65,3 @@ def test_aurora_example_ships_and_composes() -> None:
composed = compose(src)
assert "mainImage" in composed.source and "u_time" in composed.source
assert "examples/aurora_ridge.frag" in load_text("glsl_shader/cookbook.md")
- assert Path(EXAMPLE).suffix == ".frag"
diff --git a/harness/tests/orchestrator_tracks/test_cost_accounting.py b/harness/tests/orchestrator_tracks/test_cost_accounting.py
index 814fafe7..534a4666 100644
--- a/harness/tests/orchestrator_tracks/test_cost_accounting.py
+++ b/harness/tests/orchestrator_tracks/test_cost_accounting.py
@@ -11,7 +11,7 @@ from codeverse3d.contracts.agent import AgentJob, AgentResult
from codeverse3d.contracts.common import Budget, Usage
from codeverse3d.cost.instrument import MeteredAgent, run_ledger
from codeverse3d.cost.ledger import load_ledger, record_call
-from codeverse3d.orchestrator import BudgetExceeded, BudgetGuard
+from codeverse3d.orchestrator import BudgetGuard
from codeverse3d.tracks.generation import GenerationTask, _SessionAcc
FIXTURES = json.loads((Path(__file__).parent / "data" / "offrecord_runs.json").read_text())["runs"]
@@ -90,23 +90,3 @@ def test_the_round_the_budget_cut_is_still_in_the_total(tmp_path):
burned = sum(s["cost_usd"] for s in cut)
assert sum(r.cost_usd for r in load_ledger(tmp_path) if r.round == 2) == pytest.approx(burned, abs=1e-6)
assert burned > 0.8 and total > burned # $0.86 that record.rounds never mentioned, inside the total
-
-
-def test_post_hoc_texture_passes_are_inside_the_total(tmp_path):
- fx = FIXTURES["furn_hard_rolltop_desk"]
- with_tex = replay("furn_hard_rolltop_desk", tmp_path / "with")
- tex = sum(t["cost_usd"] for t in fx["post_hoc_texture_passes"])
- assert tex == pytest.approx(0.6562, abs=1e-3)
- assert with_tex - tex == pytest.approx(fx["recorded_total_usd"], abs=0.02)
-
-
-# ----------------------------------------------------------------------------- the clock
-def test_the_guard_is_a_clock_with_a_soft_share_for_the_baseline():
- g = BudgetGuard(Budget(max_minutes=60.0), soft_fraction=0.55)
- assert g.soft_exceeded() == "" and g.ok()
- g._active_s = 34 * 60.0 # noqa: SLF001 — past the baseline's 55 %, inside the ceiling
- assert g.soft_exceeded() and g.ok()
- g._active_s = 3600.0 # noqa: SLF001
- with pytest.raises(BudgetExceeded):
- g.check()
- assert set(g.summary()) == {"elapsed_min", "max_minutes"}, "the guard keeps no money"
diff --git a/harness/tests/orchestrator_tracks/test_cost_latency.py b/harness/tests/orchestrator_tracks/test_cost_latency.py
index d0a689f1..05aee436 100644
--- a/harness/tests/orchestrator_tracks/test_cost_latency.py
+++ b/harness/tests/orchestrator_tracks/test_cost_latency.py
@@ -61,8 +61,10 @@ def test_soft_budget_degrades_before_the_hard_cap_and_grace_reopens_it():
assert g.ok() # the HARD ceiling is untouched: degrade, do not die
clock["t"] = 11.0
assert not g.ok()
- with pytest.raises(BudgetExceeded):
+ with pytest.raises(BudgetExceeded) as ei:
g.check()
+ assert "max_minutes" in ei.value.reason
+ assert set(g.summary()) == {"elapsed_min", "max_minutes"}, "the guard keeps no money"
g.grant_grace(minutes=5.0)
assert g.ok() and g.hard_minutes == pytest.approx(15.0)
g.grant_grace(minutes=1.0) # never shrinks
@@ -75,6 +77,7 @@ def test_timeout_is_clipped_to_the_wall_clock_left():
assert g.timeout_s(120, floor_s=60) == pytest.approx(120, abs=2) # never inflates
g.start_time -= 600 # the run is already over its wall clock
assert g.timeout_s(1800, floor_s=90) == 90 # floor, never 0
+ assert g.timeout_s(600, floor_s=0, soft=False) == 0 # ...unless the floor is 0
# ----------------------------------------------------------------------------- dedupe
@@ -303,8 +306,8 @@ def test_a_budget_stop_before_round_zero_still_delivers_a_judged_round(tmp_path,
return {rel: "export function build(){}\n" for rel in (job.files_hint or ["src/zones/x.js"])}
return {f"src/assets/{job.label[6:]}.js": f"export function build(){{}} // {job.label}\n"}
- # the greenhouse hole: 2 asset sessions + env stay under $5; the zone session's own
- # (real, guard-enforced) charge crosses the ceiling mid-stage: $1.30 × 4 = $5.20
+ # the greenhouse hole: 2 asset sessions + env stay under the 10-minute clock; the zone
+ # session's own 3 minutes cross it mid-stage (4 × 3 = 12)
track = SceneTrack(services=services, judge=FakeJudge(scores=(0.58,)), agent=FakeAgent(writer, cost=1.3, minutes=3.0),
planner_model=_planner(plan.model_dump(mode="json")), settings=settings,
runtime=FakeRuntime(Language.SCENE_THREEJS))
@@ -347,7 +350,7 @@ def test_soft_budget_notes_land_in_the_round_record(tmp_path, settings):
spec = make_spec(Track.SCENE, Language.SCENE_THREEJS, max_rounds=0)
ws = Workspace(tmp_path / "runs" / "degraded")
services = FakeServices(assemble=True)
- # an expensive agent: the soft cap (55 % of $5) is crossed during the asset stage
+ # a slow agent: the soft cap (55 % of the 10-minute clock) is crossed during the asset stage
agent = FakeAgent(_writer, cost=1.1, minutes=2.0)
track = SceneTrack(services=services, judge=FakeJudge(scores=(0.5,)), agent=agent,
planner_model=_planner(plan.model_dump(mode="json")), settings=settings,
@@ -533,19 +536,6 @@ def test_the_shot_after_an_outage_is_a_plain_generation_not_a_repair(tmp_path, s
assert "did NOT pass" not in prompts[1] and "rewrite COMPLETELY" not in prompts[1]
-def test_a_generation_session_never_outlives_the_wall_budget():
- from codeverse3d.contracts.spec import Budget
- from codeverse3d.orchestrator import BudgetGuard
-
- g = BudgetGuard(Budget(max_minutes=30.0, max_rounds=4))
- assert g.timeout_s(1800, floor_s=120.0) == pytest.approx(1800, abs=60) # fresh run: full session
- g.start_time -= 27 * 60 # 3 minutes left
- clipped = g.timeout_s(1800, floor_s=120.0)
- assert 120 <= clipped <= 3 * 60, clipped
- g.start_time -= 10 * 60 # ceiling already crossed
- assert g.timeout_s(1800, floor_s=120.0) == 120 # the floor, never 1800
-
-
def test_one_asset_cannot_eat_the_scene_run():
from codeverse3d.contracts.spec import Budget
from codeverse3d.orchestrator import BudgetGuard
diff --git a/harness/tests/orchestrator_tracks/test_fix_batch2.py b/harness/tests/orchestrator_tracks/test_fix_batch2.py
index 87a5c917..7d083f1e 100644
--- a/harness/tests/orchestrator_tracks/test_fix_batch2.py
+++ b/harness/tests/orchestrator_tracks/test_fix_batch2.py
@@ -10,7 +10,7 @@ from codeverse3d.contracts.artifacts import BuildResult, GateFinding, GateReport
from codeverse3d.contracts.common import Language, Track
from codeverse3d.contracts.plan import BBox, PartPlan, ScenePlan, StaticPlan
from codeverse3d.contracts.run import RoundRecord, RunStatus
-from codeverse3d.orchestrator import RoundPolicy, RunState
+from codeverse3d.orchestrator import RunState
from codeverse3d.proc import EventLog
from codeverse3d.prompts import load_text
from codeverse3d.tracks.planner import plan_example
@@ -83,8 +83,8 @@ def test_finalise_restores_the_last_round_when_an_aborted_round_dirtied_src(tmp_
left HEAD at the last round's commit with foreign src/: the run then ended on unjudged code."""
spec = make_spec(max_rounds=3)
ws = Workspace(tmp_path / "runs" / "r")
- # planner 0.002 + baseline agent 0.01 + judge 0.003 = 0.015 < 0.02; the refine agent's
- # 0.01 charge crosses the ceiling AFTER its files hit the disk.
+ # the baseline session's 6 minutes fit the 10-minute clock; the refine session's 6 more
+ # cross it AFTER its files hit the disk.
track = StaticObjectTrack(services=FakeServices(), judge=FakeJudge(scores=(0.55, 0.7), targets=("Seat",)), agent=FakeAgent(_writer, minutes=6.0),
planner_model=_planner(chair_plan.model_dump(mode="json")), settings=settings,
runtime=FakeRuntime(Language.THREEJS))
@@ -214,27 +214,6 @@ def test_degraded_verdict_recovers_via_rejudge_of_same_commit(tmp_path, chair_pl
# --------------------------------------------------------------------- finding: plan stage hash covers the whole Spec
-def test_resume_with_raised_budget_does_not_replan_or_reskeleton(tmp_path, chair_plan, settings):
- spec = make_spec(max_rounds=1)
- ws = Workspace(tmp_path / "runs" / "r")
- planner = _planner(chair_plan.model_dump(mode="json"))
- services = FakeServices()
- mk = lambda: StaticObjectTrack(services=services, judge=FakeJudge(scores=(0.5, 0.6, 0.9)), agent=FakeAgent(_writer), # noqa: E731
- planner_model=planner, settings=settings, runtime=FakeRuntime(Language.THREEJS),
- policy=RoundPolicy(max_rounds=1))
- mk().run(spec, ws)
- n_plan_calls = len(planner.requests)
- src_before = (ws.src / "object.js").read_text()
- # the only way to continue a BUDGET-stopped run: raise the budget in the spec
- spec2 = make_spec(max_rounds=1)
- rec2 = mk().run(spec2, ws, resume=True)
- assert len(planner.requests) == n_plan_calls # plan stage still cached
- assert (ws.src / "object.js").read_text() == src_before or "r0" in (ws.src / "object.js").read_text()
- assert rec2.rounds[0].commit # prior rounds still loaded
- kinds = [e["event"] for e in EventLog(ws.events_path).read()]
- assert kinds.count("stage.cached") >= 2
-
-
def test_skeleton_never_reruns_over_existing_rounds(tmp_path, chair_plan, settings):
class CountingRuntime(FakeRuntime):
def __init__(self, language):
diff --git a/harness/tests/orchestrator_tracks/test_fixed_rounds.py b/harness/tests/orchestrator_tracks/test_fixed_rounds.py
index 3cb1ac8c..5068b9ff 100644
--- a/harness/tests/orchestrator_tracks/test_fixed_rounds.py
+++ b/harness/tests/orchestrator_tracks/test_fixed_rounds.py
@@ -70,8 +70,6 @@ def test_every_refine_starts_from_the_previous_rounds_commit(tmp_path, chair_pla
assert seen[1] == "import bpy # written in r0\n"
assert seen[2] == "import bpy # written in r1\n", "r02 must refine r01, not the higher-scored r00"
assert rec.rounds[2].instructions, "the tasks come from r01's verdict and gates"
- events = [e["event"] for e in EventLog(ws.events_path).read()]
- assert "round.refine_from_best" not in events and "strategy.switch" not in events
# ... and the run ENDS at its last round: no restore of a better-scored one
assert "restore" not in ws._git("log", "--format=%s").stdout # noqa: SLF001
assert ws.head() == rec.rounds[-1].commit and (ws.src / "model.py").read_text() == "import bpy # written in r2\n"
diff --git a/harness/tests/orchestrator_tracks/test_generation_planner_repair.py b/harness/tests/orchestrator_tracks/test_generation_planner_repair.py
index d5662a38..4dbe71de 100644
--- a/harness/tests/orchestrator_tracks/test_generation_planner_repair.py
+++ b/harness/tests/orchestrator_tracks/test_generation_planner_repair.py
@@ -2,8 +2,6 @@
from __future__ import annotations
-import json
-
import pytest
from codeverse3d.contracts.common import Language, Track
@@ -293,4 +291,3 @@ def test_format_error_report_and_cookbook_section():
assert "src/parts/base.js:12" in rep and "line59" in rep and "line5\n" not in rep.split("traceback")[1][:20]
assert "FIX: use vertex colours" in rep and "Canvas textures" in rep
assert relevant_cookbook_section(cb, "totally unrelated words") == ""
- assert json.dumps(rep) # serialisable
diff --git a/harness/tests/orchestrator_tracks/test_harness_failure_no_repair.py b/harness/tests/orchestrator_tracks/test_harness_failure_no_repair.py
index a2f9e274..ac1cec27 100644
--- a/harness/tests/orchestrator_tracks/test_harness_failure_no_repair.py
+++ b/harness/tests/orchestrator_tracks/test_harness_failure_no_repair.py
@@ -50,8 +50,12 @@ def no_generate(monkeypatch):
return calls
-def test_a_harness_failure_is_rebuilt_not_repaired(monkeypatch, no_generate):
- """The build is simply re-run — no model call — and a rebuild that succeeds ends it."""
[email protected]("repair_budget", [3, 0])
+def test_a_harness_failure_is_rebuilt_not_repaired(monkeypatch, no_generate, repair_budget):
+ """The build is simply re-run — no model call — and a rebuild that succeeds ends it.
+ The rebuilds are bounded by MAX_HARNESS_REBUILDS, not by the repair budget: a baseline
+ arm that runs with max_repair_attempts=0 must still get its retries, or a dropped stdout
+ tail costs it the whole round."""
seq = [(_build(ok=False, harness=True, msg="scene probe produced no result (driver output lost)"),
GateReport(gate="lint", passed=True, findings=[])),
(_build(ok=True), GateReport(gate="lint", passed=True, findings=[]))]
@@ -62,7 +66,8 @@ def test_a_harness_failure_is_rebuilt_not_repaired(monkeypatch, no_generate):
return seq[min(calls["n"] - 1, len(seq) - 1)]
monkeypatch.setattr(R, "build_once", fake_build_once)
- out = R.build_with_repair(_ctx(), round_index=0, label="r00")
+ ctx = _ctx(spec=SimpleNamespace(budget=SimpleNamespace(max_repair_attempts=repair_budget)))
+ out = R.build_with_repair(ctx, round_index=0, label="r00")
assert out.ok is True
assert calls["n"] == 2, "one rebuild, no repair"
assert out.attempts == [], "no agent attempt was spent"
@@ -132,22 +137,3 @@ def test_a_repair_session_that_died_in_the_storm_ends_the_loop(monkeypatch):
monkeypatch.setattr(R, "build_once", fake_build_once)
out = R.build_with_repair(_ctx(), round_index=0, label="r00", max_attempts=3)
assert out.ok is False and len(seen) == 1 and calls["n"] == 2, "one storm-dead repair, one rebuild, then stop"
-
-
-def test_a_harness_failure_is_rebuilt_even_with_no_repair_budget(monkeypatch, no_generate):
- """The rebuilds are bounded by MAX_HARNESS_REBUILDS, not by the repair budget: a
- baseline arm that runs with max_repair_attempts=0 must still get its retries, or a
- dropped stdout tail costs it the whole round."""
- seq = [(_build(ok=False, harness=True, msg="scene probe produced no result (driver output lost)"),
- GateReport(gate="lint", passed=True, findings=[])),
- (_build(ok=True), GateReport(gate="lint", passed=True, findings=[]))]
- calls = {"n": 0}
-
- def fake_build_once(ctx):
- calls["n"] += 1
- return seq[min(calls["n"] - 1, len(seq) - 1)]
-
- monkeypatch.setattr(R, "build_once", fake_build_once)
- ctx = _ctx(spec=SimpleNamespace(budget=SimpleNamespace(max_repair_attempts=0)))
- out = R.build_with_repair(ctx, round_index=0, label="r00")
- assert out.ok is True and calls["n"] == 2 and out.attempts == []
diff --git a/harness/tests/orchestrator_tracks/test_orchestrator.py b/harness/tests/orchestrator_tracks/test_orchestrator.py
index 172d3c7b..0b2b1069 100644
--- a/harness/tests/orchestrator_tracks/test_orchestrator.py
+++ b/harness/tests/orchestrator_tracks/test_orchestrator.py
@@ -15,12 +15,9 @@ from codeverse3d.contracts.artifacts import (
Judgment,
Severity,
)
-from codeverse3d.contracts.common import Budget
from codeverse3d.contracts.plan import AcceptanceItem
from codeverse3d.contracts.run import RunStatus
from codeverse3d.orchestrator import (
- BudgetExceeded,
- BudgetGuard,
RefineTask,
RunState,
StageRunner,
@@ -31,23 +28,6 @@ from codeverse3d.orchestrator import (
from codeverse3d.proc import EventLog, fan_out
-# ----------------------------------------------------------------------------- budget
-def test_budget_guard_raises_past_its_ceiling():
- g = BudgetGuard(Budget(max_minutes=10.0))
- assert g.ok()
- g._active_s = 11 * 60 # noqa: SLF001 — past the ceiling
- with pytest.raises(BudgetExceeded) as ei:
- g.check()
- assert "max_minutes" in ei.value.reason and not g.ok()
-
-
-def test_budget_guard_time_ceiling():
- g = BudgetGuard(Budget(max_minutes=0.0001), start_time=time.time() - 10)
- with pytest.raises(BudgetExceeded):
- g.check()
- assert g.timeout_s(600, floor_s=0, soft=False) == 0 # no wall clock left
-
-
# ----------------------------------------------------------------------------- fanout
def test_fan_out_preserves_order_and_captures_exceptions():
def fn(x: int) -> int:
diff --git a/harness/tests/orchestrator_tracks/test_planner_depth.py b/harness/tests/orchestrator_tracks/test_planner_depth.py
index 5e8860e8..26db5314 100644
--- a/harness/tests/orchestrator_tracks/test_planner_depth.py
+++ b/harness/tests/orchestrator_tracks/test_planner_depth.py
@@ -8,7 +8,7 @@ import pytest
from pydantic import ValidationError
from codeverse3d.contracts.chat import ImagePart
-from codeverse3d.contracts.common import Backends, Language, Track
+from codeverse3d.contracts.common import Backends, Language, Track, Usage
from codeverse3d.contracts.plan import (
SUBPART_REL_SLACK,
BBox,
@@ -21,6 +21,7 @@ from codeverse3d.contracts.plan import (
SubPartPlan,
)
from codeverse3d.contracts.spec import Constraints, ReferenceImage, Spec
+from codeverse3d.models.base import ModelError
from codeverse3d.tracks import planner as B
from codeverse3d.tracks import planner as BR
from codeverse3d.tracks.planner import (
@@ -266,26 +267,16 @@ def test_an_unreadable_reference_never_collapses_onto_no_references(tmp_path):
assert BR.brief_cache_key(missing, "m") != BR.brief_cache_key(_spec(), "m")
-def test_brief_failure_is_never_fatal(tmp_path):
- def boom(req):
- raise RuntimeError("503 storm")
-
- brief, usage = BR.expand_brief(_spec(), "fake:planner", model=FakeChatModel(boom), cache_dir=tmp_path)
- assert brief is None and usage.cost_usd == 0.0
-
-
-
-def test_a_failed_brief_call_keeps_what_the_provider_billed(tmp_path):
[email protected]("error, billed", [
+ (RuntimeError("503 storm"), 0.0),
+ (ModelError("bad json", usage=Usage(backend="fake", cost_usd=0.002)), 0.002),
+])
+def test_a_failed_brief_is_never_fatal_and_keeps_what_the_provider_billed(tmp_path, error, billed):
"""expand_brief goes through ``ask_structured``: a ModelError's ``usage`` (a billed
bad reply) is returned, where the hand-built call reported the failure as free."""
- from codeverse3d.contracts.common import Usage
- from codeverse3d.models.base import ModelError
-
- def billed(req):
- raise ModelError("bad json", usage=Usage(backend="fake", cost_usd=0.002))
+ brief, usage = BR.expand_brief(_spec(), "fake:planner", model=FakeChatModel([error]), cache_dir=tmp_path)
+ assert brief is None and usage.cost_usd == pytest.approx(billed)
- brief, usage = BR.expand_brief(_spec(), "fake:planner", model=FakeChatModel(billed), cache_dir=tmp_path)
- assert brief is None and usage.cost_usd == pytest.approx(0.002)
def test_brief_switch_and_track_scope(monkeypatch, switch):
switch("C3D_PLAN_BRIEF", None)
@@ -411,64 +402,3 @@ def test_planner_spends_one_quality_reask_then_ships_the_plan(tmp_path, switch):
assert calls["n"] == 1 + MAX_QUALITY_REASKS
assert "Only 3 parts" in calls["complaints"][0]
assert len(got.parts) == 3 and ws.plan_path.is_file()
-
-
-def test_a_good_plan_costs_exactly_one_call(tmp_path, switch):
- switch("C3D_PLAN_BRIEF", "off")
- ws = Workspace(tmp_path / "run")
- ws.create()
- good = json.loads(_plan([_part(f"P{i}", desc=_detailed(i), material=f"m{i}") for i in range(9)]).model_dump_json())
- calls = {"n": 0}
-
- def responder(req):
- calls["n"] += 1
- return good
-
- got = run_planner(_spec(must=8), "fake:planner", StaticPlan, ws, model=FakeChatModel(responder))
- assert calls["n"] == 1 and len(got.parts) == 9
-
-
-def test_brief_and_plan_are_one_model_and_the_events_say_so(tmp_path, switch):
- switch("C3D_PLAN_BRIEF", "on")
- switch("C3D_CACHE_DIR", str(tmp_path / "cache"))
- ws = Workspace(tmp_path / "run")
- ws.create()
- good = json.loads(_plan([_part(f"P{i}", desc=_detailed(i), material=f"m{i}") for i in range(10)]).model_dump_json())
- seen = {"n": 0}
-
- def responder(req):
- seen["n"] += 1
- if req.label == "planner-brief":
- return json.loads(_brief().model_dump_json())
- assert "ENGINEERING BRIEF" in req.messages[0].text and "PLAN BUDGET" in req.messages[0].text
- return good
-
- class _Events:
- def __init__(self):
- self.rows = []
-
- def emit(self, name, **kw):
- self.rows.append((name, kw))
-
- ev = _Events()
- got = run_planner(_spec(must=10), "fake:planner", StaticPlan, ws, model=FakeChatModel(responder), events=ev)
- assert seen["n"] == 2
- done = next(kw for name, kw in ev.rows if name == "plan.done")
- assert done["brief"] is True and done["target_parts"] == 10 and done["quality_reasks"] == 0
- assert any(name == "plan.brief" for name, _ in ev.rows)
- assert [a for a in got.acceptance if a.id.startswith("sig")]
-
-
-def test_a_model_name_leak_is_rejected_not_modelled():
- from codeverse3d.contracts.plan import JointPlan, PartPlan, SubPartPlan
-
- for bad in ("Gemini25FlashThinking", "GPT4Placeholder", "placeholder_arm"):
- with pytest.raises(ValidationError, match="leaked from"):
- PartPlan(name=bad, role="r", description="d", bbox=_bbox())
- with pytest.raises(ValidationError, match="leaked from"):
- SubPartPlan(name="ClaudePart", description="d", bbox=_bbox())
- with pytest.raises(ValidationError, match="leaked from"):
- JointPlan(name="gemini_hinge", type="revolute", parent="A", child="B",
- axis=(0, 0, 1), pivot=(0, 0, 0))
- for ok in ("CameraFlash", "ModelStand", "GearHousing"):
- PartPlan(name=ok, role="r", description="d", bbox=_bbox())
diff --git a/harness/tests/orchestrator_tracks/test_prompts_assets.py b/harness/tests/orchestrator_tracks/test_prompts_assets.py
index 6ab2e2a7..7f26fdfa 100644
--- a/harness/tests/orchestrator_tracks/test_prompts_assets.py
+++ b/harness/tests/orchestrator_tracks/test_prompts_assets.py
@@ -175,15 +175,3 @@ def test_a_replanned_asset_with_the_same_name_is_not_reused(tmp_ws, settings):
# and the regenerated module is reusable again under the NEW identity
n2 = len(agent.jobs)
assert run_asset_stage(ctx)["FishingBoat"].strategy == "reused" and len(agent.jobs) == n2
-
-
-def test_a_model_outage_is_not_an_escalation_signal() -> None:
- """A 503 reaches the asset stage only after models.retry spent its whole storm budget
- waiting; escalating to a full agent session then costs 10× and hits the same wall."""
- from codeverse3d.models.base import ModelError
- from codeverse3d.tracks.generation import is_model_outage
-
- assert is_model_outage(ModelError("high demand", retryable=True, status=503))
- assert is_model_outage(ModelError("overloaded", status=529))
- assert not is_model_outage(ModelError("bad request", status=400))
- assert not is_model_outage(ValueError("the module does not import"))
diff --git a/harness/tests/orchestrator_tracks/test_refactor_batch2.py b/harness/tests/orchestrator_tracks/test_refactor_batch2.py
index 12ffef84..ab18b148 100644
--- a/harness/tests/orchestrator_tracks/test_refactor_batch2.py
+++ b/harness/tests/orchestrator_tracks/test_refactor_batch2.py
@@ -14,7 +14,6 @@ from codeverse3d.tracks.static_object import StaticObjectTrack
from codeverse3d.workspace import Workspace
from tests.orchestrator_tracks.conftest import make_spec
from tests.orchestrator_tracks.fakes import (
- FakeChatModel,
FakeRuntime,
FakeServices,
)
@@ -96,23 +95,3 @@ def test_judge_context_needs_no_run_context(tmp_path):
text = ScenePipeline().judge_context(ws, plan, 0, build, [])
assert "Environment plan:" in text and "Cameras:" in text
assert ScenePipeline().judge_context(ws, None, 0, build, []) == ""
-
-
-def test_graphics_planner_hooks_book_a_planning_error_on_the_ledger(tmp_ws):
- import pytest
-
- from codeverse3d.contracts.plan import GraphicsPlan
- from codeverse3d.contracts.spec import Budget
- from codeverse3d.cost.instrument import metered_chat_model, run_ledger
- from codeverse3d.cost.ledger import load_ledger
- from codeverse3d.orchestrator import BudgetGuard
- from codeverse3d.tracks.planner import PlanningError
- from codeverse3d.tracks.planner import plan as run_planner
-
- spec = make_spec(Track.GRAPHICS, Language.GLSL_SHADER)
- budget = BudgetGuard(Budget(max_minutes=10))
- always_bad = metered_chat_model(FakeChatModel(lambda req: {"title": "x"}))
- with run_ledger(tmp_ws.root), pytest.raises(PlanningError):
- run_planner(spec, "fake:planner", GraphicsPlan, tmp_ws, model=always_bad, budget=budget)
- assert sum(r.cost_usd for r in load_ledger(tmp_ws.root)) > 0, "a failed re-ask is still paid for"
-
diff --git a/harness/tests/orchestrator_tracks/test_resume_reconcile.py b/harness/tests/orchestrator_tracks/test_resume_reconcile.py
index 8b890600..b90bdb39 100644
--- a/harness/tests/orchestrator_tracks/test_resume_reconcile.py
+++ b/harness/tests/orchestrator_tracks/test_resume_reconcile.py
@@ -196,12 +196,6 @@ def test_a_spec_edit_without_force_is_refused_before_anything_runs(completed_run
assert (ws.root / "rounds" / "r00.json").is_file()
assert json.loads(ws.record_path.read_text())["status"] != "failed"
- # the sanctioned budget raise (outside the fingerprint) still resumes plainly
- spec3 = make_spec(language=Language.BLENDER, max_rounds=0)
- ws.write_json(ws.spec_path, spec3)
- rec3 = run.rerun(spec=spec3, resume=True)
- assert [r.index for r in rec3.rounds] == [0]
-
# --------------------------------------------------------------------- (f3) notes survive
def test_notes_survive_a_judge_crash(tmp_path, chair_plan, settings):
@@ -225,27 +219,6 @@ def test_notes_survive_a_judge_crash(tmp_path, chair_plan, settings):
assert "judge failed: RuntimeError: vlm 500" in saved["notes"]
-def test_a_resumed_runs_total_is_its_ledger_whatever_a_session_saved(tmp_path):
- """The ledger is appended per CALL; a session's own bookkeeping is saved at boundaries.
- A crash between a call and a save used to hand the resumed run that money back. The
- record's total is read off the ledger when it is written, so nothing a crash kept out
- of a snapshot can go missing — and a subscription backend's row counts at list price
- like any other (the billed / notional split went with the guard's money, 2026-09-22)."""
- from codeverse3d.contracts.run import RunRecord
- from codeverse3d.cost.ledger import open_run_ledger
- from codeverse3d.cost.types import CallCost
- from codeverse3d.record.record import package_run
-
- ws = Workspace(tmp_path / "runs" / "r")
- ws.create()
- led = open_run_ledger(ws.root)
- for backend, cost in (("gemini", 0.30), ("gemini", 0.12), ("codex", 7.7)): # session 1, the crash, session 2
- led.append(CallCost(run=ws.root.name, backend=backend, model="m", label="planner", cost_usd=cost))
- rec = RunRecord(spec=make_spec(), workspace=str(ws.root))
- package_run(ws, rec)
- assert rec.total_usage.cost_usd == pytest.approx(8.12)
-
-
def test_has_commit_answers_no_when_git_cannot_answer(tmp_path, monkeypatch):
"""has_commit raised on a missing run dir (the OSError of a cwd that is gone) and had no
timeout, unlike every other git read — a hung git hung the resume / the export."""
diff --git a/harness/tests/orchestrator_tracks/test_round_economics.py b/harness/tests/orchestrator_tracks/test_round_economics.py
index d44f8dd5..cf7e7919 100644
--- a/harness/tests/orchestrator_tracks/test_round_economics.py
+++ b/harness/tests/orchestrator_tracks/test_round_economics.py
@@ -240,9 +240,6 @@ def test_a_regression_changes_nothing_about_the_loop_and_every_round_reports_its
rec = track.run(spec, ws)
assert [r.kind for r in rec.rounds] == ["baseline", "refine", "refine", "refine"]
assert rec.extra["stop_reason"] == "max_rounds" and rec.status is RunStatus.MAX_ROUNDS
- events = EventLog(ws.events_path).read()
- assert not [e for e in events if e["event"] in ("strategy.switch", "round.refine_from_best")]
- assert not [j for j in agent.jobs if "made the artifact WORSE" in j.prompt]
# every round's cost is the ledger rows it booked — the injected agent and planner are
# metered like the ones services hand out, and the fake judge bills a row per verdict as a
# real one's model does — and the run's total is its ledger's, the planner included, with
@@ -252,7 +249,7 @@ def test_a_regression_changes_nothing_about_the_loop_and_every_round_reports_its
assert {r.stage for r in rows} == {"plan", "baseline", "refine", "judge"}
assert rec.total_usage.cost_usd == pytest.approx(sum(r.cost_usd for r in rows))
assert rec.total_usage.cost_usd > sum(r.usage.cost_usd for r in rec.rounds)
- assert "cost_by_stage" not in rec.extra and not [e for e in events if e["event"] == "cost.round"]
+ assert "cost_by_stage" not in rec.extra
def test_a_lint_stuck_run_keeps_every_score_instead_of_deferring_the_verdict(tmp_path, chair_plan, settings):
diff --git a/harness/tests/orchestrator_tracks/test_scene_hero_ladder.py b/harness/tests/orchestrator_tracks/test_scene_hero_ladder.py
index 3426235d..c489cdc6 100644
--- a/harness/tests/orchestrator_tracks/test_scene_hero_ladder.py
+++ b/harness/tests/orchestrator_tracks/test_scene_hero_ladder.py
@@ -8,7 +8,6 @@ from __future__ import annotations
import json
import subprocess
-from pathlib import Path
import pytest
@@ -250,11 +249,10 @@ def test_hero_reentry_keeps_the_previous_sessions_src(tmp_ws, settings):
@pytest.mark.parametrize("kind", ["threejs", "blender_glb"])
def test_asset_check_soft_findings_share_one_rule_set(kind):
chk = SA.AssetCheck(ok=True, ran=True, size_m=(0.6, 0.4, 0.3), min_y=-0.1, tris=50_000, meshes=1, materials=1)
- SA._soft_findings(chk, (0.6, 0.4, 0.3), max_tris=SA.HERO_MAX_TRIS if kind == "blender_glb" else SA.ASSET_MAX_TRIS)
- assert not chk.ok and any("sinks" in e for e in chk.errors)
limit = SA.HERO_MAX_TRIS if kind == "blender_glb" else SA.ASSET_MAX_TRIS
+ SA._soft_findings(chk, (0.6, 0.4, 0.3), max_tris=limit)
+ assert not chk.ok and any("sinks" in e for e in chk.errors)
assert any(f"{limit} budget" in e for e in chk.errors)
- assert not Path("nonexistent").exists()
def test_a_fix_that_judges_worse_is_undone(tmp_ws, settings):
diff --git a/harness/tests/orchestrator_tracks/test_tracks.py b/harness/tests/orchestrator_tracks/test_tracks.py
index 388da8ee..8ee47930 100644
--- a/harness/tests/orchestrator_tracks/test_tracks.py
+++ b/harness/tests/orchestrator_tracks/test_tracks.py
@@ -192,7 +192,7 @@ def _scene_writer(job, ws):
if label.startswith("zone_"):
return {f"src/zones/{label[5:]}.js": f"export function build(){{}} // {label}\n"}
if label.startswith("refine"):
- return {f: f"// refined by {label}\n" for f in job.prompt.split("EDIT ONLY THESE FILES")[-1].splitlines() if False} or {"src/scene.js": f"// {label}\n"}
+ return {"src/scene.js": f"// {label}\n"}
return {"src/scene.js": "// x\n"}
diff --git a/harness/tests/orchestrator_tracks/test_transport_retry.py b/harness/tests/orchestrator_tracks/test_transport_retry.py
index bf42f239..5096845f 100644
--- a/harness/tests/orchestrator_tracks/test_transport_retry.py
+++ b/harness/tests/orchestrator_tracks/test_transport_retry.py
@@ -48,6 +48,7 @@ def test_round_failed_carries_the_flags_of_its_tasks_never_their_words():
def test_a_raised_error_is_classified_by_its_type():
assert GenerationResult.from_error("g", ModelError("Gemini request timed out", retryable=True, status=408)).transient
assert GenerationResult.from_error("g", ModelError("Gemini API error 503", status=503)).transient
+ assert GenerationResult.from_error("g", ModelError("overloaded", status=529)).transient
assert not GenerationResult.from_error("g", ModelError("bad request", status=400)).transient
assert not GenerationResult.from_error("g", ValueError("503 in the message")).transient
@@ -150,20 +151,12 @@ def test_baseline_transport_crash_is_retried_once_then_fails(tmp_path, chair_pla
assert evs.count("round.transport_retry") == 1 and "run.failed" in evs
-def test_an_untyped_crash_is_no_longer_a_transport_retry(tmp_path, chair_plan, settings):
[email protected]("refine", [UNTYPED_CRASH, IDLE], ids=["untyped_crash", "idle"])
+def test_an_untyped_crash_or_an_idle_session_is_a_no_change_stop_not_a_retry(tmp_path, chair_plan, settings, refine):
"""The words "response=<empty>" used to buy a retry of the whole round; only the backend's
own verdict does now (0 of 34 recorded gemini-cli error exits lacked a provider signature)."""
ws = Workspace(tmp_path / "runs" / "crash")
- rec = _track(after_baseline(UNTYPED_CRASH), (0.55,), chair_plan, settings).run(make_spec(max_rounds=3), ws)
- assert rec.status is RunStatus.NO_CHANGE
- evs = _events(ws)
- assert "round.transport_retry" not in evs and "round.no_change" in evs
-
-
-def test_an_idle_agent_is_a_no_change_stop_not_a_retry(tmp_path, chair_plan, settings):
- agent = after_baseline(IDLE)
- ws = Workspace(tmp_path / "runs" / "idle")
- rec = _track(agent, (0.55,), chair_plan, settings).run(make_spec(max_rounds=3), ws)
+ rec = _track(after_baseline(refine), (0.55,), chair_plan, settings).run(make_spec(max_rounds=3), ws)
assert rec.status is RunStatus.NO_CHANGE
evs = _events(ws)
assert "round.transport_retry" not in evs and "round.no_change" in evs