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#889 (code only)

closed derived 5d63ad3edfeff5f3 #889

Imported from GitHub aien-dev/aien-sovereign-core-mv#889 (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 b7f2250a4507b8fc44bb29fd1ba433f05eaceca9 · Head 3b46c92d60ac694d7b457dc782cdad1f73602bcc

Fetch it

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

curl -fsSL https://interplane.io/drakestapleton/aien-sovereign-core-mv/patches/5d63ad3edfeff5f3.bundle -o 5d63ad3edfeff5f3.bundle
git fetch 5d63ad3edfeff5f3.bundle refs/pull/889/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
889
3b46c92d60ac694d7b457dc782cdad1f73602bcc
{"kind":"github-import","owner":"aien-dev","repo":"aien-sovereign-core-mv","number":889,"url":"https://github.com/aien-dev/aien-sovereign-core-mv/pull/889","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:38:12Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/crates/aien-serve-http/tests/kv_persist.rs b/crates/aien-serve-http/tests/kv_persist.rs
index 3b8cc6ad..2f2a72b6 100644
--- a/crates/aien-serve-http/tests/kv_persist.rs
+++ b/crates/aien-serve-http/tests/kv_persist.rs
@@ -26,7 +26,7 @@ use std::net::TcpStream;
 use std::path::{Path, PathBuf};
 use std::sync::atomic::{AtomicUsize, Ordering};
 use std::sync::{Arc, Mutex};
-use std::time::Duration;
+use std::time::{Duration, Instant};
 
 use aien_inference_abi::qwen3_moe_omega::{host_test_engine, OmegaEngine, WeightFormat};
 use aien_serve_http::codec::ByteCodec;
@@ -793,10 +793,22 @@ fn a_park_that_lands_after_the_conversation_moved_on_is_harmless() {
 #[test]
 fn a_graceful_shutdown_releases_the_engine_and_flushes_the_parks() {
     // serve_until: on shutdown the server stops and lets go of the engine; dropping the door
-    // then drains the parks still in flight (each stalls 200 ms) and leaves no temp file.
+    // then drains the parks still in flight (each stalls 2 s) and leaves no temp file. The
+    // stall is long so the parks are still in flight when the door drops even on a starved
+    // host (with 200 ms they sometimes finished first and the drain went untested); the test
+    // checks that just before the drop.
+    //
+    // The drain budget (`AIEN_KV_STORE_DRAIN_MS`, 2 s by default) is wall-clock time, and when
+    // it runs out the store cancels the parks it has not started (ADR 0003 section 7.5). Three
+    // stalled parks on a host whose test threads are starved (nice 19 behind busy cores) can
+    // need more than 2 s, so with the default budget this test failed under load without any
+    // defect. It checks that the drop drains, not how fast the host is: the budget is WAIT, like
+    // every other wait for the parks in this file, and the drop must return as soon as the
+    // parks are done, well before that budget runs out.
     let scratch = Scratch::new("shutdown");
-    let s = Setup::new(&scratch.store(), &gen_key());
-    let (d, _) = door_with_fault(&scratch, &s, Some("p3:200"));
+    let s = Setup::new(&scratch.store(), &gen_key())
+        .with_var("AIEN_KV_STORE_DRAIN_MS", &WAIT.as_millis().to_string());
+    let (d, _) = door_with_fault(&scratch, &s, Some("p3:2000"));
     let _ = turn(&d, &prompt1());
     let h1 = d.history();
     let keep = Arc::new(d);
@@ -815,24 +827,33 @@ fn a_graceful_shutdown_releases_the_engine_and_flushes_the_parks() {
         }))
         .unwrap();
     assert_eq!(get_json(addr, "/health")["status"], "ok");
-    assert!(
-        pk_of(&keep).counters().parked_chunks < 3,
-        "the parks are still in flight"
-    );
     tx.send(()).unwrap();
     rt.block_on(h).unwrap();
     assert!(TcpStream::connect(addr).is_err(), "the listener is closed");
     wait_for("the server to release the engine", || {
         Arc::strong_count(&keep) == 1
     });
+    let parked_before = pk_of(&keep).counters().parked_chunks;
+    assert!(
+        parked_before < 3,
+        "the parks are still in flight before the drop"
+    );
+    let t0 = Instant::now();
     drop(keep);
+    let took = t0.elapsed();
+    assert!(
+        took < WAIT,
+        "the drop waited out the drain budget ({took:?}): the parks did not finish"
+    );
     assert!(
         files_under(&scratch.store().join("tmp")).is_empty(),
         "no temp file left"
     );
+    let objects = files_under(&scratch.store().join("objects")).len();
     assert!(
-        files_under(&scratch.store().join("objects")).len() >= 3,
-        "the parks were flushed"
+        objects >= 3,
+        "the parks were flushed: {objects} objects, {parked_before} parked before the drop, \
+         the drop took {took:?}"
     );
     let (b, _) = door(&scratch, &s);
     let _ = turn(&b, &prompt2(&h1));