interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / docs / native / PI5-6-AGENT-RUNS.md

104 lines · 11103 bytes Raw Blame History Source

PI5-6 final cut: a resident model's bounded reply, persisted in the sealed Store, recovered after a reboot (Raspberry Pi 5)

Tier: PI5-AGENT-QUALIFICATION, QUALIFICATION ONLY while the recovery secret comes from the card request file (\EFI\AIENOS\UNLOCK.REQ, a throwaway secret, PI5-4 cut 2). Image: make pi5-agent (CK_PI5_UNLOCK=1 CK_PI5_UNLOCK_CARD=1 CK_PI5_AGENT=1 CK_INFER_LIB=...). Hardware runs G1 to G3 are NOT_RUN in this document (the Pi was busy with another job); the host proof and the QEMU regressions are below.

What is reused (no parallel format)

What is new

Order: unlock the Store BEFORE the model is hashed and run

Decision: Store first, model second, commit last.

Memory budget (Pi 5, 8 GB class board)

Measured values are from the PI5-4 and PI5-6 runs; the agent image's own run is G1 (NOT_RUN). | item | MiB | source | | --- | --- | --- | | free after boot, no model on the card | 7033.6 (7375265792 B) | pi5-unlock-a memory: line | | model, reserved by the stub (807694368 B, plus rounding) | 770.6 | pi5-infer-b: 6567268352 B free with it, 807997440 B less | | free with the model, at the start of the agent stage | 6263.0 | pi5-infer-b memory: line | | inference heap (65536 frames), returned at close | 256.0 | core/infer.c HEAP_BYTES, frames_returned=65536 | | inside the heap: session open / peak | 22.4 / 24.1 | pi5-infer-b heap_used_kib=22900, heap_peak_kib=24695 | | Store stage heap use (64 MiB kernel heap, peak) | 2.0 | pi5-unlock-a mm_usage heap_min_free | | agent image .bss (all static buffers, 32 KiB of them the agent's) | 1.1 | size of aienos-ck.elf | | free during generation (6263.0 - 256.0 - 2.0 - 1.1) | about 6004 | arithmetic | | free on the recovery boot (no model on the card, no heap) | about 7030 | arithmetic | Model + heap + Store = about 1030 MiB, 14.6 percent of the memory the kernel owns. The 256 MiB heap is 10 times the 24.1 MiB the session peaks at (a deliberate margin, unchanged from the proven pi5-infer image).

Host proof

make -C native/kernel -f stage.mk pi5-agent-test pi5-agent-sanitize pi5-agent-mutants (run by stage-test, stage-sanitize): dev/tests/pi5_agent_test.c, 120 checks, ASan and UBSan clean. A file stands in for the card, every boot starts from a cold C state, the inference unit is a stub (a real model cannot run on the host); the stage code under test is the real svc/pi5_agent.c. It proves: the reply object equals the lifecycle's bytes and adds only the trailer; boot 1 generates, closes, commits once and reads back; boot 2 (same secret, no model) prints exactly boot 1's agent: reply line (same Store generation, same object digest) with zero model calls, also when the model is present; wrong secret: nothing recovered, zero model calls, card byte-identical, and the right secret afterwards recovers again; eight non-golden generations (wrong id, wrong head, wrong text, wrong model digest, refused prompt, cancelled prompt, model vanished, too many tokens) commit nothing; no reply and no model is NOMODEL; a lifecycle reply for the same prompt and a reply for another prompt are ignored; a stored non-golden reply is reported FAIL and is never regenerated over. Mutation proof (each TEST-ONLY mutant must make the test fail; all six killed): NO_COMMIT (commit skipped, success reported), RECOVER_BLIND (recovery never reads the Store), NO_GOLDEN_CHECK, NO_PROMPT_CHECK, RECOVER_NO_CHECK, MODEL_FIRST (model touched before the Store check). Regressions: make -C native/kernel test; scripts/ck_pi5_build_check.sh; the QEMU infer gate (scripts/qemu_ck_infer_test.sh, PASS, includes the restored prompt-head check) and the QEMU lifecycle gate (scripts/qemu_ck_lifecycle_test.sh, the reply object path).

Pi runs (PASS, 2026-10-13, Raspberry Pi 5, main 5429602, make pi5-agent)

Each run is one tryboot of the hub (~/workspace/pi5/pi5-run.sh, KLOG=1): a soft reboot, NOT a power cut. Same card and secret S as the PI5-5 runs (Store generation continues). MODEL.MAP was placed for G1 and G3 and removed from the ESP after each (every image's stub reads it).

G1 generate, check golden, commit:

store: opened generation=5 boot_count=2 prev_commit=dd99eda1ec2d3e6b097bfb71a9583b153e3face7 anchor=valid-resume
agent: generated tokens=8 prompt_ids=17 steps=25 us=16946950 prompt_head=128000,128006,882,128007
agent: reply store_gen=7 object_sha256=07d15b3d26726090494b0d033f6a955d88e4b9a1ae4322130459297db952989c model_sha256=3f5a22426976ab26cfe84dba63c1d08391717abb1af893e10f1b2968d862dcc1 tokens=8 ids=791 6864 315 9822 374 12366 13 128009 text="The capital of France is Paris."
agent: committed store_gen=7
AIENOS_PI5_AGENT: GENERATED PASS

G2 recover on the next boot (no MODEL.MAP; no model: or infer: line in the log):

store: opened generation=7 boot_count=3 prev_commit=5429602193cfc5ab79b05c0111b0cbad36e74fed anchor=valid-resume
agent: reply store_gen=7 object_sha256=07d15b3d26726090494b0d033f6a955d88e4b9a1ae4322130459297db952989c model_sha256=3f5a22426976ab26cfe84dba63c1d08391717abb1af893e10f1b2968d862dcc1 tokens=8 ids=791 6864 315 9822 374 12366 13 128009 text="The capital of France is Paris."
AIENOS_PI5_AGENT: RECOVERED PASS

G3 wrong secret W (MODEL.MAP placed; the UEFI stub still read the model bytes before the kernel ran, the kernel never hashed or used them: no infer: sha256= line):

store: REFUSED proof=keyed step="recovery secret rejected (K_vol unwrap tag failed); disk not opened" rc=-2004 (RecoverySecretRejected); disk left as found, not reformatted
agent: NOTHING RECOVERED: the Store is not open (recovery secret missing or rejected, or the disk was refused); the model was not read or hashed, nothing was generated, nothing was written
AIENOS_PI5_AGENT: NOSTORE

Limits: tryboot reset, not a power cut; the AIENOS partition was not hashed around G3 (PI5-4 run C proved the same refusal path leaves the partition byte-identical); one golden prompt; 1.20 tok/s; single runs; secret from the card, no TPM.