From 8c2d58deb7d28016f574a1167a11f47cb1d5cf64 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Sun, 18 Oct 2026 09:00:17 -0500 Subject: [PATCH 1/3] aien-test: tell a gb10 gate the runner already holds the GPU lock The worker holds /tmp/aien-gb10.lock for the whole gb10 job, and the physics gate scripts flock the same file with a blocking flock. Once the sandbox user can open the lock (#627), such a script would wait on the worker forever, and gb10 jobs are never killed. The job now gets AIEN_GB10_LOCK_HELD=1 (through the helper's --env under --sandbox user) so scripts can skip their own flock. Refs #627 Co-Authored-By: Claude Opus 5.5 --- tools/aien-test/src/process.rs | 4 ++++ tools/aien-test/src/resources.rs | 3 +++ tools/aien-test/src/runner.rs | 27 +++++++++++++++++++++ tools/aien-test/src/sandbox.rs | 40 ++++++++++++++++++++++++++++++-- 4 files changed, 72 insertions(+), 2 deletions(-) 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 { fn spawn(spec: &RunSpec) -> io::Result { 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(m: &Mutex) -> 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>) -> Result \"$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); From 6209294b254922f8eb824797ae8c40fd5495fda1 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Sun, 18 Oct 2026 09:01:32 -0500 Subject: [PATCH 2/3] crumb: recompile with the pinned tool (aien-architecture d0f0b95) Co-Authored-By: Claude Opus 5.5 --- .crumb | 52 +++++----------------------------------------------- 1 file changed, 5 insertions(+), 47 deletions(-) diff --git a/.crumb b/.crumb index d38130fb..e3dbf185 100644 --- a/.crumb +++ b/.crumb @@ -63,42 +63,6 @@ "extensions": { "generated": { "children": [ - { - "digest": "4e7f370019e67f6c71565d1544530851eb1b3b1bed61c2712f4ac7d9614a89bf", - "last_commit": "6bbe2ec2", - "name": "crates/aien-allen", - "purpose": "ALLEN identity gate: resolve-only subject check, host pin record, deployment record (ADR 0035). " - }, - { - "digest": "40a231c50dba92af7de2527ab33879c5d1eaaa6e7ea5d6a5ebaa9d60c7542075", - "last_commit": "b9b52f9c", - "name": "crates/aien-allen-memory", - "purpose": "ALLEN scoped memory store: scopes enforced at recall, inspect/correct/export, key-destroying for" - }, - { - "digest": "44dc482b8c9db8919a68ec69b019cd77967232a6ec8b1910c0dfe3cd4d71f141", - "last_commit": "b9b52f9c", - "name": "crates/aien-allen-profile", - "purpose": "ALLEN persona profile v1: versioned, user-editable profile bound to the engaged ALLEN identity; " - }, - { - "digest": "f5571bcc0bb95b44dd8bf8f0b47ded3bcb1e1ee76c81b4ff5edb87ac237d66d8", - "last_commit": "f8eea420", - "name": "crates/aien-cli", - "purpose": "" - }, - { - "digest": "25fd9f8afbea19702750f8ddba2ef4aeafc5bc4515aa695340a5af6931989c03", - "last_commit": "8cca8020", - "name": "crates/aien-scheduler/src/bin", - "purpose": "" - }, - { - "digest": "dd11ae9a698f7fcad7d1df386926426ea051d4131ee738da2ac81eb6a57b9473", - "last_commit": "afbbd804", - "name": "crates/spark-cockpit-rs", - "purpose": "" - }, { "digest": "34b010337138a65931ca4d0177631d839f71af021c5092583f52afd69ddd1b72", "last_commit": "fe3677c3", @@ -110,23 +74,17 @@ "last_commit": "fa73e778", "name": "skills", "purpose": "" - }, - { - "digest": "b787845b373f1f2ef48522c2575a6de8ad32e3584bef4b578ba61d2ab053187c", - "last_commit": "fe3677c3", - "name": "tools/aien-local-ci", - "purpose": "Local CI sandbox exec contract (C8), aien-run user/caches install, Forgejo trigger hook, health " } ], - "children_root": "sha256:111edf8bf001ed434f7dacbc6d8ab9d75f6bda2cd909d01264fb42bbe38b1d74", - "compiled_at": "2026-10-17T11:58:09Z", + "children_root": "sha256:bd742d6a3614d943dddc615cc1f2e6a2ff9b3b0274923cbb231b9a6660460503", + "compiled_at": "2026-10-18T14:01:20Z", "compiler": "crumb-compile/1", - "digest": "sha256:90138b1fd1cf3ffa4f762b157930e959f2bea50c41351c40b41330ae9edff05b", + "digest": "sha256:38029674dbf3c1483f75b4c55282459a76302a2b9fbce571411caad3cf0c7baf", "evidence_files": 1578, "evidence_root": "sha256:135e27a1a0704c4a8371cd2c1eb555f2b5beec61c212949b029a5457418a7160", "files": 5891, - "generated_at_commit": "6fb606867d2cd502b9475cd2ff0cc85ab40b16c9", - "source_tree": "sha256:7ac140a01c7f7ef0cc9f91a7cf9ea94fb063f8ca7f24365f185b9da5b2ed26b9" + "generated_at_commit": "8c2d58deb7d28016f574a1167a11f47cb1d5cf64", + "source_tree": "sha256:dd36cf8594bdf7aafdcf453cb0dc917b3dbae667371bcc1351dcb371b6e3098b" } }, "history": [], From cba9e301dcb5e8edc169db9a4cf7ed38c3571604 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Sun, 18 Oct 2026 09:31:25 -0500 Subject: [PATCH 3/3] crumb: recompile with the CI-pinned tool (aien-architecture 94fffbcf) Co-Authored-By: Claude Opus 5.5 --- .crumb | 50 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/.crumb b/.crumb index e3dbf185..7a2e9d88 100644 --- a/.crumb +++ b/.crumb @@ -63,6 +63,42 @@ "extensions": { "generated": { "children": [ + { + "digest": "4e7f370019e67f6c71565d1544530851eb1b3b1bed61c2712f4ac7d9614a89bf", + "last_commit": "6bbe2ec2", + "name": "crates/aien-allen", + "purpose": "ALLEN identity gate: resolve-only subject check, host pin record, deployment record (ADR 0035). " + }, + { + "digest": "40a231c50dba92af7de2527ab33879c5d1eaaa6e7ea5d6a5ebaa9d60c7542075", + "last_commit": "b9b52f9c", + "name": "crates/aien-allen-memory", + "purpose": "ALLEN scoped memory store: scopes enforced at recall, inspect/correct/export, key-destroying for" + }, + { + "digest": "44dc482b8c9db8919a68ec69b019cd77967232a6ec8b1910c0dfe3cd4d71f141", + "last_commit": "b9b52f9c", + "name": "crates/aien-allen-profile", + "purpose": "ALLEN persona profile v1: versioned, user-editable profile bound to the engaged ALLEN identity; " + }, + { + "digest": "f5571bcc0bb95b44dd8bf8f0b47ded3bcb1e1ee76c81b4ff5edb87ac237d66d8", + "last_commit": "f8eea420", + "name": "crates/aien-cli", + "purpose": "" + }, + { + "digest": "25fd9f8afbea19702750f8ddba2ef4aeafc5bc4515aa695340a5af6931989c03", + "last_commit": "8cca8020", + "name": "crates/aien-scheduler/src/bin", + "purpose": "" + }, + { + "digest": "dd11ae9a698f7fcad7d1df386926426ea051d4131ee738da2ac81eb6a57b9473", + "last_commit": "afbbd804", + "name": "crates/spark-cockpit-rs", + "purpose": "" + }, { "digest": "34b010337138a65931ca4d0177631d839f71af021c5092583f52afd69ddd1b72", "last_commit": "fe3677c3", @@ -74,16 +110,22 @@ "last_commit": "fa73e778", "name": "skills", "purpose": "" + }, + { + "digest": "b787845b373f1f2ef48522c2575a6de8ad32e3584bef4b578ba61d2ab053187c", + "last_commit": "fe3677c3", + "name": "tools/aien-local-ci", + "purpose": "Local CI sandbox exec contract (C8), aien-run user/caches install, Forgejo trigger hook, health " } ], - "children_root": "sha256:bd742d6a3614d943dddc615cc1f2e6a2ff9b3b0274923cbb231b9a6660460503", - "compiled_at": "2026-10-18T14:01:20Z", + "children_root": "sha256:111edf8bf001ed434f7dacbc6d8ab9d75f6bda2cd909d01264fb42bbe38b1d74", + "compiled_at": "2026-10-18T14:31:24Z", "compiler": "crumb-compile/1", - "digest": "sha256:38029674dbf3c1483f75b4c55282459a76302a2b9fbce571411caad3cf0c7baf", + "digest": "sha256:ba2ab953abfaa4b1dec7835c17ab15be85063a6be36ddb8f208e4462950af4cd", "evidence_files": 1578, "evidence_root": "sha256:135e27a1a0704c4a8371cd2c1eb555f2b5beec61c212949b029a5457418a7160", "files": 5891, - "generated_at_commit": "8c2d58deb7d28016f574a1167a11f47cb1d5cf64", + "generated_at_commit": "6209294b254922f8eb824797ae8c40fd5495fda1", "source_tree": "sha256:dd36cf8594bdf7aafdcf453cb0dc917b3dbae667371bcc1351dcb371b6e3098b" } },