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
aien-sovereign-core-mv / evidence / motor-chip-20261021 / scripts / stroke-gate.sh
| 1 | #!/usr/bin/env bash |
| 2 | # L312 stroke v1 gate: 4 conversations per stroke on the chip, red before green. |
| 3 | # The tool waits for memory (no lock held) and takes /tmp/aien-gb10.lock around the chip part. |
| 4 | # START=n resumes at step n (the earlier steps' logs for the SAME binary sha stand as evidence). |
| 5 | set -u |
| 6 | B=${B:-$HOME/workspace/targets/motor/sc/release/qwen36_stroke_gate} |
| 7 | M=${M:-$HOME/models/qwen3.6-35b-a3b-fp8-95a723d0} |
| 8 | G=$HOME/workspace/sc-motor/evidence/q36-host-20261020 |
| 9 | E=$HOME/workspace/sc-motor/evidence/motor-chip-20261021 |
| 10 | LOG=$HOME/handoffs/motor-stroke-gate.log |
| 11 | P="$G/gen-p1.json $G/gen-p2.json $G/gen-p3.json $G/gen-p4.json" |
| 12 | START=${START:-1} |
| 13 | say() { echo "$(date -u +%FT%TZ) $*" | tee -a "$LOG"; } |
| 14 | # run NAME [ENV=VAL ...]: runs the tool, retrying (up to 6 times) when its memory guard refused |
| 15 | # (exit 2 + "refusing": the box is crowded, not a verdict). Sets rc. |
| 16 | run() { |
| 17 | local name=$1; shift |
| 18 | for attempt in 1 2 3 4 5 6; do |
| 19 | env "$@" nice -n 5 "$B" "$M" "$E/stroke-$name.json" $P > "$E/stroke-$name.log" 2>&1; rc=$? |
| 20 | if [ $rc -eq 2 ] && grep -q "refusing" "$E/stroke-$name.log"; then |
| 21 | say "$name attempt $attempt: memory guard refused ($(grep refusing "$E/stroke-$name.log" | tail -1 | cut -c1-120)); retrying" |
| 22 | sleep 60; continue |
| 23 | fi |
| 24 | break |
| 25 | done |
| 26 | say "$name exit $rc: $(grep '^QWEN36_STROKE_GATE' "$E/stroke-$name.log" | tail -1 | cut -c1-200)" |
| 27 | } |
| 28 | say "stroke gate start bin sha $(sha256sum "$B" | cut -c1-16) START=$START" |
| 29 | if [ "$START" -le 1 ]; then |
| 30 | # 1. negative control: mutant 4 (shared expert dropped) must FAIL (exit 1 = judged; 2 = error = STOP) |
| 31 | run mutant4 AIEN_Q36_TEST_MUTANT=4 |
| 32 | [ $rc -eq 1 ] || { say "STOP: mutant 4 did not go red (exit $rc)"; exit 4; } |
| 33 | fi |
| 34 | if [ "$START" -le 2 ]; then |
| 35 | # 2. negative control: head states swapped, feeds not: must FAIL |
| 36 | run swap-control AIEN_STROKE_SWAP=control |
| 37 | [ $rc -eq 1 ] || { say "STOP: swap control did not go red (exit $rc)"; exit 4; } |
| 38 | fi |
| 39 | if [ "$START" -le 3 ]; then |
| 40 | # 3. the real thing: p1..p4 interleaved, one stroke per step |
| 41 | run p1234 |
| 42 | fi |
| 43 | # 4. head swap as a feature: states and feeds move together, must PASS |
| 44 | run swap-feature AIEN_STROKE_SWAP=feature |
| 45 | say "stroke gate done" |