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

The judge waits a bounded time for the GPU lock instead of trying once

merged 506300760b740fa3 #684 · opened 2026-10-19 18:48 UTC · closed 2026-10-19 19:10 UTC · merged 2026-10-19 19:10 UTC

Imported from GitHub aien-dev/aien-sovereign-core-mv#684, by drakestapleton

Labels: ready-to-merge

Base 17881bc10d8ed71bc14f68228660dda7f1293993 · Head 30e61208866b1f2a651b4efc4abfa7636a317760

Merged on GitHub as b5f7d4d8c136cc9a99734ee4d5e90a240557cd21; reachable from main 007ac4ac5ee5edc6f79f411b1706752293604044 (observed 2026-11-18T16:35:47Z)

drakestapleton wrote on 2026-10-19 18:48 UTC

The judge tried the GPU lock (/tmp/aien-gb10.lock) exactly once and gave up as "not run, gpu_lock" if anyone held it. The live 27B model server takes that same lock around every request (up to 222 s each), so one try almost always lost; chip gates (M19, COMPOSITION-GATE-GPU, ...) came back "not run".

Change (aien-test): a held lock is now waited for, up to a limit, by joining the same kernel waiting line the server's requests use, so the gate takes its turn and never jumps the line or holds the chip idle. Default limit 30 minutes (the server's own load limit). Still held after that: "not run, gpu_lock", as before. New switches --gpu-wait 0 (old behaviour), --gpu-wait 90s, --wait-gpu (no limit). A waiter that gives up and is later handed the lock lets go at once. Every chip gate receipt records the wait (gpu_wait), and aien-test verify prints a "GPU lock wait" line. No gate is dropped, skipped or loosened.

Evidence (handoff ~/handoffs/2026-10-19-gates-fix-2.md on the Spark): same test red on main ("not run, gpu_lock"), green on the branch; against the live lock old program 3 of 3 not run, new program 3 of 3 pass after waiting 73 s, 4 s, 90 s; COMPOSITION-GATE-GPU on omega main through the new judge waited 236 s then PASS; fairness check: re-polling got in 2 of 5, queued waiting 5 of 5. aien-test 291 + 32 tests pass, 4 new mutants all caught.

Trust surface (tools/aien-test), so it needs the operator run. After merge the aien-test program is rebuilt and the workers restarted with the judge idle.

Apply it

git checkout -b patch-506300760b740fa3 17881bc10d8ed71bc14f68228660dda7f1293993
curl -fsSL https://interplane.io/drakestapleton/aien-sovereign-core-mv/patches/506300760b740fa3.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
684
30e61208866b1f2a651b4efc4abfa7636a317760
{"kind":"github-import","owner":"aien-dev","repo":"aien-sovereign-core-mv","number":684,"url":"https://github.com/aien-dev/aien-sovereign-core-mv/pull/684","export_sha256":"d815604dc795b494a931d4c9d256159461266bed51d6da460421ed1d94dab90f","imported_utc":"2026-11-18T16:35:47Z"}

Changes

diff --git a/.crumb b/.crumb
index 37fb3ad4..8cd4767a 100644
--- a/.crumb
+++ b/.crumb
@@ -112,21 +112,21 @@
           "purpose": ""
         },
         {
-          "digest": "afb0a808b1cb4f66c0a20b3c49080054c824c027a2e412d4e8a67cfa8482fc09",
-          "last_commit": "5cb704d",
+          "digest": "489b92d3d4363d2b403d6fee34a384284a40c25176df4dcc77eef07478ff8825",
+          "last_commit": "96d8916",
           "name": "tools/aien-local-ci",
           "purpose": "Local CI sandbox exec contract (C8), aien-run user/caches install, Forgejo trigger hook, health "
         }
       ],
-      "children_root": "sha256:dda1fdd0a03d2e5240273dcce56351592f5e4fddd4354f220899ad0032f1f989",
-      "compiled_at": "2026-10-19T18:07:31Z",
+      "children_root": "sha256:56a733caee3618ff5b127be2a8cd1d661087f7d9e2bc2a1f6f0a06326bd5467a",
+      "compiled_at": "2026-10-19T18:48:05Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:3904b58e0b7e3c56109963389b332413e4dcb48362c6f06fc4402277bd4dbe76",
+      "digest": "sha256:00c210c6afe7b8cbf2e0bd22962383877edc999e03dc434c40d30a2854f3d72c",
       "evidence_files": 1578,
       "evidence_root": "sha256:135e27a1a0704c4a8371cd2c1eb555f2b5beec61c212949b029a5457418a7160",
       "files": 5892,
-      "generated_at_commit": "e34a12298408fa13e4cbc747341fa96bce2b55a5",
-      "source_tree": "sha256:b9bc52793e4c838b068eae124d2458f570dc80e3a416e61ebb61cfc01cce82a9"
+      "generated_at_commit": "96d8916795a0fab0f01cdcb1d3a9a8cfb12571b1",
+      "source_tree": "sha256:ae96b082a304d713393477686f806c61e6f7409ea8d41ca7a1f903970cc99f82"
     }
   },
   "history": [],
diff --git a/tools/aien-local-ci/.crumb b/tools/aien-local-ci/.crumb
index d952c33a..6a8042e3 100644
--- a/tools/aien-local-ci/.crumb
+++ b/tools/aien-local-ci/.crumb
@@ -3,14 +3,14 @@
     "generated": {
       "children": [],
       "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "compiled_at": "2026-10-19T15:30:18Z",
+      "compiled_at": "2026-10-19T18:48:05Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:afb0a808b1cb4f66c0a20b3c49080054c824c027a2e412d4e8a67cfa8482fc09",
+      "digest": "sha256:489b92d3d4363d2b403d6fee34a384284a40c25176df4dcc77eef07478ff8825",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
       "files": 18,
-      "generated_at_commit": "4ec0f1844bdd5ba2be58c5daee12381c1834a708",
-      "source_tree": "sha256:0645ea9517501bac03ea694e6e2588bd05684dfe29b5b11b7943e81bbdfb97e8"
+      "generated_at_commit": "96d8916795a0fab0f01cdcb1d3a9a8cfb12571b1",
+      "source_tree": "sha256:c12a50cb169910de1a0bcf4c541fa5b90e07316865fc6c662bfdaad29723a80b"
     }
   },
   "layer": "infra",
diff --git a/tools/aien-local-ci/README.md b/tools/aien-local-ci/README.md
index f2e89f70..a5ee7188 100644
--- a/tools/aien-local-ci/README.md
+++ b/tools/aien-local-ci/README.md
@@ -113,7 +113,7 @@ added by this lane.
 | `cargo/bin` | root | the operator's `rustup` binary + proxy symlinks; no second rustup install |
 | `rustup/` | root, read-only | `settings.toml` (default 1.98.1) + `toolchains/1.98.1-aarch64-unknown-linux-gnu` copied (631 MB) |
 | `.gitconfig` | root 0644 | `safe.directory = *` (git 2.43 has no path globs; aien-run reaches nothing else) |
-| `/tmp/aien-gb10.lock` | root 0664, ACL `u:drakestapleton:rw-`, `u:aien-run:rw-` | the one GB10 chip lock for operator runs and sandboxed gb10 gates; root ownership gets past `fs.protected_regular=2` in sticky `/tmp`; `/etc/tmpfiles.d/aien-gb10.conf` recreates it at boot (#627) |
+| `/tmp/aien-gb10.lock` | root 0664, ACL `u:drakestapleton:rw-`, `u:aien-run:rw-` | the one GB10 chip lock for operator runs and sandboxed gb10 gates; root ownership gets past `fs.protected_regular=2` in sticky `/tmp`; `/etc/tmpfiles.d/aien-gb10.conf` recreates it at boot (#627); a gb10 gate waits for it in the kernel queue up to 30 min by default (`aien-test --gpu-wait`, between the live server's requests), then is NOT_RUN `gpu_lock`; the wait is in each receipt (`volatile.gpu_wait`) |
 | `mirror/<repo>.git` | drakestapleton 0755 | bare mirror of the trusted clone, refreshed by `wt.sh sync`; unwritable by aien-run |
 | `wt/<repo>/<sha>` | root dir drakestapleton:aien-run 1775, `.git` root 0644, files aien-run | checkouts; aien-run can add files, cannot replace `.git` or write the mirror |
 | `target/`, `target/<repo>/` | root 0755 | parents cannot be swapped by aien-run |
diff --git a/tools/aien-test/docs/LOCAL_VERIFICATION.md b/tools/aien-test/docs/LOCAL_VERIFICATION.md
index a72173e4..5799e6e3 100644
--- a/tools/aien-test/docs/LOCAL_VERIFICATION.md
+++ b/tools/aien-test/docs/LOCAL_VERIFICATION.md
@@ -147,6 +147,23 @@ aien-proof `slots/gpu.lock`; the worker's target priming takes only the
 target-dir lock. Known limit: a gb10 gate is never killed on timeout, so a
 hung one holds the target dir until it exits on its own.
 
+A held GPU lock is waited for, up to a bound, then the gate is NOT_RUN
+`gpu_lock` (or `gpu_lock_proof`). The live model server takes
+`/tmp/aien-gb10.lock` around every request (one request held it 108 s median,
+222 s at most, over 323 requests on 2026-10-19), so the old single try lost
+nearly every time. The wait is a blocking `flock` in the kernel's queue, the
+same queue the server's requests (`GpuLock::acquire_queued_at`, 300 s per
+request) and `flock(1)` jobs wait in: the gate takes its turn between
+requests and never jumps the queue. A poller with `LOCK_NB` is starved by
+queued waiters (2026-10-19, two back-to-back 300 ms holders: polling got in
+after 13 to 17 s or gave up at 20 s in 2 of 5 tries; the queue got in after
+0.3 to 0.6 s in 5 of 5). Default bound 30 minutes (`DEFAULT_GPU_WAIT`, the
+server's own upload wait); `--gpu-wait 0` refuses at once, `--gpu-wait 90s`
+sets another bound, `--wait-gpu` waits without one. While it waits the gate
+keeps its pool slot and target-dir lock (never the GPU idle), so other gates
+of the same target dir wait too, at most the bound. Every gb10 receipt
+records `volatile.gpu_wait`: `mode`, `bound_ms`, `waited_ms`, `acquired`.
+
 Under `--sandbox user` every checkout is made with INFRA's worktree tool
 (`--wt-tool`, default `<clones>/aien-sovereign-core/tools/aien-local-ci/wt.sh`;
 without it the worker refuses to run). `wt.sh sync` refreshes the bare mirror
@@ -370,6 +387,7 @@ Evidence status: VERIFIED | INVALID
 Hardware status: QUALIFIED | NOT_REQUIRED | BLOCKED
 Final verdict: PASS | FAIL | NOT_RUN | BLOCKED
 Queue time: N ms | n/a
+GPU lock wait: N ms | n/a
 Build time: n/a
 Test time: N ms | n/a
 Total time: N ms | n/a
@@ -391,7 +409,9 @@ manifest at COMMIT (`MANIFEST_MISMATCH`); then the plan judge. Every
 rejection is a `Problem` or `Evidence note` line and leaves READY out of
 reach; no path defaults to PASS. Crumb status comes from `crumb verify .` in a temporary
 detached worktree at COMMIT, removed afterwards. Queue time is the sum of
-`pool_wait_ms`, test time the sum of `duration_ms` over the executed
+`pool_wait_ms`, GPU lock wait the sum of `gpu_wait.waited_ms` (gb10 gates:
+how long each waited in the kernel queue of `/tmp/aien-gb10.lock`, see
+below), test time the sum of `duration_ms` over the executed
 receipts, total time the bundle's `finished_utc - started_utc`; build time
 is not measured yet.
 
diff --git a/tools/aien-test/mutations/aien-test.mutants b/tools/aien-test/mutations/aien-test.mutants
index 90286ab3..cf596f9e 100644
--- a/tools/aien-test/mutations/aien-test.mutants
+++ b/tools/aien-test/mutations/aien-test.mutants
@@ -14,7 +14,7 @@ unknown_key_allowed	manifest.rs	s#if !KNOWN.contains(&e.key.as_str()) {#if false
 missing_exec_ignored	verdict.rs	s#if !f.exec_exists {#if false {#	a missing run.exec is not MISSING_IMPLEMENTATION
 last_value_becomes_first	verdict.rs	s#compare(rule.op, vals\[vals.len() - 1\], &rule.value)#compare(rule.op, vals[0], \&rule.value)#	a repeated observation uses the first value, not the last
 evidence_inside_not_refused	runner.rs	s#let evidence_inside = resolve(&opts.evidence_dir).starts_with(resolve(root));#let evidence_inside = false;#	evidence may be written inside the tree under test
-operator_gate_not_blocked	verdict.rs	s#if m.requires.iter().any(|r| r == "operator") {#if false {#	a gate needing an operator runs anyway
+operator_gate_not_blocked	verdict.rs	s#if !f.operator && m.requires.iter().any(|r| r == "operator") {#if false {#	a gate needing an operator runs anyway
 timeout_checked_after_exit	verdict.rs	s#let (verdict, reason) = if f.timed_out {#let (verdict, reason) = if false {#	a timed-out run is reported as rc_nonzero, not timeout
 discover_ignores_gate_files	runner.rs	s#} else if ft.is_file() && name.ends_with(".gate") {#} else if false {#	the walk finds no .gate file, so a repository-wide parse check silently covers nothing
 discover_not_recursive	runner.rs	s#walk(&path, out);#let _ = \&path;#	the walk does not descend into directories, so gates under crates/ or tests/ are never parsed
@@ -78,9 +78,13 @@ vacuous_pass_gates	bundle.rs	s#"PASS" if self.required == 0 => "NOT_RUN",#"PASS"
 crumb_close_bad_action	worker.rs	s#^            "test",$#            "done",#	the worker closes its crumb claim with an action crumb refuses, so the claim stays open
 sandbox_refusal_is_a_result	runner.rs	s#^                    facts.exit_status = None;$#                    let _ = ();#	a refusal by the exec helper (exit 2) counts as the program exiting 2
 wt_link_owner_ignored	worker.rs	s#|| md.uid() != 0 ##	a worktree whose .git link the sandbox user owns is opened with the operator git
-sibling_cache_reused	worker.rs	s#    if fresh {#    if false \&\& fresh {#	a head with siblings reuses a cached result made without them
-sibling_not_provided	worker.rs	s#let made = provision_siblings(cfg, repo, sha, \&co, \&sibs, \&mut notes);#let made: Vec<(PathBuf, PathBuf)> = Vec::new();#	the sibling map is read but no sibling is checked out
+sibling_cache_reused	worker.rs	s#    if fresh || cfg.no_cache {#    if cfg.no_cache {#	a head with siblings reuses a cached result made without them
+sibling_not_provided	worker.rs	s#let (made, pin_values) = provision_siblings(cfg, repo, sha, \&co, \&sibs, \&pins, \&mut notes);#let (made, pin_values): (Vec<(PathBuf, PathBuf)>, Value) = (Vec::new(), json!([]));#	the sibling map is read but no sibling is checked out
 sibling_self_name_accepted	worker.rs	s#if f\[1\] == f\[0\] {#if false {#	a sibling may take the name of the checkout under test
 sibling_bad_ref_accepted	worker.rs	s#if !valid_ref(f\[3\]) {#if false {#	any text is accepted as the sibling ref
 sibling_duplicate_dir_accepted	worker.rs	s#if !seen.insert((f\[0\], f\[1\])) {#if false \&\& !seen.insert((f[0], f[1])) {#	one repository may name the same sibling dir twice
 sandbox_helper_not_in_machine	runner.rs	s#    if sandbox == Sandbox::User {#    if false \&\& sandbox == Sandbox::User {#	a result made under another exec helper is reused
+gpu_wait_refuses_at_once	resources.rs	s#(GpuWait::Bounded(_), Some(d)) => flock_queued(file, d).map_err(open_err),#(GpuWait::Bounded(_), Some(_d)) => Ok(None),#	a bounded GPU wait gives up at once, so a holder of a moment makes the gate NOT_RUN (the old single try)
+gpu_default_refuses	resources.rs	s#wait: GpuWait::Bounded(DEFAULT_GPU_WAIT),#wait: GpuWait::Refuse,#	the real machine refuses a held GPU lock at once instead of waiting the default bound
+gpu_abandoned_waiter_keeps_lock	resources.rs	s#return lost(r);#return std::mem::forget(r);#	a GPU waiter given up on keeps the lock when the kernel grants it, so the GPU stays held by nobody
+gpu_wait_not_recorded	runner.rs	s#"waited_ms": attempt.waited.as_millis() as u64,#"waited_ms": 0,#	the receipt says a gb10 gate never waited for the GPU lock
diff --git a/tools/aien-test/src/cli.rs b/tools/aien-test/src/cli.rs
index ddb30bb6..e3e7a57e 100644
--- a/tools/aien-test/src/cli.rs
+++ b/tools/aien-test/src/cli.rs
@@ -16,7 +16,7 @@
 //!
 //! `--host/--qemu/--gb10` and `--mutants` are later slices and are refused.
 
-use crate::resources::{parse_jobs, JobsSpec};
+use crate::resources::{parse_jobs, GpuWait, JobsSpec};
 use crate::sandbox::Sandbox;
 use std::path::PathBuf;
 
@@ -31,7 +31,7 @@ pub const USAGE: &str = "usage:
   aien-test verify COMMIT [--repo NAME] [--base REF] [--state-dir DIR] [--release]
   aien-test worker [--once REPO SHA] [--poll SECS] [--repos A,B] [--github] [--iterations N]
                    [--state-dir DIR] [--key FILE] [--clones DIR] [--wt-root DIR] [--wt-tool FILE] [--siblings FILE] [--sandbox user|none --dev-unsandboxed]
-flags: --evidence-dir DIR  --allow-dirty  --no-cache  --release  --jobs host=N,qemu=M  --wait-gpu
+flags: --evidence-dir DIR  --allow-dirty  --no-cache  --release  --jobs host=N,qemu=M  --gpu-wait 0|DURATION  --wait-gpu
        --sandbox none|user  --base REF  --operator";
 
 /// Which gates `test` runs.
@@ -74,8 +74,10 @@ pub struct Cli {
     pub args: Option<Vec<String>>,
     /// `--jobs host=N,qemu=M`: the pool sizes that were named.
     pub jobs: JobsSpec,
-    /// `--wait-gpu`: wait for a held GPU lock instead of refusing.
-    pub wait_gpu: bool,
+    /// `--gpu-wait 0|DURATION` (refuse at once, or wait up to DURATION) or
+    /// `--wait-gpu` (no bound) for a held GPU lock; None: the default bound
+    /// (`resources::DEFAULT_GPU_WAIT`).
+    pub gpu_wait: Option<GpuWait>,
     /// `identity` only: the compiler identity string (default empty: nothing
     /// here builds yet).
     pub compiler_identity: String,
@@ -176,7 +178,7 @@ pub fn parse_args(argv: &[String]) -> Result<Cli, String> {
     let mut release = false;
     let mut args: Option<Vec<String>> = None;
     let mut jobs = JobsSpec::default();
-    let mut wait_gpu = false;
+    let mut gpu_wait: Option<GpuWait> = None;
     let mut compiler_identity = String::new();
     let mut flags: Vec<String> = Vec::new();
     let mut hardware_identity: Option<String> = None;
@@ -230,7 +232,17 @@ pub fn parse_args(argv: &[String]) -> Result<Cli, String> {
         } else if a == "--release" {
             release = true;
         } else if a == "--wait-gpu" {
-            wait_gpu = true;
+            gpu_wait = Some(GpuWait::Forever);
+        } else if a == "--gpu-wait" {
+            let d = value(&mut i, a)?;
+            gpu_wait = Some(if d == "0" {
+                GpuWait::Refuse
+            } else {
+                let ms = crate::manifest::parse_duration_ms(&d).ok_or_else(|| {
+                    format!("--gpu-wait needs 0 or a duration like 90s or 30m, not {d:?}")
+                })?;
+                GpuWait::Bounded(std::time::Duration::from_millis(ms))
+            });
         } else if a == "--operator" {
             operator = true;
         } else if a == "--base" {
@@ -371,7 +383,7 @@ pub fn parse_args(argv: &[String]) -> Result<Cli, String> {
         release,
         args,
         jobs,
-        wait_gpu,
+        gpu_wait,
         compiler_identity,
         flags,
         hardware_identity,
@@ -417,7 +429,7 @@ mod tests {
         assert!(!c.allow_dirty);
         assert!(!c.no_cache);
         assert!(!c.release);
-        assert!(!c.wait_gpu);
+        assert_eq!(c.gpu_wait, None);
         assert_eq!(c.args, None);
         assert_eq!(c.evidence_dir, None);
         assert_eq!(c.jobs, JobsSpec::default());
@@ -488,6 +500,19 @@ mod tests {
         assert!(parse_args(&v(&["test"])).is_err());
     }
 
+    #[test]
+    fn gpu_wait_takes_zero_or_a_duration() {
+        let c = parse_args(&v(&["worker", "--gpu-wait", "0"])).unwrap();
+        assert_eq!(c.gpu_wait, Some(GpuWait::Refuse));
+        let c = parse_args(&v(&["run", "g", "--gpu-wait", "90s"])).unwrap();
+        assert_eq!(
+            c.gpu_wait,
+            Some(GpuWait::Bounded(std::time::Duration::from_secs(90)))
+        );
+        assert!(parse_args(&v(&["run", "g", "--gpu-wait", "soon"])).is_err());
+        assert!(parse_args(&v(&["run", "g", "--gpu-wait"])).is_err());
+    }
+
     #[test]
     fn jobs_and_wait_gpu() {
         let c = parse_args(&v(&[
@@ -500,7 +525,7 @@ mod tests {
         .unwrap();
         assert_eq!(c.jobs.host, Some(3));
         assert_eq!(c.jobs.qemu, Some(2));
-        assert!(c.wait_gpu);
+        assert_eq!(c.gpu_wait, Some(GpuWait::Forever));
         let c = parse_args(&v(&["test", "./...", "--jobs", "qemu=1"])).unwrap();
         assert_eq!(c.jobs.host, None);
         assert_eq!(c.jobs.qemu, Some(1));
diff --git a/tools/aien-test/src/main.rs b/tools/aien-test/src/main.rs
index 7fde52f4..7805bda5 100644
--- a/tools/aien-test/src/main.rs
+++ b/tools/aien-test/src/main.rs
@@ -84,7 +84,9 @@ fn options(cli: &Cli, root: &Path) -> Result<Options, i32> {
     opts.no_cache = cli.no_cache;
     opts.args_override = cli.args.clone();
     opts.pool_sizes = opts.pool_sizes.with(cli.jobs);
-    opts.gpu.wait = cli.wait_gpu;
+    if let Some(w) = cli.gpu_wait {
+        opts.gpu.wait = w;
+    }
     opts.sandbox = cli.sandbox;
     opts.release = cli.release;
     // `--operator` is only accepted on plan, test and worker (cli.rs), so a
@@ -559,6 +561,9 @@ fn cmd_worker(cli: &Cli) -> i32 {
     cfg.repos = cli.repos.clone();
     cfg.operator = cli.operator;
     cfg.jobs = cli.jobs;
+    if let Some(w) = cli.gpu_wait {
+        cfg.gpu_wait = w;
+    }
     cfg.no_cache = cli.no_cache;
     cfg.hardware_identity = cli.hardware_identity.clone().unwrap_or_default();
     if let Some((repo, sha)) = &cli.once {
diff --git a/tools/aien-test/src/resources.rs b/tools/aien-test/src/resources.rs
index 53c116d8..4ff019f5 100644
--- a/tools/aien-test/src/resources.rs
+++ b/tools/aien-test/src/resources.rs
@@ -22,11 +22,17 @@
 //!
 //! GPU job protocol (CR-028, CR-029, CR-033, CR-052, CR-053): refuse at once
 //! (never wait, never steal) if the quiet flag file exists or an `est_load`
-//! process is running, then take `flock(2)` locks without blocking. A held lock
-//! is a refusal, not a wait, unless the operator asked for `--wait-gpu`. The
-//! lock files are created if absent and never deleted. Dropping a
-//! `GpuGuard` closes the descriptors, and the kernel releases the locks (a
-//! dead holder frees them too).
+//! process is running, then take the `flock(2)` locks. A held lock is waited
+//! for up to a bound (`GpuWait`, default `DEFAULT_GPU_WAIT`), then refused:
+//! the live model server takes `/tmp/aien-gb10.lock` around every request
+//! (sc `aien-serve-http`, `GpuLock::acquire_queued_at`), so a single try
+//! loses nearly every time. The wait is a blocking `flock` in the kernel's
+//! queue on a helper thread, the same queue the server's requests and
+//! `flock(1)` jobs wait in, so neither side can starve the other the way a
+//! poller with `LOCK_NB` is starved by queued waiters. `--gpu-wait 0` refuses
+//! at once; `--wait-gpu` waits without a bound. The lock files are created if
+//! absent and never deleted. Dropping a `GpuGuard` closes the descriptors,
+//! and the kernel releases the locks (a dead holder frees them too).
 //!
 //! Fork window: a `flock` lives as long as any copy of the open file
 //! description does, and a child that another thread forks while a lock
@@ -42,10 +48,50 @@ use std::fs::{self, File, OpenOptions};
 use std::io;
 use std::os::unix::io::AsRawFd;
 use std::path::{Path, PathBuf};
-use std::sync::{Condvar, Mutex, MutexGuard};
+use std::sync::atomic::{AtomicBool, Ordering};
+use std::sync::{mpsc, Arc, Condvar, Mutex, MutexGuard};
+use std::time::{Duration, Instant};
 
 pub const DEFAULT_GPU_LOCK: &str = "/tmp/aien-gb10.lock";
 
+/// How long a gb10 gate waits for a held GPU lock before NOT_RUN `gpu_lock`.
+/// The server's own upload waits this long for the same lock (sc
+/// `qwen38_engine::LOAD_LOCK_WAIT`, "other jobs' chip runs take minutes");
+/// one server request held it 108 s median and 222 s at most over 323
+/// requests on 2026-10-19 (serve.log), so the bound covers many turns.
+pub const DEFAULT_GPU_WAIT: Duration = Duration::from_secs(30 * 60);
+
+/// What a gb10 gate does when another holder has a GPU lock.
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub enum GpuWait {
+    /// Refuse at once (`--gpu-wait 0`, and the scratch configs of tests).
+    Refuse,
+    /// Wait in the kernel's queue up to this long, then refuse.
+    Bounded(Duration),
+    /// `--wait-gpu`: wait as long as it takes.
+    Forever,
+}
+
+impl GpuWait {
+    /// The receipt's `volatile.gpu_wait.mode`.
+    pub fn mode(self) -> &'static str {
+        match self {
+            GpuWait::Refuse => "refuse",
+            GpuWait::Bounded(_) => "bounded",
+            GpuWait::Forever => "forever",
+        }
+    }
+
+    /// The bound in ms (`Refuse` is 0, `Forever` has none).
+    pub fn bound_ms(self) -> Option<u64> {
+        match self {
+            GpuWait::Refuse => Some(0),
+            GpuWait::Bounded(d) => Some(d.as_millis() as u64),
+            GpuWait::Forever => None,
+        }
+    }
+}
+
 /// Set to `1` in a gb10 gate's environment while the runner holds the GPU
 /// locks for it (ADR 0033: gb10 is serialized by the trusted side). A gate
 /// script that also takes `/tmp/aien-gb10.lock` by hand must skip that when
@@ -292,8 +338,8 @@ pub struct GpuConfig {
     pub quiet_flag: Option<PathBuf>,
     /// Where to look for an `est_load` process (`/proc`).
     pub proc_dir: PathBuf,
-    /// `--wait-gpu`: block on a held lock instead of refusing.
-    pub wait: bool,
+    /// How long to wait for a held lock (`--gpu-wait`, `--wait-gpu`).
+    pub wait: GpuWait,
 }
 
 impl GpuConfig {
@@ -312,19 +358,19 @@ impl GpuConfig {
                 .map(|b| b.join("slots/gpu.lock")),
             quiet_flag: home.map(|h| h.join("workspace/.spark-quiet")),
             proc_dir: PathBuf::from("/proc"),
-            wait: false,
+            wait: GpuWait::Bounded(DEFAULT_GPU_WAIT),
         }
     }
 
     /// Every path inside `dir` (a scratch directory): own lock, own quiet
-    /// flag, no aien-proof lock, no `est_load`.
+    /// flag, no aien-proof lock, no `est_load`; a held lock is refused at once.
     pub fn rooted_at(dir: &Path) -> GpuConfig {
         GpuConfig {
             lock_path: dir.join("gb10.lock"),
             proof_lock_path: None,
             quiet_flag: Some(dir.join("quiet-flag")),
             proc_dir: dir.join("proc"),
-            wait: false,
+            wait: GpuWait::Refuse,
         }
     }
 }
@@ -515,23 +561,99 @@ fn flock_exclusive(file: &File, wait: bool) -> io::Result<bool> {
     }
 }
 
-fn take_lock(path: &Path, wait: bool) -> Result<Option<File>, GpuRefusal> {
-    let file =
-        open_lock(path).map_err(|e| GpuRefusal::LockOpen(format!("{}: {e}", path.display())))?;
-    match flock_exclusive(&file, wait) {
-        Ok(true) => Ok(Some(file)),
-        Ok(false) => Ok(None),
-        Err(e) => Err(GpuRefusal::LockOpen(format!("{}: {e}", path.display()))),
+/// Wait for `file`'s lock in the kernel's queue until `deadline`. The
+/// blocking `flock` runs on a helper thread; after the deadline the helper is
+/// abandoned and drops the lock (under the spawn gate) the moment the kernel
+/// grants it, so a refused gate never keeps the GPU. An abandoned helper
+/// stays queued until the holder lets go: one per refused gate at most.
+fn flock_queued(file: File, deadline: Instant) -> io::Result<Option<File>> {
+    let (tx, rx) = mpsc::channel();
+    let gave_up = Arc::new(AtomicBool::new(false));
+    let gave_up_t = Arc::clone(&gave_up);
+    std::thread::spawn(move || {
+        let r = flock_exclusive(&file, true).map(|_| file);
+        let lost = |r: io::Result<File>| {
+            if let Ok(f) = r {
+                let _gate = crate::process::spawn_gate();
+                drop(f);
+            }
+        };
+        if gave_up_t.load(Ordering::SeqCst) {
+            return lost(r);
+        }
+        if let Err(mpsc::SendError(r)) = tx.send(r) {
+            lost(r);
+        }
+    });
+    match rx.recv_timeout(deadline.saturating_duration_since(Instant::now())) {
+        Ok(r) => r.map(Some),
+        Err(_) => {
+            gave_up.store(true, Ordering::SeqCst);
+            // The helper may have sent just before the flag: take and drop it.
+            if let Ok(Ok(f)) = rx.try_recv() {
+                let _gate = crate::process::spawn_gate();
+                drop(f);
+            }
+            Ok(None)
+        }
+    }
+}
+
+/// Take the lock at `path`: at once if it is free, else as `wait` says, with
+/// `deadline` the end of a bounded wait. Ok(None) = still held.
+fn take_lock(
+    path: &Path,
+    wait: GpuWait,
+    deadline: Option<Instant>,
+) -> Result<Option<File>, GpuRefusal> {
+    let open_err = |e: io::Error| GpuRefusal::LockOpen(format!("{}: {e}", path.display()));
+    let file = open_lock(path).map_err(open_err)?;
+    if flock_exclusive(&file, false).map_err(open_err)? {
+        return Ok(Some(file));
+    }
+    match (wait, deadline) {
+        (GpuWait::Refuse, _) => Ok(None),
+        (GpuWait::Forever, _) => flock_exclusive(&file, true)
+            .map(|_| Some(file))
+            .map_err(open_err),
+        (GpuWait::Bounded(_), Some(d)) => flock_queued(file, d).map_err(open_err),
+        (GpuWait::Bounded(_), None) => Ok(None),
     }
 }
 
+/// One `acquire_gpu_timed` call: the result and how long it waited for the
+/// locks (0 when they were free or a preflight refusal came first).
+#[derive(Debug)]
+pub struct GpuAttempt {
+    pub result: Result<GpuGuard, GpuRefusal>,
+    pub waited: Duration,
+}
+
 /// The GPU job protocol up to the point of running: refusals first, then the
 /// locks in the fixed order. Call it after taking the in-process gb10 slot.
 pub fn acquire_gpu(cfg: &GpuConfig) -> Result<GpuGuard, GpuRefusal> {
+    acquire_gpu_timed(cfg).result
+}
+
+/// `acquire_gpu`, also reporting the wait. One bound covers both locks.
+pub fn acquire_gpu_timed(cfg: &GpuConfig) -> GpuAttempt {
+    let t0 = Instant::now();
+    let result = acquire_locks(cfg, t0);
+    GpuAttempt {
+        result,
+        waited: t0.elapsed(),
+    }
+}
+
+fn acquire_locks(cfg: &GpuConfig, t0: Instant) -> Result<GpuGuard, GpuRefusal> {
     if let Some(r) = preflight(cfg) {
         return Err(r);
     }
-    let primary = match take_lock(&cfg.lock_path, cfg.wait)? {
+    let deadline = match cfg.wait {
+        GpuWait::Bounded(d) => t0.checked_add(d),
+        _ => None,
+    };
+    let primary = match take_lock(&cfg.lock_path, cfg.wait, deadline)? {
         Some(f) => f,
         None => return Err(GpuRefusal::LockHeld(cfg.lock_path.clone())),
     };
@@ -539,7 +661,7 @@ pub fn acquire_gpu(cfg: &GpuConfig) -> Result<GpuGuard, GpuRefusal> {
         files: vec![primary],
     };
     if let Some(p) = &cfg.proof_lock_path {
-        match take_lock(p, cfg.wait)? {
+        match take_lock(p, cfg.wait, deadline)? {
             Some(f) => guard.files.push(f),
             // Returning drops `guard`, so the first lock is not left held,
             // and it is released through the spawn gate like any other.
@@ -552,7 +674,7 @@ pub fn acquire_gpu(cfg: &GpuConfig) -> Result<GpuGuard, GpuRefusal> {
 #[cfg(test)]
 mod tests {
     use super::*;
-    use crate::testutil::{write_file, TempDir};
+    use crate::testutil::{queued_on, write_file, TempDir};
     use std::sync::mpsc;
     use std::thread;
     use std::time::Duration;
@@ -810,6 +932,82 @@ mod tests {
         assert!(e.to_string().contains("is held"));
     }
 
+    #[test]
+    fn bounded_wait_takes_the_lock_when_the_holder_lets_go() {
+        let d = TempDir::new("gpu");
+        let mut cfg = GpuConfig::rooted_at(d.path());
+        let held = acquire_gpu(&cfg).unwrap();
+        cfg.wait = GpuWait::Bounded(Duration::from_secs(20));
+        // Let go 300 ms after the waiter shows up in the kernel queue.
+        let lock = cfg.lock_path.clone();
+        let holder = thread::spawn(move || {
+            let t0 = Instant::now();
+            while !queued_on(&lock) && t0.elapsed() < Duration::from_secs(15) {
+                thread::sleep(Duration::from_millis(5));
+            }
+            let seen = queued_on(&lock);
+            thread::sleep(Duration::from_millis(300));
+            drop(held);
+            seen
+        });
+        let a = acquire_gpu_timed(&cfg);
+        assert!(
+            holder.join().unwrap(),
+            "the waiter never queued in the kernel"
+        );
+        assert!(a.result.is_ok(), "{:?}", a.result);
+        assert!(
+            (Duration::from_millis(250)..Duration::from_secs(20)).contains(&a.waited),
+            "waited {:?}",
+            a.waited
+        );
+    }
+
+    #[test]
+    fn bounded_wait_gives_up_and_the_abandoned_waiter_hands_the_lock_back() {
+        let d = TempDir::new("gpu");
+        let mut cfg = GpuConfig::rooted_at(d.path());
+        let held = acquire_gpu(&cfg).unwrap();
+        cfg.wait = GpuWait::Bounded(Duration::from_millis(300));
+        let a = acquire_gpu_timed(&cfg);
+        assert_eq!(a.result.unwrap_err().reason(), "gpu_lock");
+        assert!(a.waited >= Duration::from_millis(300), "{:?}", a.waited);
+        assert!(a.waited < Duration::from_secs(10), "{:?}", a.waited);
+        drop(held);
+        // The helper still queued in the kernel gets the lock and drops it at
+        // once; a refusing caller then finds it free within moments.
+        cfg.wait = GpuWait::Refuse;
+        let t0 = Instant::now();
+        loop {
+            if acquire_gpu(&cfg).is_ok() {
+                break;
+            }
+            assert!(
+                t0.elapsed() < Duration::from_secs(10),
+                "lock never handed back"
+            );
+            thread::sleep(Duration::from_millis(20));
+        }
+    }
+
+    #[test]
+    fn bounded_wait_on_a_held_proof_lock_refuses_with_its_reason() {
+        let d = TempDir::new("gpu");
+        let mut cfg = GpuConfig::rooted_at(d.path());
+        cfg.proof_lock_path = Some(d.path().join("slots/gpu.lock"));
+        let proof_only = GpuConfig {
+            lock_path: d.path().join("other.lock"),
+            ..cfg.clone()
+        };
+        let held = acquire_gpu(&proof_only).unwrap();
+        cfg.wait = GpuWait::Bounded(Duration::from_millis(300));
+        let a = acquire_gpu_timed(&cfg);
+        assert_eq!(a.result.unwrap_err().reason(), "gpu_lock_proof");
+        assert!(a.waited >= Duration::from_millis(300), "{:?}", a.waited);
+        assert!(a.waited < Duration::from_secs(10), "{:?}", a.waited);
+        drop(held);
+    }
+
     #[test]
     fn open_handle_without_flock_does_not_block() {
         // CR-052: only a flock holder blocks; a plain open handle does not.
@@ -888,7 +1086,7 @@ mod tests {
         let d = TempDir::new("gpu");
         let mut cfg = GpuConfig::rooted_at(d.path());
         let held = acquire_gpu(&cfg).unwrap();
-        cfg.wait = true;
+        cfg.wait = GpuWait::Forever;
         let (tx, rx) = mpsc::channel();
         thread::scope(|s| {
             s.spawn(|| {
@@ -906,7 +1104,7 @@ mod tests {
     fn detect_builds_a_config_without_touching_anything() {
         let c = GpuConfig::detect();
         assert_eq!(c.lock_path, PathBuf::from(DEFAULT_GPU_LOCK));
-        assert!(!c.wait);
+        assert_eq!(c.wait, GpuWait::Bounded(DEFAULT_GPU_WAIT));
         assert_eq!(c.proc_dir, PathBuf::from("/proc"));
         let _ = Hardware::detect();
     }
diff --git a/tools/aien-test/src/runner.rs b/tools/aien-test/src/runner.rs
index 3f9e8684..8ed3bb72 100644
--- a/tools/aien-test/src/runner.rs
+++ b/tools/aien-test/src/runner.rs
@@ -27,7 +27,7 @@ use crate::graph::Graph;
 use crate::manifest::{self, Manifest};
 use crate::process::{self, RunSpec};
 use crate::resources::{
-    self, acquire_gpu, lock, GpuConfig, GpuGuard, Hardware, Permit, Pool, PoolSizes, Pools,
+    self, acquire_gpu_timed, lock, GpuConfig, GpuGuard, Hardware, Permit, Pool, PoolSizes, Pools,
     GPU_LOCK_HELD_MARKER,
 };
 use crate::sandbox::{self, Sandbox};
@@ -698,10 +698,20 @@ fn execute_gate(job: &Job<'_>, permit: Option<Permit<'_>>) -> Result<Outcome, Ru
         None
     };
 
-    // A gb10 gate takes the GPU locks only when nothing else already stops it.
-    // A refusal (quiet flag, est_load, a held lock) becomes the gate's reason.
+    // A gb10 gate takes the GPU locks only when nothing else already stops it,
+    // waiting for a held lock as `opts.gpu.wait` says. A refusal (quiet flag,
+    // est_load, a lock still held at the bound) becomes the gate's reason;
+    // the wait goes into the receipt (`volatile.gpu_wait`) either way.
+    let mut gpu_wait = Value::Null;
     let gpu: Option<GpuGuard> = if m.pool() == "gb10" && verdict::pre_run(m, &facts).is_none() {
-        match acquire_gpu(&opts.gpu) {
+        let attempt = acquire_gpu_timed(&opts.gpu);
+        gpu_wait = json!({
+            "mode": opts.gpu.wait.mode(),
+            "bound_ms": opts.gpu.wait.bound_ms(),
+            "waited_ms": attempt.waited.as_millis() as u64,
+            "acquired": attempt.result.is_ok(),
+        });
+        match attempt.result {
             Ok(g) => Some(g),
             Err(r) => {
                 facts.refusal = Some(r.reason().to_string());
@@ -852,6 +862,7 @@ fn execute_gate(job: &Job<'_>, permit: Option<Permit<'_>>) -> Result<Outcome, Ru
         "runner": { "name": "aien-test", "version": env!("CARGO_PKG_VERSION"), "impl": "rust" },
         "cache": cache::cache_member(&cache_key, None, mode),
         "timeout_exceeded": timeout_exceeded,
+        "gpu_wait": gpu_wait,
     });
 
     let receipt = build_receipt(Value::Object(core), volatile);
@@ -1164,6 +1175,8 @@ pub fn run_graph(
 #[cfg(test)]
 mod tests {
     use super::*;
+    use crate::resources::{acquire_gpu, GpuWait};
+    use crate::testutil::queued_on;
     use crate::testutil::{git, init_repo, write_file, TempDir};
     use std::os::unix::fs::PermissionsExt;
 
@@ -1746,6 +1759,99 @@ mod tests {
         assert!(fx.marker().exists());
     }
 
+    /// The machine's default GPU options (what `run`, `test` and the worker
+    /// start from) with the lock paths moved to scratch: a holder that keeps
+    /// the lock for a moment, as the live model server does around every
+    /// request, must not make the gate NOT_RUN. Written against fields both
+    /// the old and the new `GpuConfig` have, so it runs on either.
+    #[test]
+    fn gb10_gate_with_the_default_options_waits_out_a_brief_holder() {
+        let fx = gb10_fixture(TOUCH_MARKER, "20s");
+        let mut opts = gb10_opts(&fx);
+        let scratch = opts.gpu.clone();
+        opts.gpu = GpuConfig::detect();
+        opts.gpu.lock_path = scratch.lock_path;
+        opts.gpu.proof_lock_path = None;
+        opts.gpu.quiet_flag = scratch.quiet_flag;
+        opts.gpu.proc_dir = scratch.proc_dir;
+        let held = acquire_gpu(&GpuConfig::rooted_at(fx.scratch.path())).unwrap();
+        let holder = std::thread::spawn(move || {
+            std::thread::sleep(Duration::from_millis(1500));
+            drop(held);
+        });
+        let o = run(&fx, &opts);
+        holder.join().unwrap();
+        assert_eq!(o.verdict, Verdict::Pass, "reason {}", o.reason);
+        assert!(fx.marker().exists());
+    }
+
+    #[test]
+    fn gb10_gate_records_the_wait_and_runs_when_the_holder_lets_go() {
+        let fx = gb10_fixture(TOUCH_MARKER, "20s");
+        let mut opts = gb10_opts(&fx);
+        opts.gpu.wait = GpuWait::Bounded(Duration::from_secs(20));
+        let held = acquire_gpu(&GpuConfig::rooted_at(fx.scratch.path())).unwrap();
+        // Let go 300 ms after the kernel shows the gate queued behind us, so
+        // the wait is real however long the gate takes to reach the lock.
+        let lock = opts.gpu.lock_path.clone();
+        let holder = std::thread::spawn(move || {
+            let t0 = std::time::Instant::now();
+            while !queued_on(&lock) && t0.elapsed() < Duration::from_secs(15) {
+                std::thread::sleep(Duration::from_millis(5));
+            }
+            let seen = queued_on(&lock);
+            std::thread::sleep(Duration::from_millis(300));
+            drop(held);
+            seen
+        });
+        let o = run(&fx, &opts);
+        assert!(holder.join().unwrap(), "the gate never queued on the lock");
+        assert_eq!(o.verdict, Verdict::Pass, "reason {}", o.reason);
+        let r = read_json(&o.receipt_path.unwrap());
+        let w = &r["volatile"]["gpu_wait"];
+        assert_eq!(w["mode"], "bounded");
+        assert_eq!(w["bound_ms"], 20_000);
+        assert_eq!(w["acquired"], true);
+        let waited = w["waited_ms"].as_u64().unwrap();
+        assert!((250..20_000).contains(&waited), "waited {waited} ms");
+    }
+
+    #[test]
+    fn gb10_gate_held_past_the_bound_is_not_run_with_the_wait_recorded() {
+        let fx = gb10_fixture(TOUCH_MARKER, "20s");
+        let mut opts = gb10_opts(&fx);
+        opts.gpu.wait = GpuWait::Bounded(Duration::from_millis(400));
+        let held = acquire_gpu(&GpuConfig::rooted_at(fx.scratch.path())).unwrap();
+        let o = run(&fx, &opts);
+        assert_eq!(
+            (o.verdict, o.reason.as_str()),
+            (Verdict::NotRun, "gpu_lock")
+        );
+        assert!(!fx.marker().exists(), "a refused job must not run");
+        let r = read_json(&o.receipt_path.unwrap());
+        assert_eq!(r["core"]["reason"], "gpu_lock");
+        let w = &r["volatile"]["gpu_wait"];
+        assert_eq!(w["mode"], "bounded");
+        assert_eq!(w["bound_ms"], 400);
+        assert_eq!(w["acquired"], false);
+        assert!(w["waited_ms"].as_u64().unwrap() >= 400, "{w}");
+        // The waiter given up on must hand the lock back once the holder
+        // lets go, so the next gate gets it.
+        drop(held);
+        opts.gpu.wait = GpuWait::Bounded(Duration::from_secs(20));
+        let o = run(&fx, &opts);
+        assert_eq!(o.verdict, Verdict::Pass, "reason {}", o.reason);
+    }
+
+    #[test]
+    fn host_gate_records_no_gpu_wait() {
+        let fx = fixture(TOUCH_MARKER, 0, &[], "20s", "");
+        let o = run(&fx, &fx.opts());
+        assert_eq!(o.verdict, Verdict::Pass, "reason {}", o.reason);
+        let r = read_json(&o.receipt_path.unwrap());
+        assert_eq!(r["volatile"]["gpu_wait"], Value::Null);
+    }
+
     #[test]
     fn gb10_timeout_is_advisory_and_never_kills_the_job() {
         let fx = gb10_fixture("#!/bin/sh\nsleep 1\ntouch \"$1\"\n", "300ms");
diff --git a/tools/aien-test/src/testutil.rs b/tools/aien-test/src/testutil.rs
index 7c52eb79..9911e3a3 100644
--- a/tools/aien-test/src/testutil.rs
+++ b/tools/aien-test/src/testutil.rs
@@ -85,3 +85,20 @@ pub fn init_repo(tag: &str, files: &[(&str, &str, bool)]) -> TempDir {
     git(t.path(), &["commit", "-q", "-m", "init"]);
     t
 }
+
+/// Whether `/proc/locks` shows a blocked `flock` waiter on `path` (a line
+/// `N: -> FLOCK ... maj:min:inode ...`), so a test holder can let go only
+/// once the code under test is really queued behind it.
+pub fn queued_on(path: &Path) -> bool {
+    use std::os::unix::fs::MetadataExt;
+    let ino = match fs::metadata(path) {
+        Ok(m) => m.ino(),
+        Err(_) => return false,
+    };
+    let suffix = format!(":{ino}");
+    fs::read_to_string("/proc/locks")
+        .unwrap_or_default()
+        .lines()
+        .filter(|l| l.contains("-> FLOCK"))
+        .any(|l| l.split_whitespace().any(|w| w.ends_with(&suffix)))
+}
diff --git a/tools/aien-test/src/verify.rs b/tools/aien-test/src/verify.rs
index 3dec45f1..e7553d98 100644
--- a/tools/aien-test/src/verify.rs
+++ b/tools/aien-test/src/verify.rs
@@ -83,7 +83,9 @@ impl Found {
     }
 }
 
-fn sum_u64(index: &Index, digests: &[String], key: &str) -> Option<u64> {
+/// The sum of `volatile<pointer>` (a JSON pointer such as `/pool_wait_ms`)
+/// over the receipts; None when no receipt has it.
+fn sum_u64(index: &Index, digests: &[String], pointer: &str) -> Option<u64> {
     let mut total = 0u64;
     let mut any = false;
     for d in digests {
@@ -91,7 +93,7 @@ fn sum_u64(index: &Index, digests: &[String], key: &str) -> Option<u64> {
             if let Some(v) = s
                 .value
                 .get("volatile")
-                .and_then(|o| o.get(key))
+                .and_then(|o| o.pointer(pointer))
                 .and_then(Value::as_u64)
             {
                 total += v;
@@ -516,14 +518,16 @@ pub fn run(root: &Path, ask: &Ask) -> Report {
         _ => "NOT_RUN".to_string(),
     };
     lines.push(format!("Final verdict: {final_verdict}"));
-    let queue = sum_u64(&found.index, &run_digests, "pool_wait_ms");
-    let test = sum_u64(&found.index, &run_digests, "duration_ms");
+    let queue = sum_u64(&found.index, &run_digests, "/pool_wait_ms");
+    let test = sum_u64(&found.index, &run_digests, "/duration_ms");
+    let gpu_wait = sum_u64(&found.index, &run_digests, "/gpu_wait/waited_ms");
     let total = bundle.as_ref().and_then(|b| {
         let s = utc_secs(b["started_utc"].as_str()?)?;
         let f = utc_secs(b["finished_utc"].as_str()?)?;
         Some(f.saturating_sub(s) * 1000)
     });
     lines.push(format!("Queue time: {}", ms(queue)));
+    lines.push(format!("GPU lock wait: {}", ms(gpu_wait)));
     lines.push("Build time: n/a".to_string());
     lines.push(format!("Test time: {}", ms(test)));
     lines.push(format!("Total time: {}", ms(total)));
diff --git a/tools/aien-test/src/worker.rs b/tools/aien-test/src/worker.rs
index ae694857..5b76cd40 100644
--- a/tools/aien-test/src/worker.rs
+++ b/tools/aien-test/src/worker.rs
@@ -29,7 +29,7 @@ use crate::evidence::{canonical, canonical_digest, sha256_hex, utc_string};
 use crate::graph;
 use crate::plan::{self, Known, Section};
 use crate::process;
-use crate::resources::{Hardware, JobsSpec};
+use crate::resources::{GpuWait, Hardware, JobsSpec, DEFAULT_GPU_WAIT};
 use crate::runner::{self, CacheNote, Options};
 use crate::sandbox::Sandbox;
 use crate::verdict::Verdict;
@@ -240,6 +240,9 @@ pub struct Config {
     pub jobs: JobsSpec,
     /// `--no-cache`: run every selected gate, reuse no receipt.
     pub no_cache: bool,
+    /// How a gb10 gate waits for a held GPU lock (`--gpu-wait`, `--wait-gpu`;
+    /// default the bounded `resources::DEFAULT_GPU_WAIT`).
+    pub gpu_wait: GpuWait,
 }
 
 impl Config {
@@ -265,6 +268,7 @@ impl Config {
             siblings: None,
             jobs: JobsSpec::default(),
             no_cache: false,
+            gpu_wait: GpuWait::Bounded(DEFAULT_GPU_WAIT),
         }
     }
 
@@ -923,6 +927,7 @@ fn run_in_worktree(
     opts.cargo_target_dir = target_dir_for(cfg, repo, sha, on_main);
     opts.target_lock_dir = cfg.state.target_lock_dir();
     opts.pool_sizes = opts.pool_sizes.with(cfg.jobs);
+    opts.gpu.wait = cfg.gpu_wait;
     opts.pins = pins;
     // The same operator permission the plan had: an operator gate the plan
     // put in Required under `--operator` must not be refused by the runner.
diff --git a/tools/aien-test/tests/local_ci.rs b/tools/aien-test/tests/local_ci.rs
index 277c2b34..398475ae 100644
--- a/tools/aien-test/tests/local_ci.rs
+++ b/tools/aien-test/tests/local_ci.rs
@@ -297,6 +297,7 @@ fn worker_then_verify_is_ready() {
     assert_eq!(line(&r, "Final verdict:"), "Final verdict: PASS");
     assert_eq!(line(&r, "Executed gates:"), "Executed gates: 1 (A)");
     assert_eq!(line(&r, "Build time:"), "Build time: n/a");
+    assert_eq!(line(&r, "GPU lock wait:"), "GPU lock wait: n/a");
     assert!(line(&r, "Test time:").ends_with(" ms"));
     assert_eq!(
         line(&r, "MERGE ELIGIBILITY:"),