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#352 (code only)
Fetch it
curl -fsSL https://interplane.io/drakestapleton/aien-sovereign-core-mv/patches/8d1a1b7e52bf600c.bundle -o 8d1a1b7e52bf600c.bundle git fetch 8d1a1b7e52bf600c.bundle refs/pull/352/head
Provenance
github-import 1
aien-dev/aien-sovereign-core-mv
352
1fe3f1eeb1ae82df02fe39177dc4b92029eb70f1
{"kind":"github-import","owner":"aien-dev","repo":"aien-sovereign-core-mv","number":352,"url":"https://github.com/aien-dev/aien-sovereign-core-mv/pull/352","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:54Z","metadata":"unavailable","state_derived":true}
Changes
diff --git a/.crumb b/.crumb index f5933ee6..4525914b 100644 --- a/.crumb +++ b/.crumb @@ -77,14 +77,14 @@ } ], "children_root": "sha256:95ba9db41a2ad217bd02bbbe25aaf363580b5cd23754f40351ee780858343de5", - "compiled_at": "2026-10-08T21:22:33Z", + "compiled_at": "2026-10-08T21:46:05Z", "compiler": "crumb-compile/1", - "digest": "sha256:faa6ae7884db6d1291dabe74c7fd71be2b47922b9c029e9f9a3d89d9fc3c0d10", + "digest": "sha256:861f6d634b659453ad5d70c46c4e64aeb7fbba17b1922576cb4a3eb3a02e3c50", "evidence_files": 187, "evidence_root": "sha256:27ee0353cb4d4aae2b7dbce2bfe0d9f4ef2a94cd7a4555b84684d59372503280", "files": 1728, - "generated_at_commit": "34cb9364234c5547e53681b373fb85b1a010fd69", - "source_tree": "sha256:808396408f1ebe1f0a0cc19db83638d11f9bd3c8d018170c1ce54988a72be6d7" + "generated_at_commit": "d6af249b6598dcf8c2cf283f70ffe73f6767082f", + "source_tree": "sha256:64c56348f20d5bb92913ecd26d6adfedacda7d2c0000360f4d5432c5626d7ea6" } }, "history": [], diff --git a/crates/aien-cli/.crumb b/crates/aien-cli/.crumb index 39afb074..4a0de451 100644 --- a/crates/aien-cli/.crumb +++ b/crates/aien-cli/.crumb @@ -35,20 +35,20 @@ "children": [ { "digest": "dd43e4f3ee00804bd1aaac8906238f44688f719d9c5422a68fc4fee6906768af", - "last_commit": "ec9a17e", + "last_commit": "b0cee16", "name": "src", "purpose": "" } ], "children_root": "sha256:e2f54116bdcc7366210192f3e08ba76d21cbec793541c092782b2c14aecafc49", - "compiled_at": "2026-10-08T20:16:31Z", + "compiled_at": "2026-10-08T20:40:14Z", "compiler": "crumb-compile/1", - "digest": "sha256:00d43983308a63807ff789ee1e1053005db659c65105d8bfb2f0286d748ed2a6", + "digest": "sha256:13cd3b3fd25eba11e955c3f5271c71c59b35dae179aebf25bfd274949fb54a7e", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 35, - "generated_at_commit": "ec9a17e8fd7e138937179095ffee55d561df844a", - "source_tree": "sha256:0150a739f1b10377ed64978d07f7f1a0a86fcd8f49181814f966f0f37617bc5a" + "generated_at_commit": "b0cee161ba3342af362fcb2ddbda5f728c2d6c12", + "source_tree": "sha256:e5fe6fab325ce134c7d88582b328abfa9208d96a753d52d830774b094d8ecb24" } }, "history": [ diff --git a/crates/aien-cli/tests/desk_required_startup_test.rs b/crates/aien-cli/tests/desk_required_startup_test.rs index c2cc869e..de9ebdd7 100644 --- a/crates/aien-cli/tests/desk_required_startup_test.rs +++ b/crates/aien-cli/tests/desk_required_startup_test.rs @@ -9,6 +9,8 @@ //! at startup ("Authorize MAC: OFF, DEV OPT-OUT"). //! D4 a desk key created by `aien compose desk-key --create`: the daemon //! serves with "Authorize MAC: on". +//! A helper whose check fails still stops its daemon (a `Daemon` guard +//! kills and reaps it on drop), so a failing run leaves nothing running. //! No model and no composition library are needed (host CPU only); these run //! in every build. use std::os::unix::process::CommandExt; @@ -76,7 +78,7 @@ impl Rig { } c } - fn spawn(&self, dev: bool, switch: Option<&str>) -> Child { + fn spawn(&self, dev: bool, switch: Option<&str>) -> Daemon { let f = std::fs::File::create(self.log()).unwrap(); let mut c = self.cmd(dev, switch); c.arg("daemon") @@ -84,7 +86,7 @@ impl Rig { .stdin(Stdio::null()) .stdout(f.try_clone().unwrap()) .stderr(f); - c.spawn().expect("spawn daemon") + Daemon(c.spawn().expect("spawn daemon")) } fn text(&self) -> String { std::fs::read_to_string(self.log()).unwrap_or_default() @@ -94,7 +96,7 @@ impl Rig { fn refused(&self, dev: bool, switch: Option<&str>) -> String { let mut d = self.spawn(dev, switch); for _ in 0..1200 { - if let Some(st) = d.try_wait().unwrap() { + if let Some(st) = d.0.try_wait().unwrap() { let text = self.text(); assert!( !st.success(), @@ -113,8 +115,6 @@ impl Rig { ); std::thread::sleep(Duration::from_millis(50)); } - let _ = d.kill(); - let _ = d.wait(); panic!("the daemon did not refuse within 60 s: {}", self.text()); } @@ -123,22 +123,29 @@ impl Rig { let mut d = self.spawn(dev, switch); for _ in 0..1200 { std::thread::sleep(Duration::from_millis(50)); - if let Some(st) = d.try_wait().unwrap() { + if let Some(st) = d.0.try_wait().unwrap() { panic!("daemon exited early ({st:?}): {}", self.text()); } let text = self.text(); if self.sock().exists() && text.contains("Authorize MAC:") { - let _ = d.kill(); - let _ = d.wait(); return text; } } - let _ = d.kill(); - let _ = d.wait(); panic!("the daemon did not come up in 60 s: {}", self.text()); } } +/// A spawned daemon, killed and reaped when dropped: on return and on a +/// failed assert alike, so a failing check never leaves it running. +struct Daemon(Child); + +impl Drop for Daemon { + fn drop(&mut self) { + let _ = self.0.kill(); + let _ = self.0.wait(); + } +} + fn key_path(compose: &Path) -> String { compose.join("approval-desk.key").display().to_string() } @@ -211,3 +218,40 @@ fn d4_with_the_desk_key_the_daemon_serves_with_the_mac_on() { .unwrap_or_default(); assert!(line.starts_with("Authorize MAC: on"), "{line}"); } + +/// Daemons still running on this socket (their environment names it). +fn daemons_on(sock: &Path) -> Vec<String> { + let want = format!("AIEN_RUNTIME_SOCK={}", sock.display()); + let mut pids = Vec::new(); + for e in std::fs::read_dir("/proc").unwrap().flatten() { + let pid = e.file_name().to_string_lossy().to_string(); + if !pid.chars().all(|c| c.is_ascii_digit()) { + continue; + } + if let Ok(env) = std::fs::read(e.path().join("environ")) { + if env.split(|b| *b == 0).any(|v| v == want.as_bytes()) { + pids.push(pid); + } + } + } + pids +} + +/// A helper that fails must not leave its daemon running: here `refused` +/// meets a daemon that serves (the dev opt-out), so it panics. +#[test] +fn a_failed_check_stops_its_daemon() { + let r = Rig::new(); + let failed = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { + r.refused(true, Some("0")); + })); + assert!(failed.is_err(), "the daemon was expected to serve"); + let left = daemons_on(&r.sock()); + for pid in &left { + let _ = Command::new("kill").args(["-KILL", pid]).status(); + } + assert!( + left.is_empty(), + "the failed check left daemon(s) {left:?} running" + ); +}