Skip to content

Official Codebase of 3DCodeVerse

Python

scene: a clock that trips as a finished zones session is charged records the zones it wrote as written (Q1)

gaoypengefbdbcfc1882
diff --git a/harness/codeverse3d/tracks/scene.py b/harness/codeverse3d/tracks/scene.py
index c43c499a..6477ba9f 100644
--- a/harness/codeverse3d/tracks/scene.py
+++ b/harness/codeverse3d/tracks/scene.py
@@ -40,7 +40,7 @@ from codeverse3d.contracts.run import RoundRecord
from codeverse3d.conventions import to_snake
from codeverse3d.judges.base import judged_subset
from codeverse3d.languages.scene_threejs import zone_file
-from codeverse3d.orchestrator import TaskGroup, compact_instructions
+from codeverse3d.orchestrator import BudgetExceeded, TaskGroup, compact_instructions
from codeverse3d.prompts import render
from codeverse3d.spatial.frame_motion import motion_text_for
from codeverse3d.spatial.render_scene import perf_detail
@@ -320,7 +320,14 @@ class SceneTrack(BaseTrack):
except Exception as e: # noqa: BLE001 — BudgetExceeded included: the stage is still
# recorded + committed; the boundary check after the stage stops the run
log.warning("zones session failed: %s: %s", type(e).__name__, e)
- out = {zone.name: {"ok": False, "notes": f"{type(e).__name__}: {e}"} for zone in zones}
+ # a clock that tripped as a FINISHED session was charged: what it wrote is recorded as
+ # written (salvage assembles it, a resume serves it), the stop as a note beside it
+ stopped = isinstance(e, BudgetExceeded)
+ out = {}
+ for zone in zones:
+ done = stopped and _touched(ctx.ws.root / zone_file(zone.name), t0)
+ out[zone.name] = {"ok": done, "files": [zone_file(zone.name)] if done else [],
+ "notes": f"{type(e).__name__}: {e}"}
else:
written = {c.path for c in r.files_changed}
out = {}
diff --git a/harness/docs/ARCHITECTURE.md b/harness/docs/ARCHITECTURE.md
index c8800e84..d3178cd1 100644
--- a/harness/docs/ARCHITECTURE.md
+++ b/harness/docs/ARCHITECTURE.md
@@ -489,8 +489,9 @@ blender_glb heroes get a sub-workspace with the static planner's parts + asset_v
re-judged fix pass, undone when worse; a degraded asset verdict leaves score None / judged False,
emits asset.judge_degraded and skips the fix pass); `env` — `src/env.js`; `layouts` — L2 zone
layouts (planner calls, never fatal); `asset_api` — what the zones are told about the assets;
-`zones` — ONE session owns every zone file (D70); `clock` — the run stops here when the hard budget
-is spent, after the zones are recorded; `assemble` — `scene.js`, deterministic.
+`zones` — ONE session owns every zone file (D70; a session whose charge crossed the ceiling after
+it finished records the zones it wrote as written, the `BudgetExceeded` as their note); `clock` — the
+run stops here when the hard budget is spent, after the zones are recorded; `assemble` — `scene.js`, deterministic.
**7.2 The round — `steps._run_round`, a fixed chain in code.** Not nodes: nothing in a round can
be cached (every step reads the git tree the step before it wrote), and articulated's axis repair
diff --git a/harness/tests/orchestrator_tracks/test_cost_latency.py b/harness/tests/orchestrator_tracks/test_cost_latency.py
index 025b5010..548f15ef 100644
--- a/harness/tests/orchestrator_tracks/test_cost_latency.py
+++ b/harness/tests/orchestrator_tracks/test_cost_latency.py
@@ -445,6 +445,35 @@ def test_a_batched_session_that_writes_only_one_file_fails_the_other_zone(tmp_pa
assert zones["Quay"]["ok"] and not zones["Water"]["ok"]
+def test_a_clock_that_trips_after_a_finished_zones_session_records_what_it_wrote(tmp_path, settings):
+ """Q1: the session finished and wrote both zones, then its charge crossed the ceiling; the cached
+ zones result said ok: False for every zone — a resume served "all failed" for written work."""
+ from tests.orchestrator_tracks.conftest import FAKE_CLOCK
+
+ plan = ScenePlan.model_validate(plan_example(Track.SCENE))
+ plan = plan.model_copy(update={"assets": [_asset("Bollard", (0.3, 0.5, 0.3))],
+ "zones": [_zone("Quay", 0), _zone("Water", 0)]})
+ spec = make_spec(Track.SCENE, Language.SCENE_THREEJS, max_rounds=0, max_minutes=10.0)
+ ws = Workspace(tmp_path / "runs" / "latezone")
+
+ def writer(job, ws_):
+ if job.label.startswith("zones_"):
+ FAKE_CLOCK["minutes"] += 30.0 # the session ends past the ceiling
+ return {"src/zones/quay.js": "export function build(){}\n", "src/zones/water.js": "export function build(){}\n"}
+ if job.label == "env":
+ return {"src/env.js": "export function buildEnv(){}\n"}
+ return {"src/x.js": "// x\n"}
+
+ track = SceneTrack(services=FakeServices(assemble=True), judge=FakeJudge(scores=(0.6,)), agent=FakeAgent(writer),
+ planner_model=FakeChatModel(lambda req: plan.model_dump(mode="json")), settings=settings,
+ runtime=FakeRuntime(Language.SCENE_THREEJS))
+ with fake_clock():
+ track.run(spec, ws)
+ zones = json.loads((ws.root / "stages" / "zones.json").read_text())["result"]
+ assert zones["Quay"]["ok"] and zones["Water"]["ok"] and zones["Water"]["files"] == ["src/zones/water.js"]
+ assert "BudgetExceeded" in zones["Quay"]["notes"]
+
+
@needs_node
def test_an_imperfect_asset_stays_available_but_a_broken_one_does_not(tmp_path, settings):
services = FakeServices()