interplane.Get Omega
Read in your language

aien-sovereign-core-mv

AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.

Brought by drakestapleton

GitHub aien-dev/aien-sovereign-core-mv#845 (code only)

closed derived 25e313447bf8a336 #845

Imported from GitHub aien-dev/aien-sovereign-core-mv#845 (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 1cc6db9f1c638012ffe246cef38463949f09cceb · Head ad0e0073e31aa6e277cf6294a22e5ef0946a732c

Fetch it

A git bundle of the pull request's head, 3443 bytes.

curl -fsSL https://interplane.io/drakestapleton/aien-sovereign-core-mv/patches/25e313447bf8a336.bundle -o 25e313447bf8a336.bundle
git fetch 25e313447bf8a336.bundle refs/pull/845/head

Raw bundle · 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/aien-sovereign-core-mv
845
ad0e0073e31aa6e277cf6294a22e5ef0946a732c
{"kind":"github-import","owner":"aien-dev","repo":"aien-sovereign-core-mv","number":845,"url":"https://github.com/aien-dev/aien-sovereign-core-mv/pull/845","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:38:07Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/.crumb b/.crumb
index 0f5a6491..b75d48d2 100644
--- a/.crumb
+++ b/.crumb
@@ -125,14 +125,14 @@
         }
       ],
       "children_root": "sha256:9336db0a6669d32e68cee16900dfe9fc9e27304c00dc48daee6578317bf57d2c",
-      "compiled_at": "2026-10-31T03:48:37Z",
+      "compiled_at": "2026-10-31T05:14:03Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:91dccc38ffeb6cd2b32ef0cdd6dabf47e63ce51a602b302adb66b605d9159703",
+      "digest": "sha256:fc5f81f65678705d8ab921d1fdd3633c3d3f94b8d201d9ad21a0c8370d42d179",
       "evidence_files": 3602,
       "evidence_root": "sha256:1b8069934a4cc67803874ebd2ad5de32671fae5ccce1a3ea70aeb532fe8ea86b",
       "files": 8117,
-      "generated_at_commit": "9612b7787fcca2463b1b9737a7faebe91a72552a",
-      "source_tree": "sha256:c487a9da6aa3787d6b1814e39ef21afd612300997aa3c137ef2417326992f702"
+      "generated_at_commit": "19bd12c0711e732a6848d212a90ea84b1f2be7e5",
+      "source_tree": "sha256:1d37bf97fa9c01b4ed970f7057cf5132efafd6f74431a1788dc6217c267817c3"
     }
   },
   "history": [],
diff --git a/crates/aien-serve-http/tests/loopback.rs b/crates/aien-serve-http/tests/loopback.rs
index f0cd00cb..d2708c5d 100644
--- a/crates/aien-serve-http/tests/loopback.rs
+++ b/crates/aien-serve-http/tests/loopback.rs
@@ -333,14 +333,28 @@ fn inference_requires_authorization_and_local_json_origin() {
     assert_eq!(json(&good)["choices"][0]["message"]["content"], "accepted");
 }
 
-struct CountingCodec(std::sync::atomic::AtomicUsize);
+/// Counts `encode` calls. The first call is the occupying request's own prompt: it reports that it
+/// has been counted and then waits for the test's release. The server takes the engine slot before
+/// reading the body and keeps it through tokenizing, so while that call waits the server is
+/// saturated and the count already includes the occupying request; any later increment comes from
+/// a request that met the busy server.
+struct CountingCodec {
+    calls: std::sync::atomic::AtomicUsize,
+    entered: std::sync::mpsc::Sender<()>,
+    release: std::sync::Mutex<std::sync::mpsc::Receiver<()>>,
+}
 
 impl Codec for CountingCodec {
     fn render_chat(&self, turns: &[(&str, &str)]) -> Result<String, CodecError> {
         ByteCodec.render_chat(turns)
     }
     fn encode(&self, text: &str) -> Result<Vec<u32>, CodecError> {
-        self.0.fetch_add(1, std::sync::atomic::Ordering::SeqCst);
+        if self.calls.fetch_add(1, std::sync::atomic::Ordering::SeqCst) == 0 {
+            let _ = self.entered.send(());
+            // Ends on the test's release, or with an error once a failing test has dropped its
+            // sender, so a failed assertion never leaves this request (and the runtime) waiting.
+            let _ = self.release.lock().unwrap().recv();
+        }
         ByteCodec.encode(text)
     }
     fn decode(&self, ids: &[u32]) -> Result<String, CodecError> {
@@ -355,7 +369,13 @@ impl Codec for CountingCodec {
 fn saturated_request_does_not_read_body_or_invoke_codec() {
     use std::sync::atomic::Ordering;
     let rt = tokio::runtime::Runtime::new().unwrap();
-    let codec = Arc::new(CountingCodec(std::sync::atomic::AtomicUsize::new(0)));
+    let (entered_tx, entered) = std::sync::mpsc::channel();
+    let (release, release_rx) = std::sync::mpsc::channel();
+    let codec = Arc::new(CountingCodec {
+        calls: std::sync::atomic::AtomicUsize::new(0),
+        entered: entered_tx,
+        release: std::sync::Mutex::new(release_rx),
+    });
     let cfg = ServerConfig {
         port: 0,
         model_id: "test-model".into(),
@@ -363,21 +383,18 @@ fn saturated_request_does_not_read_body_or_invoke_codec() {
         ..ServerConfig::default()
     };
     let (addr, _h) = rt
-        .block_on(serve(
-            cfg,
-            Arc::new(stub(&"x".repeat(60)).with_delay(Duration::from_millis(25))),
-            codec.clone(),
-        ))
+        .block_on(serve(cfg, Arc::new(stub(&"x".repeat(60))), codec.clone()))
         .unwrap();
     let first = std::thread::spawn(move || chat(addr, PROMPT));
-    for _ in 0..100 {
-        if json(&request(addr, "GET", "/health", None))["busy"] == true {
-            break;
-        }
-        std::thread::sleep(Duration::from_millis(10));
-    }
+    // `/health` reports busy as soon as the slot is taken, before the occupying request has read
+    // its body or tokenized; wait for its own encode so that call is not charged to the requests
+    // below.
+    entered
+        .recv_timeout(Duration::from_secs(30))
+        .expect("occupying request never reached the tokenizer");
     assert_eq!(json(&request(addr, "GET", "/health", None))["busy"], true);
-    let before = codec.0.load(Ordering::SeqCst);
+    let before = codec.calls.load(Ordering::SeqCst);
+    assert_eq!(before, 1, "only the occupying request has tokenized");
     let full = raw_post(
         addr,
         &format!("Authorization: Bearer {TOKEN}\r\nContent-Type: application/json\r\n"),
@@ -385,14 +402,15 @@ fn saturated_request_does_not_read_body_or_invoke_codec() {
     );
     assert_eq!(full.status, 503);
     assert_eq!(
-        codec.0.load(Ordering::SeqCst),
+        codec.calls.load(Ordering::SeqCst),
         before,
         "busy request invoked tokenizer"
     );
     let incomplete = format!("POST /v1/chat/completions HTTP/1.1\r\nHost: localhost\r\nAuthorization: Bearer {TOKEN}\r\nContent-Type: application/json\r\nContent-Length: 100\r\nConnection: close\r\n\r\n");
     let rejected = raw_request(addr, &incomplete);
     assert_eq!(rejected.status, 503, "{}", rejected.body);
-    assert_eq!(codec.0.load(Ordering::SeqCst), before);
+    assert_eq!(codec.calls.load(Ordering::SeqCst), before);
+    release.send(()).unwrap();
     assert_eq!(first.join().unwrap().status, 200);
 }