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

GitHub aien-dev/aienux#312 (code only)

closed derived b4d87e501d03ed1b #312

Imported from GitHub aien-dev/aienux#312 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base 543c1fc591f231952061e25f1fdc04048c716bae · Head a550907cd72db2611f4d6d6d146cd3e058fc047f

Apply it

git checkout -b patch-b4d87e501d03ed1b 543c1fc591f231952061e25f1fdc04048c716bae
curl -fsSL https://interplane.io/drakestapleton/aienux/patches/b4d87e501d03ed1b.patch | git am

Raw patch (mbox) · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/aienux
312
a550907cd72db2611f4d6d6d146cd3e058fc047f
{"kind":"github-import","owner":"aien-dev","repo":"aienux","number":312,"url":"https://github.com/aien-dev/aienux/pull/312","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:11Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/.crumb b/.crumb
index 4164c4f0..ca554084 100644
--- a/.crumb
+++ b/.crumb
@@ -21,8 +21,8 @@
     "generated": {
       "children": [
         {
-          "digest": "e4f7c9f4b54d792a3d410c4143742cd0f95b64858494d6bfa9ffc6cc9ff7687a",
-          "last_commit": "51c05da",
+          "digest": "41b89f0a1167d3e92c235d3cdd0f7d5fe2a38b75d737a67c54edf6c10d1cabfb",
+          "last_commit": "e6a7a99",
           "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": "9bd3a5424bd1bb24ec9bf14a01fdaf11ee5b88e669438863e7a84018947e1f38",
-          "last_commit": "453f41e",
+          "digest": "c1d3748712601ff81ac581eac2c92e0ea319480f17912ec6ee4bc8c4ed227a04",
+          "last_commit": "1952329",
           "name": "native",
           "purpose": "Directory native. Purpose not yet described by a human."
         },
         {
-          "digest": "eecc6309e4e429e5236cbf29a3593351f5bd5b2cb2daf6cd36c73fc96c9b0a61",
-          "last_commit": "453f41e",
+          "digest": "28c4203cc5ca438d7d59c8a74d12d575c1d9c4ee4ce1497a5af8055183056e65",
+          "last_commit": "e6a7a99",
           "name": "scripts",
           "purpose": "Directory scripts. Purpose not yet described by a human."
         }
       ],
-      "children_root": "sha256:750e6b10e42abcb4c01f0a3f6bcb1442bb028a6bd191702788ec364f6baec055",
-      "compiled_at": "2026-10-12T07:42:03Z",
+      "children_root": "sha256:46ccfe3054999877600ebc51bdaa49baa92f83f0e3d7e2ba1c250ceea4fe5983",
+      "compiled_at": "2026-10-12T07:57:50Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:44caf9772cbe90d6f6ad9a5320cf1e08f3f91e67369299fb99c9baadc93a2b95",
+      "digest": "sha256:c0a3bf42a05d27ce0f2bb4a19d180c8026a5a717a361a1bd6e31c4ee34a037b2",
       "evidence_files": 155,
       "evidence_root": "sha256:d59c0cef4e7dd5172923754a95b411ca54b01f35baca4587f792f1b259f1eaf7",
-      "files": 3084,
-      "generated_at_commit": "453f41e7fca07a97ee52db3a125d106dfaf17ff5",
-      "source_tree": "sha256:87d540c3d77ba7a4e5132528af84b717cac3606a87a272e5f994d4a0d204fdad"
+      "files": 3085,
+      "generated_at_commit": "195232912a31e6ad7db1fb29d1bc5c7d45c47436",
+      "source_tree": "sha256:93438dd70dada699b44f29c16afa10f410ffa9b28476715a673deb930bb601b9"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/crates/.crumb b/crates/.crumb
index 546b784b..b5afab3c 100644
--- a/crates/.crumb
+++ b/crates/.crumb
@@ -108,13 +108,13 @@
         },
         {
           "digest": "ca15c2b9ae570b0aa2c7859672de2c976d6ce046188c09b7c74b5ccbee350136",
-          "last_commit": "362cba9",
+          "last_commit": "51c05da",
           "name": "aienos-capability",
           "purpose": "Directory crates/aienos-capability. Purpose not yet described by a human."
         },
         {
           "digest": "c63ab3d5643ac3c0974eee276273a0ab80584c54926cbb62c637294b5b857718",
-          "last_commit": "6d17b22",
+          "last_commit": "51c05da",
           "name": "aienos-capability-ffi",
           "purpose": "Directory crates/aienos-capability-ffi. Purpose not yet described by a human."
         },
@@ -150,14 +150,14 @@
         }
       ],
       "children_root": "sha256:006b47340025796d925d29b5143f8c38760bb782916323e4d9070a8e408f7033",
-      "compiled_at": "2026-10-11T21:20:24Z",
+      "compiled_at": "2026-10-12T07:35:53Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:e4f7c9f4b54d792a3d410c4143742cd0f95b64858494d6bfa9ffc6cc9ff7687a",
+      "digest": "sha256:41b89f0a1167d3e92c235d3cdd0f7d5fe2a38b75d737a67c54edf6c10d1cabfb",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "files": 231,
-      "generated_at_commit": "362cba9653c8021996a21b17ead00d5d1140b371",
-      "source_tree": "sha256:7d853b8e4348ea1aaebc7c18c71e06d2bd272911acc2e4861fd01a2589a66ad0"
+      "files": 232,
+      "generated_at_commit": "7c4b4aed25851e2c0a607c31df1ad03671bcd20f",
+      "source_tree": "sha256:019c27651afd04413bbf69dfd1693ea991451228d81359f46d11c0155c36be99"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/crates/aienos-infer-kernel/src/lib.rs b/crates/aienos-infer-kernel/src/lib.rs
index 38055e0a..7cd0cfed 100644
--- a/crates/aienos-infer-kernel/src/lib.rs
+++ b/crates/aienos-infer-kernel/src/lib.rs
@@ -27,6 +27,10 @@
 
 extern crate alloc;
 
+/// Bounded resident session (open / prompt / step / cancel / close); see
+/// `session.rs`. The one-shot probe below stays as the golden regression.
+pub mod session;
+
 use alloc::vec::Vec;
 use core::alloc::{GlobalAlloc, Layout};
 use core::cell::UnsafeCell;
@@ -159,6 +163,33 @@ unsafe impl GlobalAlloc for Bump {
     }
 }
 
+/// Bytes of the region still unallocated (0 when no region is set).
+pub(crate) fn heap_remaining() -> usize {
+    // SAFETY: single core, interrupts masked (see the allocator contract).
+    unsafe { (*HEAP.end.get()).saturating_sub(*HEAP.next.get()) }
+}
+
+/// Bytes allocated so far (cursor minus base; 0 when no region is set).
+pub(crate) fn heap_used() -> usize {
+    // SAFETY: as above.
+    unsafe { (*HEAP.next.get()).saturating_sub(*HEAP.base.get()) }
+}
+
+/// Reports the allocator's used and peak bytes, for the kernel's evidence
+/// lines (a session's creep across prompts is visible here).
+///
+/// # Safety
+/// `used` and `peak` must be valid or null.
+#[no_mangle]
+pub unsafe extern "C" fn aienos_infer_heap_stats(used: *mut u64, peak: *mut u64) {
+    if !used.is_null() {
+        *used = heap_used() as u64;
+    }
+    if !peak.is_null() {
+        *peak = *HEAP.peak.get() as u64;
+    }
+}
+
 /// Gives the allocator its region `[base, base+len)`. Call once, before
 /// `aienos_infer_run`. Calling it again with `(0, 0)` after the kernel has
 /// returned the frames forgets the region: every later allocation fails
diff --git a/crates/aienos-infer-kernel/src/session.rs b/crates/aienos-infer-kernel/src/session.rs
new file mode 100644
index 00000000..23851371
--- /dev/null
+++ b/crates/aienos-infer-kernel/src/session.rs
@@ -0,0 +1,361 @@
+//! Bounded inference session for the resident kernel (native v1 P06).
+//!
+//! The one-shot probe (`aienos_infer_run`) parses, prefills, decodes and
+//! drops everything inside one call with a fixed prompt. A resident product
+//! needs the same work split into steps the kernel drives: load the model
+//! once, accept an operator prompt, advance one token at a time so the
+//! kernel can look at the console between steps (cancellation), decode the
+//! result, unload. Every bound is a number the kernel configures
+//! ([`SessionLimits`]); nothing here loops without the kernel asking.
+//!
+//! One session at a time (single core, interrupts masked by the caller).
+//! Memory: the session's buffers come from the bump allocator the kernel
+//! gave this unit; the decode state is sized once at open and reused by
+//! every prompt (`DecodeState::reset`), so a prompt allocates only its id
+//! list and its decoded text. The allocator never reclaims old blocks, so a
+//! long run of prompts creeps upward; `heap_reserve` turns that creep into a
+//! refusal (`E_HEAP`) before any allocation can fail, and the kernel can
+//! read the creep (`aienos_infer_heap_stats`) and show it.
+
+use alloc::vec::Vec;
+use core::cell::UnsafeCell;
+use core::slice;
+
+use aienos_infer::{argmax, DecodeState, Gguf, Model, Tokenizer};
+
+use crate::{ck_time_us, heap_remaining, EOT};
+
+/// Limits the kernel sets at open. All are hard bounds, none is advisory.
+#[repr(C)]
+pub struct SessionLimits {
+    /// KV-cache positions: prompt tokens + generated tokens never exceed it.
+    pub kv_capacity: u32,
+    /// Generated tokens per prompt (EOT counts).
+    pub max_new: u32,
+    /// Prompt text bytes the session accepts.
+    pub max_prompt_bytes: u32,
+    /// Heap bytes that must still be free before a prompt is accepted.
+    pub heap_reserve: u32,
+}
+
+/// What open reports back.
+#[repr(C)]
+pub struct SessionInfo {
+    pub tensors: u32,
+    pub vocab: u32,
+    pub layers: u32,
+    pub heap_used_kib: u32,
+}
+
+/// Session error codes (negative). The one-shot probe's codes -1..-11 keep
+/// their meaning; these continue the list.
+pub const E_ARG: i32 = -1;
+pub const E_GGUF: i32 = -2;
+pub const E_MODEL: i32 = -3;
+pub const E_TOK_DATA: i32 = -4;
+pub const E_TOK_BUILD: i32 = -5;
+pub const E_ENCODE: i32 = -6;
+pub const E_TOO_LONG: i32 = -8;
+pub const E_FORWARD: i32 = -10;
+pub const E_DECODE: i32 = -11;
+pub const E_STATE: i32 = -12; /* no session / session already open / no prompt */
+pub const E_LIMITS: i32 = -13;
+pub const E_UTF8: i32 = -14;
+pub const E_HEAP: i32 = -15;
+pub const E_PROMPT_BYTES: i32 = -16;
+
+/// Step results (non-negative).
+pub const STEP_DONE: i32 = 0; /* nothing left: EOT or max_new reached, or no prompt */
+pub const STEP_PREFILL: i32 = 1; /* one prompt token fed, no token produced */
+pub const STEP_TOKEN: i32 = 2; /* one token produced, more may follow */
+pub const STEP_LAST: i32 = 3; /* one token produced and the reply is complete */
+
+/// The largest KV capacity a session may ask for (a bound on the cache
+/// allocation; 4096 positions of Llama-3.2-1B is about 256 MiB of f32 KV,
+/// which is the whole probe heap, so real limits sit far below).
+pub const KV_CAPACITY_MAX: u32 = 4096;
+
+struct Session {
+    model: Model<'static>,
+    tok: Tokenizer<'static>,
+    st: DecodeState,
+    limits: SessionLimits,
+    /// Prompt ids of the current request; `fed` of them are in the cache.
+    prompt: Vec<u32>,
+    fed: usize,
+    /// Tokens produced for the current request.
+    out: Vec<u32>,
+    done: bool,
+}
+
+struct Slot(UnsafeCell<Option<Session>>);
+// SAFETY: one core, interrupts masked by the caller (see the module doc).
+unsafe impl Sync for Slot {}
+static SLOT: Slot = Slot(UnsafeCell::new(None));
+
+fn slot() -> &'static mut Option<Session> {
+    // SAFETY: single-threaded by contract; no reference escapes a call.
+    unsafe { &mut *SLOT.0.get() }
+}
+
+/// Load the model at `model[..len]` and size the decode state for
+/// `limits`. Returns 0 and fills `info`, or a negative code. `E_STATE` when
+/// a session is already open.
+///
+/// # Safety
+/// `model` must point to `len` bytes that stay readable and unchanged until
+/// `aienos_infer_session_close`; `limits` and `info` must be valid. FP/SIMD
+/// enabled, interrupts masked, heap initialised (as for `aienos_infer_run`).
+#[no_mangle]
+pub unsafe extern "C" fn aienos_infer_session_open(
+    model: *const u8,
+    len: u64,
+    limits: *const SessionLimits,
+    info: *mut SessionInfo,
+) -> i32 {
+    if model.is_null() || limits.is_null() || info.is_null() || len == 0 || len > usize::MAX as u64
+    {
+        return E_ARG;
+    }
+    if slot().is_some() {
+        return E_STATE;
+    }
+    let l = SessionLimits {
+        kv_capacity: (*limits).kv_capacity,
+        max_new: (*limits).max_new,
+        max_prompt_bytes: (*limits).max_prompt_bytes,
+        heap_reserve: (*limits).heap_reserve,
+    };
+    if l.kv_capacity == 0
+        || l.kv_capacity > KV_CAPACITY_MAX
+        || l.max_new == 0
+        || l.max_new > l.kv_capacity
+        || l.max_prompt_bytes == 0
+    {
+        return E_LIMITS;
+    }
+    let bytes: &'static [u8] = slice::from_raw_parts(model, len as usize);
+    let g = match Gguf::parse(bytes) {
+        Ok(g) => g,
+        Err(_) => return E_GGUF,
+    };
+    let tensors = g.tensors().len() as u32;
+    let model = match Model::new(&g) {
+        Ok(m) => m,
+        Err(_) => return E_MODEL,
+    };
+    let td = match g.tokenizer() {
+        Ok(t) => t,
+        Err(_) => return E_TOK_DATA,
+    };
+    let tok = match Tokenizer::new(&td) {
+        Ok(t) => t,
+        Err(_) => return E_TOK_BUILD,
+    };
+    let st = DecodeState::new(&model, l.kv_capacity as usize);
+    (*info).tensors = tensors;
+    (*info).vocab = tok.vocab_size() as u32;
+    (*info).layers = model.params.block_count;
+    (*info).heap_used_kib = (crate::heap_used() / 1024) as u32;
+    *slot() = Some(Session {
+        model,
+        tok,
+        st,
+        limits: l,
+        prompt: Vec::new(),
+        fed: 0,
+        out: Vec::new(),
+        done: true,
+    });
+    0
+}
+
+/// Accept a new prompt (UTF-8 text of the user turn; the chat template is
+/// applied as in the probe). Forgets the previous request. Returns the
+/// prompt's token count, or a negative code: `E_PROMPT_BYTES` (over
+/// `max_prompt_bytes`), `E_HEAP` (less than `heap_reserve` free), `E_UTF8`,
+/// `E_ENCODE`, `E_TOO_LONG` (prompt + max_new would not fit the cache).
+/// Nothing is fed to the model here; the first steps do that.
+///
+/// # Safety
+/// `text` must point to `len` readable bytes. Same execution contract as open.
+#[no_mangle]
+pub unsafe extern "C" fn aienos_infer_session_prompt(text: *const u8, len: u32) -> i32 {
+    let s = match slot() {
+        Some(s) => s,
+        None => return E_STATE,
+    };
+    if text.is_null() && len != 0 {
+        return E_ARG;
+    }
+    if len > s.limits.max_prompt_bytes {
+        return E_PROMPT_BYTES;
+    }
+    if heap_remaining() < s.limits.heap_reserve as usize {
+        return E_HEAP;
+    }
+    let bytes = if len == 0 {
+        &[][..]
+    } else {
+        slice::from_raw_parts(text, len as usize)
+    };
+    let user = match core::str::from_utf8(bytes) {
+        Ok(u) => u,
+        Err(_) => return E_UTF8,
+    };
+    let ids = match s.tok.encode_chat(user) {
+        Ok(v) => v,
+        Err(_) => return E_ENCODE,
+    };
+    if ids.len() + s.limits.max_new as usize > s.limits.kv_capacity as usize {
+        return E_TOO_LONG;
+    }
+    s.st.reset();
+    s.prompt = ids;
+    s.fed = 0;
+    s.out = Vec::new();
+    s.done = false;
+    s.prompt.len() as i32
+}
+
+/// Advance the current request by one unit of work:
+/// `STEP_PREFILL` (one prompt token entered the cache), `STEP_TOKEN` (a
+/// token was produced into `*token` and its forward pass ran),
+/// `STEP_LAST` (a token was produced and the reply is complete: EOT or
+/// `max_new`), `STEP_DONE` (nothing left). `*us` receives the microseconds
+/// the step took. Negative: `E_STATE` (no session), `E_FORWARD`.
+///
+/// # Safety
+/// `token` and `us` must be valid or null. Same execution contract as open.
+#[no_mangle]
+pub unsafe extern "C" fn aienos_infer_session_step(token: *mut u32, us: *mut u64) -> i32 {
+    let s = match slot() {
+        Some(s) => s,
+        None => return E_STATE,
+    };
+    if s.done {
+        return STEP_DONE;
+    }
+    let t0 = ck_time_us();
+    let rc;
+    if s.fed < s.prompt.len() {
+        let id = s.prompt[s.fed];
+        let last = s.fed + 1 == s.prompt.len();
+        if s.st.forward(&s.model, id, last).is_err() {
+            s.done = true;
+            return E_FORWARD;
+        }
+        s.fed += 1;
+        rc = STEP_PREFILL;
+    } else {
+        let t = argmax(&s.st.logits);
+        s.out.push(t);
+        if !token.is_null() {
+            *token = t;
+        }
+        if t == EOT || s.out.len() >= s.limits.max_new as usize {
+            s.done = true;
+            rc = STEP_LAST;
+        } else {
+            if s.st.forward(&s.model, t, true).is_err() {
+                s.done = true;
+                return E_FORWARD;
+            }
+            rc = STEP_TOKEN;
+        }
+    }
+    if !us.is_null() {
+        *us = ck_time_us() - t0;
+    }
+    rc
+}
+
+/// Abandon the current request: the cache is forgotten and no further step
+/// does work. Returns the number of tokens produced before the cancel, or
+/// `E_STATE` without a session. Idempotent.
+///
+/// # Safety
+/// Same execution contract as open.
+#[no_mangle]
+pub unsafe extern "C" fn aienos_infer_session_cancel() -> i32 {
+    let s = match slot() {
+        Some(s) => s,
+        None => return E_STATE,
+    };
+    let n = s.out.len() as i32;
+    s.st.reset();
+    s.prompt = Vec::new();
+    s.fed = 0;
+    s.out = Vec::new();
+    s.done = true;
+    n
+}
+
+/// Copy the tokens produced for the current request into `out[..cap]`.
+/// Returns the count produced so far (which may exceed `cap`; only `cap`
+/// are copied), or `E_STATE`.
+///
+/// # Safety
+/// `out` must point to `cap` writable u32s. Same execution contract as open.
+#[no_mangle]
+pub unsafe extern "C" fn aienos_infer_session_tokens(out: *mut u32, cap: u32) -> i32 {
+    let s = match slot() {
+        Some(s) => s,
+        None => return E_STATE,
+    };
+    let n = s.out.len().min(cap as usize);
+    if n > 0 {
+        core::ptr::copy_nonoverlapping(s.out.as_ptr(), out, n);
+    }
+    s.out.len() as i32
+}
+
+/// Decode `ids[..n]` to bytes into `out[..cap]` (truncated to `cap`).
+/// Returns the number of bytes written, or `E_STATE` / `E_DECODE`.
+///
+/// # Safety
+/// `ids` must point to `n` u32s and `out` to `cap` writable bytes.
+#[no_mangle]
+pub unsafe extern "C" fn aienos_infer_session_text(
+    ids: *const u32,
+    n: u32,
+    out: *mut u8,
+    cap: u32,
+) -> i32 {
+    let s = match slot() {
+        Some(s) => s,
+        None => return E_STATE,
+    };
+    if (ids.is_null() && n != 0) || (out.is_null() && cap != 0) {
+        return E_ARG;
+    }
+    let ids = if n == 0 {
+        &[][..]
+    } else {
+        slice::from_raw_parts(ids, n as usize)
+    };
+    let text = match s.tok.decode(ids) {
+        Ok(v) => v,
+        Err(_) => return E_DECODE,
+    };
+    let keep = text.len().min(cap as usize);
+    if keep > 0 {
+        core::ptr::copy_nonoverlapping(text.as_ptr(), out, keep);
+    }
+    keep as i32
+}
+
+/// Drop the session: model binding, tokenizer, cache, request. Returns 0,
+/// or `E_STATE` when none is open. The kernel then forgets the heap region
+/// and returns its frames, as after `aienos_infer_run`.
+///
+/// # Safety
+/// Same execution contract as open.
+#[no_mangle]
+pub unsafe extern "C" fn aienos_infer_session_close() -> i32 {
+    if slot().is_none() {
+        return E_STATE;
+    }
+    *slot() = None;
+    0
+}
diff --git a/native/.crumb b/native/.crumb
index cf8ff5dc..22c42b6b 100644
--- a/native/.crumb
+++ b/native/.crumb
@@ -79,8 +79,8 @@
           "purpose": "Directory native/disk. Purpose not yet described by a human."
         },
         {
-          "digest": "4cbfcc2d3ce9c2956be80604f8c41d1eb0e87d06d20a999fc8ebe579d95dfb8b",
-          "last_commit": "453f41e",
+          "digest": "5b74dd4ac9960a38df4b45ce3cf8fd629aa608e672b4766de0157efc3e37c7e5",
+          "last_commit": "1952329",
           "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:162ac2426b94dbcda2d0c26dcdbd407750737911191f9a643ee93610d085326d",
-      "compiled_at": "2026-10-12T07:42:03Z",
+      "children_root": "sha256:9aa7e0e033b94b9fdcc2ee88cc13798185ba5c5e7594c4266bdf7911ec3f3776",
+      "compiled_at": "2026-10-12T07:57:50Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:9bd3a5424bd1bb24ec9bf14a01fdaf11ee5b88e669438863e7a84018947e1f38",
+      "digest": "sha256:c1d3748712601ff81ac581eac2c92e0ea319480f17912ec6ee4bc8c4ed227a04",
       "evidence_files": 4,
       "evidence_root": "sha256:e410b845507e00568e15b51a5797af32a97e0e4b8ab4e8487bb7c98e7e0cf335",
       "files": 469,
-      "generated_at_commit": "453f41e7fca07a97ee52db3a125d106dfaf17ff5",
-      "source_tree": "sha256:b4123b259e0bc63e39da5f9b3ec724ec27467e9976900129563ec5d54c32f961"
+      "generated_at_commit": "195232912a31e6ad7db1fb29d1bc5c7d45c47436",
+      "source_tree": "sha256:d9f337cb24178a66744d7a483d482a7eba06ffe512b296665e1dbc49d39c1e0b"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/native/kernel/.crumb b/native/kernel/.crumb
index 0a0284b6..9d24bb26 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": "438c62d03d5cc14b9d2b663dbdd54dbd4153124e759bd3a97467e8dc0f5a6f74",
-          "last_commit": "a8bf02b",
+          "digest": "d80a367d57a51994c49f6b8a5fc5554c803cc8000d6221ce6fcae75681aa3240",
+          "last_commit": "e6a7a99",
           "name": "core",
           "purpose": "Directory native/kernel/core. Purpose not yet described by a human."
         },
@@ -82,7 +82,7 @@
         },
         {
           "digest": "7d18df01ff7941ffed2ed82d18fed6ab5b635156333da8ae33d698756bf15e14",
-          "last_commit": "453f41e",
+          "last_commit": "543c1fc",
           "name": "svc",
           "purpose": "Directory native/kernel/svc. 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:49fd3831250168da5ac9a5e1d4066b65af70cc1780e3547b9c5f974f2dbb0a2d",
-      "compiled_at": "2026-10-12T07:42:03Z",
+      "children_root": "sha256:8c439f19573ba812436718fb7453053ca3a1824c4e3180f733a2b8a712db1989",
+      "compiled_at": "2026-10-12T07:57:50Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:4cbfcc2d3ce9c2956be80604f8c41d1eb0e87d06d20a999fc8ebe579d95dfb8b",
+      "digest": "sha256:5b74dd4ac9960a38df4b45ce3cf8fd629aa608e672b4766de0157efc3e37c7e5",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
       "files": 305,
-      "generated_at_commit": "453f41e7fca07a97ee52db3a125d106dfaf17ff5",
-      "source_tree": "sha256:3f01b77765ab6778ee9fc8e79002e2258ea8a9ec11be41d09753b4824b0946be"
+      "generated_at_commit": "195232912a31e6ad7db1fb29d1bc5c7d45c47436",
+      "source_tree": "sha256:810d0dd2110d00a73e174ca08e48ae2b6e3d8194c3fc70d30af36e3507914169"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/native/kernel/GATES.md b/native/kernel/GATES.md
index 0561227e..eb8197f4 100644
--- a/native/kernel/GATES.md
+++ b/native/kernel/GATES.md
@@ -25,7 +25,7 @@ C gates (one line each from `ck_gates.sh`): `M1` and `M3` (from
 `scripts/qemu_ck_net_test.sh`; rows 102-106 and 110-112; the script now also checks the virtio-net SMMU fence (ACCESS_PLATFORM required, out-of-window device DMA refused), rows 102 and 110-112 are QEMU PASS on this branch from the committed forge log `evidence/ck_net_qemu_8bdbc2e46b85d04c422f9d2830c1c4b263e254b3cfecfe21ff0063c9e33c86e8.log`, hardware NOT_RUN), the kernel entropy rows 107-109 (M1 via `scripts/lib_ck_m1_checks.sh`, ARGUS1_REVOKE and M4_STORE via the Store gate boot 7),
 `DISK_LAYOUT` (C-only, from `scripts/qemu_ck_disk_layout_test.sh`, rows 118-123: QEMU PASS at 741b2b8 before the merge with main 8555049, rerun pending at the merged head; row 123 host test), and the NOT_RUN gates
 `SMP` (C-only, from `scripts/qemu_ck_smp_test.sh`, rows 113-117, NOT_RUN pending forge receipt), `M0_ROLLBACK` (from `scripts/qemu_ck_rollback_test.sh`, rows 42-46; QEMU PASS in its committed run log, C-image, no `ck_gates.sh` receipt yet; hardware NOT_RUN), `M4_STORE_CRASH` (now read from `scripts/qemu_ck_store_crash_test.sh`, rows 73-80; NOT_RUN until a forge receipt exists),
-`M4_CONTINUITY`, `M4_RECOVERY`, `M4_ALLEN` (C-only, from `scripts/qemu_ck_allen_test.sh`, rows A1-A30; QEMU PASS, hardware NOT_RUN), `KEYBOARD` (from `scripts/qemu_ck_keyboard_test.sh`, rows 25-32 and C-only 30a-30c and 32a; QEMU PASS; C-only row 32b and all hardware NOT_RUN), `FPU` (C-only, from `scripts/qemu_ck_fpu_test.sh`, rows 124-128; QEMU PASS, hardware NOT_RUN), `INFER` (C-only, from `scripts/qemu_ck_infer_test.sh`, rows 129-139; QEMU PASS, hardware NOT_RUN), `SCREEN` (C-only, from `scripts/qemu_ck_screen_test.sh`, rows 140-145; QEMU PASS, hardware NOT_RUN), and `CONSOLE` (C-only, TEST-ONLY console session image, from `scripts/qemu_ck_console_test.sh`, rows 146-155; QEMU only, hardware NOT_RUN).
+`M4_CONTINUITY`, `M4_RECOVERY`, `M4_ALLEN` (C-only, from `scripts/qemu_ck_allen_test.sh`, rows A1-A30; QEMU PASS, hardware NOT_RUN), `KEYBOARD` (from `scripts/qemu_ck_keyboard_test.sh`, rows 25-32 and C-only 30a-30c and 32a; QEMU PASS; C-only row 32b and all hardware NOT_RUN), `FPU` (C-only, from `scripts/qemu_ck_fpu_test.sh`, rows 124-128; QEMU PASS, hardware NOT_RUN), `INFER` (C-only, from `scripts/qemu_ck_infer_test.sh`, rows 129-139 and the native v1 P06 session rows 139a-139f; QEMU PASS, hardware NOT_RUN), `SCREEN` (C-only, from `scripts/qemu_ck_screen_test.sh`, rows 140-145; QEMU PASS, hardware NOT_RUN), and `CONSOLE` (C-only, TEST-ONLY console session image, from `scripts/qemu_ck_console_test.sh`, rows 146-155; QEMU only, hardware NOT_RUN).
 
 `M4_NVME` and `SMMU` PASS in the SMMU-confined mode (default `make full`
 image, QEMU `iommu=smmuv3`). The unconfined bypass build
@@ -635,6 +635,24 @@ of the whole file takes ~40 ms, the kernel's SHA-256 of it ~8.6 s under TCG. FP/
 a silent pass) when the model file, cargo, the `aarch64-unknown-none` target, QEMU or AAVMF is missing; not
 required in CI (the runner has neither the model nor the target).
 
+Bounded session (native v1 plan P06, rows 139a-139f): after the one-shot probe the same image opens a resident
+session over the same ingested bytes through `crates/aienos-infer-kernel/src/session.rs`
+(`aienos_infer_session_open/prompt/step/cancel/tokens/text/close`, one static session slot, `#[repr(C)]` limits
+`{kv_capacity, max_new, max_prompt_bytes, heap_reserve}`). `open` binds the model once and allocates the KV cache
+for `kv_capacity` positions; `prompt` applies the chat template, refuses a prompt over `max_prompt_bytes`
+(-16) or one that would not fit the cache (-8) or the heap reserve (-15), and resets the decode state; `step`
+does exactly one unit of work per call (one prompt token into the cache during prefill, then one greedy token
+plus its forward) and returns PREFILL/TOKEN/LAST/DONE, so the kernel can cancel between any two steps; `cancel`
+forgets the cache and returns the count produced; `close` drops everything, after which the kernel forgets the
+heap region. The probe runs the session on a fresh 256 MiB region with limits kv 64, max_new 16, prompt 256
+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).
+
 | # | check | gate | status |
 |---|---|---|---|
 | 129 | kernel ingests exactly the host file's size (fw_cfg size and ingest bytes = `stat`) | INFER | QEMU PASS (hardware NOT_RUN) |
@@ -642,12 +660,18 @@ required in CI (the runner has neither the model nor the target).
 | 131 | probe rc = 0; 147 tensors (`golden.rs:112`), vocab 128256, 16 layers | INFER | QEMU PASS (hardware NOT_RUN) |
 | 132 | first four prompt ids = 128000 128006 882 128007 and prompt length 17, both read from `crates/aienos-infer/tests/fixtures/ref_fr.txt` by the script | INFER | QEMU PASS (hardware NOT_RUN) |
 | 133 | kernel alive, no panic/fault, final report, QEMU exit 0 (PSCI reset); M1/M3 boot gate unchanged PASS | INFER | QEMU PASS (hardware NOT_RUN) |
-| 134 | negative control: `--negative-control` overwrites the GGUF magic in a host copy -> probe rc=-2, every probe check FAILs, control prints PASS; `--self-test` canned logs reject 33 mutations, each by its own FAIL line | INFER | QEMU PASS (control caught; hardware NOT_RUN) |
+| 134 | negative control: `--negative-control` overwrites the GGUF magic in a host copy -> probe rc=-2, every probe check FAILs, control prints PASS; `--self-test` canned logs reject 47 mutations (33 probe, 14 session), each by its own FAIL line | INFER | QEMU PASS (control caught; hardware NOT_RUN) |
 | 135 | generated ids = the llama.cpp greedy sequence of `ref_fr.txt` "step" lines, exact: 791 6864 315 9822 374 12366 13 128009 (EOT included), read from the fixture by the script and also hard-coded in `core/infer.c` for the kernel verdict | INFER | QEMU PASS (hardware NOT_RUN) |
 | 136 | decoded text contains "Paris" (`infer: text=The capital of France is Paris.`) | INFER | QEMU PASS (hardware NOT_RUN) |
 | 137 | per-token timing line present: 7 decode forwards, mean > 0 us. First native CPU number: 40.40 s per decode token, prefill 553.9 s for 17 tokens, whole Rust call 837.8 s, under QEMU TCG single core (not hardware; host test on one Grace core is 0.59 s per forward) | INFER | QEMU PASS (hardware NOT_RUN) |
 | 138 | clean unload: `infer: unloaded` line present before the final report, frame-return rc 0,0, free frames after = before the ingest (1021097 = 1021097; 262728 frames returned), kernel then reaches M3, stages, final report, PSCI reset (QEMU exit 0) | INFER | QEMU PASS (hardware NOT_RUN) |
 | 139 | live control: the same serial log re-checked against a mutated expected-id list (second-to-last id + 1) must FAIL on the token check, else the gate FAILs; `--self-test` also covers wrong/short/swapped tokens, missing tokens/text/timing/unload lines, missing "Paris", leaked frames, refused frame return, unload after the final report | INFER | QEMU PASS (control caught; hardware NOT_RUN) |
+| 139a | session open on the same ingested bytes with explicit limits (kv 64, max_new 16, prompt 256 bytes, heap reserve 64 KiB): rc 0, same shape as the probe (147 tensors, vocab 128256, 16 layers), `infer: session open` line exactly once | INFER | QEMU PASS (2026-10-12: rc 0, 147 tensors, vocab 128256, 16 layers, heap used 22890 KiB, open 0.93 s TCG; hardware NOT_RUN) |
+| 139b | refusals before any weight is touched: a second open -12 (E_STATE), a 257-byte prompt -16 (E_PROMPT_BYTES), a step with no request pending 0 (STEP_DONE) | INFER | QEMU PASS (2026-10-12: open_twice=-12 prompt_bytes=-16 step_idle=0; hardware NOT_RUN) |
+| 139c | cancel during prefill: "Say hello." stepped 3 times then cancelled: steps = cancel_after, produced = steps - prefill, cancel returns the produced count, the next step is idle (`idle_step=done`), rc >= 0 | INFER | QEMU PASS (2026-10-12: 13 prompt ids (the fixture's 14 counts the BOS twice), steps 3 = prefill 3, produced 0, idle; hardware NOT_RUN) |
+| 139d | golden prompt through the step API after a cancel: 17 prefill steps then 8 token steps ending `last=yes`; ids = 791 6864 315 9822 374 12366 13 128009 (the one-shot reply and the llama.cpp sequence; the cache reset after cancel is proven by equality), text contains "Paris" | INFER | QEMU PASS (2026-10-12: 25 steps = 17 prefill + 8 produced, ids equal, text "The capital of France is Paris.", 40.7 s per token under TCG; hardware NOT_RUN) |
+| 139e | a second cancel after a completed request (prompt 3, one step), close rc 0 and a second close -12, session heap peak within 256 MiB, free frames after = before the session, `AIENOS_CK_INFER_SESSION: PASS` printed between the one-shot verdict and the unload line | INFER | QEMU PASS (2026-10-12: prompt 3 cancelled after 1 step, close rc 0, heap peak 24695 KiB, free frames 823823 before and after, 33 PASS lines; hardware NOT_RUN) |
+| 139f | `--self-test` rejects 14 session mutations (verdict or open line missing, limit drift, second open or long prompt accepted, cancel overrun, not idle after cancel, unfinished reply, wrong token, missing Paris, frames leaked, close refused, one-shot verdict missing, close after unload), each by its own FAIL line | INFER | host PASS (`bash scripts/qemu_ck_infer_test.sh --self-test`: 49 PASS lines) |
 
 ## SCREEN: scripts/qemu_ck_screen_test.sh -> CK `SCREEN` (L6-C prerequisite, C-only, no Rust-kernel counterpart)
 
diff --git a/native/kernel/Makefile b/native/kernel/Makefile
index 3f58626a..8c97a7ba 100644
--- a/native/kernel/Makefile
+++ b/native/kernel/Makefile
@@ -258,6 +258,8 @@ endif
 # ingests a GGUF from QEMU fw_cfg and calls the Rust unit. C flags stay
 # -mgeneral-regs-only. QEMU gate only; not combinable with CK_RUST_LIBS (two
 # Rust staticlibs would duplicate compiler_builtins) nor hardware staging.
+# The same image then runs the bounded session API (native v1 P06:
+# open/prompt/step/cancel/close in crates/aienos-infer-kernel/src/session.rs).
 CK_INFER_LIB ?=
 ifneq ($(strip $(CK_INFER_LIB)),)
 ifneq ($(strip $(CK_HARDWARE_STAGING)),)
diff --git a/native/kernel/core/.crumb b/native/kernel/core/.crumb
index bec8e447..caa99471 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-12T06:35:59Z",
+      "compiled_at": "2026-10-12T07:35:53Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:438c62d03d5cc14b9d2b663dbdd54dbd4153124e759bd3a97467e8dc0f5a6f74",
+      "digest": "sha256:d80a367d57a51994c49f6b8a5fc5554c803cc8000d6221ce6fcae75681aa3240",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
       "files": 42,
-      "generated_at_commit": "101c710b24fad41fc9a8797222e366ed71e6b6f2",
-      "source_tree": "sha256:66d1ea8b2342167efb5faa17673dc684f297f5f3c6c1710e533a881eb33e36d8"
+      "generated_at_commit": "7c4b4aed25851e2c0a607c31df1ad03671bcd20f",
+      "source_tree": "sha256:e7c95609307d15ff23b5d36cf60277f320b0e1c2db76c5ceb1b4b791ef5bcead"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/native/kernel/core/infer.c b/native/kernel/core/infer.c
index 2809ab44..8f94d955 100644
--- a/native/kernel/core/infer.c
+++ b/native/kernel/core/infer.c
@@ -53,6 +53,32 @@ struct infer_result {
 };
 extern int32_t aienos_infer_run(const uint8_t *model, uint64_t len, struct infer_result *out);
 
+/* Bounded resident session (crates/aienos-infer-kernel/src/session.rs,
+ * native v1 P06): load once, accept a prompt, one step per call so the
+ * kernel can cancel between steps, decode, unload. Mirrors of SessionLimits
+ * and SessionInfo (#[repr(C)]). */
+struct infer_limits {
+    uint32_t kv_capacity, max_new, max_prompt_bytes, heap_reserve;
+};
+struct infer_info {
+    uint32_t tensors, vocab, layers, heap_used_kib;
+};
+extern int32_t aienos_infer_session_open(const uint8_t *model, uint64_t len, const struct infer_limits *l,
+                                         struct infer_info *info);
+extern int32_t aienos_infer_session_prompt(const uint8_t *text, uint32_t len);
+extern int32_t aienos_infer_session_step(uint32_t *token, uint64_t *us);
+extern int32_t aienos_infer_session_cancel(void);
+extern int32_t aienos_infer_session_tokens(uint32_t *out, uint32_t cap);
+extern int32_t aienos_infer_session_text(const uint32_t *ids, uint32_t n, uint8_t *out, uint32_t cap);
+extern int32_t aienos_infer_session_close(void);
+extern void aienos_infer_heap_stats(uint64_t *used, uint64_t *peak);
+#define SESS_E_STATE (-12)
+#define SESS_E_PROMPT_BYTES (-16)
+#define SESS_STEP_DONE 0
+#define SESS_STEP_PREFILL 1
+#define SESS_STEP_TOKEN 2
+#define SESS_STEP_LAST 3
+
 #define CPACR_FPEN_SHIFT 20
 #define PAGE 4096ull
 #define HEAP_BYTES (256ull << 20)    /* bump-allocator region for the Rust unit */
@@ -206,6 +232,126 @@ static void hex(char *out, const uint8_t *b, unsigned n)
     out[2 * n] = 0;
 }
 
+/* Session limits of the probe: a 64-position cache, 16 generated tokens, a
+ * 256-byte prompt and 64 KiB of heap kept free (every prompt costs a few
+ * KiB that the bump allocator never gives back). */
+#define SESS_KV 64u
+#define SESS_MAX_NEW 16u
+#define SESS_PROMPT_BYTES 256u
+#define SESS_RESERVE (64u << 10)
+
+/* One request: prompt, then steps until done or until `cancel_after` steps,
+ * then cancel. Prints one line per request. Returns 1 when the request
+ * behaved (count of produced tokens as expected, no error), 0 otherwise.
+ * `expect`/`nexpect`: the exact token list a complete reply must equal. */
+static int session_request(unsigned which, const char *text, unsigned cancel_after, const uint32_t *expect,
+                           unsigned nexpect)
+{
+    uint64_t t0 = ck_time_us(), used = 0, peak = 0, pre_us = 0, tok_us_sum = 0;
+    unsigned steps = 0, prefill = 0, produced = 0, last = 0;
+    int32_t ids = aienos_infer_session_prompt((const uint8_t *)text, (uint32_t)strlen(text));
+    if (ids < 0) {
+        ck_printf("infer: session prompt=%u REFUSED rc=%d\n", which, ids);
+        return 0;
+    }
+    int32_t rc = 0;
+    for (;;) {
+        if (cancel_after && steps == cancel_after) break;
+        uint32_t t = 0;
+        uint64_t us = 0;
+        rc = aienos_infer_session_step(&t, &us);
+        if (rc < 0 || rc == SESS_STEP_DONE) break;
+        steps++;
+        if (rc == SESS_STEP_PREFILL) { prefill++; pre_us += us; continue; }
+        produced++;
+        tok_us_sum += us;
+        if (rc == SESS_STEP_LAST) { last = 1; break; }
+    }
+    static uint32_t toks[SESS_MAX_NEW];
+    static uint8_t text_out[INFER_TEXT_BYTES];
+    int32_t n = aienos_infer_session_tokens(toks, SESS_MAX_NEW);
+    int ok = rc >= 0 && n == (int32_t)produced;
+    if (cancel_after) {
+        int32_t c = aienos_infer_session_cancel();
+        ok = ok && c == (int32_t)produced && steps == cancel_after;
+        /* After a cancel the next step must do nothing. */
+        ok = ok && aienos_infer_session_step(0, 0) == SESS_STEP_DONE;
+        aienos_infer_heap_stats(&used, &peak);
+        ck_printf("infer: session prompt=%u ids=%d cancel_after_steps=%u steps=%u prefill=%u produced=%u idle_step=%s heap_used_kib=%llu rc=%d\n",
+                  which, ids, cancel_after, steps, prefill, produced, "done", (unsigned long long)(used / 1024), rc);
+        return ok;
+    }
+    ok = ok && last && (unsigned)ids == prefill && produced == nexpect;
+    for (unsigned i = 0; ok && i < nexpect; i++) ok = ok && toks[i] == expect[i];
+    int32_t tl = aienos_infer_session_text(toks, (uint32_t)produced, text_out, INFER_TEXT_BYTES);
+    ok = ok && tl >= 0;
+    escape(esc, text_out, tl > 0 ? (uint32_t)tl : 0);
+    aienos_infer_heap_stats(&used, &peak);
+    ck_printf("infer: session prompt=%u ids=%d steps=%u prefill=%u produced=%u last=%s prefill_us=%llu mean_tok_us=%llu tokens=",
+              which, ids, steps, prefill, produced, last ? "yes" : "no", (unsigned long long)pre_us,
+              (unsigned long long)(produced > 1 ? tok_us_sum / (produced - 1) : 0));
+    for (unsigned i = 0; i < produced; i++) ck_printf("%s%u", i ? " " : "", toks[i]);
+    ck_printf(" text=%s heap_used_kib=%llu request_us=%llu rc=%d\n", esc, (unsigned long long)(used / 1024),
+              (unsigned long long)(ck_time_us() - t0), rc);
+    return ok;
+}
+
+/* The bounded session over the ingested model: open with explicit limits,
+ * a request cancelled during its prefill, the golden prompt run to its end
+ * through the step API (must equal the one-shot probe's reply), a second
+ * cancelled request after a completed one, the cheap refusals, close, and
+ * the heap region returned. Prints AIENOS_CK_INFER_SESSION: PASS|FAIL. */
+static void session_run(uint64_t mpa, uint64_t msize)
+{
+    uint64_t hpa = 0, frames_before = ck_mm_free_frames();
+    if (ck_mm_frames_alloc(HEAP_BYTES / PAGE, &hpa)) {
+        ck_printf("infer: session FAIL (no frames for the heap)\nAIENOS_CK_INFER_SESSION: FAIL\n");
+        return;
+    }
+    aienos_infer_heap_init((uintptr_t)hpa, HEAP_BYTES);
+    uint64_t daif = ck_rd(daif);
+    __asm__ volatile("msr daifset, #0xf" ::: "memory");
+
+    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();
+    int32_t rc = aienos_infer_session_open((const uint8_t *)(uintptr_t)mpa, msize, &lim, &info);
+    ck_printf("infer: session 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));
+    int ok = rc == 0;
+    if (ok) {
+        /* Cheap refusals: a second open, an over-long prompt, a step with no
+         * request pending. None of them touches the model. */
+        static char longp[SESS_PROMPT_BYTES + 2];
+        memset(longp, 'a', sizeof longp - 1);
+        longp[sizeof longp - 1] = 0;
+        int32_t r_open = aienos_infer_session_open((const uint8_t *)(uintptr_t)mpa, msize, &lim, &info);
+        int32_t r_bytes = aienos_infer_session_prompt((const uint8_t *)longp, (uint32_t)strlen(longp));
+        int32_t r_idle = aienos_infer_session_step(0, 0);
+        ck_printf("infer: session refusals open_twice=%d prompt_bytes=%d step_idle=%d\n", r_open, r_bytes, r_idle);
+        ok = ok && r_open == SESS_E_STATE && r_bytes == SESS_E_PROMPT_BYTES && r_idle == SESS_STEP_DONE;
+
+        ok = session_request(1, "Say hello.", 3, 0, 0) && ok;
+        ok = session_request(2, "What is the capital of France?", 0, expect_gen,
+                             sizeof expect_gen / sizeof expect_gen[0]) && ok;
+        ok = session_request(3, "Say hello.", 1, 0, 0) && ok;
+    }
+    uint64_t used = 0, peak = 0;
+    aienos_infer_heap_stats(&used, &peak);
+    int32_t crc = aienos_infer_session_close();
+    ok = ok && crc == 0 && aienos_infer_session_close() == SESS_E_STATE;
+    ck_wr(daif, daif);
+    aienos_infer_heap_init(0, 0);
+    int f = ck_mm_frames_free(hpa, HEAP_BYTES / PAGE);
+    uint64_t frames_after = ck_mm_free_frames();
+    ok = ok && f == 0 && frames_after == frames_before;
+    ck_printf("infer: session close rc=%d heap_used_kib=%llu heap_peak_kib=%llu frames_free_before=%llu frames_free_after=%llu rc=%d\n",
+              crc, (unsigned long long)(used / 1024), (unsigned long long)(peak / 1024),
+              (unsigned long long)frames_before, (unsigned long long)frames_after, f);
+    ck_printf("AIENOS_CK_INFER_SESSION: %s\n", ok ? "PASS" : "FAIL");
+}
+
 void ck_infer_run(void)
 {
     const char *why = 0;
@@ -360,20 +506,28 @@ void ck_infer_run(void)
     for (uint32_t i = 0; ok && i < ntok; i++)
         ok = ok && res.tokens[i] == expect_gen[i];
 
-    /* Unload: the Rust unit kept nothing (its objects died at return); forget
-     * its heap region, then return every frame of the heap (and of the model
-     * when it came over fw_cfg; the disk model stays in LoaderData, never a
-     * frame). The free-frame count must come back to what it was before. */
+    /* Unload the one-shot unit: it kept nothing (its objects died at return);
+     * forget its heap region and return the heap frames. The model stays for
+     * the session below. */
     aienos_infer_heap_init(0, 0);
-    int f1 = mpages ? ck_mm_frames_free(mpa, mpages) : 0, f2 = ck_mm_frames_free(hpa, HEAP_BYTES / PAGE);
+    int f2 = ck_mm_frames_free(hpa, HEAP_BYTES / PAGE);
+    ck_printf("AIENOS_CK_INFER: %s\n", ok ? "PASS" : "FAIL");
+
+    /* Bounded session on the same model bytes, its own fresh heap region. */
+    session_run(mpa, msize);
+
+    /* Return the model's frames when it came over fw_cfg (the disk model stays
+     * in LoaderData, never a frame). The free-frame count must come back to
+     * what it was before the ingest. */
+    int f1 = mpages ? ck_mm_frames_free(mpa, mpages) : 0;
     uint64_t frames_after = ck_mm_free_frames();
     struct ck_mm_usage mu;
     ck_mm_usage(&mu);
     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)frames_before,
               (unsigned long long)frames_after, (unsigned long long)(mpages + HEAP_BYTES / PAGE), f1, f2);
-    ok = ok && f1 == 0 && f2 == 0 && frames_after == frames_before;
-    ck_printf("AIENOS_CK_INFER: %s\n", ok ? "PASS" : "FAIL");
+    if (!(f1 == 0 && f2 == 0 && frames_after == frames_before))
+        ck_puts("infer: frames NOT returned\nAIENOS_CK_INFER: FAIL\n");
 }
 #else
 void ck_infer_run(void) {}
diff --git a/scripts/.crumb b/scripts/.crumb
index 4a1b8b8a..c4b79654 100644
--- a/scripts/.crumb
+++ b/scripts/.crumb
@@ -7,14 +7,14 @@
     "generated": {
       "children": [],
       "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "compiled_at": "2026-10-12T07:42:03Z",
+      "compiled_at": "2026-10-12T07:57:50Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:eecc6309e4e429e5236cbf29a3593351f5bd5b2cb2daf6cd36c73fc96c9b0a61",
+      "digest": "sha256:28c4203cc5ca438d7d59c8a74d12d575c1d9c4ee4ce1497a5af8055183056e65",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
       "files": 83,
-      "generated_at_commit": "453f41e7fca07a97ee52db3a125d106dfaf17ff5",
-      "source_tree": "sha256:d703caef3f47b25c41635b5b5341056c640e58d745727f58177550250f352d68"
+      "generated_at_commit": "195232912a31e6ad7db1fb29d1bc5c7d45c47436",
+      "source_tree": "sha256:13d6f4d21e0959ee55980450f4daeca5c0cb9fc28eabe786164e6440aa32d336"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/scripts/qemu_ck_infer_test.sh b/scripts/qemu_ck_infer_test.sh
index 51343710..720cfc01 100755
--- a/scripts/qemu_ck_infer_test.sh
+++ b/scripts/qemu_ck_infer_test.sh
@@ -79,7 +79,8 @@ infer_check_log() {
     local re_tus='^infer: decode_tokens=([0-9]+) mean_tok_us=([0-9]+)$'
     local re_txt='^infer: text=(.*)$'
     local re_un='^infer: unloaded heap_live_kib=([0-9]+) frames_free_before=([0-9]+) frames_free_after=([0-9]+) frames_returned=([0-9]+) rc=(-?[0-9]+),(-?[0-9]+)$'
-    local n sz
+    local n sz line plen=""
+    local -a m; g() { echo "${m[$1]}"; }
     if [[ "${source_mode:-fwcfg}" == disk ]]; then
         local re_dk='^infer: disk base=0x[0-9a-f]+ size=([0-9]+) extents=([0-9]+) read_us=([0-9]+) block_size=(512|4096)$'
         n="$(grep -cE "${re_dk}" "${f}" || true)"
@@ -114,8 +115,7 @@ infer_check_log() {
         bad "exactly one well-formed infer: probe line"
     else
         line="$(grep -E "${re_p}" "${f}")"
-        local -a m; [[ "${line}" =~ ${re_p} ]]; m=("${BASH_REMATCH[@]}")
-        g() { echo "${m[$1]}"; }
+        [[ "${line}" =~ ${re_p} ]]; m=("${BASH_REMATCH[@]}")
         rc="$(g 1)"
         [[ "${rc}" == 0 ]] && ok "probe returned 0" || bad "probe returned ${rc}"
         [[ "$(g 2)" == "${want_tensors}" ]] && ok "tensor count ${want_tensors}" || bad "tensor count $(g 2), expected ${want_tensors}"
@@ -161,6 +161,75 @@ infer_check_log() {
             || bad "unload: free frames after ${fa} vs before ${fb}, frame-return rc ${r1},${r2}"
     fi
     grep -qx 'AIENOS_CK_INFER: PASS' "${f}" && ok "kernel reported AIENOS_CK_INFER: PASS" || bad "kernel did not report AIENOS_CK_INFER: PASS"
+    # native v1 P06: the bounded session over the same model bytes. Open with
+    # explicit limits, three cheap refusals, a request cancelled during its
+    # prefill, the golden prompt through the step API (reply must equal the
+    # one-shot probe's), a second cancel after a completed request, close,
+    # and every session heap frame returned.
+    local re_so='^infer: session open rc=(-?[0-9]+) tensors=([0-9]+) vocab=([0-9]+) layers=([0-9]+) kv_capacity=([0-9]+) max_new=([0-9]+) max_prompt_bytes=([0-9]+) heap_reserve_kib=([0-9]+) heap_used_kib=([0-9]+) open_us=[0-9]+$'
+    local re_sr='^infer: session refusals open_twice=(-?[0-9]+) prompt_bytes=(-?[0-9]+) step_idle=(-?[0-9]+)$'
+    local re_sc='^infer: session prompt=([0-9]+) ids=([0-9]+) cancel_after_steps=([0-9]+) steps=([0-9]+) prefill=([0-9]+) produced=([0-9]+) idle_step=done heap_used_kib=[0-9]+ rc=(-?[0-9]+)$'
+    local re_sg='^infer: session prompt=2 ids=([0-9]+) steps=([0-9]+) prefill=([0-9]+) produced=([0-9]+) last=(yes|no) prefill_us=([0-9]+) mean_tok_us=([0-9]+) tokens=([0-9 ]*) text=(.*) heap_used_kib=[0-9]+ request_us=[0-9]+ rc=(-?[0-9]+)$'
+    local re_sx='^infer: session close rc=(-?[0-9]+) heap_used_kib=([0-9]+) heap_peak_kib=([0-9]+) frames_free_before=([0-9]+) frames_free_after=([0-9]+) rc=(-?[0-9]+)$'
+    if [[ "$(grep -cE "${re_so}" "${f}" || true)" != 1 ]]; then
+        bad "exactly one well-formed infer: session open line"
+    else
+        line="$(grep -E "${re_so}" "${f}")"; [[ "${line}" =~ ${re_so} ]]; m=("${BASH_REMATCH[@]}")
+        [[ "$(g 1)" == 0 && "$(g 2)" == "${want_tensors}" && "$(g 3)" == "${want_vocab}" && "$(g 4)" == "${want_layers}" ]] \
+            && ok "session open: rc 0, same model shape ($(g 2) tensors, vocab $(g 3), $(g 4) layers)" \
+            || bad "session open: rc $(g 1), tensors $(g 2), vocab $(g 3), layers $(g 4)"
+        [[ "$(g 5)" == 64 && "$(g 6)" == 16 && "$(g 7)" == 256 && "$(g 8)" == 64 ]] \
+            && ok "session limits: kv 64, max_new 16, prompt 256 bytes, heap reserve 64 KiB" \
+            || bad "session limits: kv $(g 5), max_new $(g 6), prompt bytes $(g 7), reserve $(g 8) KiB"
+    fi
+    if [[ "$(grep -cE "${re_sr}" "${f}" || true)" != 1 ]]; then
+        bad "exactly one well-formed infer: session refusals line"
+    else
+        line="$(grep -E "${re_sr}" "${f}")"; [[ "${line}" =~ ${re_sr} ]]
+        [[ "${BASH_REMATCH[1]}" == -12 && "${BASH_REMATCH[2]}" == -16 && "${BASH_REMATCH[3]}" == 0 ]] \
+            && ok "session refusals: second open -12, over-long prompt -16, idle step 0" \
+            || bad "session refusals: second open ${BASH_REMATCH[1]}, over-long prompt ${BASH_REMATCH[2]}, idle step ${BASH_REMATCH[3]}"
+    fi
+    if [[ "$(grep -cE "${re_sc}" "${f}" || true)" != 2 ]]; then
+        bad "exactly two well-formed infer: session cancel lines (prompt 1 and 3)"
+    else
+        local which
+        for which in 1 3; do
+            line="$(grep -E "${re_sc}" "${f}" | grep "prompt=${which} " || true)"
+            if [[ "${line}" =~ ${re_sc} ]]; then
+                m=("${BASH_REMATCH[@]}")
+                [[ "$(g 2)" -gt 0 && "$(g 4)" == "$(g 3)" && "$(g 6)" == $(( $(g 4) - $(g 5) )) && "$(g 7)" -ge 0 ]] \
+                    && ok "session cancel ${which}: $(g 2) prompt ids, stopped after $(g 4) of its steps ($(g 5) prefill, $(g 6) produced), idle afterwards" \
+                    || bad "session cancel ${which}: ids $(g 2), cancel_after $(g 3), steps $(g 4), prefill $(g 5), produced $(g 6), rc $(g 7)"
+            else bad "session cancel line for prompt ${which} missing"; fi
+        done
+    fi
+    if [[ "$(grep -cE "${re_sg}" "${f}" || true)" != 1 ]]; then
+        bad "exactly one well-formed infer: session prompt=2 reply line"
+    else
+        line="$(grep -E "${re_sg}" "${f}")"; [[ "${line}" =~ ${re_sg} ]]; m=("${BASH_REMATCH[@]}")
+        local got; got="$(tr -s ' ' <<<"$(g 8)" | sed 's/ *$//')"
+        local want_n; want_n="$(wc -w <<<"${want_gen}")"
+        [[ "${got}" == "${want_gen}" ]] && ok "session reply ids '${got}' = llama.cpp greedy sequence" || bad "session reply ids '${got}', expected '${want_gen}'"
+        [[ "$(g 1)" == "${plen}" && "$(g 3)" == "${plen}" && "$(g 5)" == yes && "$(g 4)" == "${want_n}" && "$(g 2)" == $(( plen + want_n )) && "$(g 7)" -gt 0 ]] \
+            && ok "session reply: ${plen} prompt steps then ${want_n} token steps to the reply's end (mean $(g 7) us per token, QEMU TCG)" \
+            || bad "session reply: ids $(g 1), steps $(g 2), prefill $(g 3), produced $(g 4), last $(g 5), mean_tok_us $(g 7)"
+        grep -qF -- "${want_text}" <<<"$(g 9)" && ok "session reply text contains '${want_text}': $(g 9)" || bad "session reply text lacks '${want_text}': $(g 9)"
+    fi
+    if [[ "$(grep -cE "${re_sx}" "${f}" || true)" != 1 ]]; then
+        bad "exactly one well-formed infer: session close line"
+    else
+        line="$(grep -E "${re_sx}" "${f}")"; [[ "${line}" =~ ${re_sx} ]]; m=("${BASH_REMATCH[@]}")
+        [[ "$(g 1)" == 0 && "$(g 6)" == 0 && "$(g 4)" == "$(g 5)" && "$(g 4)" -gt 0 && "$(g 3)" -gt 0 && "$(g 3)" -lt 262144 ]] \
+            && ok "session close: rc 0, session heap peak $(g 3) KiB within 256 MiB, every frame returned (free frames $(g 5) = $(g 4) before)" \
+            || bad "session close: rc $(g 1), peak $(g 3) KiB, free frames after $(g 5) vs before $(g 4), frame-return rc $(g 6)"
+    fi
+    grep -qx 'AIENOS_CK_INFER_SESSION: PASS' "${f}" && ok "kernel reported AIENOS_CK_INFER_SESSION: PASS" || bad "kernel did not report AIENOS_CK_INFER_SESSION: PASS"
+    # The session runs between the one-shot verdict and the unload line.
+    if [[ "$(grep -nx 'AIENOS_CK_INFER: PASS' "${f}" | cut -d: -f1 | head -1)" -lt "$(grep -nE "${re_sx}" "${f}" | cut -d: -f1 | head -1)" \
+          && "$(grep -nE "${re_sx}" "${f}" | cut -d: -f1 | head -1)" -lt "$(grep -nE "${re_un}" "${f}" | cut -d: -f1 | head -1)" ]] 2>/dev/null; then
+        ok "session ran after the one-shot verdict and before the unload"
+    else bad "session close line not between the one-shot verdict and the unload"; fi
     grep -q "kernel: alive" "${f}" && ok "kernel alive" || bad "kernel never reached kernel: alive"
     if grep -qE 'report_kind: (panic|fault)' "${f}"; then bad "panic or fault report"; else ok "no panic or fault"; fi
     grep -q '^report_kind: final' "${f}" && ok "kernel reached its final report" || bad "no final report"
@@ -185,7 +254,7 @@ if [[ "${1:-}" == --self-test ]]; then
     [[ "${gen}" == "791 6864 315 9822 374 12366 13 128009" ]] \
         && echo "PASS  reference step tokens parsed (${gen})" || { echo "FAIL  reference step tokens '${gen}'"; echo "AIENOS_CK_INFER_SELF_TEST: FAIL"; exit 1; }
     sz=807694368
-    good() { printf 'kernel: alive\ninfer: fw_cfg base=0x9020000 dma=yes file=opt/aienos/model size=%s\ninfer: ingest bytes=%s dma_us=42340\ninfer: sha256=%s sha_us=8568801\ninfer: probe rc=0 tensors=147 vocab=128256 ids=128000,128006,882,128007 prompt_len=17 layers=16 heap_peak_kib=24695 probe_us=1116277\ninfer: prefill_us=400000000 prompt_len=17\ninfer: tokens=791 6864 315 9822 374 12366 13 128009\ninfer: tok_us=23000000,23000000,23000000,23000000,23000000,23000000,23000000\ninfer: decode_tokens=7 mean_tok_us=23000000\ninfer: text=The capital of France is Paris.\ninfer: unloaded heap_live_kib=1234 frames_free_before=900000 frames_free_after=900000 frames_returned=262705 rc=0,0\nAIENOS_CK_INFER: PASS\nreport_kind: final\n' "${sz}" "${sz}" "${pinned_sha}"; }
+    good() { printf 'kernel: alive\ninfer: fw_cfg base=0x9020000 dma=yes file=opt/aienos/model size=%s\ninfer: ingest bytes=%s dma_us=42340\ninfer: sha256=%s sha_us=8568801\ninfer: probe rc=0 tensors=147 vocab=128256 ids=128000,128006,882,128007 prompt_len=17 layers=16 heap_peak_kib=24695 probe_us=1116277\ninfer: prefill_us=400000000 prompt_len=17\ninfer: tokens=791 6864 315 9822 374 12366 13 128009\ninfer: tok_us=23000000,23000000,23000000,23000000,23000000,23000000,23000000\ninfer: decode_tokens=7 mean_tok_us=23000000\ninfer: text=The capital of France is Paris.\nAIENOS_CK_INFER: PASS\ninfer: session 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=20000 open_us=1000000\ninfer: session refusals open_twice=-12 prompt_bytes=-16 step_idle=0\ninfer: session prompt=1 ids=14 cancel_after_steps=3 steps=3 prefill=3 produced=0 idle_step=done heap_used_kib=20010 rc=1\ninfer: session prompt=2 ids=17 steps=25 prefill=17 produced=8 last=yes prefill_us=400000000 mean_tok_us=23000000 tokens=791 6864 315 9822 374 12366 13 128009 text=The capital of France is Paris. heap_used_kib=20020 request_us=600000000 rc=3\ninfer: session prompt=3 ids=14 cancel_after_steps=1 steps=1 prefill=1 produced=0 idle_step=done heap_used_kib=20030 rc=1\ninfer: session close rc=0 heap_used_kib=20030 heap_peak_kib=24695 frames_free_before=900000 frames_free_after=900000 rc=0\nAIENOS_CK_INFER_SESSION: PASS\ninfer: unloaded heap_live_kib=1234 frames_free_before=900000 frames_free_after=900000 frames_returned=262705 rc=0,0\nreport_kind: final\n' "${sz}" "${sz}" "${pinned_sha}"; }
     st=0
     chk() { infer_failed=0; out="$(infer_check_log "$3" "${sz}" "${pinned_sha}" "${ids}" 1 "${gen}")"; grep -q '^FAIL' <<<"${out}" && infer_failed=1
         if [[ "$2" == pass && ${infer_failed} == 0 ]] || [[ "$2" == fail && ${infer_failed} == 1 && -n "$4" ]] && { [[ "$2" == pass ]] || grep -q "^FAIL.*$4" <<<"${out}"; }; then echo "PASS  self-test $1"; else echo "FAIL  self-test $1"; st=1; fi; }
@@ -227,6 +296,22 @@ if [[ "${1:-}" == --self-test ]]; then
     grep -v '^infer: decode_tokens=' "${tmp}/g" >"${tmp}/z3"; chk no-timing-line fail "${tmp}/z3" "decode timing line"
     # unload line after the final report: the OS did not continue after the unload
     { grep -v '^infer: unloaded' "${tmp}/g"; grep '^infer: unloaded' "${tmp}/g"; } >"${tmp}/z4"; chk unload-after-final fail "${tmp}/z4" "not before the final report"
+    # native v1 P06: the bounded session
+    grep -v '^AIENOS_CK_INFER_SESSION' "${tmp}/g" >"${tmp}/s1"; chk no-session-verdict fail "${tmp}/s1" "AIENOS_CK_INFER_SESSION"
+    grep -v '^infer: session open' "${tmp}/g" >"${tmp}/s2"; chk no-session-open fail "${tmp}/s2" "session open line"
+    sed 's/kv_capacity=64/kv_capacity=65/' "${tmp}/g" >"${tmp}/s3"; chk session-limits-drift fail "${tmp}/s3" "session limits"
+    sed 's/open_twice=-12/open_twice=0/' "${tmp}/g" >"${tmp}/s4"; chk session-second-open-allowed fail "${tmp}/s4" "session refusals"
+    sed 's/prompt_bytes=-16/prompt_bytes=14/' "${tmp}/g" >"${tmp}/s5"; chk session-long-prompt-accepted fail "${tmp}/s5" "session refusals"
+    sed 's/cancel_after_steps=3 steps=3/cancel_after_steps=3 steps=4/' "${tmp}/g" >"${tmp}/s6"; chk session-cancel-overran fail "${tmp}/s6" "session cancel 1"
+    sed 's/idle_step=done heap_used_kib=20030/idle_step=busy heap_used_kib=20030/' "${tmp}/g" >"${tmp}/s7"; chk session-not-idle-after-cancel fail "${tmp}/s7" "session cancel lines"
+    sed 's/session prompt=2 ids=17 steps=25 prefill=17 produced=8 last=yes/session prompt=2 ids=17 steps=24 prefill=17 produced=7 last=no/' "${tmp}/g" >"${tmp}/s8"; chk session-reply-unfinished fail "${tmp}/s8" "session reply"
+    sed 's/128009 text=The capital/128010 text=The capital/' "${tmp}/g" >"${tmp}/s9"; chk session-wrong-token fail "${tmp}/s9" "session reply ids"
+    sed 's/Paris\. heap_used_kib/Lyon. heap_used_kib/' "${tmp}/g" >"${tmp}/s10"; chk session-missing-paris fail "${tmp}/s10" "session reply text lacks"
+    sed 's/session close rc=0 heap_used_kib=20030 heap_peak_kib=24695 frames_free_before=900000 frames_free_after=900000/session close rc=0 heap_used_kib=20030 heap_peak_kib=24695 frames_free_before=900000 frames_free_after=899999/' "${tmp}/g" >"${tmp}/s11"; chk session-frames-leaked fail "${tmp}/s11" "session close"
+    sed 's/session close rc=0/session close rc=-12/' "${tmp}/g" >"${tmp}/s12"; chk session-close-refused fail "${tmp}/s12" "session close"
+    { grep -v '^AIENOS_CK_INFER: PASS' "${tmp}/g"; } >"${tmp}/s13"; chk no-oneshot-verdict-still fail "${tmp}/s13" "kernel did not report AIENOS_CK_INFER: PASS"
+    # session close after the unload: the resident model was unloaded under a live session
+    { grep -v '^infer: session close' "${tmp}/g" | sed '/^report_kind: final/i infer: session close rc=0 heap_used_kib=20030 heap_peak_kib=24695 frames_free_before=900000 frames_free_after=900000 rc=0'; } >"${tmp}/s14"; chk session-close-after-unload fail "${tmp}/s14" "not between"
     # the mutated expected list must make the good log FAIL (used as the live control)
     infer_failed=0; out="$(infer_check_log "${tmp}/g" "${sz}" "${pinned_sha}" "${ids}" 1 "$(mutate_gen "${gen}")")"
     grep -q '^FAIL  generated ids' <<<"${out}" && echo "PASS  self-test mutated-expected-list" || { echo "FAIL  self-test mutated-expected-list"; st=1; }