interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

GitHub aien-dev/omega-mv#320 (code only)

closed derived 6b81031be760482e #320

Imported from GitHub aien-dev/omega-mv#320 (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 6500517017e6ac10e4f46f1723a311ac37684c03 · Head d4cab7e4844d820a65bc5366dc3848cd18dc55ce

Fetch it

A git bundle of the pull request's head, 10921 bytes.

curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/6b81031be760482e.bundle -o 6b81031be760482e.bundle
git fetch 6b81031be760482e.bundle refs/pull/320/head

Raw bundle · 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/omega-mv
320
d4cab7e4844d820a65bc5366dc3848cd18dc55ce
{"kind":"github-import","owner":"aien-dev","repo":"omega-mv","number":320,"url":"https://github.com/aien-dev/omega-mv/pull/320","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:37:19Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/.crumb b/.crumb
index d5bd054e2..c76f02f9b 100644
--- a/.crumb
+++ b/.crumb
@@ -46,7 +46,7 @@
       "children": [
         {
           "digest": "fb7cc6e608fdbe68a9735a1313285782b9717ff12bde17343f8ce635de3644f6",
-          "last_commit": "841aa11",
+          "last_commit": "190ff89",
           "name": "calibration",
           "purpose": "Directory calibration. Purpose not yet described by a human."
         },
@@ -58,7 +58,7 @@
         },
         {
           "digest": "536f7b8db9a92a1f586bad4379d47544a30d1b8e83c2d799c18e66cf8660c9ae",
-          "last_commit": "841aa11",
+          "last_commit": "30bb116",
           "name": "doctrine",
           "purpose": "Directory doctrine. Purpose not yet described by a human."
         },
@@ -70,13 +70,13 @@
         },
         {
           "digest": "69cbb8ef13ccce47ccc21f159e95f1eac58679319e2cc25937065f95c4eb9207",
-          "last_commit": "841aa11",
+          "last_commit": "ae8c7c5",
           "name": "polyglot",
           "purpose": "Directory polyglot. Purpose not yet described by a human."
         },
         {
           "digest": "8178197a3e956890d6194e5b4fcc0e0b5c4ec67b0749f0d257f2ed17c8ca7465",
-          "last_commit": "841aa11",
+          "last_commit": "559f6e5",
           "name": "research",
           "purpose": "Directory research. Purpose not yet described by a human."
         },
@@ -93,27 +93,27 @@
           "purpose": "Directory src. Purpose not yet described by a human."
         },
         {
-          "digest": "02f1cf99b38d0c0eac5b9e7ab560e1611571922ee3a5ce46fa3440266397ac92",
-          "last_commit": "62b6a28",
+          "digest": "c2187196e3d4e2a28000d45435ca7fc73e5af9966aa3ce3e9094b84973971db8",
+          "last_commit": "de7e72e",
           "name": "tests",
           "purpose": "Directory tests. Purpose not yet described by a human."
         },
         {
-          "digest": "808edb958b46d236f503828399cbdb7f1cb62f8eebfd1604d4768b42734b459f",
-          "last_commit": "2041f24",
+          "digest": "cd1b75fea968e8ce72acd897667b41af226eed0c1b8ed3a7e67d71e5388585d1",
+          "last_commit": "de7e72e",
           "name": "tools",
           "purpose": "Directory tools. Purpose not yet described by a human."
         }
       ],
-      "children_root": "sha256:e955fb0b2fdac485b29466649db06bd881789eeae19fe8735043333ecdf00b1b",
-      "compiled_at": "2026-10-06T14:32:06Z",
+      "children_root": "sha256:a1d17947cddbdaa0c40ee288a40abe396a6cf9a6ce57fd84e91fe9e77e0f2404",
+      "compiled_at": "2026-10-06T14:53:35Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:6abf3bac665916248066adbc054da128626109e66a38773e4a1041d413594f12",
+      "digest": "sha256:783ee23e4d61ab72031bc0ed7253398569c7ab32c1f4e5acefd064878865fb59",
       "evidence_files": 4743,
       "evidence_root": "sha256:34547c38b5669eb80fad819b39b679c1b425c66bc3e69d11431d684390b900e9",
-      "files": 6575,
-      "generated_at_commit": "cbe6ce2a4f973bd519a2609dfde648ea06973c19",
-      "source_tree": "sha256:90e9d14a63f616300b4b36f6b9ea92e0e06abcef0801d541a9d3db7120d56c96"
+      "files": 6579,
+      "generated_at_commit": "0dc41787bfc74b6fa965a9ea99051c936d678fc8",
+      "source_tree": "sha256:bb23a3b914c0ac66ca6e6b2a45c16648e935d2ff2cf3931a739dbf97ca8a42b0"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/Makefile b/Makefile
index 39639f824..f78e92fc8 100644
--- a/Makefile
+++ b/Makefile
@@ -1326,6 +1326,17 @@ test-r16-operator-host: $(RX_R13_HOST) $(RX_OPERATOR_CLI)
 test-r16-operator-silicon: $(RX_R13_SILICON) $(RX_OPERATOR_CLI)
 	bash tests/runtime/rx_operator_host.sh silicon $(RX_R13_SILICON) $(RX_OPERATOR_CLI)
 
+.PHONY: test-r16-operator-mutants-evidence test-r13-first-failure test-window-lane-guard
+test-r16-operator-mutants-evidence:
+	bash tests/runtime/rx_operator_mutants_evidence_test.sh
+
+# Builds the R13 host test build twice into a scratch OUT_DIR and runs it (host only, no GPU).
+test-r13-first-failure:
+	bash tests/runtime/rx_r13_first_failure_test.sh
+
+test-window-lane-guard:
+	bash tests/window_lane_guard_test.sh
+
 test-r16-operator-mutants: $(RX_R13_HOST) $(RX_OPERATOR_CLI)
 	CC="$(CC)" CFLAGS="$(CFLAGS)" RX_PROD_ARGUS_FLAGS="$(RX_PROD_ARGUS_FLAGS)" \
 		RX_R13_SRCS="$(RX_R13_SRCS)" RX_PROD_ARGUS_SRCS="$(RX_PROD_ARGUS_SRCS)" \
diff --git a/tests/.crumb b/tests/.crumb
index ae0938300..b4b3cbc31 100644
--- a/tests/.crumb
+++ b/tests/.crumb
@@ -253,8 +253,8 @@
           "purpose": "Directory tests/relations. Purpose not yet described by a human."
         },
         {
-          "digest": "27b7f9eb01e2612c581e23eaa9d3d9fccf5faa6b38dbb7399d8edfb47c2af868",
-          "last_commit": "df6bc1c",
+          "digest": "2de57bdd33483fb5cf55de98b3767f5f38c0c4065f3eefaac648a67f02e7b46c",
+          "last_commit": "de7e72e",
           "name": "runtime",
           "purpose": "Directory tests/runtime. Purpose not yet described by a human."
         },
@@ -283,15 +283,15 @@
           "purpose": "Directory tests/visor. Purpose not yet described by a human."
         }
       ],
-      "children_root": "sha256:81a445b3b2b430db307f071883ae531b21fa110d26db79e5106608c4094b8f4b",
-      "compiled_at": "2026-10-06T02:24:19Z",
+      "children_root": "sha256:f10af5b33d005f7f66640a9a370308c5527d614f6ebf2524c8409594dbf60d1a",
+      "compiled_at": "2026-10-06T14:35:34Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:02f1cf99b38d0c0eac5b9e7ab560e1611571922ee3a5ce46fa3440266397ac92",
+      "digest": "sha256:c2187196e3d4e2a28000d45435ca7fc73e5af9966aa3ce3e9094b84973971db8",
       "evidence_files": 11,
       "evidence_root": "sha256:d5c1bceb4d57ef0eb42797c58801b5926509711614c3e38bb7105b6efa3942f2",
-      "files": 813,
-      "generated_at_commit": "df6bc1cd3e0fbb70807274858bd734eb677be72c",
-      "source_tree": "sha256:4079d5c49623d1f71203b5e643b338c2e876a52e5f9edf5ea308debb806dd557"
+      "files": 816,
+      "generated_at_commit": "de7e72ece2c55f53ed3b8ddbbeed5461e1123ae2",
+      "source_tree": "sha256:0c8c752ed57138adee3ecdd64fd47edb63b5819de6852d7170910c7bb2002c59"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/tests/runtime/.crumb b/tests/runtime/.crumb
index b2ff84133..0a2ecc375 100644
--- a/tests/runtime/.crumb
+++ b/tests/runtime/.crumb
@@ -7,14 +7,14 @@
     "generated": {
       "children": [],
       "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "compiled_at": "2026-10-06T01:18:22Z",
+      "compiled_at": "2026-10-06T14:35:34Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:27b7f9eb01e2612c581e23eaa9d3d9fccf5faa6b38dbb7399d8edfb47c2af868",
+      "digest": "sha256:2de57bdd33483fb5cf55de98b3767f5f38c0c4065f3eefaac648a67f02e7b46c",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "files": 61,
-      "generated_at_commit": "55f11ad10e21f9f2dd49649a95da0a85f93ce4df",
-      "source_tree": "sha256:ff21d2b5c9620f87a3176d7197f211a68f9cf0078be46069f9b13a860b490093"
+      "files": 63,
+      "generated_at_commit": "de7e72ece2c55f53ed3b8ddbbeed5461e1123ae2",
+      "source_tree": "sha256:30f236c631a8792c1403ab55d5decbed02c1febaefb64e1b41c5930f22b83022"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/tests/runtime/rx_operator_mutants.sh b/tests/runtime/rx_operator_mutants.sh
index 8dbb8a790..62c270a30 100644
--- a/tests/runtime/rx_operator_mutants.sh
+++ b/tests/runtime/rx_operator_mutants.sh
@@ -14,7 +14,28 @@ set -u
 HERE=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)
 CLI=$(cd "$(dirname "$1")" && pwd)/$(basename "$1")
 W=$(mktemp -d "${TMPDIR:-/tmp}/rx-op-mut.XXXXXX")
-trap 'rm -rf "$W"' EXIT
+# Evidence rule (omega #313 item 2, #314): a run that does not end in PASS keeps its logs.
+# RX_OP_MUT_KEEP (default: a new folder in TMPDIR) receives the logs of every case; the work
+# folder itself (copies of the sources, built programs) is then removed. Nothing is ever kept
+# under build/qual-runs, and an existing folder is never overwritten.
+KEEP=${RX_OP_MUT_KEEP:-${TMPDIR:-/tmp}/rx-op-mut-kept.$(date -u +%Y%m%dT%H%M%SZ).$$}
+keep_logs() {
+    [ "$1" = 0 ] && return 0
+    [ -e "$KEEP" ] && { echo "RX_OPERATOR_MUTANTS: not keeping logs, $KEEP already exists" >&2; return 0; }
+    mkdir -p "$KEEP" || return 0
+    local d; for d in "$W"/*/; do
+        d=${d%/}; mkdir -p "$KEEP/${d##*/}"
+        cp -a "$d"/build.log "$d"/run.log "$d"/name "$d"/phases "$d"/out "$d"/build/qual-runs "$KEEP/${d##*/}/" 2>/dev/null
+    done
+    echo "RX_OPERATOR_MUTANTS: logs kept in $KEEP" >&2
+}
+trap 'rc=$?; keep_logs "$rc"; rm -rf "$W"' EXIT
+
+# Mutant runs write their R13 receipts under their own build/qual-runs inside the work folder
+# (the run directory is the mutant copy, and its build/ is a real folder that links to the real build/ products (argus sources, libraries) but not to qual-runs). A mutant run must never add anything to the real build/qual-runs (#314).
+REAL_RUNS="$HERE/build/qual-runs"
+runs_listing() { [ -d "$REAL_RUNS" ] && find "$REAL_RUNS" -mindepth 1 | LC_ALL=C sort; true; }
+RUNS_BEFORE=$(runs_listing)
 JOBS=${RX_OP_MUT_JOBS:-4}
 
 # name|file|phases the test runs against it|perl substitution (applied with -0, must match once)
@@ -45,7 +66,7 @@ O24 a request without a deadline accepted (S4)|src/runtime/rx_operator.c|control
 O25 any deadline accepted (S4)|src/runtime/rx_operator.c|control|s/    if \(q->deadline_ns > monotonic_ns\(\) \+ RX_OPERATOR_DEADLINE_MAX_NS\) return -1;\n//
 '
 
-copy() { mkdir -p "$1"; (cd "$HERE" && tar -cf - src tests/runtime tests/fabric tools) | tar -xf - -C "$1"; ln -s "$HERE/build" "$1/build"; }
+copy() { mkdir -p "$1"; (cd "$HERE" && tar -cf - src tests/runtime tests/fabric tools) | tar -xf - -C "$1"; mkdir -p "$1/build"; local e; for e in "$HERE"/build/*; do [ -e "$e" ] && [ "${e##*/}" != qual-runs ] && ln -s "$e" "$1/build/${e##*/}"; done; }
 build() { # dir: the production host program, production flags and sources
     (cd "$1" && $CC $CFLAGS $RX_PROD_ARGUS_FLAGS -pthread -o prog $RX_R13_SRCS $RX_PROD_ARGUS_SRCS \
         $AIENOS_CAP_LIB -lm) > "$1/build.log" 2>&1
@@ -70,7 +91,7 @@ export CC CFLAGS RX_PROD_ARGUS_FLAGS RX_R13_SRCS RX_PROD_ARGUS_SRCS AIENOS_CAP_L
 export -f build
 printf '%s\n' base $names | xargs -P "$JOBS" -I{} bash -c 'build "$0/{}" || echo "build failed: {}"' "$W"
 
-if [ -x "$W/base/prog" ] && RX_OP_OUT="$W/base/out" bash "$HERE/tests/runtime/rx_operator_host.sh" host "$W/base/prog" "$CLI" > "$W/base/run.log" 2>&1; then
+if [ -x "$W/base/prog" ] && (cd "$W/base" && RX_OP_OUT="$W/base/out" bash "$HERE/tests/runtime/rx_operator_host.sh" host "$W/base/prog" "$CLI" > "$W/base/run.log" 2>&1); then
     echo "ok   unmutated: PASS ($(grep -c '^\[+\]' "$W/base/run.log") checks)"
 else
     echo "FAIL unmutated: did not pass"; grep -E '^\[-\]|SKIPPED|build failed' "$W/base/run.log" "$W/base/build.log" | head -5
@@ -80,13 +101,18 @@ skipped=$(grep -c '^\[SKIPPED\]' "$W/base/run.log" 2>/dev/null); skipped=${skipp
 for id in $names; do
     d="$W/$id"; name=$(cat "$d/name"); n_mut=$((n_mut + 1))
     if [ ! -x "$d/prog" ]; then echo "FAIL $name: mutant did not build"; tail -3 "$d/build.log"; fails=$((fails + 1)); continue; fi
-    RX_OP_OUT="$d/out" RX_OP_PHASES=$(cat "$d/phases") RX_OP_FAILFAST=1 bash "$HERE/tests/runtime/rx_operator_host.sh" host "$d/prog" "$CLI" > "$d/run.log" 2>&1; rc=$?
+    (cd "$d" && RX_OP_OUT="$d/out" RX_OP_PHASES=$(cat "$d/phases") RX_OP_FAILFAST=1 bash "$HERE/tests/runtime/rx_operator_host.sh" host "$d/prog" "$CLI" > "$d/run.log" 2>&1); rc=$?
     nf=$(grep -c '^\[-\]' "$d/run.log" 2>/dev/null); nf=${nf:-0}
     first=$(grep -m1 '^\[-\]' "$d/run.log" | cut -c1-110)
     if [ $rc != 0 ] && [ "$nf" -gt 0 ]; then echo "ok   $name: killed by: ${first#\[-\] }"
     elif grep -q '^\[SKIPPED\]' "$d/run.log"; then echo "SKIPPED $name: the test could not run the case that kills it"; skipped=$((skipped + 1))
     else echo "FAIL $name: SURVIVED (exit $rc)"; fails=$((fails + 1)); fi
 done
+RUNS_AFTER=$(runs_listing)
+if [ "$RUNS_BEFORE" != "$RUNS_AFTER" ]; then
+    echo "FAIL mutant runs wrote under the real $REAL_RUNS:"; diff <(echo "$RUNS_BEFORE") <(echo "$RUNS_AFTER") | head -5
+    fails=$((fails + 1))
+fi
 echo "RX_OPERATOR_MUTANTS: $n_mut mutants, $fails failures, $skipped skipped"
 if [ "$fails" = 0 ] && [ "$skipped" = 0 ]; then echo "RX_OPERATOR_MUTANTS: PASS"; exit 0; fi
 if [ "$fails" = 0 ]; then echo "RX_OPERATOR_MUTANTS: NOT_RUN (SKIPPED cases)"; exit 3; fi
diff --git a/tests/runtime/rx_operator_mutants_evidence_test.sh b/tests/runtime/rx_operator_mutants_evidence_test.sh
new file mode 100644
index 000000000..19d62ce5a
--- /dev/null
+++ b/tests/runtime/rx_operator_mutants_evidence_test.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+# Host self-test for the evidence rules of tests/runtime/rx_operator_mutants.sh (omega #313 item 2, #314).
+# Runs the script inside a fake tree with a stub compiler and a stub operator test; no real build, no chip.
+#   1. a failing run keeps its logs outside the work folder (RX_OP_MUT_KEEP);
+#   2. mutant programs run in their own folder: their build/qual-runs is not the fake tree's;
+#   3. a mutant program that does write under the real build/qual-runs makes the script FAIL.
+set -u
+HERE=$(cd "$(dirname "$0")/../.." && pwd)
+T=$(mktemp -d "${TMPDIR:-/tmp}/rxopmut.XXXXXX"); trap 'rm -rf "$T"' EXIT
+FAILS=0
+check() { if eval "$2"; then echo "ok   $1"; else echo "FAIL $1"; FAILS=$((FAILS + 1)); fi; }
+F=$T/tree
+mkdir -p "$F/tests/runtime" "$F/src" "$F/tests/fabric" "$F/tools" "$F/build/qual-runs/existing"
+cp "$HERE/tests/runtime/rx_operator_mutants.sh" "$F/tests/runtime/"
+# Stub of the operator test: runs the built program once (as the real test does) and reports one failed check.
+printf '#!/bin/bash\n"$2" > /dev/null 2>&1 < /dev/null\necho "[-] stub check failed"\nexit 1\n' > "$F/tests/runtime/rx_operator_host.sh"
+echo keep > "$F/build/qual-runs/existing/sentinel"
+printf '#!/bin/sh\n:\n' > "$T/cli"; chmod +x "$T/cli"
+# Stub compiler: the "program" it builds writes a receipt relative to its working folder, and, when
+# STUB_REAL is set, also straight into the real build/qual-runs.
+cat > "$T/cc" <<'STUB'
+#!/bin/bash
+while [ $# -gt 0 ]; do [ "$1" = -o ] && { out=$2; break; }; shift; done
+cat > "$out" <<PROG
+#!/bin/bash
+mkdir -p build/qual-runs/stub && echo receipt > build/qual-runs/stub/r.json
+[ -n "${STUB_REAL:-}" ] && { mkdir -p "$STUB_REAL/build/qual-runs/leak"; echo x > "$STUB_REAL/build/qual-runs/leak/r.json"; }
+exit 1
+PROG
+chmod +x "$out"
+STUB
+chmod +x "$T/cc"
+run() { # keepdir, extra env...
+    local keep=$1; shift
+    env "$@" CC="$T/cc" CFLAGS= RX_PROD_ARGUS_FLAGS= RX_R13_SRCS=x RX_PROD_ARGUS_SRCS=y AIENOS_CAP_LIB= \
+        RX_OP_MUT_KEEP="$keep" bash "$F/tests/runtime/rx_operator_mutants.sh" "$T/cli" 2>&1
+}
+before=$(find "$F/build/qual-runs" | LC_ALL=C sort)
+out=$(run "$T/kept1" X=1); rc=$?
+check "failing run exits non-zero" '[ $rc != 0 ]'
+check "failing run keeps its logs" '[ -s "$T/kept1/base/run.log" ] && [ -s "$T/kept1/base/build.log" -o -e "$T/kept1/base/build.log" ]'
+check "failing run says where the logs are" 'echo "$out" | grep -q "logs kept in $T/kept1"'
+check "kept logs include the mutant receipt folder" '[ -s "$T/kept1/base/qual-runs/stub/r.json" ]'
+check "mutant receipt did not land in the real build/qual-runs" '[ "$(find "$F/build/qual-runs" | LC_ALL=C sort)" = "$before" ]'
+check "no leak reported when nothing leaked" '! echo "$out" | grep -q "wrote under the real"'
+out=$(run "$T/kept2" STUB_REAL="$F"); rc=$?
+check "a program writing under the real build/qual-runs is reported" 'echo "$out" | grep -q "FAIL mutant runs wrote under the real"'
+check "that run exits non-zero" '[ $rc != 0 ]'
+mkdir -p "$T/kept3"
+out=$(run "$T/kept3" X=1)
+check "an existing keep folder is not overwritten" 'echo "$out" | grep -q "not keeping logs" && [ -z "$(ls -A "$T/kept3")" ]'
+echo "rx_operator_mutants_evidence_test: $FAILS failures"
+[ "$FAILS" = 0 ]
diff --git a/tests/runtime/rx_r13_first_failure_test.sh b/tests/runtime/rx_r13_first_failure_test.sh
new file mode 100644
index 000000000..fde6151c1
--- /dev/null
+++ b/tests/runtime/rx_r13_first_failure_test.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+# Host test: the R13 receipt carries the FIRST failure message (omega #313 item 3).
+# Builds the R13 host test build twice into its own scratch OUT_DIR (never build/): the normal program
+# (receipt first_failure is null) and one compiled with an unreachable goal (-DTARGET_PCT=1u, so the goal
+# check fails). The failing run must exit 1, write a FAIL receipt, and record the goal message in
+# first_failure; the stderr line and the receipt agree. No GPU. Runs from a scratch folder so no receipt
+# is written under the real build/qual-runs.
+# Usage: tests/runtime/rx_r13_first_failure_test.sh   (environment as for `make test-r13-testbuild-host`)
+set -u
+HERE=$(cd "$(dirname "$0")/../.." && pwd)
+T=$(mktemp -d "${TMPDIR:-/tmp}/rxr13ff.XXXXXX"); trap 'rm -rf "$T"' EXIT
+FAILS=0
+check() { if eval "$2"; then echo "ok   $1"; else echo "FAIL $1"; FAILS=$((FAILS + 1)); fi; }
+BASE_CFLAGS=$(make -C "$HERE" -pn 2>/dev/null | sed -n 's/^CFLAGS = //p' | head -1)
+mk() { make -C "$HERE" OUT_DIR="$T/out" CFLAGS="$BASE_CFLAGS $1" "$T/out/rx_r13_living_testbuild_host" > "$T/make.log" 2>&1; }
+runit() { # name; runs the built program in its own folder
+    mkdir -p "$T/$1" && chmod 700 "$T/$1" && mkdir -m 700 "$T/$1/state"
+    (cd "$T/$1" && "$T/out/rx_r13_living_testbuild_host" --state-dir "$T/$1/state" > stdout.log 2> stderr.log; echo $? > rc)
+    receipt=$(find "$T/$1" -name rx_living_test_build_receipt.json | head -1)
+}
+mk "" || { echo "NOT_RUN: normal build failed (see environment: PHYSICS_DIR, ARGUS_REPO, AIENOS_LOCK_REPO)"; tail -3 "$T/make.log"; exit 3; }
+runit pass
+check "normal run: receipt written" '[ -s "$receipt" ]'
+check "normal run: first_failure is null" '[ "$(jq -c .first_failure "$receipt")" = null ]'
+rm -f "$T/out/rx_r13_living_testbuild_host"
+mk "-DTARGET_PCT=1u" || { echo "FAIL variant build"; tail -3 "$T/make.log"; exit 1; }
+runit fail
+check "unreachable goal: exit 1" '[ "$(cat "$T/fail/rc")" = 1 ]'
+check "unreachable goal: receipt written" '[ -s "$receipt" ]'
+check "unreachable goal: gate is FAIL" '[ "$(jq -r ".gate | to_entries[0].value" "$receipt")" = FAIL ]'
+check "first_failure names the goal check" 'jq -r .first_failure "$receipt" | grep -q "AIEN.s belief does not show the goal met"'
+check "first_failure is the first stderr R13 failure line" '[ "$(jq -r .first_failure "$receipt")" = "$(grep -m1 "^R13 mode" "$T/fail/stderr.log")" ]'
+check "nothing written under the real build/qual-runs by this test" '[ -z "$(find "$HERE/build/qual-runs" -newer "$T/make.log" 2>/dev/null | head -1)" ]'
+echo "rx_r13_first_failure_test: $FAILS failures"
+[ "$FAILS" = 0 ]
diff --git a/tests/runtime/rx_r13_living.c b/tests/runtime/rx_r13_living.c
index d8a1f2f20..4490b0d24 100644
--- a/tests/runtime/rx_r13_living.c
+++ b/tests/runtime/rx_r13_living.c
@@ -1,3 +1,9 @@
+    /* Timing sensitivity (omega #313 item 1): `target` is 55 percent of the incumbent cost AIEN confirmed
+     * on the old core class, and `final_expected` is the cost AIEN later confirmed on the new one. Both
+     * are wall-clock (CLOCK_MONOTONIC) measurements taken at different times, so CPU contention that
+     * slows the second more than the first can miss the goal. The check is deliberately unchanged: a
+     * CPU-time or repeat-and-median variant needs the measurement in src/runtime (rx_omega.c, rx_aien.c)
+     * changed, which is outside this test program and a separate, declared change. */
 /* R13: one world; after the goal, only production requests and observation. */
 #include "runtime/rx_living.h"
 #include "runtime/rx_resident_gpu.h"
@@ -26,6 +32,7 @@
 #include <dirent.h>
 #include <errno.h>
 #include <ftw.h>
+#include <stdarg.h>
 #include <stdatomic.h>
 #include <sched.h>
 #include <signal.h>
@@ -998,9 +1005,24 @@ static int seat_blocked(Rig *r, uint64_t after) {
 
 static uint64_t acts(Rig *r, uint32_t id) { return r->w.reactions[id].activations; }
 
+/* Failure evidence (omega #313 item 3): the FIRST failure message is kept for the receipt,
+ * never overwritten by later ones. stderr still gets every message. */
+static char g_first_failure[512];
+static void note_failure(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
+static void note_failure(const char *fmt, ...) {
+    char msg[512];
+    va_list ap;
+    va_start(ap, fmt);
+    vsnprintf(msg, sizeof msg, fmt, ap);
+    va_end(ap);
+    fprintf(stderr, "%s\n", msg);
+    if (!g_first_failure[0]) snprintf(g_first_failure, sizeof g_first_failure, "%s", msg);
+}
+
 #define FAIL(...) do { if (atomic_load(&g_op_shutdown)) return OP_SHUTDOWN; \
-                       fprintf(stderr, "R13 mode %d: ", mode); \
-                       fprintf(stderr, __VA_ARGS__); fputc('\n', stderr); return -1; } while (0)
+                       char fail_msg_[400]; \
+                       snprintf(fail_msg_, sizeof fail_msg_, __VA_ARGS__); \
+                       note_failure("R13 mode %d: %s", mode, fail_msg_); return -1; } while (0)
 
 static int run(Rig *r, int mode) {
     int with_aien = mode != NO_AIEN;
@@ -1953,6 +1975,21 @@ static void receipt(int tests_ok) {
         : !tests_ok || !controls || !g_argus_ok ? "FAIL"
         : !g->silicon_observed ? "HOST_PASS_NON_SILICON"
         : "SILICON_PASS_UNBOUND";
+    /* The first failure message as a JSON string, or null when there was none. */
+    char first_failure[1100];
+    if (!g_first_failure[0]) strcpy(first_failure, "null");
+    else {
+        size_t k = 0;
+        first_failure[k++] = '"';
+        for (const char *s = g_first_failure; *s && k + 8 < sizeof first_failure; s++) {
+            unsigned char c = (unsigned char)*s;
+            if (c == '"' || c == '\\') { first_failure[k++] = '\\'; first_failure[k++] = (char)c; }
+            else if (c < 0x20 || c >= 0x7f) k += (size_t)snprintf(first_failure + k, 7, "\\u%04x", c);
+            else first_failure[k++] = (char)c;
+        }
+        first_failure[k++] = '"';
+        first_failure[k] = 0;
+    }
     struct utsname host;
     memset(&host, 0, sizeof host);
     uname(&host);
@@ -1988,6 +2025,7 @@ static void receipt(int tests_ok) {
             "\"release\": \"%s\", \"architecture\": \"%s\"},\n"
         "  \"silicon_observed\": %s,\n"
         "  \"gate\": {\"" R13_GATE_KEY "\": \"%s\"},\n"
+        "  \"first_failure\": %s,\n"
         "  \"scenario\": {\"operation\": \"omega integer matvec 64x256\", "
             "\"goal\": \"cost below %u%% of the confirmed incumbent, semantics preserved\", "
             "\"incumbent_ns\": %llu, \"target_ns\": %llu, "
@@ -2057,6 +2095,7 @@ static void receipt(int tests_ok) {
         aienos ? aienos : "unknown", physics, binary,
         host.nodename, host.sysname, host.release, host.machine,
         g->silicon_observed ? "true" : "false", gate,
+        first_failure,
         TARGET_PCT, U(g->incumbent_ns), U(g->target_ns), U(g->selected_ps), U(g->reference_ps),
         U(g->final_expected_ns), g->final_status == RX_AIEN_GOAL_MET ? "MET" : "NOT_MET",
         U(g->final_prediction_epoch),
@@ -2113,7 +2152,7 @@ int main(int argc, char **argv) {
         if (!r) return 1;
         int rc = start(r, mode);
         if (rc != 0 && rc != OP_SHUTDOWN)
-            fprintf(stderr, "R13 %s: setup failed at stage %d\n", names[mode], g_stage);
+            note_failure("R13 %s: setup failed at stage %d", names[mode], g_stage);
         if (rc == 0) rc = run(r, mode);
 #if defined(AIEN_TEST_BUILD) && !defined(R13_SILICON)
         /* COMPOSITION-2 in the living system (host test build only), after the episode,
@@ -2134,8 +2173,8 @@ int main(int argc, char **argv) {
         }
         /* R16 G6: the crumb log shows what operator control did in this world. */
         if (r->ready && (rc == 0 || rc == OP_SHUTDOWN) && operator_audit(r) != 0 && rc == 0) {
-            fprintf(stderr, "R13 %s: work committed or published while the operator stop was in force\n",
-                    names[mode]);
+            note_failure("R13 %s: work committed or published while the operator stop was in force",
+                         names[mode]);
             rc = -1;
         }
         if (rc != 0 && rc != OP_SHUTDOWN)
diff --git a/tests/window_lane_guard_test.sh b/tests/window_lane_guard_test.sh
new file mode 100644
index 000000000..b81f7fbf3
--- /dev/null
+++ b/tests/window_lane_guard_test.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+# Host self-test for tools/window_lane_guard.sh (omega #315). No chip, no make clean is run.
+set -u
+HERE=$(cd "$(dirname "$0")/.." && pwd)
+T=$(mktemp -d "${TMPDIR:-/tmp}/wlg.XXXXXX"); trap 'rm -rf "$T"' EXIT
+FAILS=0
+check() { if eval "$2"; then echo "ok   $1"; else echo "FAIL $1"; FAILS=$((FAILS + 1)); fi; }
+. "$HERE/tools/window_lane_guard.sh"
+OUT=$T/out; B=$T/build
+mkdir -p "$B/qual-runs/run1/R11" "$OUT"
+printf '{"gate":"PASS"}\n' > "$B/qual-runs/run1/R11/rx_aien_faculty_receipt.json"
+
+wl_begin "$OUT" r11
+wl_guard_clean "$OUT" chipwait 2>/dev/null; rc=$?
+check "chipwait refused while the r11 receipt is unarchived (exit 2)" '[ $rc = 2 ]'
+check "refusal names the lane" 'wl_guard_clean "$OUT" chipwait 2>&1 | grep -q "lane r11 has an unarchived receipt"'
+check "a lane is not refused by itself" 'wl_guard_clean "$OUT" r11'
+
+wl_r11_archive "$OUT" "$B"; rc=$?
+sha=$(sha256sum "$B/qual-runs/run1/R11/rx_aien_faculty_receipt.json" | cut -c1-64)
+check "r11 archive exits 0" '[ $rc = 0 ]'
+check "archived under its sha256 name" '[ -f "$OUT/R11-living/rx_aien_faculty_receipt.$sha.json" ]'
+check "archived copy is identical" 'cmp -s "$OUT/R11-living/rx_aien_faculty_receipt.$sha.json" "$B/qual-runs/run1/R11/rx_aien_faculty_receipt.json"'
+check "chipwait allowed after archiving" 'wl_guard_clean "$OUT" chipwait'
+rm -rf "$B"   # what make clean does
+check "receipt survives make clean" '[ -s "$OUT/R11-living/rx_aien_faculty_receipt.$sha.json" ]'
+check "archiving twice keeps the same single file" 'mkdir -p "$B/qual-runs/run1/R11" && printf "{\"gate\":\"PASS\"}\n" > "$B/qual-runs/run1/R11/rx_aien_faculty_receipt.json" && wl_r11_archive "$OUT" "$B" && [ "$(ls "$OUT/R11-living" | wc -l)" = 1 ]'
+
+rm -rf "$B"; wl_begin "$OUT" r11b
+wl_r11_archive "$OUT" "$B" 2>/dev/null; rc=$?
+check "missing receipt: archive fails (exit 1)" '[ $rc = 1 ]'
+check "missing receipt: clean still refused for that lane" '! wl_guard_clean "$OUT" chipwait 2>/dev/null'
+wl_no_receipt "$OUT" r11b
+check "explicit no-receipt mark releases the guard" 'wl_guard_clean "$OUT" chipwait'
+
+echo "window_lane_guard_test: $FAILS failures"
+[ "$FAILS" = 0 ]
diff --git a/tools/.crumb b/tools/.crumb
index a28495829..d1f0be3fc 100644
--- a/tools/.crumb
+++ b/tools/.crumb
@@ -56,14 +56,14 @@
         }
       ],
       "children_root": "sha256:8a042dc49a250f0d1b7ae1358fc70bf7bdc9eff651a5ff7c9ee41fd49d329041",
-      "compiled_at": "2026-10-06T01:57:59Z",
+      "compiled_at": "2026-10-06T14:35:34Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:808edb958b46d236f503828399cbdb7f1cb62f8eebfd1604d4768b42734b459f",
+      "digest": "sha256:cd1b75fea968e8ce72acd897667b41af226eed0c1b8ed3a7e67d71e5388585d1",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "files": 136,
-      "generated_at_commit": "1f4a3c7821d769a99ce1fcc896ac8ee30a33ea69",
-      "source_tree": "sha256:edd75db96bda888946c0299792d0e240668f4d7a38378c60359e693585700bad"
+      "files": 137,
+      "generated_at_commit": "de7e72ece2c55f53ed3b8ddbbeed5461e1123ae2",
+      "source_tree": "sha256:50ddbb0c1517a9997b7dba7c982e52d6bb3174fe3f4d2e5899cb63a342cb0412"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/tools/window_lane_guard.sh b/tools/window_lane_guard.sh
new file mode 100644
index 000000000..6f8543171
--- /dev/null
+++ b/tools/window_lane_guard.sh
@@ -0,0 +1,56 @@
+#!/bin/bash
+# Window lane evidence guard (omega #315). Source this from a window ladder (cand<N>_ladder.sh):
+#   . "$(dirname "$0")/window_lane_guard.sh"   (or from tools/ in the omega worktree)
+# It keeps a lane's receipts from being lost when a later lane runs `make clean`
+# (tools/m19r_qualify.sh does, and removes build/ with every receipt in build/qual-runs).
+#
+#   wl_begin    <out> <lane>              declare that <lane> will produce receipts that must be archived
+#   wl_archive  <out> <lane> <file> <dir> copy <file> to <dir>/<stem>.<sha256>.<ext> (never overwrites,
+#                                         verifies the copy), then mark <lane> archived
+#   wl_no_receipt <out> <lane>            mark <lane> archived when it produced no receipt (explicit, logged)
+#   wl_r11_archive <out> <build_dir>      the r11 lane: archive the newest R11 receipt written by this run
+#                                         into <out>/R11-living/ under its sha256 name
+#   wl_guard_clean <out> <lane>           call before any lane that runs `make clean`: returns 2 and says
+#                                         which lane while an earlier lane's receipt is still unarchived
+#
+# State lives in <out>/.lane-guard/{pending,archived}/<lane>. Nothing here deletes or edits an existing file.
+wl_begin() { mkdir -p "$1/.lane-guard/pending" "$1/.lane-guard/archived"; date -u +%FT%TZ > "$1/.lane-guard/pending/$2"; }
+
+wl_archive() { # out lane file dir
+    local out=$1 lane=$2 f=$3 dir=$4
+    [ -s "$f" ] || { echo "wl_archive: $lane has no receipt at $f" >&2; return 1; }
+    local sha base stem ext dest
+    sha=$(sha256sum "$f" | cut -c1-64); base=$(basename "$f")
+    stem=${base%.*}; ext=${base##*.}
+    mkdir -p "$dir" "$out/.lane-guard/archived"
+    dest="$dir/$stem.$sha.$ext"
+    if [ -e "$dest" ]; then
+        [ "$(sha256sum "$dest" | cut -c1-64)" = "$sha" ] || { echo "wl_archive: $dest exists with other content" >&2; return 1; }
+    else
+        cp "$f" "$dest" || return 1
+        [ "$(sha256sum "$dest" | cut -c1-64)" = "$sha" ] || { echo "wl_archive: copy of $f does not match" >&2; return 1; }
+    fi
+    echo "$dest" >> "$out/.lane-guard/archived/$lane"
+}
+
+wl_no_receipt() { mkdir -p "$1/.lane-guard/archived"; echo "no receipt produced" >> "$1/.lane-guard/archived/$2"; }
+
+wl_r11_archive() { # out build_dir
+    local out=$1 b=$2 f
+    f=$(ls -1t "$b"/qual-runs/*/R11/rx_aien_faculty_receipt.json 2>/dev/null | head -1)
+    [ -n "$f" ] || { echo "wl_r11_archive: no R11 receipt under $b/qual-runs" >&2; return 1; }
+    wl_archive "$out" r11 "$f" "$out/R11-living"
+}
+
+wl_guard_clean() { # out lane
+    local p lane bad=0
+    for p in "$1"/.lane-guard/pending/*; do
+        [ -e "$p" ] || continue
+        lane=$(basename "$p")
+        [ "$lane" = "$2" ] && continue
+        if [ ! -s "$1/.lane-guard/archived/$lane" ]; then
+            echo "REFUSED: lane $2 runs make clean while lane $lane has an unarchived receipt" >&2; bad=1
+        fi
+    done
+    [ "$bad" = 0 ] || return 2
+}