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/omega-mv/blob/main/tools/chipwait_campaign.sh # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / tools / chipwait_campaign.sh` 112 lines ยท 5382 bytes Raw Blame History 1 #!/bin/bash 2 # SPDX-License-Identifier: Apache-2.0 3 # Copyright 2026 Drake Stapleton (AIEN / aien-dev) 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 17 # chipwait_campaign.sh -- run an N-run M19R qualification campaign and print 18 # the mechanical verdict. 19 # 20 # tools/chipwait_campaign.sh --omega-candidate SHA --physics-candidate SHA \ 21 # --physics-dir DIR --campaign-dir DIR [--runs N] (N default 3) 22 # 23 # 1. Refuses (exit 2) if the campaign dir already holds campaign.json or any 24 # run-00N directory. Nothing is ever overwritten or deleted. 25 # 2. Writes campaign.json FIRST (tools/m19r_campaign.sh only creates it when 26 # absent, so this one is kept; its extra keys are not read by that script). 27 # 3. Runs tools/m19r_qualify.sh (override: env CHIPWAIT_QUALIFY) N times as 28 # run-001..run-00N with --evidence-root . A failing run does 29 # not stop the campaign. Each run's stdout/stderr are tee'd to 30 # /runner-run-00.{stdout,stderr}.log and its exit code is 31 # written to runner-run-00.exit (files beside, not inside, the run dir, 32 # because m19r_qualify.sh refuses an existing run dir). 33 # 4. Calls tools/m19r_campaign.sh (override: env CHIPWAIT_CAMPAIGN). Exit 0 34 # only if that verdict is PASS, else 1. Bad arguments: 2. 35 # Never touches the GPU itself; the qualify script does. Bash + coreutils + jq. 36 37 HERE=$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd) 38 QUALIFY=${CHIPWAIT_QUALIFY:-$HERE/m19r_qualify.sh} 39 CAMPAIGN=${CHIPWAIT_CAMPAIGN:-$HERE/m19r_campaign.sh} 40 41 usage() { 42 echo "usage: chipwait_campaign.sh --omega-candidate SHA --physics-candidate SHA --physics-dir DIR --campaign-dir DIR [--runs N]" >&2 43 } 44 die() { echo "chipwait_campaign: $*" >&2; usage; exit 2; } 45 46 omega= physics= pdir= cdir= runs=3 47 while [ $# -gt 0 ]; do 48 case $1 in 49 --omega-candidate|--physics-candidate|--physics-dir|--campaign-dir|--runs) 50 [ $# -ge 2 ] || die "missing value for $1" 51 case $1 in 52 --omega-candidate) omega=$2;; 53 --physics-candidate) physics=$2;; 54 --physics-dir) pdir=$2;; 55 --campaign-dir) cdir=$2;; 56 --runs) runs=$2;; 57 esac 58 shift 2;; 59 --omega-candidate=*) omega=${1#*=}; shift;; 60 --physics-candidate=*) physics=${1#*=}; shift;; 61 --physics-dir=*) pdir=${1#*=}; shift;; 62 --campaign-dir=*) cdir=${1#*=}; shift;; 63 --runs=*) runs=${1#*=}; shift;; 64 *) die "unknown argument: $1";; 65 esac 66 done 67 [ -n "$omega" ] || die "--omega-candidate is required" 68 [ -n "$physics" ] || die "--physics-candidate is required" 69 [ -n "$pdir" ] || die "--physics-dir is required" 70 [ -n "$cdir" ] || die "--campaign-dir is required" 71 [[ $runs =~ ^[1-9][0-9]*$ ]] || die "--runs must be a positive integer" 72 73 if [ -e "$cdir/campaign.json" ] || compgen -G "$cdir/run-00*" > /dev/null; then 74 echo "chipwait_campaign: $cdir already holds campaign.json or a run-00N entry; refusing to reuse it" >&2 75 exit 2 76 fi 77 # Lane receipt guard (omega #315): m19r_qualify.sh runs `make clean`, which removes 78 # build/qual-runs. Refuse while an earlier window lane's receipt (WINDOW_LANE_OUT, the 79 # window directory a ladder keeps .lane-guard/ and R11-living/ in) or any R11 receipt in 80 # the build directory m19r_qualify.sh cleans is unarchived. Nothing is created first. 81 . "$HERE/window_lane_guard.sh" || exit 2 82 build_dir=${CHIPWAIT_BUILD_DIR:-$(realpath -m "$HERE/../${OUT_DIR:-build}")} 83 wl_guard_build "${WINDOW_LANE_OUT:-}" chipwait "$build_dir" || { 84 echo "chipwait_campaign: lane receipt guard refused (see above); nothing was run" >&2; exit 2; } 85 mkdir -p "$cdir" || { echo "chipwait_campaign: cannot create $cdir" >&2; exit 2; } 86 87 runner_sha=$(git -C "$HERE" rev-parse HEAD 2> /dev/null || echo unknown) 88 jq -n --arg o "$omega" --arg p "$physics" --arg rule "$runs/$runs PASS, predeclared" \ 89 --argjson n "$runs" --arg at "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \ 90 --arg host "$(hostname)" --arg un "$(uname -a)" --arg rs "$runner_sha" \ 91 '{omega_candidate_sha: $o, physics_candidate_sha: $p, rule: $rule, runs_required: $n, 92 created_at: $at, host: $host, uname: $un, runner_sha: $rs}' > "$cdir/campaign.json" || 93 { echo "chipwait_campaign: cannot write campaign.json" >&2; exit 1; } 94 95 i=1 96 while [ "$i" -le "$runs" ]; do 97 id=$(printf 'run-%03d' "$i") 98 echo "== $id of $runs ==" 99 "$QUALIFY" --omega-candidate "$omega" --physics-candidate "$physics" --physics-dir "$pdir" \ 100 --evidence-root "$cdir" --run-id "$id" \ 101 > >(tee "$cdir/runner-$id.stdout.log") 2> >(tee "$cdir/runner-$id.stderr.log" >&2) 102 rc=$? 103 wait # let both tee processes finish flushing 104 echo "$rc" > "$cdir/runner-$id.exit" 105 echo "== $id exit $rc ==" 106 i=$((i + 1)) 107 done 108 109 echo "== mechanical verdict ==" 110 "$CAMPAIGN" --campaign-dir "$cdir" --runs "$runs" 111 [ $? -eq 0 ] && exit 0 112 exit 1