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#212 (code only)

closed derived 8a19dc0332fa6a69 #212

Imported from GitHub aien-dev/omega-mv#212 (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 3affe89593c78c623601c9bea720bcb8a86187fa · Head 4240bccc84b2fe37a49640d3855f74e273c4f172

Apply it

git checkout -b patch-8a19dc0332fa6a69 3affe89593c78c623601c9bea720bcb8a86187fa
curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/8a19dc0332fa6a69.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/omega-mv
212
4240bccc84b2fe37a49640d3855f74e273c4f172
{"kind":"github-import","owner":"aien-dev","repo":"omega-mv","number":212,"url":"https://github.com/aien-dev/omega-mv/pull/212","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:48Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/Makefile b/Makefile
index 1890e1f39..3309c768c 100644
--- a/Makefile
+++ b/Makefile
@@ -172,6 +172,11 @@ test-gate14-combine:
 test-chip-run:
 	tests/test_chip_run.sh
 
+# Host-only check of the unwritten-trap manifest and its wrapper. No GPU.
+.PHONY: test-chip-run-trap-manifest
+test-chip-run-trap-manifest:
+	tests/test_chip_run_trap_manifest.sh
+
 # Gate 5 (OMEGA-NUMERIC-0), CPU tiers only: reference, CPU parity, provenance
 # and negative tests. Opens no device. The GB10 tier and the receipt come
 # from tests/run_numeric_gates.sh on the chip. Exits nonzero while any gate
diff --git a/tests/test_chip_run.sh b/tests/test_chip_run.sh
index 3b7e3afc2..73249b907 100755
--- a/tests/test_chip_run.sh
+++ b/tests/test_chip_run.sh
@@ -63,6 +63,8 @@ int main(int argc, char **argv) {
     if (!strcmp(m, "fail")) { printf("RESULT chip x ok=false\nVERDICT FAIL\n"); return 0; }
     if (!strcmp(m, "failpass")) { printf("VERDICT FAIL\nVERDICT PASS\n"); return 0; }
     if (!strcmp(m, "passrc")) { printf("VERDICT PASS\n"); return 3; }
+    if (!strcmp(m, "rc1")) { printf("VERDICT FAIL\n"); return 1; }
+    if (!strcmp(m, "rc2")) { printf("VERDICT PASS\n"); return 2; }
     if (!strcmp(m, "dash")) { printf("--- VERDICT PASS\n"); return 0; }
     printf("RESULT chip x ok=true\nVERDICT PASS\n");
     return 0;
@@ -103,6 +105,7 @@ mkman "$T/m.sh"; mkman "$T/m-hostfail.sh" "HOST_TIER_CMD=false"
 mkman "$T/m-map.sh" "REFUSE_EXIT=1; REFUSE_VERDICT_LINE='VERDICT NOT_RUN'"
 mkman "$T/m-off.sh" "RAISE_QUIET=0; TAKE_GPU_LOCK=0"
 mkman "$T/m-all.sh" "REQUIRE_ALL_PASS=1; VERDICT_RE='^VERDICT'"
+mkman "$T/m-pt.sh" "CHILD_EXIT_PASSTHROUGH=1"; mkman "$T/m-pt-bad.sh" "CHILD_EXIT_PASSTHROUGH=2"
 mkman "$T/m-dash.sh" "VERDICT_RE='^--- VERDICT'; PASS_LINE='^--- VERDICT PASS\$'"
 CRMAN=$T/m.sh; PD=(--physics-dir "$PHYS")
 
@@ -291,6 +294,20 @@ expect fail_any_verdict 1 '^CHIP_RUN: FAIL a verdict line does not match PASS_LI
 assert fail_any_verdict "a FAIL receipt is still written" receipt_verdict fail_any_verdict FAIL
 reset_world; CRMAN=$T/m-all.sh cr all_pass_ok FAKE_MODE=pass -- "${PD[@]}"
 expect all_pass_ok 0 '^CHIP_RUN: PASS'
+# child exit passthrough: fake binary exiting 0, 1, 2 (exit 2 is the trap harness NOT_RUN code)
+reset_world; CRMAN=$T/m-pt.sh cr child_exit_pass0 FAKE_MODE=pass -- "${PD[@]}"
+expect child_exit_pass0 0 '^CHIP_RUN: PASS'
+reset_world; CRMAN=$T/m-pt.sh cr child_exit_pass1 FAKE_MODE=rc1 -- "${PD[@]}"
+expect child_exit_pass1 1 '^CHIP_RUN: FAIL'
+reset_world; CRMAN=$T/m-pt.sh cr child_exit_passthrough FAKE_MODE=rc2 -- "${PD[@]}"
+expect child_exit_passthrough 2 '^CHIP_RUN: FAIL binary exit status 2'
+assert child_exit_passthrough "receipt still written with chip_exit_status 2" jq -e '.chip_exit_status == 2 and .verdict == "FAIL"' "$T"/ev-child_exit_passthrough/*.json
+reset_world; CRMAN=$T/m-pt.sh cr child_exit_zero_fail FAKE_MODE=fail -- "${PD[@]}"
+expect child_exit_zero_fail 1 '^CHIP_RUN: FAIL'
+reset_world; CRMAN=$T/m.sh cr child_exit_default FAKE_MODE=rc2 -- "${PD[@]}"
+expect child_exit_default 1 '^CHIP_RUN: FAIL binary exit status 2'
+reset_world; CRMAN=$T/m-pt-bad.sh cr child_exit_value -- "${PD[@]}"
+expect child_exit_value 1 '^CHIP_RUN: BAD_MANIFEST CHILD_EXIT_PASSTHROUGH='; CRMAN=$T/m.sh
 # evidence reuse: a second run keeps one log blob; a tampered blob is caught
 reset_world; cr reuse -- "${PD[@]}"; cr reuse -- "${PD[@]}"
 expect reuse 0 '^CHIP_RUN: PASS'
diff --git a/tests/test_chip_run_trap_manifest.sh b/tests/test_chip_run_trap_manifest.sh
new file mode 100755
index 000000000..605f682f1
--- /dev/null
+++ b/tests/test_chip_run_trap_manifest.sh
@@ -0,0 +1,106 @@
+#!/bin/bash
+# Host-only check of tools/manifests/unwritten_trap.chiprun and its wrapper. No GPU, no build.
+#   tests/test_chip_run_trap_manifest.sh
+# Checks: (1) manifest sets every required variable and names only existing sources;
+# (2) its gcc source list equals the old script's, pinned as a literal (git show 2dc9dd8:tools/run_unwritten_trap.sh);
+# (3) the wrapper with a missing physics dir prints REFUSED and the NOT_RUN line, exit 2;
+# (4) the module gcc flags equal the old script's; (5) the wrapper passes exit 0/1/2 through;
+# (6) the manifest sets CHILD_EXIT_PASSTHROUGH=1 and the old default args.
+# Each check is also run against a mutated manifest and must fail there.
+set -u
+HERE=$(cd -P "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
+MAN=$HERE/tools/manifests/unwritten_trap.chiprun
+T=$(mktemp -d); trap 'rm -rf "$T"' EXIT
+FAILS=0
+ok() { echo "PASS $1"; }
+bad() { echo "FAIL $1"; FAILS=$((FAILS + 1)); }
+FAKE_PHYS=/nonexistent-physics-for-test
+
+# Prints "<TEST_SOURCE> <SOURCES> <EXTRA>" as one token per line, or fails.
+load_list() { ( PHYSICS=$FAKE_PHYS; . "$1" 2>/dev/null || exit 1; read -ra A <<< "$TEST_SOURCE $SOURCES $EXTRA_BUILD_SOURCES"; printf '%s\n' "${A[@]}" ); }
+check_vars() { ( PHYSICS=$FAKE_PHYS; . "$1" 2>/dev/null || exit 1
+    for v in GATE OWNER TEST_SOURCE SOURCES EXTRA_BUILD_SOURCES RUN_ARGS VERDICT_RE PASS_LINE EVIDENCE_DIR REFUSE_VERDICT_LINE REFUSE_EXIT REFUSE_DIRTY_OMEGA; do
+        [ -n "${!v:-}" ] || { echo "unset $v"; exit 1; }; done
+    [ "$REFUSE_EXIT" = 2 ] && [ "$REFUSE_VERDICT_LINE" = "OMEGA_UNWRITTEN_TRAP: NOT_RUN" ] && [ "$RUN_ARGS" = "--chip --repeats 3000" ] || { echo "old exit/line/args not kept"; exit 1; }
+    [ "$EVIDENCE_DIR" = "$HOME/workspace/evidence-out/OMEGA-UNWRITTEN-TRAP" ] && [ "${REQUIRE_ALL_PASS:-}" = 0 ] && [ "${CHILD_EXIT_PASSTHROUGH:-}" = 1 ] || { echo "evidence dir, REQUIRE_ALL_PASS or CHILD_EXIT_PASSTHROUGH wrong"; exit 1; }
+    for s in $TEST_SOURCE $SOURCES; do [ -f "$HERE/$s" ] || { echo "missing $s"; exit 1; }; done ); }
+# Old script, pinned as literals. Source: git show 2dc9dd8:tools/run_unwritten_trap.sh (the last
+# commit before the wrapper replaced it). origin/main no longer holds it once the wrapper merges.
+OLD_LIST='tests/test_omega_unwritten_trap_gb10.c
+src/omega_unwritten_trap.c
+src/omega_numeric_divsqrt_gb10.c
+src/omega_numeric_transc.c
+src/omega_numeric.c
+src/omega_numeric_provenance.c
+src/omega_blackwell_encoder.c
+src/omega_blackwell_codegen.c
+src/omega_blackwell_matmul.c
+src/omega_blackwell_qmd.c
+src/sha256.c
+/nonexistent-physics-for-test/nvrm/nvrm.c
+/nonexistent-physics-for-test/m16/m16_native.c'
+# gcc flags and include paths of the old script, in order (the -o and its sources excluded).
+OLD_FLAGS='-std=gnu11
+-O2
+-Wall
+-Wextra
+-Werror
+-ffp-contract=off
+-fno-fast-math
+-pthread
+-Isrc
+-I"$PHYSICS/nvrm"
+-I"$PHYSICS/m16"
+-I"$NV/src/common/sdk/nvidia/inc"
+-I"$NV/kernel-open/common/inc"
+-I"$NV/kernel-open/nvidia-uvm"
+-I"$NV/src/nvidia/arch/nvalloc/unix/include"'
+check_list_matches_old() {
+    printf '%s\n' "$OLD_LIST" > "$T/old.list"
+    load_list "$1" > "$T/new.list" || { echo "manifest failed to load"; return 1; }
+    diff "$T/old.list" "$T/new.list" > "$T/diff.out" || { cat "$T/diff.out"; return 1; }; }
+# $1 = a copy of tools/chip_run.sh. Its gcc flags must equal OLD_FLAGS.
+check_flags_match_old() {
+    sed -n '/gcc -std=gnu11/,/-o "\$BIN"/p' "$1" | tr -s ' \\\n' '\n\n\n' | grep -E '^-' | grep -vx -- '-o' > "$T/new.flags"
+    printf '%s\n' "$OLD_FLAGS" > "$T/old.flags"
+    [ -s "$T/new.flags" ] || { echo "no gcc line found"; return 1; }
+    diff "$T/old.flags" "$T/new.flags" > "$T/diff.out" || { cat "$T/diff.out"; return 1; }; }
+# $1 = a copy of the wrapper. With a stub chip_run.sh beside it that exits $STUB_RC, the wrapper
+# must exit with exactly that code (the old script's 0 clean, 1 hits or device error, 2 NOT_RUN).
+check_wrapper_exit() {
+    local d=$T/w$RANDOM; mkdir -p "$d/tools/manifests"; cp "$1" "$d/tools/run_unwritten_trap.sh"
+    printf '#!/bin/bash\nexit "$STUB_RC"\n' > "$d/tools/chip_run.sh"; : > "$d/tools/manifests/unwritten_trap.chiprun"
+    local rc; for rc in 0 1 2; do STUB_RC=$rc bash "$d/tools/run_unwritten_trap.sh" > /dev/null 2>&1; [ "$?" = "$rc" ] || { echo "stub exit $rc came out as $?"; return 1; }; done; }
+
+# Mutants of the manifest.
+sed 's#^SOURCES="src/omega_unwritten_trap.c #SOURCES="#' "$MAN" > "$T/m_dropsrc"
+sed 's#src/sha256.c#src/sha256_nope.c#' "$MAN" > "$T/m_badfile"
+sed '/^PASS_LINE=/d' "$MAN" > "$T/m_novar"
+sed 's#^REFUSE_EXIT=2#REFUSE_EXIT=1#' "$MAN" > "$T/m_exit"
+sed "s#evidence-out/OMEGA-UNWRITTEN-TRAP#evidence/unwritten_trap#" "$MAN" > "$T/m_evid"
+sed '/^CHILD_EXIT_PASSTHROUGH=/d' "$MAN" > "$T/m_nopass"
+sed 's#^RUN_ARGS="--chip --repeats 3000"#RUN_ARGS="--chip --repeats 300"#' "$MAN" > "$T/m_args"
+sed 's#-Werror #-Wno-error #' "$HERE/tools/chip_run.sh" > "$T/cr_noerror"
+sed 's#-O2 #-O3 #' "$HERE/tools/chip_run.sh" > "$T/cr_o3"
+sed 's#-fno-fast-math ##' "$HERE/tools/chip_run.sh" > "$T/cr_fastmath"
+sed 's#^exec \(.*\)$#\1; [ $? = 0 ] || exit 1#' "$HERE/tools/run_unwritten_trap.sh" > "$T/w_map"
+
+check_vars "$MAN" > "$T/o" 2>&1 && ok "1 manifest variables and source files" || { bad "1 manifest variables and source files: $(cat "$T/o")"; }
+check_list_matches_old "$MAN" > "$T/o" 2>&1 && ok "2 source list identical to old script" || bad "2 source list identical to old script: $(cat "$T/o")"
+
+for m in m_novar m_badfile m_exit m_evid m_nopass m_args; do check_vars "$T/$m" > /dev/null 2>&1 && bad "mutant $m passed check 1" || ok "mutant $m fails check 1"; done
+for m in m_dropsrc m_badfile; do check_list_matches_old "$T/$m" > /dev/null 2>&1 && bad "mutant $m passed check 2" || ok "mutant $m fails check 2"; done
+
+check_flags_match_old "$HERE/tools/chip_run.sh" > "$T/o" 2>&1 && ok "4 module gcc flags identical to old script" || bad "4 module gcc flags identical to old script: $(cat "$T/o")"
+for m in cr_noerror cr_o3 cr_fastmath; do check_flags_match_old "$T/$m" > /dev/null 2>&1 && bad "mutant $m passed check 4" || ok "mutant $m fails check 4"; done
+check_wrapper_exit "$HERE/tools/run_unwritten_trap.sh" > "$T/o" 2>&1 && ok "5 wrapper passes exit 0, 1, 2 through" || bad "5 wrapper passes exit 0, 1, 2 through: $(cat "$T/o")"
+check_wrapper_exit "$T/w_map" > /dev/null 2>&1 && bad "mutant w_map passed check 5" || ok "mutant w_map fails check 5"
+OUT=$(env -u PHYSICS_DIR PHYSICS=$FAKE_PHYS bash "$HERE/tools/run_unwritten_trap.sh" 2>&1); RC=$?
+{ [ "$RC" = 2 ] && printf '%s\n' "$OUT" | grep -q '^REFUSED: no physics checkout' && printf '%s\n' "$OUT" | grep -qx 'OMEGA_UNWRITTEN_TRAP: NOT_RUN'; } && ok "3 wrapper refuses with exit 2 and NOT_RUN line" || bad "3 wrapper refusal (rc=$RC): $OUT"
+# Mutant: the same wrapper pointed at a manifest with the wrong refuse exit must not give 2.
+cp "$T/m_exit" "$T/m_exit.chiprun"
+OUT=$(env -u PHYSICS_DIR PHYSICS=$FAKE_PHYS bash "$HERE/tools/chip_run.sh" "$T/m_exit.chiprun" 2>&1); RC=$?
+[ "$RC" = 2 ] && bad "mutant wrong REFUSE_EXIT still exits 2" || ok "mutant wrong REFUSE_EXIT does not exit 2"
+
+[ "$FAILS" = 0 ] && { echo "CHIP_RUN_TRAP_MANIFEST: PASS"; exit 0; }
+echo "CHIP_RUN_TRAP_MANIFEST: FAIL ($FAILS)"; exit 1
diff --git a/tools/chip_run.sh b/tools/chip_run.sh
index fae0b738f..7f3aa9f67 100755
--- a/tools/chip_run.sh
+++ b/tools/chip_run.sh
@@ -8,7 +8,9 @@
 #   EVIDENCE_DIR RAISE_QUIET TAKE_GPU_LOCK REFUSE_DIRTY_OMEGA (default 1) REFUSE_EXIT
 #   (default 2; must be an integer 1..125, else exit 1 "CHIP_RUN: BAD_MANIFEST") REFUSE_VERDICT_LINE
 #   (default "CHIP_RUN: NOT_RUN") REQUIRE_ALL_PASS (default 0; 0 or 1; when 1 EVERY line matching
-#   VERDICT_RE must also match PASS_LINE, so set VERDICT_RE to verdict lines only), hooks
+#   VERDICT_RE must also match PASS_LINE, so set VERDICT_RE to verdict lines only), CHILD_EXIT_PASSTHROUGH
+#   (default 0; 0 or 1; when 1 and the binary exited nonzero, this module exits with the binary's
+#   exit code, receipt and verdict still written; exit 0 with a non-PASS verdict still gives 1), hooks
 #   HOST_TIER_CMD (run first; nonzero refuses) and RECEIPT_EXTRA_JQ (jq filter on the receipt,
 #   $log = chip log). The manifest cannot change the test seam variables below, QUIET_FLAG,
 #   GPU_LOCK or EST_LOAD_CMD (checked and restored after it is sourced). That is an accident guard,
@@ -117,13 +119,14 @@ PHYSICS=${PHYS_FLAG:-${PHYSICS_DIR:-${PHYSICS:-$HOME/workspace/physics}}}
 PHYSICS=$(realpath -m "$PHYSICS")
 
 GATE=""; TEST_SOURCE=""; SOURCES=""; EXTRA_BUILD_SOURCES=""; RUN_ARGS=""; VERDICT_RE=""; PASS_LINE=""
-OWNER=""; EVIDENCE_DIR=""; RAISE_QUIET=1; TAKE_GPU_LOCK=1; REFUSE_DIRTY_OMEGA=1; HOST_TIER_CMD=""; RECEIPT_EXTRA_JQ=""; REQUIRE_ALL_PASS=0
+OWNER=""; EVIDENCE_DIR=""; RAISE_QUIET=1; TAKE_GPU_LOCK=1; REFUSE_DIRTY_OMEGA=1; HOST_TIER_CMD=""; RECEIPT_EXTRA_JQ=""; REQUIRE_ALL_PASS=0; CHILD_EXIT_PASSTHROUGH=0
 [ -f "$MANIFEST" ] || refuse "no manifest at $MANIFEST" # REFUSAL:no_manifest
 . "$MANIFEST"; MRC=$?
 REX_BAD=""
 case $REFUSE_EXIT in ''|*[!0-9]*) REX_BAD=1 ;; *) { [ "${#REFUSE_EXIT}" -le 3 ] && [ "$((10#$REFUSE_EXIT))" -ge 1 ] && [ "$((10#$REFUSE_EXIT))" -le 125 ]; } || REX_BAD=1 ;; esac
 [ -z "$REX_BAD" ] || bad_manifest "REFUSE_EXIT=$REFUSE_EXIT is not an integer from 1 to 125" # REFUSAL:refuse_exit
 case $REQUIRE_ALL_PASS in 0|1) ;; *) bad_manifest "REQUIRE_ALL_PASS=$REQUIRE_ALL_PASS is not 0 or 1" ;; esac # REFUSAL:require_all_value
+case $CHILD_EXIT_PASSTHROUGH in 0|1) ;; *) bad_manifest "CHILD_EXIT_PASSTHROUGH=$CHILD_EXIT_PASSTHROUGH is not 0 or 1" ;; esac # REFUSAL:child_exit_value
 seam_check # REFUSAL:seam_after
 for v in "${SEAM_VARS[@]}"; do [ "${!v:-}" = "${SEAM0[$v]}" ] || refuse "manifest changed $v, a test seam variable"; done # REFUSAL:seam_changed
 QUIET_FLAG=$QUIET0; GPU_LOCK=$GPU0; EST_LOAD_CMD=$EST0 # REFUSAL:restore_vars
@@ -196,7 +199,7 @@ echo "== chip run (not killed, not timed out): ${GATE_ARGS[*]}"
 END=$(date -u +%Y-%m-%dT%H:%M:%SZ)
 exec 9>&-
 mapfile -t VLINES < <(grep -E -- "$VERDICT_RE" "$RUN/chip.log")
-printf '%s\n' "${VLINES[@]}"
+cat "$RUN/chip.log"   # the full chip log goes to stdout, as the old trap script did (HIT and DEVERR lines included)
 
 OMEGA_CLEAN_AFTER=$(clean "$HERE"); PHYS_CLEAN_AFTER=$(clean "$PHYSICS")
 OMEGA_SAME=$([ "$(head_of "$HERE")" = "$OMEGA_COMMIT" ] && echo true || echo false)
@@ -240,4 +243,5 @@ fi
 cmp -s "$RUN/receipt.json" "$OUT" || fatal "receipt $OUT does not match what was built"
 echo "RECEIPT $OUT"
 echo "CHIP_RUN: $VERDICT${FAIL_REASON:+ $FAIL_REASON}"
+[ "$CHILD_EXIT_PASSTHROUGH" = 1 ] && [ "$CHIP_RC" != 0 ] && exit "$CHIP_RC" # REFUSAL:child_exit_passthrough
 [ "$VERDICT" = PASS ]
diff --git a/tools/manifests/unwritten_trap.chiprun b/tools/manifests/unwritten_trap.chiprun
new file mode 100644
index 000000000..b743ec91f
--- /dev/null
+++ b/tools/manifests/unwritten_trap.chiprun
@@ -0,0 +1,39 @@
+# Manifest for tools/chip_run.sh: the GB10 unwritten-output trap (C3b).
+# Sourced as shell by chip_run.sh, which provides $HERE (omega root) and $PHYSICS.
+# Forge queue only. Verdict semantics follow tests/test_omega_unwritten_trap_gb10.c:
+#   line 182  prints "OMEGA_UNWRITTEN_TRAP: <hits>/<runs>" on a completed run
+#   line 185  returns 1 if hits or device errors, else 0
+#   lines 87,104,110,113,123 print "OMEGA_UNWRITTEN_TRAP: NOT_RUN..." and return 2
+# Hit lines (OMEGA_UNWRITTEN_HIT, line 170) and DEVERR lines (line 153) are not verdict lines.
+GATE=unwritten_trap
+OWNER=unwritten_trap
+TEST_SOURCE="tests/test_omega_unwritten_trap_gb10.c"
+SOURCES="src/omega_unwritten_trap.c src/omega_numeric_divsqrt_gb10.c src/omega_numeric_transc.c src/omega_numeric.c src/omega_numeric_provenance.c src/omega_blackwell_encoder.c src/omega_blackwell_codegen.c src/omega_blackwell_matmul.c src/omega_blackwell_qmd.c src/sha256.c"
+EXTRA_BUILD_SOURCES="$PHYSICS/nvrm/nvrm.c $PHYSICS/m16/m16_native.c"
+# Same default as the old script.
+RUN_ARGS="--chip --repeats 3000"
+# Every line starting with the trap tag is a verdict candidate (this includes NOT_RUN lines);
+# only "<0>/<runs>" passes, so "N/M" with N>0 and "NOT_RUN" both fail.
+VERDICT_RE='^OMEGA_UNWRITTEN_TRAP: '
+PASS_LINE='^OMEGA_UNWRITTEN_TRAP: 0/[0-9]+$'
+# Evidence receipts go outside both candidate trees; convention is ~/workspace/evidence-out/<GATE>.
+EVIDENCE_DIR="$HOME/workspace/evidence-out/OMEGA-UNWRITTEN-TRAP"
+# Old script exit codes kept: 2 = refused / NOT_RUN, with its refusal text line.
+REFUSE_EXIT=2
+REFUSE_VERDICT_LINE="OMEGA_UNWRITTEN_TRAP: NOT_RUN"
+# Old script took only the GPU lock (blocking). It never raised the quiet flag, and the
+# forge queue already serialises runs, so keep that.
+RAISE_QUIET=0
+TAKE_GPU_LOCK=1
+# DECISION (explicit): refuse on a dirty omega tree. The old script had no check; the trap
+# script is run from the forge queue on a clean checkout, so this costs nothing there and
+# makes the receipt's omega_commit trustworthy.
+REFUSE_DIRTY_OMEGA=1
+# REQUIRE_ALL_PASS stays 0 (the default, set here so it is explicit). The harness prints exactly
+# one OMEGA_UNWRITTEN_TRAP line per run, so "last matching line must pass" and "every matching
+# line must pass" are the same test; keeping 0 means a future extra tagged line (for example a
+# NOT_RUN note before a completed line) is judged by the last line, as the old script did.
+REQUIRE_ALL_PASS=0
+# Old script exit codes passed straight through: 0 clean, 1 hits or device error, 2 NOT_RUN
+# printed by the harness (tests/test_omega_unwritten_trap_gb10.c lines 87,104,110,113,123).
+CHILD_EXIT_PASSTHROUGH=1
diff --git a/tools/run_unwritten_trap.sh b/tools/run_unwritten_trap.sh
index 2d499b070..2822e5fc6 100755
--- a/tools/run_unwritten_trap.sh
+++ b/tools/run_unwritten_trap.sh
@@ -3,28 +3,9 @@
 # run is never killed and never timed out. No Python.
 #   tools/run_unwritten_trap.sh [harness args]   (default: --chip --repeats 3000)
 #   Exit: 0 = clean (no unwritten output), 1 = hits or device error, 2 = refused / NOT_RUN.
+# Thin wrapper: build, refusals, evidence receipt and verdict live in tools/chip_run.sh,
+# configured by tools/manifests/unwritten_trap.chiprun. PHYSICS env (default
+# ~/workspace/physics) is honoured by the module.
 set -u
-HERE=$(cd "$(dirname "$0")/.." && pwd)
-PHYSICS=${PHYSICS:-$HOME/workspace/physics}
-refuse() { echo "REFUSED: $*"; echo "OMEGA_UNWRITTEN_TRAP: NOT_RUN"; exit 2; }
-[ -d "$PHYSICS/nvrm" ] || refuse "no physics checkout at $PHYSICS"
-PIN=$(tr -d '[:space:]' < "$HERE/physics.lock")
-[ "$(git -C "$PHYSICS" rev-parse HEAD)" = "$PIN" ] || refuse "physics HEAD is not the physics.lock pin $PIN"
-NV=$PHYSICS/third_party/nvidia-open-580.173.02
-BIN=$HERE/build/test_omega_unwritten_trap_gb10
-mkdir -p "$HERE/build"
-(cd "$HERE" && gcc -std=gnu11 -O2 -Wall -Wextra -Werror -ffp-contract=off -fno-fast-math -pthread \
-    -Isrc -I"$PHYSICS/nvrm" -I"$PHYSICS/m16" \
-    -I"$NV/src/common/sdk/nvidia/inc" -I"$NV/kernel-open/common/inc" \
-    -I"$NV/kernel-open/nvidia-uvm" -I"$NV/src/nvidia/arch/nvalloc/unix/include" \
-    -o "$BIN" tests/test_omega_unwritten_trap_gb10.c src/omega_unwritten_trap.c \
-    src/omega_numeric_divsqrt_gb10.c src/omega_numeric_transc.c src/omega_numeric.c src/omega_numeric_provenance.c \
-    src/omega_blackwell_encoder.c src/omega_blackwell_codegen.c src/omega_blackwell_matmul.c src/omega_blackwell_qmd.c \
-    src/sha256.c "$PHYSICS/nvrm/nvrm.c" "$PHYSICS/m16/m16_native.c") || refuse "chip build failed"
-exec 9> /tmp/aien-gb10.lock || refuse "cannot open /tmp/aien-gb10.lock"
-flock -x 9 || refuse "cannot take /tmp/aien-gb10.lock"
-[ $# -gt 0 ] || set -- --chip --repeats 3000
-"$BIN" "$@"
-RC=$?
-exec 9>&-
-exit $RC
+HERE=$(cd -P "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
+exec bash "$HERE/tools/chip_run.sh" "$HERE/tools/manifests/unwritten_trap.chiprun" -- "$@"