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

closed derived 1b32c964b72e51b3 #653

Imported from GitHub aien-dev/aien-sovereign-core-mv#653 (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 12e71aad80fda23a428317d11b0dac02d1c777f1 · Head cba9e301dcb5e8edc169db9a4cf7ed38c3571604

Apply it

git checkout -b patch-1b32c964b72e51b3 12e71aad80fda23a428317d11b0dac02d1c777f1
curl -fsSL https://interplane.io/drakestapleton/aien-sovereign-core-mv/patches/1b32c964b72e51b3.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/aien-sovereign-core-mv
653
cba9e301dcb5e8edc169db9a4cf7ed38c3571604
{"kind":"github-import","owner":"aien-dev","repo":"aien-sovereign-core-mv","number":653,"url":"https://github.com/aien-dev/aien-sovereign-core-mv/pull/653","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:37:46Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/.crumb b/.crumb
index d38130fb..7a2e9d88 100644
--- a/.crumb
+++ b/.crumb
@@ -119,14 +119,14 @@
         }
       ],
       "children_root": "sha256:111edf8bf001ed434f7dacbc6d8ab9d75f6bda2cd909d01264fb42bbe38b1d74",
-      "compiled_at": "2026-10-17T11:58:09Z",
+      "compiled_at": "2026-10-18T14:31:24Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:90138b1fd1cf3ffa4f762b157930e959f2bea50c41351c40b41330ae9edff05b",
+      "digest": "sha256:ba2ab953abfaa4b1dec7835c17ab15be85063a6be36ddb8f208e4462950af4cd",
       "evidence_files": 1578,
       "evidence_root": "sha256:135e27a1a0704c4a8371cd2c1eb555f2b5beec61c212949b029a5457418a7160",
       "files": 5891,
-      "generated_at_commit": "6fb606867d2cd502b9475cd2ff0cc85ab40b16c9",
-      "source_tree": "sha256:7ac140a01c7f7ef0cc9f91a7cf9ea94fb063f8ca7f24365f185b9da5b2ed26b9"
+      "generated_at_commit": "6209294b254922f8eb824797ae8c40fd5495fda1",
+      "source_tree": "sha256:dd36cf8594bdf7aafdcf453cb0dc917b3dbae667371bcc1351dcb371b6e3098b"
     }
   },
   "history": [],
diff --git a/tools/aien-test/src/process.rs b/tools/aien-test/src/process.rs
index efd49933..2abb57e8 100644
--- a/tools/aien-test/src/process.rs
+++ b/tools/aien-test/src/process.rs
@@ -22,6 +22,8 @@ pub struct RunSpec {
     /// Decision 6, gb10 jobs). `timeout` is then advisory and only sets
     /// `timeout_exceeded`.
     pub enforce_timeout: bool,
+    /// Extra `K=V` pairs set in the job's environment on top of the runner's.
+    pub env: Vec<(String, String)>,
 }
 
 #[derive(Debug)]
@@ -150,6 +152,7 @@ pub(crate) fn output_gated(cmd: &mut Command) -> io::Result<Output> {
 fn spawn(spec: &RunSpec) -> io::Result<Child> {
     let mut cmd = Command::new(&spec.program);
     cmd.args(&spec.args)
+        .envs(spec.env.iter().map(|(k, v)| (k, v)))
         .current_dir(&spec.cwd)
         .stdin(Stdio::null())
         .stdout(Stdio::piped())
@@ -250,6 +253,7 @@ mod tests {
             timeout: Duration::from_millis(timeout_ms),
             kill_grace: Duration::from_millis(500),
             enforce_timeout: true,
+            env: Vec::new(),
         }
     }
 
diff --git a/tools/aien-test/src/resources.rs b/tools/aien-test/src/resources.rs
index 407c6aad..993f5401 100644
--- a/tools/aien-test/src/resources.rs
+++ b/tools/aien-test/src/resources.rs
@@ -45,6 +45,9 @@ use std::path::{Path, PathBuf};
 use std::sync::{Condvar, Mutex, MutexGuard};
 
 pub const DEFAULT_GPU_LOCK: &str = "/tmp/aien-gb10.lock";
+/// Set to `1` in a gb10 job's environment while the runner holds the GPU
+/// lock for it. Gate scripts that take the lock themselves skip it then.
+pub const GPU_LOCK_HELD_ENV: &str = "AIEN_GB10_LOCK_HELD";
 
 pub(crate) fn lock<T>(m: &Mutex<T>) -> MutexGuard<'_, T> {
     m.lock().unwrap_or_else(|e| e.into_inner())
diff --git a/tools/aien-test/src/runner.rs b/tools/aien-test/src/runner.rs
index 04f57e51..d87197eb 100644
--- a/tools/aien-test/src/runner.rs
+++ b/tools/aien-test/src/runner.rs
@@ -726,6 +726,13 @@ fn execute_gate(job: &Job<'_>, permit: Option<Permit<'_>>) -> Result<Outcome, Ru
             // gb10 jobs are never killed (ADR 0028 Decision 6): the timeout
             // only marks the receipt.
             enforce_timeout: m.pool() != "gb10",
+            // The runner already holds the GPU lock for this job: a gate script that
+            // would take it again must not, or it waits on us forever (#627).
+            env: if gpu.is_some() {
+                vec![(resources::GPU_LOCK_HELD_ENV.to_string(), "1".to_string())]
+            } else {
+                Vec::new()
+            },
         };
         // The sandbox seam (C8): `none` returns `direct` unchanged.
         let spec = sandbox::wrap(
@@ -1624,6 +1631,26 @@ mod tests {
         );
     }
 
+    const ECHO_LOCK_HELD: &str = "#!/bin/sh\nprintf '[%s]' \"$AIEN_GB10_LOCK_HELD\" > \"$1\"\n";
+
+    #[test]
+    fn gb10_gate_is_told_the_runner_holds_the_gpu_lock() {
+        // #627: the gate script must not take the lock again, or it waits on us forever.
+        let fx = gb10_fixture(ECHO_LOCK_HELD, "20s");
+        let o = run(&fx, &gb10_opts(&fx));
+        assert_eq!(o.verdict, Verdict::Pass, "reason {}", o.reason);
+        assert_eq!(fs::read_to_string(fx.marker()).unwrap(), "[1]");
+
+        let fx = fixture(ECHO_LOCK_HELD, 0, &[], "20s", "");
+        let o = run(&fx, &fx.opts());
+        assert_eq!(o.verdict, Verdict::Pass, "reason {}", o.reason);
+        assert_eq!(
+            fs::read_to_string(fx.marker()).unwrap(),
+            "[]",
+            "host gates hold no GPU lock"
+        );
+    }
+
     #[test]
     fn operator_gate_runs_when_the_operator_started_it() {
         // sc #614: the same gate the previous test refuses runs under
diff --git a/tools/aien-test/src/sandbox.rs b/tools/aien-test/src/sandbox.rs
index c1d64300..1f6978e3 100644
--- a/tools/aien-test/src/sandbox.rs
+++ b/tools/aien-test/src/sandbox.rs
@@ -99,12 +99,15 @@ pub fn command(
 
 /// Rewrite a direct `RunSpec` for the sandbox. `None` returns it unchanged,
 /// byte for byte. The timeout policy (`enforce_timeout`) is not touched: a
-/// gb10 job stays advisory and is never killed.
+/// gb10 job stays advisory and is never killed. The spec's own `env` pairs
+/// move onto the helper's `--env` list, since sudo would drop them.
 pub fn wrap(sandbox: Sandbox, spec: RunSpec, profile: &str, env: &[(String, String)]) -> RunSpec {
     if sandbox == Sandbox::None {
         return spec;
     }
     let secs = spec.timeout.as_secs().max(1);
+    let mut pairs = env.to_vec();
+    pairs.extend(spec.env.iter().cloned());
     let (program, args) = command(
         sandbox,
         &spec.program,
@@ -112,11 +115,12 @@ pub fn wrap(sandbox: Sandbox, spec: RunSpec, profile: &str, env: &[(String, Stri
         &spec.cwd,
         secs,
         profile,
-        env,
+        &pairs,
     );
     RunSpec {
         program,
         args,
+        env: Vec::new(),
         ..spec
     }
 }
@@ -144,6 +148,7 @@ mod tests {
             timeout: Duration::from_millis(90_500),
             kill_grace: Duration::from_secs(10),
             enforce_timeout: false,
+            env: Vec::new(),
         }
     }
 
@@ -219,6 +224,37 @@ mod tests {
         );
     }
 
+    #[test]
+    fn the_specs_own_env_moves_onto_the_helper_command_line() {
+        let held = vec![("AIEN_GB10_LOCK_HELD".to_string(), "1".to_string())];
+        let mut s = spec();
+        s.env = held.clone();
+        let none = wrap(Sandbox::None, s, "gb10", &[]);
+        assert_eq!(none.env, held, "none keeps the pairs for the direct spawn");
+        let mut s = spec();
+        s.env = held;
+        let env = vec![("CARGO_TARGET_DIR".to_string(), "/t".to_string())];
+        let w = wrap(Sandbox::User, s, "gb10", &env);
+        let envs: Vec<&String> = w
+            .args
+            .windows(2)
+            .filter(|p| p[0] == "--env")
+            .map(|p| &p[1])
+            .collect();
+        assert_eq!(
+            envs,
+            vec![
+                "AIEN_SANDBOX_NESTED=1",
+                "CARGO_TARGET_DIR=/t",
+                "AIEN_GB10_LOCK_HELD=1"
+            ]
+        );
+        assert!(
+            w.env.is_empty(),
+            "sudo would drop them, so none stay on the spec"
+        );
+    }
+
     #[test]
     fn parse_and_names() {
         assert_eq!(Sandbox::parse("none").unwrap(), Sandbox::None);