omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / docs / r15-handoff.md
| 1 | # R15 handoff (Claude → Codex), 2026-09-28 |
| 2 | |
| 3 | Task: finish ADR 0016. R15 performance proof first, then R16 orchestrator |
| 4 | retirement, and only if R15 genuinely PASSES. The full operator brief is the |
| 5 | "FINISH ADR 0016 — R15 PERFORMANCE PROOF, THEN R16" prompt. Follow it exactly. |
| 6 | Drake is not a programmer, so talk to him in plain English (see ~/AGENTS.md). |
| 7 | |
| 8 | ## Where things are |
| 9 | |
| 10 | - Worktree: `~/workspace/omega-r15`, branch `feat/r15-performance-proof` |
| 11 | (pushed; base is omega main `f70ae10`, which is R14). |
| 12 | - Build: `make AIENOS_R7_DIR=../aienos-capability-c PHYSICS_DIR=../physics-r13 <target>`. |
| 13 | - **Pre-registered methodology: `spec/r15-performance-proof.md`, commit |
| 14 | `a4c6123`**, pushed before any R15 data was collected. Its acceptance |
| 15 | criteria G1–G16 are binding. To change a criterion: new commit to the spec, |
| 16 | explain why, then rerun the whole qualification. Clarifications that are not |
| 17 | criteria (for example, trial-window latency distributions stored as |
| 18 | per-window histograms rather than one line per activation) should be a |
| 19 | small spec commit before qualification. |
| 20 | |
| 21 | ## Done |
| 22 | |
| 23 | 1. Surveyed the legacy loops. sovereign-core `run_until_complete`/`step` is |
| 24 | LLM batched decode. aegis-runtime `execute_task` is an LLM tool-calling |
| 25 | loop, and `pulse_once` runs SQLite chores. None of them does R13's semantic |
| 26 | work, so the spec marks them NOT DIRECTLY COMPARABLE (§2). The baseline is |
| 27 | the sequential control (SEQ). |
| 28 | 2. Engine instrumentation (uncommitted before this handoff, committed with |
| 29 | it). Existing tests still pass: R3 host, R13 host, R12 silicon (209 checks). |
| 30 | - `RxStats`: `activations`, `externals`, `snapshot_bytes`, `crumb_bytes`, |
| 31 | `proj_bytes`, `ring_bytes`, `gpu_results_taken`, `gpu_polls_empty`, |
| 32 | `gpu_host_waits`, `seq_pulses`, `seq_polls`, `seq_runs`. |
| 33 | - `RxTiming` ring (`rx_world_set_timing`). Each activation records |
| 34 | demand, ready, run, fn_end, visible and sched_ns. Timestamps are taken |
| 35 | only when the ring is installed. |
| 36 | - `w->last_prop_ns` / `last_prop_hits`, for the propagation cost of the |
| 37 | most recent wave. |
| 38 | - `-DRX_MEASURE_NO_CAUSAL_DIGEST` skips the crumb SHA-256. It is for the |
| 39 | RES-1-NODIGEST measurement build only. `rx_world_causal_digest_enabled` |
| 40 | reports whether digests are on. |
| 41 | - `rx_resident_wait_outstanding()` plus `claim_cv`, so the GPU completion |
| 42 | acceptor sleeps until a claim is posted. Do not reuse R13's 1 ms nap: it |
| 43 | would distort GPU latency. |
| 44 | - `rx_gen_io_counters()` counts R9 bytes written and fsync calls. |
| 45 | - GPU seat: S2R `%globaltimer` (0x52, defined locally in |
| 46 | rx_resident_gpu.c, because `omega_blackwell_codegen.h` is hash-pinned). |
| 47 | It writes the pickup time, the done time and the claim index to heartbeat |
| 48 | words 20/24/28 (`RX_SEAT_HB_T_PICK/T_DONE/CLAIM`). R12 silicon passes |
| 49 | with this change. **Not yet checked: that the stamp values are sane |
| 50 | (nonzero, done > pick, a few µs apart).** |
| 51 | 3. Sequential control: `src/runtime/rx_seq_reference.{c,h}`, labelled |
| 52 | REFERENCE ORACLE ONLY. |
| 53 | - Setup: `rx_world_init_native_sequential_reference()` creates a world |
| 54 | with no workers and turns off the dependency wakes. |
| 55 | - `rx_seq_pulse()` polls each stage's trigger field versions in a fixed |
| 56 | order. It runs a ready stage through the engine's own `run_one`, via |
| 57 | `rx_world_seq_activate_locked`, which keeps R6 budgets, admission, |
| 58 | validation and crumbs. For a GPU stage it host-waits through a callback. |
| 59 | - `rx_seq_run_until_complete()` has the legacy loop shape. |
| 60 | - `rx_world_wait_quiescent` in sequential mode waits for an idle pulse. |
| 61 | |
| 62 | ## Next (in order) |
| 63 | |
| 64 | 1. Add R9 phase stamps: enter, barrier (after `live`), flip (after the |
| 65 | `active` commit_file), receipt. Expose them with `rx_gen_last_phases`, for |
| 66 | L1-G. |
| 67 | 2. Write `tests/runtime/rx_r15_perf.c`, modes `trial <cfg> <round> <out>`, |
| 68 | `l1 ...` and `l2 ...`. Build binaries for RES and NODIGEST, both host and |
| 69 | silicon. |
| 70 | - Rig: copy `start()` from `rx_r13_living.c`. Config RES4/RES1 uses |
| 71 | `rx_world_init_native(...,4|1,...)`. SEQ uses the sequential init, plus |
| 72 | an orchestrator thread that rebuilds its plan whenever `n_reactions` |
| 73 | changes. It orders reactions by spec §2.2 names: `workload.matvec.serve`, |
| 74 | `living.experiment.ask`, `aegis.decide`, `root.install`, `aien.observe`, |
| 75 | `aien.predict`, `aien.explain`, `aien.assess`, `aien.plan`, |
| 76 | `omega.watch`, `omega.reconsider`, `omega.synthesize.k`, |
| 77 | `omega.verify.k`, `omega.measure.k`, `omega.select`, |
| 78 | `living.experiment.prepare`, `living.blackwell.add`, |
| 79 | `living.experiment.evidence`, `aien.experiment.observe`, |
| 80 | `generation.prepare`, `generation.promote`, `generation.restore`. It |
| 81 | yields when a pulse runs nothing. |
| 82 | - Trial phases per spec §4: warm-up on A725 until the first selection and |
| 83 | AIEN is confirmed; a BEFORE window of 2 s + 5 s; then X925, placement, |
| 84 | goal and the ADAPT window; wait for goal MET; an AFTER window of |
| 85 | 2 s + 5 s. Record JSONL for windows, the episode, telemetry at 10 Hz, |
| 86 | residency and correctness. |
| 87 | - Crumb capacity: the log does not wrap. Size it to about 12M crumbs |
| 88 | (about 1128 B each) and prefault it. Overflow must fail the trial. |
| 89 | - PMU: per-CPU counters on the cores in use: `cpu_cycles` 0x11, |
| 90 | `inst_retired` 0x08, `bus_access` 0x19, `ll_cache_miss_rd` 0x37, |
| 91 | `l2d_cache_refill` 0x17, `mem_access` 0x13. PMU type `armv8_pmuv3_0` is |
| 92 | A725 (cpus 0-4,10-14); `_1` is X925 (5-9,15-19). The qualification |
| 93 | script sets `kernel.perf_event_paranoid` to 0 and restores it afterwards |
| 94 | (sudo works). |
| 95 | - L1: A activation latency (crumb t_start − cause t_end, timing off), |
| 96 | B fanout, C scheduler (timing ring), D publication, E caps |
| 97 | (batches of 100 validations), G barrier. L1-F comes from the AFTER |
| 98 | windows of RES-1 vs NODIGEST. |
| 99 | - L2: the R12 chain A→seat→B→dep→C (see `rig_up` in `rx_r12_silicon.c`). |
| 100 | 3. `tools/r15_reduce.c`: C only, no Python. Deterministic, bootstrap seed |
| 101 | 0x15, 10k resamples. It reproduces every metric and gate G1–G16 from raw |
| 102 | data. |
| 103 | 4. `tools/r15_qualify.sh`: 12 Latin-square rounds of RES-4/RES-1/SEQ/NODIGEST |
| 104 | + L1 + L2, with thermal wait and machine.json. Detach it (`setsid nohup` |
| 105 | plus a finisher script), because usage limits can kill long runs. |
| 106 | 5. **Energy blocker: must be resolved before any PASS.** See below. |
| 107 | 6. Candidate-bound clean-tree qualification on GB10. Then the correctness |
| 108 | reruns: R3, R7, R8, R9, R10, R11, R12 host+silicon, R13 host+silicon, R14 |
| 109 | host+silicon. Then the receipt `AIEN_RX_R15_REACTION_PERFORMANCE_V1`, the |
| 110 | evidence commit, and a PR **merged with a merge commit** (not squash). |
| 111 | 7. Only if R15 PASSES: R16, per the brief. |
| 112 | |
| 113 | ## Energy blocker (Drake decision needed) |
| 114 | |
| 115 | - The GPU-domain energy counter works: |
| 116 | `nvmlDeviceGetTotalEnergyConsumption` via dlopen `libnvidia-ml.so.1`, in |
| 117 | mJ. It does not see CPU load. A test with all 20 cores busy moved it only |
| 118 | from 4.1 W to 4.7 W. |
| 119 | - Whole-chip energy accumulators exist in firmware: `SPBM`, ACPI `NVDA8800` |
| 120 | "MTEL", physical address `0x1c238000`, 4 KiB. Offsets: PKG energy 0x344, |
| 121 | CPU_E 0x350, CPU_P 0x35c, GPC 0x368, GPM 0x374; SYS_TOTAL power 0x300; SoC |
| 122 | package 0x304. Units are unverified. |
| 123 | - They are unreadable today. Secure Boot is on, so kernel lockdown blocks |
| 124 | `/dev/mem`. No driver binds the device, and only Canonical's key is |
| 125 | enrolled. |
| 126 | - Options for Drake: |
| 127 | - (1) Enroll a machine-owner key and load a small signed read-only |
| 128 | telemetry driver that exposes these as hwmon `energy*_input`. This |
| 129 | changes the Secure Boot trust setup and needs him at the console for the |
| 130 | MOK enrollment screen after a reboot. |
| 131 | - (2) An external logging wall/USB-C power meter. |
| 132 | - (3) Accept that R15 cannot PASS yet. |
| 133 | - Do NOT disable Secure Boot or bypass lockdown without Drake. |
| 134 | |
| 135 | ## Energy decision (Drake, 2026-09-28): OPTION 1 |
| 136 | |
| 137 | Drake chose option 1: enroll a machine-owner key and load a small signed, |
| 138 | read-only telemetry driver. |
| 139 | |
| 140 | - Key made by Claude: `/var/lib/aien-mok/MOK.der` (public) and `MOK.priv` |
| 141 | (root-only, mode 600). CN "AIEN Spark owner key (telemetry)", SHA-256 |
| 142 | fingerprint `19:0C:18:68:...:DF:D7:AE`. |
| 143 | - Enrollment is **pending Drake**. He runs |
| 144 | `sudo mokutil --import /var/lib/aien-mok/MOK.der`, picks a one-time |
| 145 | password, reboots, and at the blue MOK Manager screen chooses Enroll MOK → |
| 146 | Continue → Yes → types the password → Reboot. Check it with |
| 147 | `mokutil --list-enrolled | grep AIEN`. |
| 148 | - Codex still has to: |
| 149 | - Write the driver: an out-of-tree, read-only platform driver bound to |
| 150 | ACPI `NVDA8800` that ioremaps `0x1c238000`/0x1000 only. It exposes hwmon |
| 151 | `energy*_input` for PKG/CPU_P/CPU_E/GPC/GPM and `power*_input` for |
| 152 | SYS_TOTAL/SOC_PKG. It never writes. Put it in a repo (C, no Rust). |
| 153 | - Build it against `/lib/modules/$(uname -r)/build` and sign it with |
| 154 | `/usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 |
| 155 | /var/lib/aien-mok/MOK.priv /var/lib/aien-mok/MOK.der <mod>.ko`. |
| 156 | - After Drake's enrollment, `insmod` it. |
| 157 | - Calibrate the units: find the raw units and the overflow behaviour |
| 158 | against a known load, and cross-check GPC against NVML GPU energy. |
| 159 | - Record the method in spec §7 in a new commit before qualification. |
| 160 | - No systemd, including for loading the module (see memory no-systemd). |
| 161 | |
| 162 | - 2026-09-28: the enrollment request is QUEUED (Drake confirmed with `sudo mokutil --list-new`; the one-time password is known to Drake). Next: Drake reboots and approves at the blue screen. Afterwards, verify with `mokutil --list-enrolled | grep AIEN`. |
| 163 | |
| 164 | - 2026-09-28 10:02: KEY ENROLLED. `mokutil --list-enrolled` shows CN=AIEN Spark owner key (telemetry). Secure Boot stays on. Modules signed with /var/lib/aien-mok/MOK.priv will now load. Next: write, sign and load the read-only SPBM telemetry driver, then calibrate it. |
| 165 | |
| 166 | ## Recovery audit and rework (Claude, 2026-09-28 afternoon) |
| 167 | |
| 168 | - Forensic audit before any change; snapshot of the pre-audit local state |
| 169 | (unpushed `f714c08`, uncommitted Makefile, untracked draft |
| 170 | `rx_r15_perf.c` / `r15_reduce.c`) is in |
| 171 | `~/workspace/forensics/r15-2026-09-28/` (patches + git bundle). The old |
| 172 | `~/workspace/omega-r15` worktree is left untouched as evidence. |
| 173 | - Machine: Secure Boot on, owner key enrolled and matching the loaded |
| 174 | module's signature, `MOK.priv` root 0600. The read-only SPBM module is |
| 175 | loaded (owner approved keeping it loaded). `kernel.perf_event_paranoid` |
| 176 | had been left at 0 by an unlogged session; restored to 4 (boot default). |
| 177 | - Rework branch: `r15-rework`, pushed to `feat/r15-performance-proof`. |
| 178 | - SPBM reader and preflight runs kept under `research/m15/spbm/`; its |
| 179 | in-place §7 spec rewrite not adopted. |
| 180 | - Instrumentation fixes (CPU vs wall scheduler time, propagation counters, |
| 181 | per-path copied bytes, per-store R9 I/O, timing overflow status) with |
| 182 | `make test-r15-instr`. |
| 183 | - Spec §16 clarification C1 (paranoid 4→1→4; PMU per-task inherited on |
| 184 | both PMUs, raw sums, never scaled; byte definitions; parity gate). |
| 185 | - Shared rig `tests/runtime/rx_r15_rig.{c,h}` and SEQ parity gate |
| 186 | `make test-r15-parity-host` / `test-r15-parity-silicon`. |
| 187 | - The parity gate gives both sides a detector configuration (rig |
| 188 | `r15_set_aien_config`; gate `main`) in which a miss streak can never fail |
| 189 | a prediction and the hit band is 99 percent, so host timing noise in |
| 190 | Omega's wall-clock serve costs can neither make one side research for |
| 191 | DRIFT where the other does for the GOAL nor stall the confirmation wait |
| 192 | behind one preempted baseline interval. Product defaults are unchanged; |
| 193 | G7 and the harness keep them. |
| 194 | - The draft `rx_r15_perf.c` / `r15_reduce.c` predate these fixes and are not |
| 195 | carried forward; the harness is to be rebuilt on `rx_r15_rig`. |
| 196 | - Still to do, in order: energy clarification C2 (needs load tests: give |
| 197 | Drake a heads-up first; a power surge was reported during the earlier CPU |
| 198 | load collection), harness, reducer, qualify script, dry run, full run. |
| 199 | |
| 200 | ### Finding: W-EPISODE goal miss rate (pre-qualification, host stand-in) |
| 201 | |
| 202 | A 100-episode soak of each of SEQ and RES-1 (`R15_PARITY_REPEAT`) failed 7 of |
| 203 | 100 in both, with identical failure types: 6 × goal UNMET_EXPLORED (AIEN's |
| 204 | post-promotion cost on X925 above the TARGET_PCT 55 goal) and 1 × the post- |
| 205 | promotion wait for AIEN's confirmed prediction running long enough that |
| 206 | continuous production filled the 2^18-crumb log (publication refused). A |
| 207 | later 40-episode RES-1 run had 0 failures, cost after/before 0.40-0.54 |
| 208 | (target 0.55). The misses clustered in time, which points at machine |
| 209 | interference. Not orchestration-specific; no lost trigger or semantic |
| 210 | mismatch was found in any completed episode. |
| 211 | |
| 212 | Consequence for R15: G1 requires goal MET in every one of 48 trials. At a |
| 213 | ~6% per-trial miss rate the chance all 48 pass is ~5%. This is a property of |
| 214 | the R13 workload's target margin, recorded here BEFORE any qualification |
| 215 | data. TARGET_PCT and G1 are unchanged; any correction is an owner decision |
| 216 | and must be committed as a methodology clarification before qualification. |
| 217 | The harness must size the crumb log for the longest allowed window and fail |
| 218 | a trial on overflow (§16 C1 item 4 applies equally to crumbs). |
| 219 | |
| 220 | ### Blocker found: R14 silicon F is intermittent (2026-09-28 afternoon) |
| 221 | |
| 222 | `test-r14-silicon` failed F_checkpoint_crash (and once B) on the rework |
| 223 | branch AND on the pre-change head `0ab53fb`, so the R15 instrumentation did |
| 224 | not cause it. Rerun of `rx_r14_recovery_silicon BF` on a quiet machine |
| 225 | (all cores < 3% busy, governor performance, max clocks): B passed, F adapted |
| 226 | after 3 crash points and failed at ~5 with `adapt -4` (AIEN never confirmed |
| 227 | the incumbent within 60 s while production filled the 2^18 crumb log) or |
| 228 | `adapt -11` (goal not MET). Host R14 passes. R14 last passed on silicon at |
| 229 | 08:45 today (evidence 2c647c6); since then: two reboots (MOK enrollment), |
| 230 | the SPBM reader loaded, LM Studio and the NVIDIA Personal AI Router |
| 231 | resident. Cause not yet found. §14 requires R14 silicon on the candidate, so |
| 232 | this must be resolved before qualification. |
| 233 | |
| 234 | ### R14 question settled against the exact candidate `6b38173` (2026-09-28 13:09-13:22) |
| 235 | |
| 236 | The R14 silicon test binary was built from `6b38173` itself (clean worktree, |
| 237 | no R15 change) and run 5 times back to back on a quiet machine, sampling the |
| 238 | machine once a second (`research/r14-failure-modes/exact-20260928-130858/`). |
| 239 | |
| 240 | - Result: **5 of 5 runs FAIL** (`R14_LIVING_RECOVERY=FAIL`). F failed in all |
| 241 | 5; A in 4; C and D once each. B and E passed every time. |
| 242 | - Dominant failure: the organism adapts but the goal is never MET (`adapt -11`) |
| 243 | or AIEN never confirms within 60 s (`adapt -4`); the crumb-log overflow and |
| 244 | "production did not resume" lines follow from that long wait (the lazily |
| 245 | backed log, `80f102a`, removes the overflow but not the goal miss). |
| 246 | - The machine was quiet (top process the test itself; temperatures 31-34 C; |
| 247 | A725 2.808 GHz, X925 3.9 GHz). The `performance` governor is set at every |
| 248 | boot by NVIDIA's stock `nv-cpu-governor` service, before this morning's pass |
| 249 | too, so it is not the change. |
| 250 | |
| 251 | **Conclusion:** the R14 silicon failure is not caused by any R15 change. The |
| 252 | same code that passed at 08:45 fails today; R14's pass depended on the |
| 253 | episode's goal margin (quad4 on X925 reaching <= 55% of the A725 incumbent |
| 254 | cost), which is marginal on this machine now. This is the same property as |
| 255 | the W-EPISODE miss-rate finding above. It blocks the §14 R14-silicon rerun and |
| 256 | G1 (goal MET in every trial) until TARGET_PCT / the goal margin is settled as |
| 257 | an owner decision committed before qualification. It does **not** block |
| 258 | building the harness, reducer and qualification runner; per the owner's |
| 259 | direction, no further environment analysis is done before those exist. |
| 260 | |
| 261 | ## Harness, reducer and qualification runner (built 2026-09-28 afternoon) |
| 262 | |
| 263 | Built on the shared rig, as the rework plan required; no further environment |
| 264 | analysis was done first. |
| 265 | |
| 266 | - `tests/runtime/rx_r15_perf.c` (+ `r15_measure.{c,h}`): one observation per |
| 267 | process, raw JSON Lines only. |
| 268 | - `trial <RES4|RES1|SEQ>`: the §4 episode with measurement hooks in the rig |
| 269 | (`R15Hooks`: IDLE 5 s quiescent, BEFORE 2+5 s on A725, AFTER 2+5 s on X925 |
| 270 | at goal MET). ADAPT (goal crumb -> promotion crumb) and the L3 intervals |
| 271 | (plan, selection, first seat claim, evidence, candidate, in force) come |
| 272 | from crumbs. Live windows record served ops, rusage, RxStats deltas, SPBM |
| 273 | + NVML energy, PMU (both CPU PMUs, inherited, raw sums), R9 store vs |
| 274 | process I/O, per-thread CPU, R5 slots and seat residency (1 ms sampler). |
| 275 | G1 uses the goal status at MET; the status after the AFTER window is |
| 276 | reported as `goal_status_final` (AIEN keeps re-assessing while production |
| 277 | continues; on the host it was seen falling back to UNKNOWN). |
| 278 | - `l1 <A|B|C|D|E|G|W0|W1> <RES1|SEQ>`: X925 cpu 7 driver / cpu 8 worker for |
| 279 | A-E; G (30 R9 barriers under production) and W0/W1 (timing off/on) use the |
| 280 | rig on X925. |
| 281 | - `l2 <RES1|SEQ>`: 256 closed-loop claims through `living.blackwell.add`; |
| 282 | chip `%globaltimer` pick/done from the heartbeat block. |
| 283 | - Four build targets: `r15-perf-host` / `r15-perf-silicon` (production and |
| 284 | `_nodigest`) plus `r15_reduce`. Qualification builds them from verified |
| 285 | candidate/dependency archives and stages digest-bound run copies; ignored |
| 286 | files under `build/` are never qualification inputs. |
| 287 | - `tools/r15_reduce.c`: verifies every file against SHA256SUMS, recomputes |
| 288 | metrics 1-17 and G1-G16, writes `summary.json`. Seed 0x15, 10,000 |
| 289 | resamples, percentile CI; missing data = FAIL. |
| 290 | - `tools/r15_qualify.sh [--detach] <host|silicon> [rounds] [l1] [l2]`: balanced |
| 291 | Latin square, L1, L2, machine.json, paranoid 4 -> 1 -> 4, SHA256SUMS, reducer. |
| 292 | `--detach` = setsid nohup; progress in plain words in `progress.log`. |
| 293 | Set `AIENOS_LOCK_REPO`/`PHYSICS_DIR` to repositories holding the pinned |
| 294 | commits, and `R15_OUT_BASE` for dry runs outside `evidence/`. |
| 295 | |
| 296 | Still blocking a real qualification: (1) the goal-margin decision above (R14 |
| 297 | silicon and G1); (2) §9: LM Studio and Ollama were resident at 13:45 and must |
| 298 | be stopped for the run; (3) a clean, committed candidate. |