interplane.Get Omega
Read in your language

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

branch main Branches Tags History

aien-sovereign-core-mv / tools / aien-local-ci / sibling-map-check

75 lines · 4536 bytes Raw Blame History
1#!/usr/bin/env bash
2# sibling-map-check: the part of the retired crumb-doctor that worked (Drake 2026-11-08: "get rid of crumbs",
3# "keep the parts that worked"). Code taken unchanged from crumb-doctor's heal and SIBMAP checks.
4#
5# The test workers read the sibling map (tools/aien-local-ci/siblings: which repos need which neighbour repos beside
6# them to run their tests) from the WORK TREE of the trusted aien-sovereign-core clone. This tool:
7# HEAL moves that work tree to origin/main when it is clean (--heal-only does only this; cheap, every tick)
8# SIBMAP every map a running worker reads equals origin/main's, and covers every need_sibling / pin that a
9# repo's tests/gates/run.sh asks for
10# --alert writes a SIBLING-MAP line into the aien-watch ALERT (removed when green). Exit 0 all PASS, 1 any FAIL.
11set -u
12CLONES=${AIEN_CLONES:-$HOME/workspace/pipeline/clones}
13WATCH=${AIEN_WATCH_STATE:-$HOME/.local/state/aienos/watch}
14TRUSTED=$CLONES/aien-sovereign-core
15REPOS="aien-sovereign-core omega aienux physics aien-protocols aegis-runtime spark-rsi aien-architecture benchmarks synapse interplane"
16HEAL=0 HEAL_ONLY=0 ALERT=0
17while [ $# -gt 0 ]; do
18 case $1 in
19 --heal) HEAL=1 ;; --heal-only) HEAL=1; HEAL_ONLY=1 ;; --alert) ALERT=1 ;;
20 --repos) REPOS=${2//,/ }; shift ;;
21 *) echo "usage: sibling-map-check [--heal|--heal-only] [--alert] [--repos a,b]" >&2; exit 2 ;;
22 esac; shift
23done
24npass=0; FAILS=()
25record() { printf '%-4s %-6s %-40s %s\n' "$1" "$2" "$3" "$4"; case $1 in PASS) npass=$((npass+1)) ;; FAIL) FAILS+=("$2 $3") ;; esac; }
26g() { git -c advice.detachedHead=false "$@"; }
27heal_trusted() {
28 local head main
29 head=$(git -C "$TRUSTED" rev-parse HEAD 2>/dev/null); main=$(git -C "$TRUSTED" rev-parse origin/main 2>/dev/null)
30 [ "$HEAL" = 1 ] && [ -n "$main" ] && [ "$head" != "$main" ] || return 0
31 if [ -n "$(git -C "$TRUSTED" status --porcelain --untracked-files=no)" ]; then
32 record FAIL HEAL "trusted clone" "work tree has local changes; not moved off ${head:0:8}"
33 else
34 g -C "$TRUSTED" checkout -q --detach origin/main && record INFO HEAL "trusted clone" "work tree moved ${head:0:8} -> origin/main ${main:0:8}"
35 fi
36}
37if [ "$HEAL_ONLY" = 1 ]; then heal_trusted; [ ${#FAILS[@]} = 0 ]; exit $?; fi
38
39SIBFILES=()
40for p in /proc/[0-9]*; do
41 cmd=$( { tr '\0' ' ' < "$p/cmdline"; } 2>/dev/null) || continue
42 [[ $cmd == *aien-test\ worker* ]] || continue
43 [[ $cmd =~ --siblings\ ([^ ]+) ]] && SIBFILES+=("${BASH_REMATCH[1]}|--siblings of pid ${p#/proc/}")
44done
45echo "sibling-map-check $(date -u +%FT%TZ)"
46map_rows() { sed 's/#.*//' "$@" 2>/dev/null | awk 'NF==4 {print $1" "$2}' | sort -u; }
47heal_trusted
48main=$(git -C "$TRUSTED" rev-parse origin/main 2>/dev/null)
49want=$(git -C "$TRUSTED" show origin/main:tools/aien-local-ci/siblings 2>/dev/null | sed 's/#.*//' | awk 'NF==4 {print $1" "$2}' | sort -u)
50for entry in "$TRUSTED/tools/aien-local-ci/siblings|default (poll workers)" "${SIBFILES[@]}"; do
51 f=${entry%%|*}; who=${entry#*|}
52 missing=$(comm -23 <(printf '%s\n' "$want") <(map_rows "$f") | grep . | sed 's/ / ..\//' | paste -sd, -)
53 if [ -n "$missing" ]; then record FAIL SIBMAP "$f" "$who: missing $missing (origin/main ${main:0:8} has them)"
54 else record PASS SIBMAP "$f" "$who: matches origin/main ${main:0:8}"; fi
55done
56for repo in $REPOS; do
57 runsh=$(git -C "$CLONES/$repo" show origin/main:tests/gates/run.sh 2>/dev/null)
58 need=$( { printf '%s\n' "$runsh" | grep -oE 'need_sibling[[:blank:]]+[A-Za-z0-9._-]+' | awk '{print $2}'
59 printf '%s\n' "$runsh" | grep -E '^[[:blank:]]*pin[[:blank:]]+[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+[^[:blank:]]+' | awk '{print $3}'; } | sort -u)
60 for d in $need; do
61 grep -qx "$repo $d" <<<"$want" || record FAIL SIBMAP "$repo needs ../$d" "origin/main sibling map has no line for it"
62 done
63done
64echo "sibling-map-check: $npass pass, ${#FAILS[@]} FAIL"
65if [ "$ALERT" = 1 ]; then
66 mkdir -p "$WATCH"; stamp=$(date -u +%FT%TZ)
67 keep=$(grep -v -e '^SIBLING-MAP:' -e '^CRUMB-DRIFT:' "$WATCH/ALERT" 2>/dev/null)
68 if [ ${#FAILS[@]} -gt 0 ]; then
69 text=$(printf '%s; ' "${FAILS[@]}" | cut -c1-600)
70 printf '%s SIBLING-MAP %s\n' "$stamp" "$text" >> "$WATCH/alerts.log"
71 keep=$(printf '%s\n%s' "$keep" "SIBLING-MAP: a test worker's list of neighbour repos is incomplete: $text(run: sibling-map-check; since $stamp)" | grep .)
72 fi
73 if [ -n "$keep" ]; then printf '%s\n' "$keep" > "$WATCH/ALERT.tmp" && mv -f "$WATCH/ALERT.tmp" "$WATCH/ALERT"; else rm -f "$WATCH/ALERT"; fi
74fi
75[ ${#FAILS[@]} = 0 ]