Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-sovereign-core-mv/patches/b097ee9e2cbbb634 # 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 Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers ## GitHub aien-dev/aien-sovereign-core-mv#516 (code only) closed derived `b097ee9e2cbbb634` #516 Imported from GitHub aien-dev/aien-sovereign-core-mv#516 (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 `515ec69621bfdd8836dcda6d65544e04d51a5014` · Head `3bc906231124fe82f1b4280971e4504e2939f1af` ### Apply it ``` git checkout -b patch-b097ee9e2cbbb634 515ec69621bfdd8836dcda6d65544e04d51a5014 curl -fsSL https://interplane.io/drakestapleton/aien-sovereign-core-mv/patches/b097ee9e2cbbb634.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 516 3bc906231124fe82f1b4280971e4504e2939f1af ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"aien-sovereign-core-mv","number":516,"url":"https://github.com/aien-dev/aien-sovereign-core-mv/pull/516","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:37:22Z","metadata":"unavailable","state_derived":true} ``` ### Changes ``` diff --git a/.crumb b/.crumb index 17ba13f7..fd47135d 100644 --- a/.crumb +++ b/.crumb @@ -101,7 +101,7 @@ }, { "digest": "07f19c8d7013a03659eb514ccf94dd7ff76f2ff3ce3736cc3bb11c156ed30e1c", - "last_commit": "43537272", + "last_commit": "cc36bc72", "name": "scripts", "purpose": "" }, @@ -119,14 +119,14 @@ } ], "children_root": "sha256:235c8241a95dae8b28714acb8c85e84f60a3227c48d4d2f94ba498bdfed9b2f9", - "compiled_at": "2026-10-14T13:56:26Z", + "compiled_at": "2026-10-14T15:09:35Z", "compiler": "crumb-compile/1", - "digest": "sha256:5f474ac3d924f88270dd311d33aa3c99bfddd1c50c7b4d76543416ddfd95e264", + "digest": "sha256:77bb7bb9d01d7767359bacc46facf352c31aba364f1fb213a8ae5dd32afe7583", "evidence_files": 439, "evidence_root": "sha256:342c5ebcb210cb45fa14616a90393f4872b4a086c7e58810a03aef42064ea1df", "files": 4359, - "generated_at_commit": "9f9cd0ee046f3a52a9a86f13723596276455c50d", - "source_tree": "sha256:bea34fcb2774bf84181c789f86b69da5e99e7bb8f1206aab76b24be7fc8e927b" + "generated_at_commit": "afc55ff0be82a0ea86faabf07daad39215aca105", + "source_tree": "sha256:4ae0ddf3f1f13ee606ab4ab8db9c8c8c63fb13fda6236be5fe84d3a10c38304b" } }, "history": [], diff --git a/scripts/.crumb b/scripts/.crumb index ef96dde3..cf7ba53b 100644 --- a/scripts/.crumb +++ b/scripts/.crumb @@ -4,13 +4,13 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-11T20:24:07Z", + "compiled_at": "2026-10-14T15:09:35Z", "compiler": "crumb-compile/1", "digest": "sha256:07f19c8d7013a03659eb514ccf94dd7ff76f2ff3ce3736cc3bb11c156ed30e1c", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 39, - "generated_at_commit": "cc3fd4f0794c49f5f311e407a290d873bc1417fd", + "generated_at_commit": "afc55ff0be82a0ea86faabf07daad39215aca105", "source_tree": "sha256:598bb5a2099247f550440bb55a97df08889b7495b1948f56e5611cf1bc2171f5" } }, diff --git a/tools/aien-test/docs/LOCAL_VERIFICATION.md b/tools/aien-test/docs/LOCAL_VERIFICATION.md index 0da8773f..790900cb 100644 --- a/tools/aien-test/docs/LOCAL_VERIFICATION.md +++ b/tools/aien-test/docs/LOCAL_VERIFICATION.md @@ -182,9 +182,17 @@ The one rule: 6. **Manifests.** A gate that needs a sibling is `requires: host` (or a stronger pool), never `portable`: `portable` means the tree alone, which is what the hosted thin gate runs. -7. **Cache.** A sibling lies outside the tree the cache key covers, so a - head whose repository has siblings never reuses an earlier result: every - gate runs fresh (`no_cache`). +7. **Cache.** A sibling lies outside the tree the cache key covers, so the + worker records each sibling made (`name` = its `dir`) and each operator + pin (`name` = `pin:`) with its commit in the receipt's `pins`, + which is part of the cache key. The worker's evidence directory is per + head (`evidence///`), so a result is reused only when the same + commit runs again with every sibling at the same commit; a sibling that + moved runs every gate fresh. A declared sibling that cannot be made turns + the cache off for the head (`no_cache`). Results are never reused across + commits in the worker: gates read files they do not declare as `inputs` + (SC-TEST reads the root `README.md` and `COVENANT.md`), so a key built + from declared inputs alone could hand a commit another commit's PASS. `wt.sh remove` takes the whole run directory away (checkout and siblings) and prunes every mirror's worktree list. An older `wt.sh` that still makes @@ -301,7 +309,7 @@ Forgejo). Merging a pull request on GitHub does not wake it. `--jobs host=N,qemu=M` and `--no-cache` apply to the runs the worker starts, as they do for `aien-test test`. `--no-cache` runs every selected gate again -(a head with sibling checkouts never uses the cache anyway). `--jobs host=1` +(a head reuses only its own earlier results, see "Sibling checkouts"). `--jobs host=1` runs one host gate at a time: omega's gates share one checkout's `build/` and pin clones, and on main 771af52 ten of them failed from parallel races ("Text file busy" on `build/omegatool`, concurrent clones of diff --git a/tools/aien-test/src/cache.rs b/tools/aien-test/src/cache.rs index 67170968..89f6a9b7 100644 --- a/tools/aien-test/src/cache.rs +++ b/tools/aien-test/src/cache.rs @@ -402,7 +402,7 @@ pub fn explain_chain( build_inputs_digest: id.inputs_digest.clone(), machine_digest: id.machine_digest.clone(), dependencies: deps, - pins: json!([]), + pins: opts.pins.clone(), args_override: None, }; match key(&now, index) { diff --git a/tools/aien-test/src/plan.rs b/tools/aien-test/src/plan.rs index 78bc4baa..1b872db3 100644 --- a/tools/aien-test/src/plan.rs +++ b/tools/aien-test/src/plan.rs @@ -862,7 +862,7 @@ pub fn probe_cached(root: &Path, graph: &Graph, opts: &crate::runner::Options) - build_inputs_digest: id.inputs_digest.clone(), machine_digest: id.machine_digest.clone(), dependencies: deps, - pins: json!([]), + pins: opts.pins.clone(), args_override: None, }; if let Ok(k) = cache::key(&now, &index) { diff --git a/tools/aien-test/src/runner.rs b/tools/aien-test/src/runner.rs index 744e0ea0..1258b401 100644 --- a/tools/aien-test/src/runner.rs +++ b/tools/aien-test/src/runner.rs @@ -63,6 +63,9 @@ pub struct Options { /// `--release`: qualification mode. No cache reuse and the tree must be /// clean even with `--allow-dirty`. pub release: bool, + /// `core.pins` and part of `cache.key` (ADR 0028: `{name, commit}` sorted + /// by `name`). The worker sets the head's sibling and operator pins. + pub pins: Value, } impl Options { @@ -81,6 +84,7 @@ impl Options { sandbox: Sandbox::None, cargo_target_dir: None, release: false, + pins: json!([]), } } } @@ -609,7 +613,7 @@ fn execute_gate(job: &Job<'_>, permit: Option>) -> Result, permit: Option>) -> Result`. A sibling that cannot be made is a /// note (its gates then fail on the missing directory, never PASS); every /// sibling made is journaled with its commit. Returns what to remove later -/// under `Sandbox::None`. +/// under `Sandbox::None`, and the receipt `pins` (ADR 0028: `{name, commit}` +/// sorted by `name`): each sibling made, named by its `dir`, and each operator +/// pin, named `pin:`. They enter `core.pins` and `cache.key`, so a +/// result is reused only while every sibling is at the same commit. fn provision_siblings( cfg: &Config, repo: &str, sha: &str, co: &Checkout, sibs: &[Sibling], + pins: &[Pin], notes: &mut Vec, -) -> Vec<(PathBuf, PathBuf)> { +) -> (Vec<(PathBuf, PathBuf)>, Value) { let mut made = Vec::new(); - if sibs.is_empty() { - return made; - } - if !co.nested { + let mut pin_entries: Vec<(String, String)> = Vec::new(); + if !sibs.is_empty() && !co.nested { notes.push(format!( "siblings not provided: the worktree tool makes the old flat layout (update {})", cfg.wt_tool @@ -529,7 +531,7 @@ fn provision_siblings( .map(|t| t.display().to_string()) .unwrap_or_default() )); - return made; + return (made, json!([])); } for s in sibs { let src = cfg.clones.join(&s.source); @@ -582,11 +584,21 @@ fn provision_siblings( s.dir, s.source, s.git_ref, sib_sha )); made.push((src, path)); + pin_entries.push((s.dir.clone(), sib_sha)); } Err(e) => notes.push(format!("sibling ../{}: not provided: {e}", s.dir)), } } - made + for p in pins { + pin_entries.push((format!("pin:{}", p.source), p.sha.clone())); + } + // ADR 0028 receipt member `pins`: `{name, commit}` sorted by `name`. + pin_entries.sort(); + let pin_json: Vec = pin_entries + .into_iter() + .map(|(name, commit)| json!({ "name": name, "commit": commit })) + .collect(); + (made, Value::Array(pin_json)) } /// Under `Sandbox::User`: make the worktree with INFRA's `wt.sh` (`sync` the @@ -815,15 +827,18 @@ pub fn run_once(cfg: &Config, repo: &str, sha: &str) -> Result cfg.state.beat(repo, sha, "checkout"); let co = checkout(cfg, repo, sha, &mut notes)?; ensure_pins(&cfg.clones, &pins, &sibs, &mut notes); - let made = provision_siblings(cfg, repo, sha, &co, &sibs, &mut notes); + let (made, pin_values) = provision_siblings(cfg, repo, sha, &co, &sibs, &pins, &mut notes); let (clone, wt) = (co.clone.clone(), co.wt.clone()); // A wt.sh worktree belongs to aien-run; the operator's git opens it only // after `check_worktree_link` (see `process::trust_worktree`). let trust = (cfg.sandbox == Sandbox::User).then(|| process::trust_worktree(&wt)); - // A sibling is outside the tree the cache key covers, so a head with - // siblings never reuses an earlier result: every gate runs fresh. - let fresh = !sibs.is_empty(); - let result = run_in_worktree(cfg, repo, sha, &clone, &wt, fresh, &mut notes); + // Every sibling's commit is in `opts.pins` (`core.pins` and `cache.key`), + // and the evidence directory is this head's own (`evidence//`), + // so a result is reused only for this same commit with every sibling at + // the same commit. A declared sibling that could not be made turns the + // cache off for the whole head. + let fresh = made.len() < sibs.len(); + let result = run_in_worktree(cfg, repo, sha, &co, fresh, pin_values, &mut notes); crumb( cfg, &wt, @@ -858,11 +873,12 @@ fn run_in_worktree( cfg: &Config, repo: &str, sha: &str, - clone: &Path, - wt: &Path, + co: &Checkout, fresh: bool, + pins: Value, notes: &mut Vec, ) -> Result { + let (clone, wt) = (co.clone.as_path(), co.wt.as_path()); let started = now_secs(); crumb( cfg, @@ -897,6 +913,7 @@ fn run_in_worktree( opts.sandbox = cfg.sandbox; opts.cargo_target_dir = target_dir_for(cfg, repo, on_main); opts.pool_sizes = opts.pool_sizes.with(cfg.jobs); + opts.pins = pins; if fresh || cfg.no_cache { opts.no_cache = true; } diff --git a/tools/aien-test/tests/local_ci.rs b/tools/aien-test/tests/local_ci.rs index 3864f8ee..730a73b6 100644 --- a/tools/aien-test/tests/local_ci.rs +++ b/tools/aien-test/tests/local_ci.rs @@ -1349,3 +1349,141 @@ fn nested_in_sandbox(test: &str) -> bool { } nested } + +/// A new commit `name` on `branch` of the world's origin that writes `files`, +/// fetched into the trusted clone. Returns the commit. +fn commit_on(w: &World, branch: &str, files: &[(&str, &str)], name: &str) -> String { + git(&w.origin, &["checkout", "-q", branch]); + for (rel, content) in files { + write(&w.origin, rel, content, false); + } + git(&w.origin, &["add", "-A"]); + git(&w.origin, &["commit", "-q", "-m", name]); + let sha = git(&w.origin, &["rev-parse", "HEAD"]); + git(&w.origin, &["checkout", "-q", "main"]); + git(&w.clone, &["fetch", "-q", "--all"]); + sha +} + +fn gate_status(s: &worker::Summary, id: &str) -> (String, Verdict) { + s.gates + .iter() + .find(|g| g.0 == id) + .map(|g| (g.1.clone(), g.2)) + .unwrap_or_else(|| panic!("no gate {id} in {:?}", s.gates)) +} + +/// With siblings, the worker reuses a result only for the same commit of +/// the repository and only while every sibling is at the same commit: the +/// sibling commits are in the cache key, and the evidence directory is the +/// head's own. +#[test] +fn worker_reuses_only_the_same_commit_while_its_sibling_commits_match() { + if nested_in_sandbox("worker_reuses_only_the_same_commit_while_its_sibling_commits_match") { + return; + } + let w = world(); + let (head_s, sib_sha, map) = sibling_world(&w); + let mut cfg = w.config(); + cfg.operator = true; // S is a new gate: a pipeline configuration change. + cfg.siblings = Some(map); + let pass = |st: &str| (st.to_string(), Verdict::Pass); + + let r1 = worker::run_once(&cfg, REPO, &head_s).expect("worker r1"); + assert_eq!(gate_status(&r1, "S"), pass("run"), "{:?}", r1.notes); + assert!( + r1.notes.iter().any(|n| n.contains(&sib_sha)), + "{:?}", + r1.notes + ); + + // The same head again, sibling unchanged: reused. + let r2 = worker::run_once(&cfg, REPO, &head_s).expect("worker r2"); + assert_eq!(gate_status(&r2, "S"), pass("cached"), "{:?}", r2.gates); + + // A new commit that leaves S's declared inputs (tools/) alone still runs + // S: results never cross commits. + let head_s2 = commit_on(&w, "topic-s", &[("h/h.txt", "s2\n")], "change h"); + let r3 = worker::run_once(&cfg, REPO, &head_s2).expect("worker r3"); + assert_eq!(gate_status(&r3, "S"), pass("run"), "{:?}", r3.gates); + + // The sibling moves to a new commit: the same head runs S again. + let so = w.origin.parent().unwrap().join("sib-origin"); + write(&so, "lib/extra.txt", "world\n", false); + git(&so, &["add", "-A"]); + git(&so, &["commit", "-q", "-m", "sib v2"]); + let sib_sha2 = git(&so, &["rev-parse", "HEAD"]); + assert_ne!(sib_sha, sib_sha2); + git( + &w.clone.parent().unwrap().join(SIB), + &["fetch", "-q", "--all"], + ); + let r4 = worker::run_once(&cfg, REPO, &head_s).expect("worker r4"); + assert_eq!(gate_status(&r4, "S"), pass("run"), "{:?}", r4.gates); + assert!( + r4.notes.iter().any(|n| n.contains(&sib_sha2)), + "{:?}", + r4.notes + ); + + // Same head, sibling still at its new commit: reused again. + let r5 = worker::run_once(&cfg, REPO, &head_s).expect("worker r5"); + assert_eq!(gate_status(&r5, "S"), pass("cached"), "{:?}", r5.gates); +} + +/// Cache safety across commits: gate U declares only `u/` as its input but +/// its program also reads the root `README.md`, as SC-TEST's +/// `tier2_boundary` tests read the root `README.md` and `COVENANT.md`. A +/// later commit that changes only `README.md` makes U fail when it really +/// runs, so the worker must run U again, never hand it the earlier PASS. +#[test] +fn worker_never_reuses_a_pass_when_an_undeclared_file_changed_across_commits() { + if nested_in_sandbox( + "worker_never_reuses_a_pass_when_an_undeclared_file_changed_across_commits", + ) { + return; + } + let w = world(); + let mut cfg = w.config(); + cfg.operator = true; // U is a new gate: a pipeline configuration change. + + git(&w.origin, &["checkout", "-q", "-b", "topic-u", "main"]); + write( + &w.origin, + "tools/u.sh", + "#!/bin/sh\ngrep -q 'AGPL-3.0' README.md || { echo 'README.md lost its licence' >&2; exit 1; }\necho PASS\n", + true, + ); + git(&w.origin, &["checkout", "-q", "main"]); + let head_u1 = commit_on( + &w, + "topic-u", + &[ + ("u/u.txt", "1\n"), + ("README.md", "Licence: AGPL-3.0\n"), + ("tests/gates/U.gate", &gate("U", "u/", "tools/u.sh", "")), + ], + "gate U reads README.md", + ); + let head_u2 = commit_on( + &w, + "topic-u", + &[("README.md", "Licence: none\n")], + "README.md loses its licence", + ); + + let r1 = worker::run_once(&cfg, REPO, &head_u1).expect("worker u1"); + assert_eq!( + gate_status(&r1, "U"), + ("run".to_string(), Verdict::Pass), + "{:?}", + r1.notes + ); + let r2 = worker::run_once(&cfg, REPO, &head_u2).expect("worker u2"); + assert_eq!( + gate_status(&r2, "U"), + ("run".to_string(), Verdict::Fail), + "a PASS from {head_u1} must not be handed to {head_u2}: {:?}", + r2.gates + ); +} ```