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.
PREFILL-E2E-2: mutant legs build apart from the main leg; CI checks mutant patches apply (#452 parts 1, 2)
mergedcb667c3f13f8e70f #673 · opened 2026-10-18 22:17 UTC · closed 2026-10-19 14:05 UTC · merged 2026-10-19 14:05 UTC
Imported from GitHub aien-dev/aien-sovereign-core-mv#673, by drakestapleton
Labels: ready-to-merge
Base 24c29ae9ca75495dea62500482e44a4d3ac09be8 · Head 72882c9e9e814808d19bad03600c5454b835886c
Merged on GitHub as 0b7dabd8d3b2088f55cfa6491e5d7d7f2b01b601; reachable from main 007ac4ac5ee5edc6f79f411b1706752293604044 (observed 2026-11-18T16:35:48Z)
drakestapleton wrote on 2026-10-18 22:17 UTC
Summary
Parts 1 and 2 of #452. Part 3 (release-negatives kill race) is #608, verified below.
Part 2: the real-model "flake" is mutant code leaking into the main leg
The mutant leg of prefill_e2e2_run.sh built its patched copy in the same CARGO_TARGET_DIR as the main leg. Cargo decides a workspace crate is fresh by file times (library newer than sources), not contents, and the library file has the same name whichever tree built it. aien-kv-cache has no build script with an absolute path, so after M8 built it from the patched copy, the next main leg linked M8's library as fresh and failed with M8's own signature. The same rule let one mutant link another mutant's aien-kv-cache and survive or fail with the wrong marker.
Evidence:
Every RECLAIM_VIOLATION in the Spark evidence store (98 hits) reads exactly allocated blocks 4 (expected 0), free 18 (expected 22), the M8 signature, including on main-leg PREFILL-E2E-2 receipts.
Main-leg failures with that signature keep happening after #589's target-dir lock (2692c1e8, aeca68fe, e22f0d4a, 6d2c3cc3, ed4a169c on 2026-10-18). Running gates one at a time does not stop a later gate from reusing an earlier gate's library. So this is not the #601 overlap class, and #607 will not fix it either.
Fix (mutant leg only): build in $CARGO_TARGET_DIR/prefill-e2e2-mutants, and extract the copy with tar -m so each mutant rebuilds the workspace crates from its own copy. Third-party crates build once in the mutant dir. Cost: each mutant leg rebuilds the workspace crates it uses, about 30 to 60 s here.
Part 1: stale mutant patches
#589 already regenerated m1/m2/m3/m5/m7, and all eight apply on main. Nothing stopped this from happening again, though: a stale patch only showed up at the slow local gate. The new prefill_e2e2_run.sh patches mode runs git apply --check on every patch, with no model and no build. GitHub CI now runs it, so a change that breaks a patch fails on its own PR.
Model-free repro (repro-452-part2.sh: real driver, cargo runner stubbed so the model never loads). It checks which libaien_kv_cache the main leg holds after an M8 leg. Main 1db20d4: RED 2/2, the main leg ends up with M8's library. With this branch: GREEN 2/2, it stays the checkout's library (1b7dd8ae both times).
Mutant to mutant: M2 after M8 in the mutant dir. Separate dir without tar -m: M2 links M8's kv-cache (RED). With it: rebuilt (GREEN).
Real model, unmodified main 1db20d4, clean tree, run after an M8 build in the same target dir: test result: FAILED, (g) RECLAIM_VIOLATION: allocated blocks 4 (expected 0), free 18 (expected 22).
Real model, this branch, one shared target dir, run in this order: mutant m8 KILLED, mutant m2 KILLED, then main fmt_rc 0, clippy_rc 0, test result: ok. 1 passed.
patches at 076585a (the head #452 was filed on): exit 1, STALE m2 m3 m5 m7 with the issue's exact patch failed lines. On main: exit 0, 8/8 apply.
sh -n OK. crumb verify . OK (16 current). No Python.
All real-model runs used flock /tmp/aien-gb10.lock.
#608 (part 3) check
Verified that it fixes the real cause. I put a 0.3 s stall between the two kills to stand in for a loaded host. With main's order (sleep killed first), kill -9 found no installer 8/8 times: it had already exited on its own through set -e and its EXIT trap, so nothing was killed at the pause point. With #608's order, it hit the installer 8/8 times. Both scripts still print PASS: main hides the miss with || true (a2e7439, fe3677c), so the gate stays green either way. #608 now conflicts with main in .crumb only and needs a crumb recompile on rebase.
Not covered
Target dirs already on the Spark may still hold a mutant-built libaien_kv_cache that is newer than a head's checkout. A fresh worktree's files are newer, so cargo should rebuild (not tested). If not, a one-time cargo clean -p aien-kv-cache --release on those dirs clears it. I did not touch them.
Without the runner's target-dir lock, two mutant legs running at once can still race inside the mutant dir.
Refs #452, #608, #601, #589.
Certifications
No em or en dashes, no AI clichés. No Python. Feature branch.
diff --git a/.crumb b/.crumb
index 3b277823..92c42a43 100644
--- a/.crumb
+++ b/.crumb
@@ -65,68 +65,68 @@
"children": [
{
"digest": "4e7f370019e67f6c71565d1544530851eb1b3b1bed61c2712f4ac7d9614a89bf",
- "last_commit": "6bbe2ec2",
+ "last_commit": "6bbe2ec",
"name": "crates/aien-allen",
"purpose": "ALLEN identity gate: resolve-only subject check, host pin record, deployment record (ADR 0035). "
},
{
"digest": "40a231c50dba92af7de2527ab33879c5d1eaaa6e7ea5d6a5ebaa9d60c7542075",
- "last_commit": "b9b52f9c",
+ "last_commit": "b9b52f9",
"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",
+ "last_commit": "b9b52f9",
"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",
+ "last_commit": "f8eea42",
"name": "crates/aien-cli",
"purpose": ""
},
{
"digest": "25fd9f8afbea19702750f8ddba2ef4aeafc5bc4515aa695340a5af6931989c03",
- "last_commit": "8cca8020",
+ "last_commit": "8cca802",
"name": "crates/aien-scheduler/src/bin",
"purpose": ""
},
{
"digest": "dd11ae9a698f7fcad7d1df386926426ea051d4131ee738da2ac81eb6a57b9473",
- "last_commit": "afbbd804",
+ "last_commit": "afbbd80",
"name": "crates/spark-cockpit-rs",
"purpose": ""
},
{
"digest": "34b010337138a65931ca4d0177631d839f71af021c5092583f52afd69ddd1b72",
- "last_commit": "fe3677c3",
+ "last_commit": "fe3677c",
"name": "scripts",
"purpose": ""
},
{
"digest": "75e439cb2ae120e1807af894b70b6454971028f5527f56451f9d6558f503c88b",
- "last_commit": "fa73e778",
+ "last_commit": "fa73e77",
"name": "skills",
"purpose": ""
},
{
"digest": "bb2a911a1a7d4088d5c767bba72d8248154b71fedd0d86102490a594a64a9947",
- "last_commit": "f23e1cbd",
+ "last_commit": "24c29ae",
"name": "tools/aien-local-ci",
"purpose": "Local CI sandbox exec contract (C8), aien-run user/caches install, Forgejo trigger hook, health "
}
],
"children_root": "sha256:7233404baa7d5c3ce664e4abee8970212f5e6213399ba74d2ad7a65e3a5324d5",
- "compiled_at": "2026-10-19T00:25:49Z",
+ "compiled_at": "2026-10-19T13:00:20Z",
"compiler": "crumb-compile/1",
- "digest": "sha256:69cf673760ee93f6515aaf2f2a14e6dfcb7727fd42e17a40b228cbd595a9cd9b",
+ "digest": "sha256:ea0202453111a8990de0aa7a2f711dd7d0c958ad0903891451d5d3b2e33e9635",
"evidence_files": 1578,
"evidence_root": "sha256:135e27a1a0704c4a8371cd2c1eb555f2b5beec61c212949b029a5457418a7160",
"files": 5891,
- "generated_at_commit": "f23e1cbd1827d99d525a19052b6d8ae993951ad6",
- "source_tree": "sha256:ce2e8982a235ab142a117b2520b276a256c772c9990ac51d31a27b08f5914dd3"
+ "generated_at_commit": "bcca2c34c6700c90bcee4e335d238b96b9964f5d",
+ "source_tree": "sha256:603da1edb5d681dc6f1190abf6f619dfa7ec9e7d514c229129d6d4bf5c845b96"
}
},
"history": [],
diff --git a/crates/aien-runtime/tests/prefill_e2e2_run.sh b/crates/aien-runtime/tests/prefill_e2e2_run.sh
index 73dca004..752d78d9 100755
--- a/crates/aien-runtime/tests/prefill_e2e2_run.sh
+++ b/crates/aien-runtime/tests/prefill_e2e2_run.sh
@@ -17,7 +17,12 @@
# prefill_e2e2_mutants/mutant_ID.patch there and run the same test
# there (the checkout is never patched). Succeed only when the test
# failed and its output holds MARKER (the forge KILLED rule). A mutant
-# that survives, or fails with another message, exits 1.
+# that survives, or fails with another message, exits 1. The copy is
+# built in its own target dir (see run_mutant), never the shared one.
+# prefill_e2e2_run.sh patches
+# Check that every prefill_e2e2_mutants/mutant_*.patch still applies to
+# this tree (git apply --check). No model, no build; run it after changing
+# a file a mutant patch touches (sc #452).
#
# Observations ("AIEN-OBS NAME JSON" lines, see tools/aien-test) tell the
# runner what happened; the verdict is derived from the manifest, not here.
@@ -98,13 +103,22 @@ run_mutant() {
lg="$out/AIENTEST-DOGFOOD-$sha8-$id.log"
# The patch goes into a private copy of the tree, never into the checkout: aien-test runs gates in
# parallel in one checkout, and a patched file there fails their clean-tree checks (and the main leg's
- # fmt check). The copy shares CARGO_TARGET_DIR so dependencies build once.
+ # fmt check).
+ #
+ # The copy never builds in the shared target dir, and its files carry the time of the copy, not
+ # the checkout's (tar -m). Cargo calls a workspace crate fresh when its library is newer than its
+ # sources; it compares file times, not contents, and the library has the same name whichever
+ # tree built it. So a library built from the patched copy was later linked as fresh by the main
+ # leg on the same target dir, which then ran the mutant (sc #452: PREFILL-E2E-2 failing with
+ # M8's RECLAIM_VIOLATION, allocated blocks 4, free 18), and a mutant whose patched file was older
+ # than a library built after it linked that one instead and survived. Fresh file times make every
+ # workspace crate of the copy rebuild; third-party crates build once in the mutant dir and stay.
work=$(mktemp -d) || exit 3
trap 'rm -rf "$work"' EXIT
trap 'rm -rf "$work"; exit 143' HUP INT TERM
git ls-files -z --cached --others --exclude-standard --deduplicate |
- tar --null --ignore-failed-read -T - -cf - | tar -xf - -C "$work" || exit 3
- CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-$PWD/target}
+ tar --null --ignore-failed-read -T - -cf - | tar -xmf - -C "$work" || exit 3
+ CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-$PWD/target}/prefill-e2e2-mutants
export CARGO_TARGET_DIR
cd "$work" || exit 3
git apply "$patch" || exit 3
@@ -124,14 +138,28 @@ run_mutant() {
exit 1
}
+check_patches() {
+ rc=0
+ for p in crates/aien-runtime/tests/prefill_e2e2_mutants/mutant_m*.patch; do
+ if git apply --check "$p"; then
+ echo "applies: $p"
+ else
+ echo "STALE: $p no longer applies; regenerate it so it still plants its bug" >&2
+ rc=1
+ fi
+ done
+ exit "$rc"
+}
+
case "${1:-}" in
main) run_main ;;
+patches) check_patches ;;
mutant)
shift
run_mutant "$@"
;;
*)
- echo "usage: $0 main | mutant ID MARKER" >&2
+ echo "usage: $0 main | mutant ID MARKER | patches" >&2
exit 2
;;
esac