From 88040d6db9b29f97f539b0fc2a5cfa99cfe14fff Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Mon, 12 Oct 2026 02:28:21 -0500 Subject: [PATCH 1/4] native v1 P06 cut 2 (aienos): prompt and recall verbs on the resident lifecycle Service images built with CK_INFER_LIB keep the model and one bounded session resident from boot to the stop order (core/infer.c resident mode, CK_INFER_RESIDENT). `prompt ` generates a bounded reply; between steps only `cancel` is accepted; the reply becomes the pending proposal and `approve` commits it as one sealed reply object (kind 'R1'). `recall` reads the newest approved note or reply back through the sealed Store, so a cold boot answers from the disk. Lifecycle gate boots 5 and 6 (rows 174-176, separate AIENOS_CK_LIFECYCLE_INFER verdict, NOT_RUN without the model, cargo or the Rust target). Host test: 79 checks. QEMU only: the model arrives over the TEST-ONLY fw_cfg channel; the hardware service image has no inference. Co-authored-by: Drake Stapleton Co-Authored-By: Claude Fable 5.1 --- native/kernel/GATES.md | 19 +-- native/kernel/Makefile | 6 + native/kernel/core/infer.c | 135 +++++++++++++++++++++ native/kernel/core/lifecycle.c | 169 +++++++++++++++++++++++++-- native/kernel/core/lifecycle_fsm.c | 55 ++++++++- native/kernel/core/lifecycle_fsm.h | 21 +++- native/kernel/include/ck.h | 25 ++++ native/kernel/tests/test_lifecycle.c | 61 ++++++++++ scripts/qemu_ck_lifecycle_test.sh | 134 +++++++++++++++++++-- 9 files changed, 590 insertions(+), 35 deletions(-) diff --git a/native/kernel/GATES.md b/native/kernel/GATES.md index eb8197f4..26896fa3 100644 --- a/native/kernel/GATES.md +++ b/native/kernel/GATES.md @@ -648,10 +648,12 @@ heap region. The probe runs the session on a fresh 256 MiB region with limits kv bytes, reserve 64 KiB: three refusals that touch no weights, "Say hello." cancelled after 3 prefill steps, the golden prompt stepped to its end (its ids must equal the one-shot reply and the llama.cpp sequence, which proves the cache reset after a cancel), "Say hello." cancelled again after one step, close, every frame returned, -`AIENOS_CK_INFER_SESSION: PASS|FAIL`. Limits: the session API is linked only into the QEMU probe image -(`CK_INFER_LIB` cannot combine with `CK_HARDWARE_STAGING` or `CK_RUST_LIBS`), so the hardware service image has -no inference yet; the lifecycle `prompt` verb (operator prompt -> bounded output -> approve -> Store) is the next -P06 cut; the bump allocator never frees, so each prompt costs a few KiB until close (`heap_used_kib` per line). +`AIENOS_CK_INFER_SESSION: PASS|FAIL`. The lifecycle `prompt` verb (operator prompt -> bounded output -> approve -> +Store, P06 cut 2) runs the same session resident in a `CK_SERVICE=1 CK_INFER_LIB=...` image (LIFECYCLE rows +174-176). Limits: `CK_INFER_LIB` cannot combine with `CK_HARDWARE_STAGING` or `CK_RUST_LIBS` and the QEMU model +source is TEST-ONLY fw_cfg, so the hardware service image has no inference yet (the MODEL.MAP boot-disk source +is the hardware path); the bump allocator never frees, so each prompt costs a few KiB until close +(`heap_used_kib` per line). | # | check | gate | status | |---|---|---|---| @@ -830,9 +832,9 @@ are this adapter's choices (UNVERIFIED against a frozen contract). (5) The reque bytes; the contract's exact digest input is not defined (UNVERIFIED). (6) The "task" is the adapter's session; the EL0 shell units hold no capability (caps=0) and the check is made by the kernel-side adapter. -## LIFECYCLE: resident production lifecycle (native v1 plan P03, P06 cut 3 host rows 177-178, C-only) -> CK `LIFECYCLE` (scripts/qemu_ck_lifecycle_test.sh) +## LIFECYCLE: resident production lifecycle (native v1 plan P03, P04 cut 1, P05 cut 1, P06 cuts 2-3; C-only) -> CK `LIFECYCLE` (scripts/qemu_ck_lifecycle_test.sh) -The product boundary. A `CK_SERVICE=1` image (`full-service/`, allowed with `CK_HARDWARE_STAGING`, refused with every TEST-only flag) links `core/lifecycle.c` + `core/lifecycle_fsm.c`: after every boot stage the kernel serves bounded operator requests on the serial console (states init, locked, ready, serve, quiesce, stop; verbs status, unlock, task , approve, deny, cancel, evidence, help, shutdown; one 64-byte line, one 48-byte task, one pending task at a time) until `shutdown`, then runs the stop order (Store closed, NVMe normal shutdown + bus master off + SMMU stream to abort, final report, reset) instead of resetting at once. The diagnostic images are unchanged (the weak `ck_lifecycle_run` is absent). The production key source still refuses (no in-kernel K_vol unwrap, P04), so the production service image comes up LOCKED. The TEST-ONLY `CK_SERVICE_TEST_KEYS=1` image (`full-service-testkeys/`, refused with `CK_HARDWARE_STAGING`) opens the Store with the TEST keys so the ready/serve/commit paths run in QEMU. Host test: `tests/test_lifecycle.c` (`make test`, 41 checks on the state machine and decoder). QEMU qualifies nothing physical. +The product boundary. A `CK_SERVICE=1` image (`full-service/`, allowed with `CK_HARDWARE_STAGING`, refused with every TEST-only flag) links `core/lifecycle.c` + `core/lifecycle_fsm.c`: after every boot stage the kernel serves bounded operator requests on the serial console (states init, locked, ready, serve, quiesce, stop; verbs status, unlock, task , prompt , approve, deny, cancel, recall, evidence, help, shutdown; one 96-byte line, one 48-byte task or prompt, one 256-byte reply, one pending proposal at a time) until `shutdown`, then runs the stop order (Store closed, NVMe normal shutdown + bus master off + SMMU stream to abort, final report, reset) instead of resetting at once. The diagnostic images are unchanged (the weak `ck_lifecycle_run` is absent). The production key source still refuses (no in-kernel K_vol unwrap, P04), so the production service image comes up LOCKED. The TEST-ONLY `CK_SERVICE_TEST_KEYS=1` image (`full-service-testkeys/`, refused with `CK_HARDWARE_STAGING`) opens the Store with the TEST keys so the ready/serve/commit paths run in QEMU. Host test: `tests/test_lifecycle.c` (`make test`, 79 checks on the state machine and decoder). P06 cut 2 (rows 174-176): a service image built with `CK_INFER_LIB` keeps the model and one bounded session resident from boot to the stop order (`core/infer.c` resident mode, `CK_INFER_RESIDENT`); `prompt ` generates a bounded reply between whose steps only `cancel` is accepted, the reply becomes the pending proposal and `approve` commits it as one sealed reply object (kind 0x5231 'R1': `aienos.reply.v1`, the prompt and the reply); `recall` reads the newest approved note or reply back through the sealed Store, so a cold boot answers from the disk and never from memory. QEMU only: the model arrives over the TEST-ONLY fw_cfg channel and `CK_INFER_LIB` cannot combine with `CK_HARDWARE_STAGING`, so the hardware service image still has no inference (the MODEL.MAP boot-disk source is the hardware path, P06 next cut). QEMU qualifies nothing physical. | # | Check | CK gate | Status | |---|---|---|---| @@ -845,12 +847,15 @@ The product boundary. A `CK_SERVICE=1` image (`full-service/`, allowed with `CK_ | 166 | bounds: a 97-byte line (limit 96, room for `unlock ` + 64 hex) is refused whole and never run; `evidence` counts agree (`tasks=3 approved=1 denied=1 cancelled=1 overlong=1`) with the last commit generation and object id | LIFECYCLE | QEMU PASS (hardware NOT_RUN) | | 167 | stop order: `lifecycle: ready` < `dma_gate: nvme bus master revoked` < `stop order store=closed nvme=released` < `stage lifecycle: ok` < final report; no panic or fault; QEMU exit 0; M1 checks | LIFECYCLE | QEMU PASS (hardware NOT_RUN) | | 167a | build shape: the default image carries no lifecycle; `CK_SERVICE` refused with `CK_CONSOLE_SESSION`, `CK_QEMU_UNSAFE_DMA` and any `CK_TEST_*`; `CK_SERVICE_TEST_KEYS` refused with `CK_HARDWARE_STAGING` | LIFECYCLE (build) | PASS | -| 167b | limits: operator input is serial only (USB keyboard binding stays with the xHCI session code, later cut); a committed note is not yet read back after a cold boot (P06; the continuity identity and ALLEN subject are, rows 171-172); the lifecycle loop polls with interrupts as the boot stages left them (no scheduler integration yet) | LIFECYCLE | LIMIT (declared) | +| 167b | limits: operator input is serial only (USB keyboard binding stays with the xHCI session code, later cut); a committed note or reply is read back by `recall` (row 175) but the memory-only fact of N3 (the Omega CxStore adapter record) is the next P06 cut; the lifecycle loop polls with interrupts as the boot stages left them (no scheduler integration yet) | LIFECYCLE | LIMIT (declared) | | 168 | P04 cut 1, recovery keyslot GENESIS (production service image, blank disk): `unlock deadbeef` refused (`rc=-2004`, 64 hex digits expected); `unlock <64-hex secret>` draws K_vol/salt/nonce from the entropy service, wraps K_vol into the ADR 0017 Slot 1 Recovery_RawSecret descriptor (HKDF-SHA256 KEK) and commits the KeySlotManifest (kind 21, plaintext, bound by the sealed transaction record) in the same first transaction as the boot record: `formatted production store`, `key source=recovery-keyslot genesis=1`, `committed generation=2 boot_count=1`, `unlock ok ... genesis=1`, lifecycle READY; the continuity genesis commits generation 3 (row 171); a note is approved and committed at generation 4; stop order closes the Store; QEMU exit 0; M1 checks | LIFECYCLE / TRUST-1 | QEMU PASS (hardware NOT_RUN) | | 169 | P04 cut 1, recovery keyslot RESUME (same disk, cold boot): the wrong secret is refused by the keyslot AES-GCM-SIV tag (`RecoverySecretRejected rc=-2004`, disk not opened, not reformatted, lifecycle stays locked, `refused=1`); the right secret unwraps K_vol, derives PRODUCTION-class keys (owner hierarchy generation = active_key_epoch 1), the keyed open re-binds the manifest through the transaction record: `opened generation=4 boot_count=1 ... anchor=valid-resume`, `committed generation=5 boot_count=2`, `unlock ok ... genesis=0`; the continuity resume commits generation 6 (row 172); stop order closes the Store; QEMU exit 0; M1 checks | LIFECYCLE / TRUST-1 | QEMU PASS (hardware NOT_RUN) | | 170 | secret hygiene and limits: the typed secret is echoed as 64 `*` and neither secret's hex appears in any serial log; no TEST key banner; no key material is compiled into the image (`ck_store_production_keys` still refuses `rc=-2002`: TPM Slot 0 BLOCKED_HARDWARE); no key rotation (`active_key_epoch` 1); the manifest is not yet bound into the secman `keyslot_manifest_id`; host rig (`stage_test` `test_unlock_recovery`): entropy refusal leaves a blank disk untouched, wrong secret and wrong provisioned uuid leave the image byte-identical, a TEST-key Store has no manifest (`NoKeyslotManifest rc=-2003`) | LIFECYCLE / TRUST-1 | QEMU PASS + LIMIT (declared) | | 171 | P05 cut 1, production continuity GENESIS (unlock boot, after `store: unlock ok`): `svc/continuity_service.c` (linked only into `CK_SERVICE` images; the TEST-ONLY mode selection `continuity_boot.c`, the `AIENCONT` plan line and the Recovery Core are not) finds the Store unprovisioned and mints the identity (AgentRoot, genesis AgentState, Manifest incarnation 1) and the ALLEN subject (kind 24, sequence 1) in ONE sealed transaction (`svc/continuity_subject_provision.c`, generation 3) with entropy from the kernel RNDR service: `continuity: genesis source=qualification provenance=store-uuid-only`, `continuity: PROVISIONED agent=<64 hex> incarnation=1 sequence=1 cortex=0 branches=1`, `allen: GENESIS subject=<64 hex> sequence=1 lineage=<64 hex> intents=0 active=0 knowledge=0`; order `unlock ok` < `PROVISIONED` < `lifecycle: unlock ok`; `status` reports `continuity=provisioned agent=<16 hex> incarnation=1 subject_seq=1`. Genesis inputs are public and deterministic: provenance = SHA-256("AIENOS/ALLEN/PROVENANCE-V1" \|\| owner root public key (hardware staging image) \|\| store uuid), cortex lineage = SHA-256("AIENOS/ALLEN/CORTEX-LINEAGE-V1" \|\| store uuid): the Cortex of this subject is the sealed Store on this disk (CURRENT_EXECUTION_PLAN addendum, conflict 3). A hardware staging service image uses `source=operator` and the owner root key (`ck_owner_root_pk`) | LIFECYCLE / M4_CONTINUITY / M4_ALLEN | QEMU PASS (hardware NOT_RUN) | | 172 | P05 cut 1, production continuity RESUME (relock boot, cold start of the same disk): the ALLEN subject is restored read-only first (`allen: RESTORED ... sequence=1`; absent, corrupt, forked or foreign: REFUSED, nothing written, never minted over), then `cr_resume` commits incarnation 2 (generation 6): `continuity: RESUMED agent= incarnation=2 sequence=2 cortex=0 branches=1`; no second genesis, no degraded mount; order `unlock ok` < `RESUMED` < `lifecycle: unlock ok`; `status` reports `continuity=resumed ... incarnation=2 subject_seq=1`; after the wrong secret `status` reports `continuity=none`. Host rig (`stage_test` `test_continuity_service`): provisioned at generation 3, resumed at incarnation 2 then 3 on the same agent, an entropy refusal on a fresh Store leaves the disk byte-identical and the state `refused` (not writable) | LIFECYCLE / M4_CONTINUITY / M4_ALLEN | QEMU PASS (hardware NOT_RUN) | | 173 | shape and refusal path: the locked service boot prints no `continuity:` or `allen:` line (nothing runs before the Store opens); the test-keys image provisions at boot before `store: service lifetime: Store open`; the service EFI carries `continuity: REFUSED` and neither `AIENCONT` nor `RECOVERY_OPERATOR_KEY` (Makefile `cont_check` for `CK_SERVICE` images: `cr_provision`/`cr_resume` allowed, `ck_cont_boot_stage`/`rc_inspect` and the uppercase `CONTINUITY: ` markers refused; the markers are fenced out of `continuity_commit.c` under `CK_SERVICE`). A refusal (`continuity: REFUSED step=... outcome=... store_rc=...`) erases the Store keys, leaves the disk as found and keeps the lifecycle LOCKED with the NVMe bound for the stop order (`store: service lifetime: continuity REFUSED ...`, `ContinuityRefused rc=-2007`); `approve` is refused on a degraded (read-only) mount. Limits: the approved note is a plain Store object, not yet a continuity WAL / Cortex record (P06 CxStore adapter); no Recovery Core in the service image (its operator key is TEST-only); aienos#285 resource incarnations are NOT triggered (continuity objects are Store objects, not ADR 0013 domain-1 channels/objects); physical NVMe geometry, confined DMA, flush, shutdown and interrupted-transaction qualification (aienos#31) NOT_RUN | LIFECYCLE / M4_CONTINUITY | QEMU PASS + LIMIT (declared) | +| 174 | P06 cut 2, resident inference on the lifecycle (boot 5: test-keys image built with `CK_INFER_LIB`, model over the TEST-ONLY fw_cfg channel, `-m 4096`): only that image carries the session (`infer: resident open` absent from the plain test-keys image); `infer: resident open rc=0 tensors=147 vocab=128256 layers=16 kv_capacity=64 max_new=16 max_prompt_bytes=256 heap_reserve_kib=64` before `lifecycle: ready`; `prompt What is the capital of France?` -> `lifecycle: generating ...` -> `lifecycle: reply ids=791 6864 315 9822 374 12366 13 128009 tokens=8 prompt_ids=17 steps=25` (the golden one-shot and session sequence, row 139d) -> `reply pending state=serve proposed="reply: The capital of France is Paris."`; `approve` -> `approve committed gen=N id=...` (one sealed reply object, kind 0x5231 'R1') | LIFECYCLE / INFER | NOT_RUN | +| 175 | cancel and recall: `prompt Say hello.` then `cancel` typed 5 s later stops generation between steps (`generation cancelled steps>=1 prompt_ids=13 produced=0 state=ready`, nothing pending, no refusal); `recall` in the same boot reads the reply back through the sealed Store (`recall gen=N kind=reply id=... text="aienos.reply.v1?prompt: What is the capital of France??reply: The capital of France is Paris.?"`, newlines shown as `?`); boot 6 (same disk, cold boot, no prompt): the session opens again, continuity RESUMED (incarnation 2, no second genesis), `recall` returns the same approved reply from the disk (`last_commit_gen=0` in evidence: nothing from memory), `recalls=1`, stop order `requests=4`, every frame returned, QEMU exit 0, M1 checks | LIFECYCLE / INFER | NOT_RUN | +| 176 | evidence and stop order (boot 5): `evidence requests=5 ... approved=1 ... prompts=2 replies=1 gen_cancelled=1 gen_failed=0 recalls=0 inference=resident` (the `cancel` that stops a generation is `gen_cancelled`, not a request; `cancelled` counts dropped proposals); stop order `infer: resident close rc=0` < `infer: unloaded ... frames_free_after = frames_free_before rc=0,0` < `lifecycle: stop order store=closed nvme=released state=stop requests=7` < `stage lifecycle: ok` < final report; no panic or fault; QEMU exit 0; M1 checks. Separate verdict `AIENOS_CK_LIFECYCLE_INFER: PASS|FAIL|NOT_RUN` (NOT_RUN when the model file, cargo or the Rust target is missing; the main `AIENOS_CK_LIFECYCLE` verdict covers rows 174-176 whenever they run). Limits: QEMU only (TCG ~25 min for both boots); the hardware service image has no inference; a prompt is 48 bytes and a reply 256 bytes; generation is not pre-emptible inside a step (one prefill or token step, ~30 s under TCG); the bump allocator never frees between prompts; a second resident session per boot is not supported (one static slot) | LIFECYCLE / INFER | NOT_RUN | | 177 | P06 cut 3, canonical Omega Cortex store over the sealed Store (`third_party/omega/rx_cortex.c` at omega `362c9ab`, built freestanding by `svc/cortex_store.c`; journal = `svc/cortex_journal.c`, kind `0x434a` 'CJ' chunks of <= 16 KiB, one Cortex record = one sealed transaction, truncate only at the current length): host test `test_cortex_journal` in `svc/tests/stage_test.c`: a blank Store gets the 32-byte header as one generation; three records are three generations and `cx_verify_chain` passes; a second writable open is `CX_ERR_WRITER` while read-only opens are served; `truncate(len)` OK and `truncate(len-1)` `CX_ERR_IO`; a record above 128 KiB is refused (`CX_ERR_IO`) with memory and Store generation unchanged; a 40000-byte payload is three chunks of one transaction; reopen on the same mount and after a cold start replays all five records (40760 bytes, 8 chunks, heap peak 287 KiB); another subject count is `CX_ERR_FORMAT`; an in-memory edit is `CX_ERR_DIGEST`; a 256-byte heap makes the open `CX_ERR_NOMEM` without a write | LIFECYCLE (host, `make stage-test` and `stage-sanitize`) | PASS (host test, 2026-10-12, `CK_STAGE_HOST: PASS checks=772`, ASan + UBSan clean; kernel use of the journal is the next P06 cut; hardware NOT_RUN) | | 178 | the vendored files equal omega `362c9ab50c8ecc3012dd2e3ac20329865ba80982` (`omega.lock`, `scripts/omega_lock_check.sh`: offline sha256 always, the omega blob when reachable; an edited copy FAILs) and the adapter compiles freestanding (`make stage-free`: `CK_STAGE_FREE: PASS objects=45`, undefined symbols are ck.h services only); the `CK_SERVICE` image links `cx_open_with`, `cx_append`, `ck_cj_init`, `ck_cx_heap_init` and no `malloc`/`open`/`fsync` | LIFECYCLE (host) | PASS (host, 2026-10-12; both checks run in CI from this cut) | diff --git a/native/kernel/Makefile b/native/kernel/Makefile index 8c97a7ba..4905a435 100644 --- a/native/kernel/Makefile +++ b/native/kernel/Makefile @@ -269,6 +269,12 @@ ifneq ($(strip $(CK_RUST_LIBS)),) $(error CK_INFER_LIB and CK_RUST_LIBS cannot be combined: two Rust staticlibs duplicate compiler_builtins) endif CK_EXTRA_CFLAGS += -DCK_INFER_PROBE=1 +# native v1 P06 cut 2: in a service image the model and one bounded session +# stay resident for the lifecycle's `prompt` verb (core/lifecycle.c) instead +# of running the one-shot probe. QEMU gate only (fw_cfg TEST-ONLY source). +ifeq ($(strip $(CK_SERVICE)),1) +CK_EXTRA_CFLAGS += -DCK_INFER_RESIDENT=1 +endif endif ifneq ($(strip $(CK_QEMU_UNSAFE_DMA)),) ifneq ($(strip $(CK_HARDWARE_STAGING)),) diff --git a/native/kernel/core/infer.c b/native/kernel/core/infer.c index 8f94d955..2f8aba77 100644 --- a/native/kernel/core/infer.c +++ b/native/kernel/core/infer.c @@ -352,6 +352,121 @@ static void session_run(uint64_t mpa, uint64_t msize) ck_printf("AIENOS_CK_INFER_SESSION: %s\n", ok ? "PASS" : "FAIL"); } +#ifdef CK_INFER_RESIDENT +/* Resident mode (native v1 P06, CK_SERVICE images built with CK_INFER_LIB): + * the ingested model and one bounded session stay open from boot to the + * lifecycle stop order. */ +static struct { + int open; + uint64_t mpa, msize, mpages, hpa, frames_before; +} g_res; + +int ck_infer_resident(void) { return g_res.open; } + +static void resident_open(uint64_t mpa, uint64_t msize, uint64_t mpages, uint64_t hpa, uint64_t frames_before) +{ + uint64_t v = ck_rd(cpacr_el1); + v |= 3ull << CPACR_FPEN_SHIFT; + ck_wr(cpacr_el1, v); + ck_isb(); + aienos_infer_heap_init((uintptr_t)hpa, HEAP_BYTES); + struct infer_limits lim = { SESS_KV, SESS_MAX_NEW, SESS_PROMPT_BYTES, SESS_RESERVE }; + struct infer_info info = { 0, 0, 0, 0 }; + uint64_t t0 = ck_time_us(), daif = ck_rd(daif); + __asm__ volatile("msr daifset, #0xf" ::: "memory"); + int32_t rc = aienos_infer_session_open((const uint8_t *)(uintptr_t)mpa, msize, &lim, &info); + ck_wr(daif, daif); + ck_printf("infer: resident open rc=%d tensors=%u vocab=%u layers=%u kv_capacity=%u max_new=%u max_prompt_bytes=%u heap_reserve_kib=%u heap_used_kib=%u open_us=%llu\n", + rc, info.tensors, info.vocab, info.layers, lim.kv_capacity, lim.max_new, lim.max_prompt_bytes, + lim.heap_reserve >> 10, info.heap_used_kib, (unsigned long long)(ck_time_us() - t0)); + if (rc != 0) { + aienos_infer_heap_init(0, 0); + ck_mm_frames_free(hpa, HEAP_BYTES / PAGE); + if (mpages) ck_mm_frames_free(mpa, mpages); + ck_puts("infer: resident FAIL (session did not open; frames returned)\n"); + return; + } + g_res.open = 1; + g_res.mpa = mpa; + g_res.msize = msize; + g_res.mpages = mpages; + g_res.hpa = hpa; + g_res.frames_before = frames_before; +} + +int ck_infer_prompt(const char *text, size_t len, int (*cancel_poll)(void), struct ck_infer_reply *r) +{ + if (!g_res.open) return SESS_E_STATE; + memset(r, 0, sizeof *r); + uint64_t t0 = ck_time_us(), daif = ck_rd(daif); + __asm__ volatile("msr daifset, #0xf" ::: "memory"); + int32_t ids = aienos_infer_session_prompt((const uint8_t *)text, (uint32_t)len); + ck_wr(daif, daif); + if (ids < 0) return ids; + r->prompt_ids = (uint32_t)ids; + int32_t rc = 0; + for (;;) { + uint32_t t = 0; + uint64_t us = 0; + __asm__ volatile("msr daifset, #0xf" ::: "memory"); + rc = aienos_infer_session_step(&t, &us); + ck_wr(daif, daif); + if (rc < 0 || rc == SESS_STEP_DONE) break; + r->steps++; + if (rc != SESS_STEP_PREFILL) r->produced++; + if (rc == SESS_STEP_LAST) break; + if (cancel_poll && cancel_poll()) { + __asm__ volatile("msr daifset, #0xf" ::: "memory"); + aienos_infer_session_cancel(); + ck_wr(daif, daif); + r->cancelled = 1; + break; + } + } + r->rc = rc; + r->us = ck_time_us() - t0; + if (rc < 0) return rc; + if (!r->cancelled) { + __asm__ volatile("msr daifset, #0xf" ::: "memory"); + int32_t n = aienos_infer_session_tokens(r->ids, CK_INFER_REPLY_IDS); + int32_t tl = aienos_infer_session_text(r->ids, n > 0 && n <= CK_INFER_REPLY_IDS ? (uint32_t)n : 0, r->text, + CK_INFER_REPLY_TEXT); + ck_wr(daif, daif); + if (n < 0) return n; + if (tl < 0) return tl; + r->produced = (uint32_t)n; + r->text_len = (uint32_t)tl; + /* A completed request is consumed: the session is idle for the next prompt. */ + __asm__ volatile("msr daifset, #0xf" ::: "memory"); + aienos_infer_session_cancel(); + ck_wr(daif, daif); + } + return 0; +} + +void ck_infer_resident_close(void) +{ + if (!g_res.open) return; + uint64_t daif = ck_rd(daif), used = 0, peak = 0; + __asm__ volatile("msr daifset, #0xf" ::: "memory"); + aienos_infer_heap_stats(&used, &peak); + int32_t crc = aienos_infer_session_close(); + ck_wr(daif, daif); + aienos_infer_heap_init(0, 0); + int f2 = ck_mm_frames_free(g_res.hpa, HEAP_BYTES / PAGE); + int f1 = g_res.mpages ? ck_mm_frames_free(g_res.mpa, g_res.mpages) : 0; + uint64_t frames_after = ck_mm_free_frames(); + struct ck_mm_usage mu; + ck_mm_usage(&mu); + g_res.open = 0; + ck_printf("infer: resident close rc=%d heap_used_kib=%llu heap_peak_kib=%llu\n", crc, (unsigned long long)(used / 1024), + (unsigned long long)(peak / 1024)); + ck_printf("infer: unloaded heap_live_kib=%llu frames_free_before=%llu frames_free_after=%llu frames_returned=%llu rc=%d,%d\n", + (unsigned long long)((mu.heap_bytes - mu.heap_free) / 1024), (unsigned long long)g_res.frames_before, + (unsigned long long)frames_after, (unsigned long long)(g_res.mpages + HEAP_BYTES / PAGE), f1, f2); +} +#endif /* CK_INFER_RESIDENT */ + void ck_infer_run(void) { const char *why = 0; @@ -460,6 +575,14 @@ void ck_infer_run(void) return; } +#ifdef CK_INFER_RESIDENT + /* Service image: the model stays resident for the lifecycle's prompt verb + * (core/lifecycle.c); the one-shot probe and session_run below are the + * QEMU probe image's regression, not the service's job. */ + resident_open(mpa, msize, mpages, hpa, frames_before); + return; +#endif + /* FP/SIMD on, every exception masked for the Rust unit (see core/fpu.c). * The FP registers are left dirty afterwards (nothing else in the kernel * reads them; EL0 traps on FP). */ @@ -532,3 +655,15 @@ void ck_infer_run(void) #else void ck_infer_run(void) {} #endif + +#ifndef CK_INFER_RESIDENT +/* No resident session: the diagnostic image, the QEMU probe image and a + * service image built without CK_INFER_LIB (every hardware image today). */ +int ck_infer_resident(void) { return 0; } +int ck_infer_prompt(const char *text, size_t len, int (*cancel_poll)(void), struct ck_infer_reply *r) +{ + (void)text; (void)len; (void)cancel_poll; (void)r; + return -12; /* no session in this image */ +} +void ck_infer_resident_close(void) {} +#endif diff --git a/native/kernel/core/lifecycle.c b/native/kernel/core/lifecycle.c index b7c08d1b..01a37c1d 100644 --- a/native/kernel/core/lifecycle.c +++ b/native/kernel/core/lifecycle.c @@ -48,7 +48,8 @@ #error "CK_SERVICE_TEST_KEYS (TEST keys) cannot be combined with CK_HARDWARE_STAGING" #endif -#define CK_LC_OBJ_KIND 0x4e31u /* 'N1': v1 approved note, version 1 */ +#define CK_LC_OBJ_KIND 0x4e31u /* 'N1': v1 approved note, version 1 */ +#define CK_LC_REPLY_KIND 0x5231u /* 'R1': v1 approved reply (prompt + generated text), version 1 */ void ck_dev_nvme_release(void); int ck_store_service_ready(void); @@ -62,7 +63,7 @@ static unsigned g_overlong, g_dropped; static void help(void) { - ck_puts("lifecycle: verbs: status unlock [<64-hex recovery secret>] task approve deny cancel evidence help shutdown\n"); + ck_puts("lifecycle: verbs: status unlock [<64-hex recovery secret>] task prompt approve deny cancel recall evidence help shutdown\n"); } static void status(void) @@ -76,24 +77,56 @@ static void status(void) static void evidence(void) { ck_printf("lifecycle: evidence requests=%u refused=%u invalid=%u tasks=%u approved=%u denied=%u cancelled=%u " - "overlong=%u last_commit_gen=%llu last_id=%02x%02x%02x%02x\n", + "overlong=%u last_commit_gen=%llu last_id=%02x%02x%02x%02x prompts=%u replies=%u gen_cancelled=%u " + "gen_failed=%u recalls=%u inference=%s\n", g_lc.requests, g_lc.refused, g_lc.invalid, g_lc.tasks, g_lc.approved, g_lc.denied, g_lc.cancelled, - g_overlong, (unsigned long long)g_last_gen, g_last_id[0], g_last_id[1], g_last_id[2], g_last_id[3]); + g_overlong, (unsigned long long)g_last_gen, g_last_id[0], g_last_id[1], g_last_id[2], g_last_id[3], + g_lc.prompts, g_lc.replies, g_lc.gen_cancelled, g_lc.gen_failed, g_lc.recalls, + ck_infer_resident() ? "resident" : "none"); } /* Commit the pending task as one sealed Store object. Bytes: a fixed header * then the operator's text, bounded by CK_LC_TASK_MAX. */ +/* Printable copy of a byte span for a serial line: ASCII 0x20..0x7e kept, + * everything else (including the newline a reply may end with) becomes '?'. */ +static void printable(char *out, size_t cap, const uint8_t *b, size_t n) +{ + size_t i; + if (n > cap - 1) n = cap - 1; + for (i = 0; i < n; i++) out[i] = (b[i] >= 0x20 && b[i] <= 0x7e) ? (char)b[i] : '?'; + out[n] = 0; +} + +static void put(uint8_t *buf, size_t *n, const char *s, size_t len) +{ + size_t i; + for (i = 0; i < len; i++) buf[(*n)++] = (uint8_t)s[i]; +} + +/* A note: "aienos.note.v1\n" + text (kind 'N1'). A reply: "aienos.reply.v1\nprompt: " + * + prompt + "\nreply: " + generated bytes + "\n" (kind 'R1'). Both bounded. */ +#define CK_LC_REPLY_OBJ_MAX (16 + 8 + CK_LC_TASK_MAX + 8 + CK_LC_REPLY_MAX + 1) static int commit_task(void) { - static const char hdr[] = "aienos.note.v1\n"; - uint8_t buf[sizeof hdr - 1 + CK_LC_TASK_MAX]; + static const char note_hdr[] = "aienos.note.v1\n", reply_hdr[] = "aienos.reply.v1\nprompt: ", reply_sep[] = "\nreply: "; + uint8_t buf[CK_LC_REPLY_OBJ_MAX]; size_t n = 0, i; + uint16_t kind = CK_LC_OBJ_KIND; ss_store *s = store_boot_store(); if (!s || !ck_store_service_ready()) return -1; if (!ck_cont_service_writable()) return CK_SB_E_CONTINUITY; /* degraded mount: read-only */ - for (i = 0; i < sizeof hdr - 1; i++) buf[n++] = (uint8_t)hdr[i]; - for (i = 0; i < g_lc.task_len; i++) buf[n++] = (uint8_t)g_lc.task[i]; - ss_object o = { CK_LC_OBJ_KIND, 1, buf, n }; + if (g_lc.pending == CK_LC_PENDING_REPLY) { + kind = CK_LC_REPLY_KIND; + put(buf, &n, reply_hdr, sizeof reply_hdr - 1); + put(buf, &n, g_lc.task, g_lc.task_len); + put(buf, &n, reply_sep, sizeof reply_sep - 1); + put(buf, &n, g_lc.reply, g_lc.reply_len); + put(buf, &n, "\n", 1); + } else { + put(buf, &n, note_hdr, sizeof note_hdr - 1); + put(buf, &n, g_lc.task, g_lc.task_len); + } + ss_object o = { kind, 1, buf, n }; uint8_t ids[1][32]; int rc = ss_transact(s, &o, 1, 0, 0, ids); if (rc == 0) { @@ -103,6 +136,118 @@ static int commit_task(void) return rc; } +/* Between generation steps the console is polled: a complete line "cancel" + * abandons the request; any other complete line is refused (only cancel is + * accepted while generating). */ +static char g_gen_line[CK_LC_LINE_MAX + 1]; +static size_t g_gen_len; +static int cancel_poll(void) +{ + for (;;) { + int b = ck_console_rx_poll(); + if (b == -1) return 0; + if (b == -2) continue; + char c = (char)b; + if (c == '\r' || c == '\n') { + const char *arg; + size_t arg_len; + enum ck_lc_verb v = g_gen_len ? ck_lc_decode(g_gen_line, g_gen_len, &arg, &arg_len) : CK_LC_V_EMPTY; + g_gen_len = 0; + if (v == CK_LC_V_CANCEL) return 1; + if (v == CK_LC_V_EMPTY) continue; + g_lc.refused++; + ck_printf("lifecycle: REFUSED verb=%s reason=\"generating: only cancel is accepted\"\n", ck_lc_verb_name(v)); + continue; + } + if (c >= 0x20 && c <= 0x7e && g_gen_len < CK_LC_LINE_MAX) g_gen_line[g_gen_len++] = c; + } +} + +/* prompt accepted: the resident model generates a bounded reply, which + * becomes the pending proposal (approve | deny | cancel) exactly like a + * note. Without a resident unit the verb is refused. */ +static void generate(void) +{ + static struct ck_infer_reply r; /* ~0.4 KiB; static keeps it off the EL1 stack */ + static char shown[CK_LC_REPLY_MAX + 1]; + unsigned i; + if (!ck_infer_resident()) { + ck_lc_generate_done(&g_lc, CK_LC_GEN_FAILED, 0, 0); + g_lc.refused++; + ck_printf("lifecycle: REFUSED verb=prompt state=%s reason=\"no inference unit in this image\"\n", + ck_lc_state_name(g_lc.state)); + return; + } + ck_printf("lifecycle: generating prompt=\"%s\" (cancel stops it between steps)\n", g_lc.task); + g_gen_len = 0; + int rc = ck_infer_prompt(g_lc.task, g_lc.task_len, cancel_poll, &r); + if (rc < 0) { + ck_lc_generate_done(&g_lc, CK_LC_GEN_FAILED, 0, 0); + ck_printf("lifecycle: REFUSED verb=prompt rc=%d state=%s reason=\"inference refused the prompt\"\n", rc, + ck_lc_state_name(g_lc.state)); + return; + } + if (r.cancelled) { + ck_lc_generate_done(&g_lc, CK_LC_GEN_CANCELLED, 0, 0); + ck_printf("lifecycle: generation cancelled steps=%u prompt_ids=%u produced=%u us=%llu state=%s\n", r.steps, + r.prompt_ids, r.produced, (unsigned long long)r.us, ck_lc_state_name(g_lc.state)); + return; + } + ck_printf("lifecycle: reply ids="); + for (i = 0; i < r.produced && i < CK_INFER_REPLY_IDS; i++) ck_printf("%s%u", i ? " " : "", r.ids[i]); + ck_printf(" tokens=%u prompt_ids=%u steps=%u us=%llu\n", r.produced, r.prompt_ids, r.steps, (unsigned long long)r.us); + if (r.text_len == 0) { + ck_lc_generate_done(&g_lc, CK_LC_GEN_FAILED, 0, 0); + ck_printf("lifecycle: REFUSED verb=prompt state=%s reason=\"empty reply\"\n", ck_lc_state_name(g_lc.state)); + return; + } + ck_lc_generate_done(&g_lc, CK_LC_GEN_REPLY, (const char *)r.text, r.text_len); + printable(shown, sizeof shown, (const uint8_t *)g_lc.reply, g_lc.reply_len); + ck_printf("lifecycle: reply pending state=%s proposed=\"reply: %s\" (approve | deny | cancel)\n", + ck_lc_state_name(g_lc.state), shown); +} + +/* recall: the newest approved object (note or reply) by Store generation, + * read back through the sealed Store. Nothing in memory is trusted: a cold + * boot answers from the disk. */ +static void recall(void) +{ + static uint8_t body[SS_MAX_PLAINTEXT]; + static char shown[CK_LC_REPLY_OBJ_MAX + 1]; + ss_store *s = store_boot_store(); + if (!s || !ck_store_service_ready()) { + ck_puts("lifecycle: recall REFUSED reason=\"no production Store\"\n"); + return; + } + int best = -1; + uint32_t k; + for (k = 0; k < s->nclaims; k++) { + const ss_claim *c = &s->ws->claims[k]; + if (c->c.obj.object_kind != CK_LC_OBJ_KIND && c->c.obj.object_kind != CK_LC_REPLY_KIND) continue; + if (best < 0 || c->c.store_generation > s->ws->claims[best].c.store_generation || + (c->c.store_generation == s->ws->claims[best].c.store_generation && + c->c.object_sequence > s->ws->claims[best].c.object_sequence)) + best = (int)k; + } + if (best < 0) { + ck_printf("lifecycle: recall none objects=%u\n", (unsigned)s->nclaims); + return; + } + uint8_t sid[32]; + size_t len = 0, i; + uint16_t kind = 0; + for (i = 0; i < 32; i++) sid[i] = s->ws->claims[best].sid[i]; + uint64_t gen = s->ws->claims[best].c.store_generation; + int rc = ss_read(s, sid, body, sizeof body, &len, &kind); + if (rc) { + ck_printf("lifecycle: recall FAIL gen=%llu rc=%d\n", (unsigned long long)gen, rc); + return; + } + printable(shown, sizeof shown, body, len); + ck_printf("lifecycle: recall gen=%llu kind=%s id=%02x%02x%02x%02x bytes=%u text=\"%s\"\n", (unsigned long long)gen, + kind == CK_LC_REPLY_KIND ? "reply" : "note", sid[0], sid[1], sid[2], sid[3], (unsigned)len, shown); +} + static void handle_line(const char *line, size_t len) { const char *arg; @@ -142,6 +287,8 @@ static void handle_line(const char *line, size_t len) case CK_LC_R_STOP: ck_printf("lifecycle: shutdown accepted state=%s\n", ck_lc_state_name(g_lc.state)); return; + case CK_LC_R_GENERATE: generate(); return; + case CK_LC_R_RECALL: recall(); return; case CK_LC_R_OK: break; } switch (v) { @@ -234,7 +381,9 @@ int ck_lifecycle_run(void) } } } - /* Stop order: Store closed, then NVMe released, then the caller resets. */ + /* Stop order: inference session closed (frames returned), Store closed, + * then NVMe released, then the caller resets. */ + ck_infer_resident_close(); int closed = ck_store_service_close(); ck_dev_nvme_release(); ck_lc_stopped(&g_lc); diff --git a/native/kernel/core/lifecycle_fsm.c b/native/kernel/core/lifecycle_fsm.c index c8b1aaff..a20a5706 100644 --- a/native/kernel/core/lifecycle_fsm.c +++ b/native/kernel/core/lifecycle_fsm.c @@ -39,6 +39,10 @@ enum ck_lc_verb ck_lc_decode(const char *line, size_t len, const char **arg, siz if (*arg_len == 0 || *arg_len > CK_LC_TASK_MAX) return CK_LC_V_INVALID; return CK_LC_V_TASK; } + if (word_is(w, n, "prompt")) { + if (*arg_len == 0 || *arg_len > CK_LC_TASK_MAX) return CK_LC_V_INVALID; + return CK_LC_V_PROMPT; + } /* unlock carries the optional recovery secret (the binding checks its * shape and never echoes it); every other verb takes no argument. */ if (word_is(w, n, "unlock")) return CK_LC_V_UNLOCK; @@ -48,6 +52,7 @@ enum ck_lc_verb ck_lc_decode(const char *line, size_t len, const char **arg, siz if (word_is(w, n, "approve")) return CK_LC_V_APPROVE; if (word_is(w, n, "deny")) return CK_LC_V_DENY; if (word_is(w, n, "cancel")) return CK_LC_V_CANCEL; + if (word_is(w, n, "recall")) return CK_LC_V_RECALL; if (word_is(w, n, "evidence")) return CK_LC_V_EVIDENCE; if (word_is(w, n, "shutdown")) return CK_LC_V_SHUTDOWN; return CK_LC_V_UNKNOWN; @@ -68,6 +73,8 @@ const char *ck_lc_verb_name(enum ck_lc_verb v) case CK_LC_V_CANCEL: return "cancel"; case CK_LC_V_EVIDENCE: return "evidence"; case CK_LC_V_SHUTDOWN: return "shutdown"; + case CK_LC_V_PROMPT: return "prompt"; + case CK_LC_V_RECALL: return "recall"; } return "?"; } @@ -110,7 +117,18 @@ static void drop_task(ck_lc *lc) { size_t i; for (i = 0; i < sizeof lc->task; i++) lc->task[i] = 0; + for (i = 0; i < sizeof lc->reply; i++) lc->reply[i] = 0; lc->task_len = 0; + lc->reply_len = 0; + lc->pending = CK_LC_PENDING_NONE; +} + +static void set_task(ck_lc *lc, const char *arg, size_t arg_len) +{ + size_t i; + for (i = 0; i < arg_len; i++) lc->task[i] = arg[i]; + lc->task[arg_len] = 0; + lc->task_len = arg_len; } enum ck_lc_result ck_lc_apply(ck_lc *lc, enum ck_lc_verb v, const char *arg, size_t arg_len) @@ -136,15 +154,22 @@ enum ck_lc_result ck_lc_apply(ck_lc *lc, enum ck_lc_verb v, const char *arg, siz if (lc->state == CK_LC_LOCKED) return refuse(lc, "locked: no production Store"); if (lc->state == CK_LC_SERVE) return refuse(lc, "a task is pending: approve, deny or cancel it first"); if (arg_len == 0 || arg_len > CK_LC_TASK_MAX) return refuse(lc, "task text out of bounds"); - { - size_t i; - for (i = 0; i < arg_len; i++) lc->task[i] = arg[i]; - lc->task[arg_len] = 0; - lc->task_len = arg_len; - } + set_task(lc, arg, arg_len); + lc->pending = CK_LC_PENDING_NOTE; lc->tasks++; lc->state = CK_LC_SERVE; return CK_LC_R_OK; + case CK_LC_V_PROMPT: + if (lc->state == CK_LC_LOCKED) return refuse(lc, "locked: no production Store"); + if (lc->state == CK_LC_SERVE) return refuse(lc, "a task is pending: approve, deny or cancel it first"); + if (arg_len == 0 || arg_len > CK_LC_TASK_MAX) return refuse(lc, "prompt text out of bounds"); + set_task(lc, arg, arg_len); /* the prompt; the reply arrives through ck_lc_generate_done */ + lc->prompts++; + return CK_LC_R_GENERATE; + case CK_LC_V_RECALL: + if (lc->state == CK_LC_LOCKED) return refuse(lc, "locked: no production Store"); + lc->recalls++; + return CK_LC_R_RECALL; case CK_LC_V_APPROVE: if (lc->state != CK_LC_SERVE) return refuse(lc, "nothing pending"); return CK_LC_R_COMMIT; @@ -195,3 +220,21 @@ void ck_lc_stopped(ck_lc *lc) { lc->state = CK_LC_STOP; } + +void ck_lc_generate_done(ck_lc *lc, enum ck_lc_gen outcome, const char *reply, size_t n) +{ + if (lc->state != CK_LC_READY || lc->task_len == 0) return; /* only a READY prompt generates */ + if (outcome == CK_LC_GEN_REPLY && n > 0 && n <= CK_LC_REPLY_MAX) { + size_t i; + for (i = 0; i < n; i++) lc->reply[i] = reply[i]; + lc->reply[n] = 0; + lc->reply_len = n; + lc->pending = CK_LC_PENDING_REPLY; + lc->replies++; + lc->state = CK_LC_SERVE; + return; + } + if (outcome == CK_LC_GEN_CANCELLED) lc->gen_cancelled++; + else lc->gen_failed++; + drop_task(lc); +} diff --git a/native/kernel/core/lifecycle_fsm.h b/native/kernel/core/lifecycle_fsm.h index a25870e7..ce84de00 100644 --- a/native/kernel/core/lifecycle_fsm.h +++ b/native/kernel/core/lifecycle_fsm.h @@ -35,11 +35,16 @@ enum ck_lc_verb { CK_LC_V_CANCEL, CK_LC_V_EVIDENCE, CK_LC_V_SHUTDOWN, + CK_LC_V_PROMPT, /* native v1 P06: bounded generation from the resident model */ + CK_LC_V_RECALL, /* read back the newest approved object from the Store */ }; /* Bounds: one request line, and the task text that a line may carry. */ #define CK_LC_LINE_MAX 96 /* "unlock " + 64 hex = 71 bytes fits */ #define CK_LC_TASK_MAX 48 +#define CK_LC_REPLY_MAX 256 /* generated reply bytes kept for approval (INFER_TEXT_BYTES) */ +/* What is pending in SERVE: an operator note (task) or a generated reply. */ +enum ck_lc_pending { CK_LC_PENDING_NONE = 0, CK_LC_PENDING_NOTE, CK_LC_PENDING_REPLY }; /* Outcome of one request against the state machine. */ enum ck_lc_result { @@ -49,19 +54,25 @@ enum ck_lc_result { CK_LC_R_COMMIT, /* approve accepted: the binding must commit the task */ CK_LC_R_UNLOCK, /* unlock accepted: the binding must try the key source */ CK_LC_R_STOP, /* shutdown accepted: the binding must run the stop order */ + CK_LC_R_GENERATE, /* prompt accepted: the binding must generate (task holds the prompt) */ + CK_LC_R_RECALL, /* recall accepted: the binding must read the newest approved object */ }; typedef struct { enum ck_lc_state state; - char task[CK_LC_TASK_MAX + 1]; /* pending task text in SERVE, else "" */ + char task[CK_LC_TASK_MAX + 1]; /* pending note text, or the prompt of a pending reply, in SERVE; else "" */ size_t task_len; + char reply[CK_LC_REPLY_MAX + 1]; /* generated reply awaiting approval (pending == REPLY), else "" */ + size_t reply_len; + enum ck_lc_pending pending; /* counters for the evidence verb (bounded, wrap is harmless) */ uint32_t requests, refused, invalid, tasks, approved, denied, cancelled; + uint32_t prompts, replies, gen_cancelled, gen_failed, recalls; const char *reason; /* last refusal reason, static string */ } ck_lc; /* Decode one request line (len bytes, no terminator required). arg and arg_len - * receive the text after "task" (trimmed), else an empty span. */ + * receive the text after "task" or "prompt" (trimmed), else an empty span. */ enum ck_lc_verb ck_lc_decode(const char *line, size_t len, const char **arg, size_t *arg_len); const char *ck_lc_verb_name(enum ck_lc_verb v); const char *ck_lc_state_name(enum ck_lc_state s); @@ -76,6 +87,12 @@ enum ck_lc_result ck_lc_apply(ck_lc *lc, enum ck_lc_verb v, const char *arg, siz * with reason), unlock outcome (1 opened: LOCKED -> READY). */ void ck_lc_commit_done(ck_lc *lc, int rc); void ck_lc_unlock_done(ck_lc *lc, int opened); +/* Generation outcome after CK_LC_R_GENERATE: a reply of n bytes (1..CK_LC_REPLY_MAX) + * becomes the pending proposal (READY -> SERVE, replies++); cancelled (the + * operator typed cancel between steps) or failed/refused (n == 0) drops the + * prompt and stays READY with the counter named by the outcome. */ +enum ck_lc_gen { CK_LC_GEN_REPLY = 0, CK_LC_GEN_CANCELLED, CK_LC_GEN_FAILED }; +void ck_lc_generate_done(ck_lc *lc, enum ck_lc_gen outcome, const char *reply, size_t n); void ck_lc_stopped(ck_lc *lc); #endif diff --git a/native/kernel/include/ck.h b/native/kernel/include/ck.h index 610f9248..9efc5d69 100644 --- a/native/kernel/include/ck.h +++ b/native/kernel/include/ck.h @@ -219,6 +219,31 @@ int ck_console_rx_ready(uint32_t *cr); int ck_console_rx_poll(void); unsigned ck_console_rx_errors(void); +/* Resident inference (core/infer.c, native v1 P06): a CK_SERVICE image built + * with CK_INFER_LIB keeps the ingested model and one bounded session open + * from boot to the lifecycle stop order. ck_infer_resident: 1 when a session + * is open. ck_infer_prompt: chat-templates `text`, steps to the reply's end + * (EOT or max_new) calling cancel_poll() between steps (1 = abandon the + * request); 0 on a completed or cancelled request (r filled), negative on a + * refusal (session codes: -12 no session, -16 prompt over max_prompt_bytes, + * -8 longer than the cache, -15 heap reserve). ck_infer_resident_close: + * closes the session and returns every frame (prints the unloaded line). + * Images without the unit: resident 0, prompt -12, close a no-op. */ +#define CK_INFER_REPLY_IDS 16 +#define CK_INFER_REPLY_TEXT 256 +struct ck_infer_reply { + uint32_t ids[CK_INFER_REPLY_IDS]; + uint32_t prompt_ids, produced, steps; + int cancelled; + int32_t rc; + uint64_t us; + uint8_t text[CK_INFER_REPLY_TEXT]; + uint32_t text_len; +}; +int ck_infer_resident(void); +int ck_infer_prompt(const char *text, size_t len, int (*cancel_poll)(void), struct ck_infer_reply *r); +void ck_infer_resident_close(void); + /* Optional Store-stage hook: signed P2 artifact candidates read from the boot * disk Store (svc/artifact_store.c) during ck_stage_store, before the NVMe * release. The bytes are UNTRUSTED: the core loader verifies them exactly as diff --git a/native/kernel/tests/test_lifecycle.c b/native/kernel/tests/test_lifecycle.c index 5dcdeef5..88fdb7dc 100644 --- a/native/kernel/tests/test_lifecycle.c +++ b/native/kernel/tests/test_lifecycle.c @@ -28,6 +28,10 @@ int main(void) CHECK(dec("unlock deadbeef ", &a, &al) == CK_LC_V_UNLOCK && al == 8 && memcmp(a, "deadbeef", 8) == 0); CHECK(CK_LC_LINE_MAX >= 7 + 64); /* "unlock " + a 64-hex recovery secret fits in one line */ CHECK(dec("frobnicate", &a, &al) == CK_LC_V_UNKNOWN); + CHECK(dec("prompt hi", &a, &al) == CK_LC_V_PROMPT && al == 2 && memcmp(a, "hi", 2) == 0); + CHECK(dec("prompt", &a, &al) == CK_LC_V_INVALID); /* prompt needs text */ + CHECK(dec("recall", &a, &al) == CK_LC_V_RECALL && al == 0); + CHECK(dec("recall x", &a, &al) == CK_LC_V_INVALID); /* no argument allowed */ CHECK(dec("sta\x01tus", &a, &al) == CK_LC_V_INVALID); /* unprintable */ { char big[CK_LC_LINE_MAX + 2]; @@ -84,5 +88,62 @@ int main(void) ck_lc_commit_done(&lc, 0); /* ignored outside SERVE */ CHECK(lc.approved == 1); CHECK(lc.requests == 14); + + /* P06: prompt and recall. Locked: both refused, nothing counted. */ + ck_lc_init(&lc); + ck_lc_start(&lc, 0); + CHECK(req(&lc, "prompt hi") == CK_LC_R_REFUSED && lc.prompts == 0 && strstr(lc.reason, "locked")); + CHECK(req(&lc, "recall") == CK_LC_R_REFUSED && lc.recalls == 0 && lc.refused == 2); + /* ready: prompt asks the kernel to generate (state stays READY, the + * prompt is the task text); the reply becomes the pending proposal */ + ck_lc_init(&lc); + ck_lc_start(&lc, 1); + CHECK(req(&lc, "prompt What is the capital of France?") == CK_LC_R_GENERATE && lc.state == CK_LC_READY && lc.prompts == 1); + CHECK(strcmp(lc.task, "What is the capital of France?") == 0 && lc.task_len == 30 && lc.pending == CK_LC_PENDING_NONE); + ck_lc_generate_done(&lc, CK_LC_GEN_REPLY, "Paris.", 6); + CHECK(lc.state == CK_LC_SERVE && lc.pending == CK_LC_PENDING_REPLY && lc.replies == 1); + CHECK(lc.reply_len == 6 && strcmp(lc.reply, "Paris.") == 0 && strcmp(lc.task, "What is the capital of France?") == 0); + CHECK(req(&lc, "prompt again") == CK_LC_R_REFUSED && lc.state == CK_LC_SERVE && lc.prompts == 1); /* one proposal at a time */ + CHECK(req(&lc, "task note") == CK_LC_R_REFUSED && lc.tasks == 0); + CHECK(req(&lc, "approve") == CK_LC_R_COMMIT && lc.pending == CK_LC_PENDING_REPLY); + ck_lc_commit_done(&lc, 0); + CHECK(lc.state == CK_LC_READY && lc.approved == 1 && lc.pending == CK_LC_PENDING_NONE); + CHECK(lc.reply_len == 0 && lc.reply[0] == 0 && lc.task_len == 0 && lc.task[0] == 0); + /* cancelled between steps: nothing pending, counted apart from `cancel` of a proposal */ + CHECK(req(&lc, "prompt Say hello.") == CK_LC_R_GENERATE); + ck_lc_generate_done(&lc, CK_LC_GEN_CANCELLED, 0, 0); + CHECK(lc.state == CK_LC_READY && lc.gen_cancelled == 1 && lc.cancelled == 0 && lc.task_len == 0 && lc.pending == CK_LC_PENDING_NONE); + /* failed, empty and overlong replies: nothing pending, gen_failed counts */ + CHECK(req(&lc, "prompt Say hello.") == CK_LC_R_GENERATE); + ck_lc_generate_done(&lc, CK_LC_GEN_FAILED, 0, 0); + CHECK(lc.state == CK_LC_READY && lc.gen_failed == 1 && lc.task_len == 0); + CHECK(req(&lc, "prompt x") == CK_LC_R_GENERATE); + ck_lc_generate_done(&lc, CK_LC_GEN_REPLY, "", 0); + CHECK(lc.state == CK_LC_READY && lc.gen_failed == 2); + { + char big[CK_LC_REPLY_MAX + 2]; + memset(big, 'r', sizeof big - 1); big[sizeof big - 1] = 0; + CHECK(req(&lc, "prompt x") == CK_LC_R_GENERATE); + ck_lc_generate_done(&lc, CK_LC_GEN_REPLY, big, CK_LC_REPLY_MAX + 1); + CHECK(lc.state == CK_LC_READY && lc.gen_failed == 3 && lc.reply_len == 0); + CHECK(req(&lc, "prompt x") == CK_LC_R_GENERATE); + ck_lc_generate_done(&lc, CK_LC_GEN_REPLY, big, CK_LC_REPLY_MAX); /* exactly the bound fits */ + CHECK(lc.state == CK_LC_SERVE && lc.reply_len == CK_LC_REPLY_MAX && lc.replies == 2); + } + /* a reply arriving with no prompt pending is ignored (kernel-internal misuse) */ + CHECK(req(&lc, "deny") == CK_LC_R_OK && lc.state == CK_LC_READY && lc.denied == 1 && lc.reply_len == 0); + ck_lc_generate_done(&lc, CK_LC_GEN_REPLY, "stray", 5); + CHECK(lc.state == CK_LC_READY && lc.replies == 2 && lc.pending == CK_LC_PENDING_NONE); + /* recall is answered in READY and in SERVE and never changes the state */ + CHECK(req(&lc, "recall") == CK_LC_R_RECALL && lc.recalls == 1 && lc.state == CK_LC_READY); + CHECK(req(&lc, "task n") == CK_LC_R_OK && req(&lc, "recall") == CK_LC_R_RECALL && lc.recalls == 2); + CHECK(lc.state == CK_LC_SERVE && lc.pending == CK_LC_PENDING_NOTE); + /* shutdown drops a pending reply, never commits it; then everything is refused */ + CHECK(req(&lc, "cancel") == CK_LC_R_OK && req(&lc, "prompt z") == CK_LC_R_GENERATE); + ck_lc_generate_done(&lc, CK_LC_GEN_REPLY, "zz", 2); + CHECK(lc.state == CK_LC_SERVE && req(&lc, "shutdown") == CK_LC_R_STOP); + CHECK(lc.state == CK_LC_QUIESCE && lc.reply_len == 0 && lc.task_len == 0 && lc.pending == CK_LC_PENDING_NONE); + CHECK(req(&lc, "prompt q") == CK_LC_R_REFUSED && req(&lc, "recall") == CK_LC_R_REFUSED); + CHECK(lc.requests == 18 && lc.prompts == 7 && lc.refused == 4 && lc.approved == 1); return ck_t_verdict("CK_LIFECYCLE"); } diff --git a/scripts/qemu_ck_lifecycle_test.sh b/scripts/qemu_ck_lifecycle_test.sh index e1c99f08..fe40d209 100755 --- a/scripts/qemu_ck_lifecycle_test.sh +++ b/scripts/qemu_ck_lifecycle_test.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash -# LIFECYCLE gate for the AIENOS C kernel (native v1 plan P03 + P04 cut 1): rows -# 160-170 of native/kernel/GATES.md "LIFECYCLE resident production lifecycle". C-only. +# LIFECYCLE gate for the AIENOS C kernel (native v1 plan P03 + P04 cut 1 + P05 +# cut 1 + P06 cut 2): rows 160-176 of native/kernel/GATES.md "LIFECYCLE resident +# production lifecycle". C-only. # QEMU is not hardware: a PASS here qualifies nothing physical. # # Boots two CK_SERVICE images in QEMU AArch64 (AAVMF, NVMe disk, iommu=smmuv3), @@ -61,6 +62,24 @@ # row 173 shape: the locked boot prints no continuity line; the test-keys image # provisions before `Store open`; the service image carries the # production continuity layer and no TEST mode selection (AIENCONT) +# row 174 P06 cut 2 (boot 5, test-keys image built with CK_INFER_LIB, model over +# the TEST-ONLY fw_cfg channel, -m 4096): the model and one bounded +# session are resident from boot (`infer: resident open rc=0`, before +# `lifecycle: ready`); `prompt What is the capital of France?` generates +# the golden reply (ids 791 6864 315 9822 374 12366 13 128009, 17 +# prompt ids, 25 steps) which becomes the pending proposal; `approve` +# commits it as one sealed reply object (kind 'R1') +# row 175 `prompt Say hello.` then `cancel` stops generation between steps +# (steps >= 1, produced 0, state ready, nothing pending); `recall` reads +# the newest approved object back through the sealed Store (kind=reply, +# the prompt and "The capital of France is Paris."); boot 6 (same +# disk, cold boot): continuity RESUMED, `recall` answers from the disk +# row 176 evidence counters (prompts=2 replies=1 gen_cancelled=1 gen_failed=0 +# inference=resident); stop order: `infer: resident close` and +# `infer: unloaded` (every frame returned) before the stop order line; +# QEMU exit 0; M1 checks. Separate verdict AIENOS_CK_LIFECYCLE_INFER: +# NOT_RUN (never a silent pass) when the model file, cargo or the Rust +# target aarch64-unknown-none is missing; TCG needs ~25 min for it # build the default (diagnostic) image carries no lifecycle; CK_SERVICE is # refused with CK_CONSOLE_SESSION, CK_QEMU_UNSAFE_DMA and a CK_TEST_* # flag; CK_SERVICE_TEST_KEYS is refused with CK_HARDWARE_STAGING @@ -91,7 +110,7 @@ testkeys_efi="${out}/full-service-testkeys/BOOTAA64.EFI" . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/lib_gate_hold.sh" if ! gh_quiet_check; then echo "NOT_RUN ${gh_why}"; echo "${final_tag}: NOT_RUN (quiet flag held)"; exit 3; fi -if ! gh_lock_take qemu_ck_lifecycle_test "${AIENOS_GATE_MINUTES:-40}"; then echo "NOT_RUN ${gh_why}"; echo "${final_tag}: NOT_RUN (QEMU gate lock held)"; exit 3; fi +if ! gh_lock_take qemu_ck_lifecycle_test "${AIENOS_GATE_MINUTES:-75}"; then echo "NOT_RUN ${gh_why}"; echo "${final_tag}: NOT_RUN (QEMU gate lock held)"; exit 3; fi top="$(mktemp -d)" qemu_pid="" drain_pid="" @@ -106,6 +125,9 @@ trap cleanup EXIT source "${repo_root}/scripts/lib_ck_m1_checks.sh" boot_timeout="${AIENOS_QEMU_TIMEOUT:-600}" +boot_to="${boot_timeout}" # per boot; the inference boots raise it +boot_mem=2048 # MiB; the inference boots need the model in RAM +boot_extra=() # extra QEMU arguments (the fw_cfg model channel) fail=0 ok() { echo "ROW $1 PASS $2"; } bad() { echo "ROW $1 FAIL $2"; fail=1; } @@ -137,8 +159,8 @@ boot() { # name efi driver [nvme.img to reuse] if [[ -n "${4:-}" ]]; then cp "$4" "${work}/nvme.img"; else "${gpt_tool}" create "${work}/nvme.img" 512 64 aienos-middle >/dev/null; fi mkfifo "${work}/ser.in" "${work}/ser.out" : >"${work}/serial.log" - timeout "${boot_timeout}" qemu-system-aarch64 \ - -M virt,virtualization=on,gic-version=3,iommu=smmuv3 -accel tcg,thread=single -cpu max -smp 4 -m 2048 \ + timeout "${boot_to}" qemu-system-aarch64 \ + -M virt,virtualization=on,gic-version=3,iommu=smmuv3 -accel tcg,thread=single -cpu max -smp 4 -m "${boot_mem}" \ -drive if=pflash,format=raw,readonly=on,file="${code_fd}" \ -drive if=pflash,format=raw,file="${work}/vars.fd" \ -drive if=none,id=esp,format=raw,file=fat:rw:"${work}/esp" \ @@ -146,12 +168,12 @@ boot() { # name efi driver [nvme.img to reuse] -drive if=none,id=nvme0,format=raw,file="${work}/nvme.img" \ -device nvme,drive=nvme0,serial=aienos-lifecycle-test \ -device ramfb -display none -nic none -monitor none \ - -chardev pipe,id=ser,path="${work}/ser" -serial chardev:ser -no-reboot 2>"${work}/qemu.err" & + -chardev pipe,id=ser,path="${work}/ser" -serial chardev:ser -no-reboot "${boot_extra[@]}" 2>"${work}/qemu.err" & qemu_pid=$! cat "${work}/ser.out" >>"${work}/serial.log" & drain_pid=$! exec 4>"${work}/ser.in" - if wait_for "${boot_timeout}" '^lifecycle: ready state=' '^report_kind: (panic|fault|final)' && serial_has '^lifecycle: ready state='; then + if wait_for "${boot_to}" '^lifecycle: ready state=' '^report_kind: (panic|fault|final)' && serial_has '^lifecycle: ready state='; then sleep 1 "$3" fi @@ -190,6 +212,25 @@ drive_unlock() { ser_line evidence ser_line shutdown } +# P06 cut 2: the resident model answers a prompt, the reply is approved and +# committed, a second prompt is cancelled between steps, recall reads the disk. +infer_wait="${AIENOS_QEMU_INFER_WAIT:-1800}" +drive_infer() { + ser_line status + ser_line "prompt What is the capital of France?" + wait_for "${infer_wait}" '^lifecycle: (reply pending|generation cancelled|REFUSED verb=prompt)' '^report_kind: (panic|fault|final)' || true + ser_line approve; ser_wait '^lifecycle: (approve committed|REFUSED verb=approve)' + ser_line "prompt Say hello." + sleep 5 + ser_line cancel + wait_for 900 '^lifecycle: (generation cancelled|reply pending|REFUSED verb=prompt)' '^report_kind: (panic|fault|final)' || true + ser_line evidence + ser_line recall + ser_line shutdown +} +drive_infer_recall() { + ser_line status; ser_line recall; ser_line evidence; ser_line shutdown +} drive_relock() { ser_line "unlock ${secret_bad}"; ser_wait '^(lifecycle: unlock ok|lifecycle: REFUSED verb=unlock)' ser_line status @@ -227,7 +268,7 @@ rcheck 161 "task refused while locked" '^lifecycle: REFUSED verb=task state=lock rcheck 161 "unlock refused, still locked" '^lifecycle: REFUSED verb=unlock state=locked reason="production key source refused: still locked"' rcheck 161 "unlock asked the production key source again" '^store: unlock REFUSED proof=keyed step="production Store key source" rc=-2002' rcheck 161 "status answered" '^lifecycle: state=locked store=locked pending=- requests=' -rcheck 161 "help answered" '^lifecycle: verbs: status unlock \[<64-hex recovery secret>\] task approve deny cancel evidence help shutdown$' +rcheck 161 "help answered" '^lifecycle: verbs: status unlock \[<64-hex recovery secret>\] task prompt approve deny cancel recall evidence help shutdown$' rcheck 161 "evidence answered" '^lifecycle: evidence requests=5 refused=2 invalid=0 tasks=0 approved=0' rcheck 162 "stop order with no Store" '^lifecycle: stop order store=was-locked nvme=released state=stop requests=6$' before 162 "locked lifecycle ready < NVMe revoke (revoke only at the stop order)" '^lifecycle: ready state=locked' '^dma_gate: nvme bus master revoked' @@ -254,7 +295,7 @@ rcheck 165 "approve with nothing pending refused" '^lifecycle: REFUSED verb=appr rcheck 165 "deny drops" '^lifecycle: denied state=ready$' rcheck 165 "cancel drops" '^lifecycle: cancelled state=ready$' rcheck 166 "overlong line refused whole" '^lifecycle: REFUSED verb=invalid reason="line longer than 96 bytes"$' -rcheck 166 "evidence counts" '^lifecycle: evidence requests=10 refused=2 invalid=0 tasks=3 approved=1 denied=1 cancelled=1 overlong=1 last_commit_gen=[0-9]+ last_id=[0-9a-f]{8}$' +rcheck 166 "evidence counts" '^lifecycle: evidence requests=10 refused=2 invalid=0 tasks=3 approved=1 denied=1 cancelled=1 overlong=1 last_commit_gen=[0-9]+ last_id=[0-9a-f]{8} prompts=0 replies=0 gen_cancelled=0 gen_failed=0 recalls=0 inference=none$' rcheck 167 "stop order closed the Store" '^lifecycle: stop order store=closed nvme=released state=stop requests=11$' before 167 "lifecycle ready < NVMe revoke (revoke only at the stop order)" '^lifecycle: ready state=ready' '^dma_gate: nvme bus master revoked' before 167 "NVMe revoke < stop order line" '^dma_gate: nvme bus master revoked' '^lifecycle: stop order store=closed' @@ -321,8 +362,81 @@ m1 169 rabsent 170 "secret hex never in the serial log (resume boot)" "${secret_ok}" rabsent 170 "wrong secret hex never in the serial log" "${secret_bad}" +# --- boots 5 and 6: test-keys image with the resident inference session (P06 cut 2) --- +infer_tag="AIENOS_CK_LIFECYCLE_INFER" +infer_boots="" +model="${AIENOS_MODEL:-${HOME}/models/aien-mail/Llama-3.2-1B-Instruct-Q4_K_M.gguf}" +infer_notrun="" +[[ -r "${model}" ]] || infer_notrun="model file ${model} missing" +[[ -n "${infer_notrun}" ]] || command -v cargo >/dev/null || infer_notrun="cargo not installed" +if [[ -z "${infer_notrun}" ]] && { ! rustc --print target-list 2>/dev/null | grep -qx aarch64-unknown-none \ + || ! [[ -d "$(rustc --print sysroot)/lib/rustlib/aarch64-unknown-none/lib" ]]; }; then + infer_notrun="Rust target aarch64-unknown-none not installed (rustup target add aarch64-unknown-none)" +fi +[[ -z "${AIENOS_LIFECYCLE_SKIP_INFER:-}" ]] || infer_notrun="AIENOS_LIFECYCLE_SKIP_INFER set" +if [[ -n "${infer_notrun}" ]]; then + echo "${infer_tag}: NOT_RUN (${infer_notrun})" +else + fail_before_infer="${fail}" + lib="${repo_root}/target/infer-kernel/aarch64-unknown-none/release/libaienos_infer_kernel.a" + CARGO_TARGET_DIR="${repo_root}/target/infer-kernel" cargo build -q --release --target aarch64-unknown-none \ + --manifest-path crates/aienos-infer-kernel/Cargo.toml + out_infer="${out}-lifecycle-infer" # own OUT: same FULL_NAME as the plain test-keys image + make -s -C native/kernel CROSS="${cross}" OUT="${out_infer}" AIENOS_COMMIT="${commit}" full CK_SERVICE=1 CK_SERVICE_TEST_KEYS=1 CK_INFER_LIB="${lib}" >/dev/null + infer_efi="${out_infer}/full-service-testkeys/BOOTAA64.EFI" + if grep -aqF "infer: resident open" "${infer_efi}" && ! grep -aqF "infer: resident open" "${testkeys_efi}"; then ok 174 "only the CK_INFER_LIB service image carries the resident session"; else bad 174 "resident session shape wrong (missing from the inference image, or present in the plain test-keys image)"; fi + re_open='^infer: resident open rc=0 tensors=147 vocab=128256 layers=16 kv_capacity=64 max_new=16 max_prompt_bytes=256 heap_reserve_kib=64 heap_used_kib=[0-9]+ open_us=[0-9]+$' + re_recall='^lifecycle: recall gen=[0-9]+ kind=reply id=[0-9a-f]{8} bytes=[0-9]+ text="aienos\.reply\.v1.prompt: What is the capital of France\?.reply: The capital of France is Paris\.' + frames_kept() { # row label: the unload line returned every frame (free after = free before) + local l b a; l="$(grep -E -m1 '^infer: unloaded ' "${work}/serial.txt" || true)" + b="$(sed -nE 's/.* frames_free_before=([0-9]+).*/\1/p' <<<"${l}")"; a="$(sed -nE 's/.* frames_free_after=([0-9]+).*/\1/p' <<<"${l}")" + if [[ -n "${b}" && "${b}" == "${a}" ]] && grep -qE '^infer: unloaded .* rc=0,0$' <<<"${l}"; then ok "$1" "$2 (${b} = ${a})"; else bad "$1" "$2 (before=${b:-none} after=${a:-none})"; fi; } + boot_to="${AIENOS_QEMU_INFER_TIMEOUT:-2700}"; boot_mem=4096; boot_extra=(-fw_cfg "name=opt/aienos/model,file=${model}") + boot infer "${infer_efi}" drive_infer + infer_boots="infer" + rcheck 174 "TEST-ONLY fw_cfg model source declared" '^infer_source_mode: TEST-ONLY QEMU fw_cfg model ingest' + rcheck 174 "resident session open with the declared limits" "${re_open}" + before 174 "resident open < lifecycle ready" '^infer: resident open rc=0' '^lifecycle: ready state=ready store=open' + rcheck 174 "TEST-ONLY banner" '^lifecycle: TEST-ONLY service image' + rcheck 174 "generating line" '^lifecycle: generating prompt="What is the capital of France\?" \(cancel stops it between steps\)$' + rcheck 174 "golden reply ids (17 prompt ids, 25 steps)" '^lifecycle: reply ids=791 6864 315 9822 374 12366 13 128009 tokens=8 prompt_ids=17 steps=25 us=[0-9]+$' + rcheck 174 "reply is the pending proposal" '^lifecycle: reply pending state=serve proposed="reply: The capital of France is Paris\.\??" \(approve \| deny \| cancel\)$' + rcheck 174 "approve committed the reply object" '^lifecycle: approve committed gen=[0-9]+ id=[0-9a-f]{8} state=ready$' + rcheck 175 "second prompt cancelled between steps (produced 0, nothing pending)" '^lifecycle: generation cancelled steps=[1-9][0-9]* prompt_ids=[0-9]+ produced=0 us=[0-9]+ state=ready$' + rabsent 175 "the cancel was not refused" '^lifecycle: REFUSED verb=cancel' + rabsent 175 "no prompt refused" '^lifecycle: REFUSED verb=prompt' + rcheck 175 "recall (same boot) reads the reply back through the sealed Store" "${re_recall}" + rcheck 176 "evidence counters" '^lifecycle: evidence requests=5 refused=0 invalid=0 tasks=0 approved=1 denied=0 cancelled=0 overlong=0 last_commit_gen=[0-9]+ last_id=[0-9a-f]{8} prompts=2 replies=1 gen_cancelled=1 gen_failed=0 recalls=0 inference=resident$' + rcheck 176 "resident close" '^infer: resident close rc=0 heap_used_kib=[0-9]+ heap_peak_kib=[0-9]+$' + frames_kept 176 "unload returned every frame" + before 176 "resident close < unload line" '^infer: resident close rc=0' '^infer: unloaded ' + before 176 "unload line < stop order" '^infer: unloaded ' '^lifecycle: stop order store=closed' + rcheck 176 "stop order closed the Store" '^lifecycle: stop order store=closed nvme=released state=stop requests=7$' + before 176 "stop order < stage result" '^lifecycle: stop order store=closed' '^stage lifecycle: ok rc=0$' + rabsent 176 "no panic or fault" '^report_kind: (panic|fault)' + if [[ "${qemu_status}" == 0 ]]; then ok 176 "QEMU exit 0"; else bad 176 "QEMU exit ${qemu_status}"; fi + m1 176 + infer_img="${top}/infer/nvme.img" + # boot 6: same disk, cold boot; recall answers from the disk, nothing in memory + boot_to="${AIENOS_QEMU_INFER_TIMEOUT:-2700}"; boot_mem=4096 + boot infer-recall "${infer_efi}" drive_infer_recall "${infer_img}" + infer_boots="infer infer-recall" + boot_to="${boot_timeout}"; boot_mem=2048; boot_extra=() + rcheck 175 "cold boot: resident session open again" "${re_open}" + rcheck 175 "cold boot: continuity RESUMED on the same disk" '^continuity: RESUMED agent=[0-9a-f]{64} incarnation=2 ' + rabsent 175 "cold boot: no second genesis" '^continuity: PROVISIONED' + rcheck 175 "cold boot: recall returns the approved reply from the disk" "${re_recall}" + rcheck 175 "cold boot: evidence shows one recall, no prompt" '^lifecycle: evidence requests=3 refused=0 invalid=0 tasks=0 approved=0 denied=0 cancelled=0 overlong=0 last_commit_gen=0 last_id=00000000 prompts=0 replies=0 gen_cancelled=0 gen_failed=0 recalls=1 inference=resident$' + frames_kept 175 "cold boot: unload returned every frame" + rcheck 175 "cold boot: stop order closed the Store" '^lifecycle: stop order store=closed nvme=released state=stop requests=4$' + rabsent 175 "cold boot: no panic or fault" '^report_kind: (panic|fault)' + if [[ "${qemu_status}" == 0 ]]; then ok 175 "cold boot: QEMU exit 0"; else bad 175 "cold boot: QEMU exit ${qemu_status}"; fi + m1 175 + if [[ "${fail}" == "${fail_before_infer}" ]]; then echo "${infer_tag}: PASS (QEMU only; hardware NOT_RUN)"; else echo "${infer_tag}: FAIL"; fi +fi + if [[ "${fail}" != 0 || -n "${AIENOS_QEMU_VERBOSE:-}" ]]; then - for b in service testkeys unlock relock; do echo "---- ${b} serial (lifecycle lines) ----"; grep -E '^(lifecycle|store|continuity|allen|stage lifecycle|dma_gate|smmu: nvme|report_kind|mm_usage)' "${top}/${b}/serial.txt" | head -60 || true; done + for b in service testkeys unlock relock ${infer_boots}; do echo "---- ${b} serial (lifecycle lines) ----"; grep -E '^(lifecycle|store|continuity|allen|infer|stage lifecycle|dma_gate|smmu: nvme|report_kind|mm_usage)' "${top}/${b}/serial.txt" | head -80 || true; done fi if [[ "${fail}" == 0 ]]; then echo "${final_tag}: PASS (QEMU only; hardware NOT_RUN)"; exit 0; fi echo "${final_tag}: FAIL"; exit 1 From 491d2f59e36e6913627cbffe21b64672698960f1 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Mon, 12 Oct 2026 02:56:19 -0500 Subject: [PATCH 2/4] native v1 P06 cut 2: open the resident session after the store stage The lifecycle gate's unload check (free frames at close == free frames at open) failed by exactly the 4 NVMe queue frames: the resident session opened before the store stage bound the NVMe for the service lifetime and closed before the stop order released it. A CK_INFER_RESIDENT image now opens the session after the store stage (before the lifecycle), so the accounting brackets only the session's own frames. Probe builds unchanged. Co-Authored-By: Claude Fable 5.1 --- native/kernel/core/kmain.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/native/kernel/core/kmain.c b/native/kernel/core/kmain.c index 079f87a2..d915d276 100644 --- a/native/kernel/core/kmain.c +++ b/native/kernel/core/kmain.c @@ -229,8 +229,14 @@ static __attribute__((noreturn)) void ck_el1_main(void *arg) /* One FP/SIMD-enabled Rust unit (core/fpu.c), probe build only. */ ck_fpu_run(); - /* Ingest the GGUF over fw_cfg and call the Rust inference unit (core/infer.c), probe build only. */ + /* Ingest the GGUF over fw_cfg and call the Rust inference unit (core/infer.c), probe build only. + * A CK_INFER_RESIDENT service image opens the session after the store + * stage instead (below), so the session's frame accounting (free frames + * at open == free frames at close) brackets only its own allocations and + * not the NVMe queues the store stage binds for the service lifetime. */ +#ifndef CK_INFER_RESIDENT ck_infer_run(); +#endif /* M3 isolation checks (core/m3.c), before any stage registers an IRQ. */ ck_m3_run(); @@ -243,6 +249,11 @@ static __attribute__((noreturn)) void ck_el1_main(void *arg) * stage: its default candidate source is the boot disk Store, read by that * stage before the NVMe DMA revoke. No stage registers an IRQ. */ ck_artifact_run(); +#ifdef CK_INFER_RESIDENT + /* Resident inference session for the lifecycle (core/infer.c): model + * ingest and session open after the store stage, before the lifecycle. */ + ck_infer_run(); +#endif struct ck_mm_usage mu; ck_mm_usage(&mu); ck_printf("mm_usage: stack_bytes=%llu stack_used=%llu heap_bytes=%llu heap_free=%llu heap_min_free=%llu\n", From 620210ed8651c274e7f13efd78d836b9d567f9f0 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Mon, 12 Oct 2026 03:30:56 -0500 Subject: [PATCH 3/4] native v1 P06 cut 2 (aienos): record the QEMU lifecycle gate result (rows 174-176) Co-Authored-By: Claude Fable 5.1 --- native/kernel/GATES.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/native/kernel/GATES.md b/native/kernel/GATES.md index 26896fa3..a533d614 100644 --- a/native/kernel/GATES.md +++ b/native/kernel/GATES.md @@ -854,8 +854,8 @@ The product boundary. A `CK_SERVICE=1` image (`full-service/`, allowed with `CK_ | 171 | P05 cut 1, production continuity GENESIS (unlock boot, after `store: unlock ok`): `svc/continuity_service.c` (linked only into `CK_SERVICE` images; the TEST-ONLY mode selection `continuity_boot.c`, the `AIENCONT` plan line and the Recovery Core are not) finds the Store unprovisioned and mints the identity (AgentRoot, genesis AgentState, Manifest incarnation 1) and the ALLEN subject (kind 24, sequence 1) in ONE sealed transaction (`svc/continuity_subject_provision.c`, generation 3) with entropy from the kernel RNDR service: `continuity: genesis source=qualification provenance=store-uuid-only`, `continuity: PROVISIONED agent=<64 hex> incarnation=1 sequence=1 cortex=0 branches=1`, `allen: GENESIS subject=<64 hex> sequence=1 lineage=<64 hex> intents=0 active=0 knowledge=0`; order `unlock ok` < `PROVISIONED` < `lifecycle: unlock ok`; `status` reports `continuity=provisioned agent=<16 hex> incarnation=1 subject_seq=1`. Genesis inputs are public and deterministic: provenance = SHA-256("AIENOS/ALLEN/PROVENANCE-V1" \|\| owner root public key (hardware staging image) \|\| store uuid), cortex lineage = SHA-256("AIENOS/ALLEN/CORTEX-LINEAGE-V1" \|\| store uuid): the Cortex of this subject is the sealed Store on this disk (CURRENT_EXECUTION_PLAN addendum, conflict 3). A hardware staging service image uses `source=operator` and the owner root key (`ck_owner_root_pk`) | LIFECYCLE / M4_CONTINUITY / M4_ALLEN | QEMU PASS (hardware NOT_RUN) | | 172 | P05 cut 1, production continuity RESUME (relock boot, cold start of the same disk): the ALLEN subject is restored read-only first (`allen: RESTORED ... sequence=1`; absent, corrupt, forked or foreign: REFUSED, nothing written, never minted over), then `cr_resume` commits incarnation 2 (generation 6): `continuity: RESUMED agent= incarnation=2 sequence=2 cortex=0 branches=1`; no second genesis, no degraded mount; order `unlock ok` < `RESUMED` < `lifecycle: unlock ok`; `status` reports `continuity=resumed ... incarnation=2 subject_seq=1`; after the wrong secret `status` reports `continuity=none`. Host rig (`stage_test` `test_continuity_service`): provisioned at generation 3, resumed at incarnation 2 then 3 on the same agent, an entropy refusal on a fresh Store leaves the disk byte-identical and the state `refused` (not writable) | LIFECYCLE / M4_CONTINUITY / M4_ALLEN | QEMU PASS (hardware NOT_RUN) | | 173 | shape and refusal path: the locked service boot prints no `continuity:` or `allen:` line (nothing runs before the Store opens); the test-keys image provisions at boot before `store: service lifetime: Store open`; the service EFI carries `continuity: REFUSED` and neither `AIENCONT` nor `RECOVERY_OPERATOR_KEY` (Makefile `cont_check` for `CK_SERVICE` images: `cr_provision`/`cr_resume` allowed, `ck_cont_boot_stage`/`rc_inspect` and the uppercase `CONTINUITY: ` markers refused; the markers are fenced out of `continuity_commit.c` under `CK_SERVICE`). A refusal (`continuity: REFUSED step=... outcome=... store_rc=...`) erases the Store keys, leaves the disk as found and keeps the lifecycle LOCKED with the NVMe bound for the stop order (`store: service lifetime: continuity REFUSED ...`, `ContinuityRefused rc=-2007`); `approve` is refused on a degraded (read-only) mount. Limits: the approved note is a plain Store object, not yet a continuity WAL / Cortex record (P06 CxStore adapter); no Recovery Core in the service image (its operator key is TEST-only); aienos#285 resource incarnations are NOT triggered (continuity objects are Store objects, not ADR 0013 domain-1 channels/objects); physical NVMe geometry, confined DMA, flush, shutdown and interrupted-transaction qualification (aienos#31) NOT_RUN | LIFECYCLE / M4_CONTINUITY | QEMU PASS + LIMIT (declared) | -| 174 | P06 cut 2, resident inference on the lifecycle (boot 5: test-keys image built with `CK_INFER_LIB`, model over the TEST-ONLY fw_cfg channel, `-m 4096`): only that image carries the session (`infer: resident open` absent from the plain test-keys image); `infer: resident open rc=0 tensors=147 vocab=128256 layers=16 kv_capacity=64 max_new=16 max_prompt_bytes=256 heap_reserve_kib=64` before `lifecycle: ready`; `prompt What is the capital of France?` -> `lifecycle: generating ...` -> `lifecycle: reply ids=791 6864 315 9822 374 12366 13 128009 tokens=8 prompt_ids=17 steps=25` (the golden one-shot and session sequence, row 139d) -> `reply pending state=serve proposed="reply: The capital of France is Paris."`; `approve` -> `approve committed gen=N id=...` (one sealed reply object, kind 0x5231 'R1') | LIFECYCLE / INFER | NOT_RUN | -| 175 | cancel and recall: `prompt Say hello.` then `cancel` typed 5 s later stops generation between steps (`generation cancelled steps>=1 prompt_ids=13 produced=0 state=ready`, nothing pending, no refusal); `recall` in the same boot reads the reply back through the sealed Store (`recall gen=N kind=reply id=... text="aienos.reply.v1?prompt: What is the capital of France??reply: The capital of France is Paris.?"`, newlines shown as `?`); boot 6 (same disk, cold boot, no prompt): the session opens again, continuity RESUMED (incarnation 2, no second genesis), `recall` returns the same approved reply from the disk (`last_commit_gen=0` in evidence: nothing from memory), `recalls=1`, stop order `requests=4`, every frame returned, QEMU exit 0, M1 checks | LIFECYCLE / INFER | NOT_RUN | -| 176 | evidence and stop order (boot 5): `evidence requests=5 ... approved=1 ... prompts=2 replies=1 gen_cancelled=1 gen_failed=0 recalls=0 inference=resident` (the `cancel` that stops a generation is `gen_cancelled`, not a request; `cancelled` counts dropped proposals); stop order `infer: resident close rc=0` < `infer: unloaded ... frames_free_after = frames_free_before rc=0,0` < `lifecycle: stop order store=closed nvme=released state=stop requests=7` < `stage lifecycle: ok` < final report; no panic or fault; QEMU exit 0; M1 checks. Separate verdict `AIENOS_CK_LIFECYCLE_INFER: PASS|FAIL|NOT_RUN` (NOT_RUN when the model file, cargo or the Rust target is missing; the main `AIENOS_CK_LIFECYCLE` verdict covers rows 174-176 whenever they run). Limits: QEMU only (TCG ~25 min for both boots); the hardware service image has no inference; a prompt is 48 bytes and a reply 256 bytes; generation is not pre-emptible inside a step (one prefill or token step, ~30 s under TCG); the bump allocator never frees between prompts; a second resident session per boot is not supported (one static slot) | LIFECYCLE / INFER | NOT_RUN | +| 174 | P06 cut 2, resident inference on the lifecycle (boot 5: test-keys image built with `CK_INFER_LIB`, model over the TEST-ONLY fw_cfg channel, `-m 4096`): only that image carries the session (`infer: resident open` absent from the plain test-keys image); `infer: resident open rc=0 tensors=147 vocab=128256 layers=16 kv_capacity=64 max_new=16 max_prompt_bytes=256 heap_reserve_kib=64` before `lifecycle: ready`; `prompt What is the capital of France?` -> `lifecycle: generating ...` -> `lifecycle: reply ids=791 6864 315 9822 374 12366 13 128009 tokens=8 prompt_ids=17 steps=25` (the golden one-shot and session sequence, row 139d) -> `reply pending state=serve proposed="reply: The capital of France is Paris."`; `approve` -> `approve committed gen=N id=...` (one sealed reply object, kind 0x5231 'R1') | LIFECYCLE / INFER | QEMU PASS (2026-10-12, tree ce0026e: 130 rows, AIENOS_CK_LIFECYCLE and AIENOS_CK_LIFECYCLE_INFER PASS; hardware NOT_RUN) | +| 175 | cancel and recall: `prompt Say hello.` then `cancel` typed 5 s later stops generation between steps (`generation cancelled steps>=1 prompt_ids=13 produced=0 state=ready`, nothing pending, no refusal); `recall` in the same boot reads the reply back through the sealed Store (`recall gen=N kind=reply id=... text="aienos.reply.v1?prompt: What is the capital of France??reply: The capital of France is Paris.?"`, newlines shown as `?`); boot 6 (same disk, cold boot, no prompt): the session opens again, continuity RESUMED (incarnation 2, no second genesis), `recall` returns the same approved reply from the disk (`last_commit_gen=0` in evidence: nothing from memory), `recalls=1`, stop order `requests=4`, every frame returned, QEMU exit 0, M1 checks | LIFECYCLE / INFER | QEMU PASS (2026-10-12, tree ce0026e: 130 rows, AIENOS_CK_LIFECYCLE and AIENOS_CK_LIFECYCLE_INFER PASS; hardware NOT_RUN) | +| 176 | evidence and stop order (boot 5): `evidence requests=5 ... approved=1 ... prompts=2 replies=1 gen_cancelled=1 gen_failed=0 recalls=0 inference=resident` (the `cancel` that stops a generation is `gen_cancelled`, not a request; `cancelled` counts dropped proposals); stop order `infer: resident close rc=0` < `infer: unloaded ... frames_free_after = frames_free_before rc=0,0` < `lifecycle: stop order store=closed nvme=released state=stop requests=7` < `stage lifecycle: ok` < final report; no panic or fault; QEMU exit 0; M1 checks. Separate verdict `AIENOS_CK_LIFECYCLE_INFER: PASS|FAIL|NOT_RUN` (NOT_RUN when the model file, cargo or the Rust target is missing; the main `AIENOS_CK_LIFECYCLE` verdict covers rows 174-176 whenever they run). Limits: QEMU only (TCG ~25 min for both boots); the hardware service image has no inference; a prompt is 48 bytes and a reply 256 bytes; generation is not pre-emptible inside a step (one prefill or token step, ~30 s under TCG); the bump allocator never frees between prompts; a second resident session per boot is not supported (one static slot) | LIFECYCLE / INFER | QEMU PASS (2026-10-12, tree ce0026e: 130 rows, AIENOS_CK_LIFECYCLE and AIENOS_CK_LIFECYCLE_INFER PASS; hardware NOT_RUN) | | 177 | P06 cut 3, canonical Omega Cortex store over the sealed Store (`third_party/omega/rx_cortex.c` at omega `362c9ab`, built freestanding by `svc/cortex_store.c`; journal = `svc/cortex_journal.c`, kind `0x434a` 'CJ' chunks of <= 16 KiB, one Cortex record = one sealed transaction, truncate only at the current length): host test `test_cortex_journal` in `svc/tests/stage_test.c`: a blank Store gets the 32-byte header as one generation; three records are three generations and `cx_verify_chain` passes; a second writable open is `CX_ERR_WRITER` while read-only opens are served; `truncate(len)` OK and `truncate(len-1)` `CX_ERR_IO`; a record above 128 KiB is refused (`CX_ERR_IO`) with memory and Store generation unchanged; a 40000-byte payload is three chunks of one transaction; reopen on the same mount and after a cold start replays all five records (40760 bytes, 8 chunks, heap peak 287 KiB); another subject count is `CX_ERR_FORMAT`; an in-memory edit is `CX_ERR_DIGEST`; a 256-byte heap makes the open `CX_ERR_NOMEM` without a write | LIFECYCLE (host, `make stage-test` and `stage-sanitize`) | PASS (host test, 2026-10-12, `CK_STAGE_HOST: PASS checks=772`, ASan + UBSan clean; kernel use of the journal is the next P06 cut; hardware NOT_RUN) | | 178 | the vendored files equal omega `362c9ab50c8ecc3012dd2e3ac20329865ba80982` (`omega.lock`, `scripts/omega_lock_check.sh`: offline sha256 always, the omega blob when reachable; an edited copy FAILs) and the adapter compiles freestanding (`make stage-free`: `CK_STAGE_FREE: PASS objects=45`, undefined symbols are ck.h services only); the `CK_SERVICE` image links `cx_open_with`, `cx_append`, `ck_cj_init`, `ck_cx_heap_init` and no `malloc`/`open`/`fsync` | LIFECYCLE (host) | PASS (host, 2026-10-12; both checks run in CI from this cut) | From 5f963154e966aa957716fd7b40b080838e1be6b0 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Mon, 12 Oct 2026 03:33:40 -0500 Subject: [PATCH 4/4] crumb: recompile after the P06 cut 2 rebase Co-Authored-By: Claude Fable 5.1 --- .crumb | 20 ++++++++++---------- native/.crumb | 14 +++++++------- native/kernel/.crumb | 22 +++++++++++----------- native/kernel/core/.crumb | 8 ++++---- native/kernel/include/.crumb | 8 ++++---- native/kernel/tests/.crumb | 8 ++++---- scripts/.crumb | 8 ++++---- 7 files changed, 44 insertions(+), 44 deletions(-) diff --git a/.crumb b/.crumb index ca554084..abfff00e 100644 --- a/.crumb +++ b/.crumb @@ -22,7 +22,7 @@ "children": [ { "digest": "41b89f0a1167d3e92c235d3cdd0f7d5fe2a38b75d737a67c54edf6c10d1cabfb", - "last_commit": "e6a7a99", + "last_commit": "bf70027", "name": "crates", "purpose": "Directory crates. Purpose not yet described by a human." }, @@ -33,27 +33,27 @@ "purpose": "Directory docs. Purpose not yet described by a human." }, { - "digest": "c1d3748712601ff81ac581eac2c92e0ea319480f17912ec6ee4bc8c4ed227a04", - "last_commit": "1952329", + "digest": "a6970d12ef4c87df8acd2a54068d997082077b097a6649c323ee90f2223cad11", + "last_commit": "620210e", "name": "native", "purpose": "Directory native. Purpose not yet described by a human." }, { - "digest": "28c4203cc5ca438d7d59c8a74d12d575c1d9c4ee4ce1497a5af8055183056e65", - "last_commit": "e6a7a99", + "digest": "4e6fc7109351e6175133ad3577ab107daa624fe7e443793636c88844c2b1859a", + "last_commit": "88040d6", "name": "scripts", "purpose": "Directory scripts. Purpose not yet described by a human." } ], - "children_root": "sha256:46ccfe3054999877600ebc51bdaa49baa92f83f0e3d7e2ba1c250ceea4fe5983", - "compiled_at": "2026-10-12T07:57:50Z", + "children_root": "sha256:792b3a044c117281fc57bed7cfa8676c9ceb203737788302df0df629bea19048", + "compiled_at": "2026-10-12T08:33:35Z", "compiler": "crumb-compile/1", - "digest": "sha256:c0a3bf42a05d27ce0f2bb4a19d180c8026a5a717a361a1bd6e31c4ee34a037b2", + "digest": "sha256:a6769253d253679917d42121bbaa6bcc9c442787cd9adf6833e7034bb26e9ec4", "evidence_files": 155, "evidence_root": "sha256:d59c0cef4e7dd5172923754a95b411ca54b01f35baca4587f792f1b259f1eaf7", "files": 3085, - "generated_at_commit": "195232912a31e6ad7db1fb29d1bc5c7d45c47436", - "source_tree": "sha256:93438dd70dada699b44f29c16afa10f410ffa9b28476715a673deb930bb601b9" + "generated_at_commit": "620210ed8651c274e7f13efd78d836b9d567f9f0", + "source_tree": "sha256:c9298eec57070bead0ca34b92185c545b85e7e2ed6787383076c7d757615e288" }, "owner_lane": "", "provenance": { diff --git a/native/.crumb b/native/.crumb index 22c42b6b..18445e11 100644 --- a/native/.crumb +++ b/native/.crumb @@ -79,8 +79,8 @@ "purpose": "Directory native/disk. Purpose not yet described by a human." }, { - "digest": "5b74dd4ac9960a38df4b45ce3cf8fd629aa608e672b4766de0157efc3e37c7e5", - "last_commit": "1952329", + "digest": "61c6e04bb83cd28c92b897b7c522ae85f93b9b6ca7cb8fde9086aeebcffeef03", + "last_commit": "620210e", "name": "kernel", "purpose": "Directory native/kernel. Purpose not yet described by a human." }, @@ -109,15 +109,15 @@ "purpose": "Directory native/store. Purpose not yet described by a human." } ], - "children_root": "sha256:9aa7e0e033b94b9fdcc2ee88cc13798185ba5c5e7594c4266bdf7911ec3f3776", - "compiled_at": "2026-10-12T07:57:50Z", + "children_root": "sha256:0bb44db0fc09a72e3d71268623bd085b03f5372e9562edb17172b2a33819ac36", + "compiled_at": "2026-10-12T08:33:35Z", "compiler": "crumb-compile/1", - "digest": "sha256:c1d3748712601ff81ac581eac2c92e0ea319480f17912ec6ee4bc8c4ed227a04", + "digest": "sha256:a6970d12ef4c87df8acd2a54068d997082077b097a6649c323ee90f2223cad11", "evidence_files": 4, "evidence_root": "sha256:e410b845507e00568e15b51a5797af32a97e0e4b8ab4e8487bb7c98e7e0cf335", "files": 469, - "generated_at_commit": "195232912a31e6ad7db1fb29d1bc5c7d45c47436", - "source_tree": "sha256:d9f337cb24178a66744d7a483d482a7eba06ffe512b296665e1dbc49d39c1e0b" + "generated_at_commit": "620210ed8651c274e7f13efd78d836b9d567f9f0", + "source_tree": "sha256:c9469bb2804c83e3e990009171d747c9eb863de16a2bb3770963a7cd789a33d9" }, "owner_lane": "", "provenance": { diff --git a/native/kernel/.crumb b/native/kernel/.crumb index 9d24bb26..7c7eb4aa 100644 --- a/native/kernel/.crumb +++ b/native/kernel/.crumb @@ -57,8 +57,8 @@ "purpose": "Directory native/kernel/artifact. Purpose not yet described by a human." }, { - "digest": "d80a367d57a51994c49f6b8a5fc5554c803cc8000d6221ce6fcae75681aa3240", - "last_commit": "e6a7a99", + "digest": "c1e462d1b7437cd8ac0a08236a36e8480a019d2e7329ef275604fbef47407fe3", + "last_commit": "491d2f5", "name": "core", "purpose": "Directory native/kernel/core. Purpose not yet described by a human." }, @@ -69,8 +69,8 @@ "purpose": "Directory native/kernel/dev. Purpose not yet described by a human." }, { - "digest": "bad996a1149ddaa6a4404ac97b147414f8df3b376d9f403d9bca7b0ea72a4e9c", - "last_commit": "adb4dd0", + "digest": "5641b8a18b587d5e35df3dccc6a157af5f4ea14d72713bb6fb970b903b554eb9", + "last_commit": "88040d6", "name": "include", "purpose": "Directory native/kernel/include. Purpose not yet described by a human." }, @@ -87,8 +87,8 @@ "purpose": "Directory native/kernel/svc. Purpose not yet described by a human." }, { - "digest": "08b0938d801a9dfeea54c16f1f585ff01e806ef264047b625e3d0555389087ac", - "last_commit": "1feaca1", + "digest": "cb0be2302b05819c629d9936885310c31648bd9dbca9e4a6ac3ac07b62fe55e5", + "last_commit": "88040d6", "name": "tests", "purpose": "Directory native/kernel/tests. Purpose not yet described by a human." }, @@ -99,15 +99,15 @@ "purpose": "Directory native/kernel/tools. Purpose not yet described by a human." } ], - "children_root": "sha256:8c439f19573ba812436718fb7453053ca3a1824c4e3180f733a2b8a712db1989", - "compiled_at": "2026-10-12T07:57:50Z", + "children_root": "sha256:02930edad8a38a5004de63ac26b49a0f050f7865297e3fa70504e9f41b985da7", + "compiled_at": "2026-10-12T08:33:35Z", "compiler": "crumb-compile/1", - "digest": "sha256:5b74dd4ac9960a38df4b45ce3cf8fd629aa608e672b4766de0157efc3e37c7e5", + "digest": "sha256:61c6e04bb83cd28c92b897b7c522ae85f93b9b6ca7cb8fde9086aeebcffeef03", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 305, - "generated_at_commit": "195232912a31e6ad7db1fb29d1bc5c7d45c47436", - "source_tree": "sha256:810d0dd2110d00a73e174ca08e48ae2b6e3d8194c3fc70d30af36e3507914169" + "generated_at_commit": "620210ed8651c274e7f13efd78d836b9d567f9f0", + "source_tree": "sha256:6390c6ef3a77b3ae0aa436bbe0b998ebd96f768c21cf407041e92d26ef3bcb0f" }, "owner_lane": "", "provenance": { diff --git a/native/kernel/core/.crumb b/native/kernel/core/.crumb index caa99471..c5ce6ff1 100644 --- a/native/kernel/core/.crumb +++ b/native/kernel/core/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-12T07:35:53Z", + "compiled_at": "2026-10-12T08:33:35Z", "compiler": "crumb-compile/1", - "digest": "sha256:d80a367d57a51994c49f6b8a5fc5554c803cc8000d6221ce6fcae75681aa3240", + "digest": "sha256:c1e462d1b7437cd8ac0a08236a36e8480a019d2e7329ef275604fbef47407fe3", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 42, - "generated_at_commit": "7c4b4aed25851e2c0a607c31df1ad03671bcd20f", - "source_tree": "sha256:e7c95609307d15ff23b5d36cf60277f320b0e1c2db76c5ceb1b4b791ef5bcead" + "generated_at_commit": "620210ed8651c274e7f13efd78d836b9d567f9f0", + "source_tree": "sha256:2e404f5904fc49648af79be70201287a9a1468ad053c2e9803d4ab0a3155716f" }, "owner_lane": "", "provenance": { diff --git a/native/kernel/include/.crumb b/native/kernel/include/.crumb index 054b5c88..ca083320 100644 --- a/native/kernel/include/.crumb +++ b/native/kernel/include/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-12T03:57:43Z", + "compiled_at": "2026-10-12T08:33:35Z", "compiler": "crumb-compile/1", - "digest": "sha256:bad996a1149ddaa6a4404ac97b147414f8df3b376d9f403d9bca7b0ea72a4e9c", + "digest": "sha256:5641b8a18b587d5e35df3dccc6a157af5f4ea14d72713bb6fb970b903b554eb9", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 1, - "generated_at_commit": "51c05daff49b0836692eb1c777ec2758cf0746ae", - "source_tree": "sha256:b3b1ead81ab787c8cbc4f733ff7cba42097995619da3380a717038889e1bfaec" + "generated_at_commit": "620210ed8651c274e7f13efd78d836b9d567f9f0", + "source_tree": "sha256:3b68dd7854ac89039e7084496587b660f78cf43ff74536029d098a1150ab45f0" }, "owner_lane": "", "provenance": { diff --git a/native/kernel/tests/.crumb b/native/kernel/tests/.crumb index cbe75f01..188066f1 100644 --- a/native/kernel/tests/.crumb +++ b/native/kernel/tests/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-12T05:32:10Z", + "compiled_at": "2026-10-12T08:33:35Z", "compiler": "crumb-compile/1", - "digest": "sha256:08b0938d801a9dfeea54c16f1f585ff01e806ef264047b625e3d0555389087ac", + "digest": "sha256:cb0be2302b05819c629d9936885310c31648bd9dbca9e4a6ac3ac07b62fe55e5", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 150, - "generated_at_commit": "a9d120b2e91893bb80a378dc746cf0a274e42878", - "source_tree": "sha256:19e2d9e99bdd9fe265da5c4d84140d7f0b9cc52ae60e19838e2cfcb8cf64f8d5" + "generated_at_commit": "620210ed8651c274e7f13efd78d836b9d567f9f0", + "source_tree": "sha256:dfb81d431a173b2d5d4d42265351fbb8d5e57908e71f35960c60d87d705eaf81" }, "owner_lane": "", "provenance": { diff --git a/scripts/.crumb b/scripts/.crumb index c4b79654..dd5cd14f 100644 --- a/scripts/.crumb +++ b/scripts/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-12T07:57:50Z", + "compiled_at": "2026-10-12T08:33:35Z", "compiler": "crumb-compile/1", - "digest": "sha256:28c4203cc5ca438d7d59c8a74d12d575c1d9c4ee4ce1497a5af8055183056e65", + "digest": "sha256:4e6fc7109351e6175133ad3577ab107daa624fe7e443793636c88844c2b1859a", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 83, - "generated_at_commit": "195232912a31e6ad7db1fb29d1bc5c7d45c47436", - "source_tree": "sha256:13d6f4d21e0959ee55980450f4daeca5c0cb9fc28eabe786164e6440aa32d336" + "generated_at_commit": "620210ed8651c274e7f13efd78d836b9d567f9f0", + "source_tree": "sha256:e216f80c2123f9abc3c15fef6c960caac89011b534a1d8d10aecb53f1aca0132" }, "owner_lane": "", "provenance": {