Skip to content

Official Codebase of 3DCodeVerse

Python

Merge remote-tracking branch 'origin/main' into ziyao/articulated-wave-2

ziyao8a3c33695908
diff --cc harness/codeverse/tracks/prompting.py
index 3b89613f,9ab6b893..df5c5333
--- a/harness/codeverse/tracks/prompting.py
+++ b/harness/codeverse/tracks/prompting.py
@@@ -13,9 -13,9 +13,9 @@@ from collections.abc import Sequenc
from pathlib import Path
from typing import TYPE_CHECKING, Any
-from codeverse.config import fewer_turns_enabled
+from codeverse.config import fewer_turns_enabled, lean_prompt_enabled
from codeverse.contracts.chat import ImagePart
- from codeverse.contracts.common import HARNESS_OWNED_SRC, Language, Track
+ from codeverse.contracts.common import HARNESS_OWNED_SRC, Language, Track, is_harness_owned
from codeverse.contracts.plan import Plan, StaticPlan
from codeverse.contracts.run import RoundRecord
from codeverse.conventions import LANGUAGE_FRAME, Frame, frame_doc, to_snake
diff --cc harness/docs/DECISIONS.md
index 49cb841e,3286f19c..fd2b4a2e
--- a/harness/docs/DECISIONS.md
+++ b/harness/docs/DECISIONS.md
@@@ -586,56 -586,74 +586,123 @@@ written) that were accepted because th
deterministic-repairs bundle (axis flip + buried check) A/B'd at Δ −0.039 ± 0.105 over
12 paired prompts, the flip firing in 1 cell of 12 — the aggregation ships on rationale,
not on a resolved score delta.
+ * **D51 The effect library is HARNESS-OWNED STARTER CODE, not an SDK import
+ (2026-09-01).** Context: `scene_multifile_graphics` shipped 52 three.js effect modules
+ (21.7k lines) that this harness had no equivalent of — canopies, water, weather, aging,
+ neon, night windows — and every scene run was re-deriving worse versions of them inside
+ a 60-minute budget. Law 1 says generated code is raw language, never an SDK/helper
+ import. **Decision — an amendment, not an exception**: law 1 forbids the AGENT from
+ reaching outside its workspace for someone else's abstraction. Modules the HARNESS
+ writes into `src/`, verifies on its own renderer, and forbids the agent to rewrite are
+ not that: they are the same thing `src/recipes.glsl` already was for `glsl_shader`
+ (D-precedent: `contracts.common.HARNESS_OWNED_SRC`, `AgentJob.read_only`), one order of
+ magnitude larger. So `src/lib/*.js` ships into every scene workspace, is listed in
+ `HARNESS_OWNED_SRC[SCENE_THREEJS]` (a new DIRECTORY-prefix entry form, predicate
+ `is_harness_owned`), and a post-session write to it is reverted like any other
+ harness-owned file. Generated code stays raw three.js + GLSL: the library IS raw
+ three.js, and it is in the workspace, in the agent's git history, readable and
+ debuggable.
+
+ **What shipped.** 52 modules / 28.8k lines under
+ `codeverse/languages/scene_threejs/starter/src/lib/`, ported module-by-module against
+ the reference's own test per module, adapted to OUR renderer contract (their exposure
+ 1.1 → our 1.0; their log-depth on → ours off, so their logdepth chunks are harmless
+ no-ops; their renderer-contract assertions dropped). Every module was rendered through
+ the real host on the showcase harness and LOOKED at, most of them twice (a `before` port
+ and an `after` improvement pass): 53 modules carry a before/after pair on disk and 77
+ night renders were taken. Aesthetic changes were measured, not asserted — linear albedo
+ band 0.02–0.8, hue variance inside every effect, emissives re-scaled to a bloom-friendly
+ 1.5–4, fresnel on water/glass, fog in the sky's hue family. 678 node-marked tests
+ (`tests/scene_runtime/lib/`, one file per module) pin the physics claims, the shared-name
+ contracts and the option-is-a-uniform law; the GPU compile in them is real
+ (headless ANGLE/D3D12, e.g. godrays 21 programs / 6 custom materials).
+
+ **Companion side track**: a post chain for scene renders
+ (`runtime_js/lib/browser/post.js`, ON by default, `--no-post` / `CV3D_POST=0`):
+ RenderPass → finite clamp → GTAO → SELECTIVE emissive bloom → grade → OutputPass, 18
+ tests. The bloom is NOT the reference's luminance bright-pass: measured on this
+ renderer every daylight scene tops out at 1.883 linear (the sky dome) while the
+ brightest authored emissive in the whole library is 1.231, so a global bright-pass
+ cannot separate a neon sign from the sky — at the reference's 0.85 threshold a daylit
+ grass frame lost a quarter of its saturation (0.3132 → 0.0699). The mask is a second
+ cheap render of emission only; a scene with nothing emissive pays nothing.
+
+ **Consolidation (same day).** `_probe.shader_check` could never work — it staged only
+ `src/fixture.js` while `check_shaders.mjs` boots the workspace's `src/scene.js` — so 32
+ module tests had each hand-rolled the same 17-line workaround. Replaced by
+ `_probe.compile_scene`; **843 lines deleted**, and two further inline copies
+ (`test_lights`, `test_foliage_shade`) and `test_shader.compile_fixture` fold into it
+ too. Also fixed: `scene_host.mjs` failed a camera-less boot with `info.error` EMPTY
+ (message named no reason at all); plan-mode `write_skeleton` shipped `PATTERN_FILES`
+ only, so a PLANNED run — the production path — would have got the catalog in its prompt
+ and no `src/lib/` to import from; `signage.js` carried a `unpkg.com` CDN font pin that
+ violates the no-network law (dead since `import.meta.resolve` landed); and both the
+ workspace lint and the static shader audit now skip `src/lib/`, which was 3 hard lint
+ ERRORs (signage's node-only font fallback) + 12 "large file" WARNs + a uTime
+ false-positive pair that outranked the agent's own real shader error in the build report.
+ `patchStandard` gained three opt-in injection hooks — `roughnessBody` / `metalnessBody`
+ (after `<roughnessmap_fragment>` / `<metalnessmap_fragment>`) and `outputBody` (after
+ `<opaque_fragment>`, where the colour is still linear) — the gap three module agents
+ reported independently, since `<color_fragment>` reaches only the albedo and a 30 %
+ rust crust could until now only be sold by dematting 100 % of the material.
+
+ **Evidence label — honest.** Everything above is RENDERED AND EYEBALLED plus
+ deterministic metrics and 2 809 offline tests green. It is **NOT yet A/B-judged**: no
+ paired battery has scored scenes with the library against scenes without it, so the
+ claim "this raises scene scores" is unproven. The shader.js hook change was isolated by
+ rendering all six shader.js-dependent modules (grass, water, canopy, godrays, neon,
+ clouds) against a control build with the hooks cut out: mean luminance identical to five
+ decimals on all 12 frames. Funding the A/B is the next call.
+* **D51 The articulated wave measured its own instrument first, and then only the loss
+ events (2026-09-02/03).** Context: four articulated levers (the D49 geometry re-ask, a
+ pro planner, a deterministic repair bundle, `CV3D_FEWER_TURNS`) all measured inside
+ ±0.13 on 12-14 paired prompts, which is not evidence that they do nothing. Decision:
+ calibrate, then change the channel.
+ * **The instrument.** A/A on `articulated_v2` (`bench/ab_plan.py --aa --pin-plan`,
+ identical arms, generator `gemini-cli:gemini-3.7-flash`, fixed judge
+ `gemini:gemini-3.1-pro-preview`, `n_samples=3`, rubric `articulated_v1`, 3 rounds,
+ 60 min/cell): 12 paired prompts (2 pairs dropped at the pinned plan to provider read
+ timeouts, redone; 0 budget_exhausted), mean Δ **−0.046**, median −0.048, paired sd
+ **0.225**, SE 0.065, **2 SE ±0.130**, sign 3 up / 8 down, p 0.227, separated from
+ noise **NO**; the rig's own n_for_power is ~506 pairs for ±0.02. Every phase-4/5
+ result sat inside that band, and the rig printed "revert" from identical arms.
+ * **The channel that works.** `local/scripts/plan_degeneracy.py` runs the plan stage
+ ALONE (≈$0.03 and ≈85 s per call), so a 280-call arm is affordable where a 14-cell
+ battery is not. `CV3D_PLAN_RESTART` (a plan that names links it never lists is
+ re-sampled from the original request instead of edited in context) measured on 560
+ calls, both arms in the same window: planner losses **4.7 % (13/277) → 0.7 % (2/276)**,
+ Fisher exact two-sided **p = 0.0067**; the restart fires on 14 % of calls and recovers
+ 39 of 40; cost per call unchanged ($0.0345 vs $0.0337). Ships ON with a kill switch.
+ The rule this sets: measure the loss event (a run that produced nothing, a retried
+ tool call, a pose the mechanism cannot reach), not the judge mean, unless the battery
+ is large enough for the judge mean.
+ * **What the judge channel could not have found.** `is_error = not obs.ok` (§30 of
+ docs/COST.md) made 62 % of 1 445 `joint_sweep` calls and 23 % of 2 144 `build` calls
+ arrive as broken calls the model retried, and — because gemini-cli stringifies an
+ errored result — turned a 275 kB articulation sheet into ~261 k prompt tokens of
+ base64 instead of ~516 as an image; ~10 % of requests carried ~225 k uncacheable
+ tokens, 67 % of the uncached bill. That is a mechanism fault with no score signature
+ at n=14, found by reading the recorded tool stats. **Measured after the fix** (same
+ battery and config, 108 sessions vs 120): calls reported as errors 26.6 % → **1.4 %**
+ (the remainder are genuine `Observation.error` cases), cache hit 69 % → **89 %**,
+ uncached prompt tokens per request 38 390 → **13 736**, generator dollars per round
+ median 1.572 → **0.967** (−38 %). docs/COST.md §30 carries the selector.
+ * **`CV3D_LEAN_PROMPT` stays OFF, now with a number.** Paired battery on
+ `articulated_v2` (12 pairs, plan pinned, same fixed judge): mean Δ **+0.030**, paired
+ sd 0.131, **2 SE ±0.076**, 8 up / 3 down (p 0.227), one regression — inconclusive by
+ the rig's own rule — and no cost saving ($3.51 vs $3.66 per scored cell), which is the
+ second time a prompt/turn-shape change has moved tokens without moving dollars
+ (docs/COST.md §29). The switch and its measured character savings stay for the day a
+ larger battery can resolve them.
+ * **`<mimic>` is used and it changes the sweep, which is what it was for.** In the same
+ battery the planner and agent declared couplings in 8 of 14 prompts (umbrella 6 joints,
+ workbench 4, step ladder 4, scissor mirror 3, rolltop desk 3), and the sampled poses
+ now drive 1-2 joints where the same prompts previously produced 5-6-joint random
+ combinations — the mechanism is posed through its own input. The score effect on the
+ three coupled prompts is inside the noise band at n=2 per side, as expected; the pose
+ count is the readout that resolves.
+
## Rejected / deferred
* A versioned `Spec`/`RunRecord`/`RunState` load-normaliser (rejected 2026-08-30: of the seven