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/aien-sovereign-core-mv/patches/0aca8826a1c2e389 # 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 Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers ## GitHub aien-dev/aien-sovereign-core-mv#648 (code only) closed derived `0aca8826a1c2e389` #648 Imported from GitHub aien-dev/aien-sovereign-core-mv#648 (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 `12e71aad80fda23a428317d11b0dac02d1c777f1` · Head `39f8db6e24f6292061341647edc7fbf0445efb09` ### Apply it ``` git checkout -b patch-0aca8826a1c2e389 12e71aad80fda23a428317d11b0dac02d1c777f1 curl -fsSL https://interplane.io/drakestapleton/aien-sovereign-core-mv/patches/0aca8826a1c2e389.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/aien-sovereign-core-mv 648 39f8db6e24f6292061341647edc7fbf0445efb09 ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"aien-sovereign-core-mv","number":648,"url":"https://github.com/aien-dev/aien-sovereign-core-mv/pull/648","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:37:45Z","metadata":"unavailable","state_derived":true} ``` ### Changes ``` diff --git a/.crumb b/.crumb index d38130fb..9cd3d609 100644 --- a/.crumb +++ b/.crumb @@ -112,21 +112,21 @@ "purpose": "" }, { - "digest": "b787845b373f1f2ef48522c2575a6de8ad32e3584bef4b578ba61d2ab053187c", - "last_commit": "fe3677c3", + "digest": "bfd2235ed4c88e5e075d7ac5ddb10856e260184d923a9f4b7bf3fc40ecdafce3", + "last_commit": "7378ed90", "name": "tools/aien-local-ci", "purpose": "Local CI sandbox exec contract (C8), aien-run user/caches install, Forgejo trigger hook, health " } ], - "children_root": "sha256:111edf8bf001ed434f7dacbc6d8ab9d75f6bda2cd909d01264fb42bbe38b1d74", - "compiled_at": "2026-10-17T11:58:09Z", + "children_root": "sha256:5b659436214f9ab167b1c224e9bbdee955caffc6bcbe077a61fd79014583ae13", + "compiled_at": "2026-10-18T14:31:55Z", "compiler": "crumb-compile/1", - "digest": "sha256:90138b1fd1cf3ffa4f762b157930e959f2bea50c41351c40b41330ae9edff05b", + "digest": "sha256:27e6271795cc839bd3ad8063601ca42b27a1608b42f851de0333b6a6d8260299", "evidence_files": 1578, "evidence_root": "sha256:135e27a1a0704c4a8371cd2c1eb555f2b5beec61c212949b029a5457418a7160", - "files": 5891, - "generated_at_commit": "6fb606867d2cd502b9475cd2ff0cc85ab40b16c9", - "source_tree": "sha256:7ac140a01c7f7ef0cc9f91a7cf9ea94fb063f8ca7f24365f185b9da5b2ed26b9" + "files": 5893, + "generated_at_commit": "85e020c41bf843b37bfb9de5f9bf655bac3f36bb", + "source_tree": "sha256:d186191b9381f1bf6120aeabb8b09243d56805760f56d38fbd1c71d0fd0ec8f4" } }, "history": [], diff --git a/tools/aien-local-ci/.crumb b/tools/aien-local-ci/.crumb index 61fb8264..9cbb2d08 100644 --- a/tools/aien-local-ci/.crumb +++ b/tools/aien-local-ci/.crumb @@ -3,14 +3,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-17T11:27:44Z", + "compiled_at": "2026-10-18T14:31:55Z", "compiler": "crumb-compile/1", - "digest": "sha256:b787845b373f1f2ef48522c2575a6de8ad32e3584bef4b578ba61d2ab053187c", + "digest": "sha256:bfd2235ed4c88e5e075d7ac5ddb10856e260184d923a9f4b7bf3fc40ecdafce3", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 12, - "generated_at_commit": "fe3677c38c6cd8219db0959d954c8d83e1c8a52c", - "source_tree": "sha256:9cfa14eaf95c90bacd4d1a84f592c18e7a0f9abe0eb5992f9b779cf1a78b9d52" + "files": 14, + "generated_at_commit": "85e020c41bf843b37bfb9de5f9bf655bac3f36bb", + "source_tree": "sha256:c515b9e819754cdcabe5d6c1903485fba2877c07608b0b867f5762b19f001af8" } }, "layer": "infra", diff --git a/tools/aien-local-ci/README.md b/tools/aien-local-ci/README.md index af8d9224..70e5ced3 100644 --- a/tools/aien-local-ci/README.md +++ b/tools/aien-local-ci/README.md @@ -87,6 +87,7 @@ added by this lane. | `/var/lib/aien-run` | root:aien-run 0750, ACL `u:drakestapleton:r-x` | HOME of aien-run; no skeleton dotfiles | | `cargo/` | root 0755 | CARGO_HOME (cargo works with it read-only: `--locked --offline` builds need no writes there) | | `cargo/registry`, `cargo/git` | root, read-only | seeded once from `~/.cargo` (1.9 GB + 1.3 GB; the git cache is needed because `Cargo.lock` has 3 git sources) | +| `registry-refresh.sh ` | operator, sudo | adds to `cargo/registry` the crates.io packages a trusted lockfile names that the judge lacks: copied from `~/.cargo`, sha256 checked against the lockfile, index-cache entry copied, one journal line; never deletes or replaces a crate (#622). `--dry-run` only lists | | `cargo/bin` | root | the operator's `rustup` binary + proxy symlinks; no second rustup install | | `rustup/` | root, read-only | `settings.toml` (default 1.98.1) + `toolchains/1.98.1-aarch64-unknown-linux-gnu` copied (631 MB) | | `.gitconfig` | root 0644 | `safe.directory = *` (git 2.43 has no path globs; aien-run reaches nothing else) | diff --git a/tools/aien-local-ci/registry-refresh.sh b/tools/aien-local-ci/registry-refresh.sh new file mode 100755 index 00000000..087eca4e --- /dev/null +++ b/tools/aien-local-ci/registry-refresh.sh @@ -0,0 +1,108 @@ +#!/usr/bin/env bash +# registry-refresh.sh: add to the judge's read-only cargo registry the crates a trusted Cargo.lock names +# that it does not have yet (issue #622). The judge builds with `--locked --offline` against +# /var/lib/aien-run/cargo/registry, which install.sh seeded once from the operator's ~/.cargo; nothing +# refreshed it, so every PR that adds or bumps a crate failed on the judge. This is the operator-run refresh +# step. The trust model is unchanged: the registry stays root-owned and read-only to aien-run, nothing here +# touches the network, and the source of every byte is the operator's own cache. +# +# bash tools/aien-local-ci/registry-refresh.sh [--dry-run] +# +# For each crates.io package in the lockfile that is missing from the judge registry: copy the .crate from +# the operator's ~/.cargo cache, refuse unless its sha256 equals the lockfile checksum, then copy the matching +# index-cache entry. Prints what it added and appends one journal line so the next bundle can be traced to +# the registry state it ran with. Never deletes or replaces an existing crate file. +# +# Test overrides (tests/registry_refresh_test.sh uses them on throwaway directories, no sudo): +# AIEN_JUDGE_REGISTRY, AIEN_OPERATOR_REGISTRY, AIEN_JOURNAL, AIEN_INSTALL (the privileged copy command). +set -euo pipefail + +lock=${1:-} +dry=0 +for a in "${@:2}"; do case $a in --dry-run) dry=1 ;; *) echo "unknown argument: $a" >&2; exit 2 ;; esac; done +[[ -n $lock && -f $lock ]] || { echo "usage: registry-refresh.sh [--dry-run]" >&2; exit 2; } + +OP_HOME=${AIEN_OP_HOME:-$HOME} +JUDGE=${AIEN_JUDGE_REGISTRY:-/var/lib/aien-run/cargo/registry} +OPER=${AIEN_OPERATOR_REGISTRY:-$OP_HOME/.cargo/registry} +JOURNAL=${AIEN_JOURNAL:-$OP_HOME/.local/state/aien-local-ci/journal.jsonl} +INSTALL=${AIEN_INSTALL:-sudo -n install -o root -g root} +CRATES_IO='registry+https://github.com/rust-lang/crates.io-index' + +say() { printf '[registry-refresh] %s\n' "$*"; } +die() { echo "registry-refresh: $*" >&2; exit 1; } + +[[ -d $JUDGE/cache && -d $OPER/cache ]] || die "registry layout missing (judge $JUDGE, operator $OPER)" +# One index directory on each side (index.crates.io-); the names must agree or the judge's cargo +# would never look where we copy. +idx_judge=$(ls "$JUDGE/cache"); idx_oper=$(ls "$OPER/cache") +[[ $idx_judge == "$idx_oper" && $(wc -w <<<"$idx_judge") -eq 1 ]] || die "index directory mismatch: judge '$idx_judge' operator '$idx_oper'" +idx=$idx_judge + +# cargo's sparse-index cache path for a crate name: 1/, 2/, 3//, // (lower case). +index_rel() { + local n; n=$(printf '%s' "$1" | tr 'A-Z' 'a-z') + case ${#n} in + 1) printf '1/%s' "$n" ;; + 2) printf '2/%s' "$n" ;; + 3) printf '3/%s/%s' "${n:0:1}" "$n" ;; + *) printf '%s/%s/%s' "${n:0:2}" "${n:2:2}" "$n" ;; + esac +} + +# Lockfile packages from crates.io: "name version checksum" per line. +packages() { + awk -v src="$CRATES_IO" ' + function emit() { if (name != "" && source == src) print name, version, checksum } + /^\[\[package\]\]/ { emit(); name=""; version=""; source=""; checksum="" } + /^name = / { gsub(/"/, "", $3); name=$3 } + /^version = / { gsub(/"/, "", $3); version=$3 } + /^source = / { gsub(/"/, "", $3); source=$3 } + /^checksum = / { gsub(/"/, "", $3); checksum=$3 } + END { emit() }' "$lock" +} + +lock_digest=$(sha256sum "$lock" | cut -d' ' -f1) +added=() missing_src=() refused=() +total=0 +while read -r name version checksum; do + [[ -n $name ]] || continue + total=$((total + 1)) + file="$name-$version.crate" + [[ -e $JUDGE/cache/$idx/$file ]] && continue + src="$OPER/cache/$idx/$file" + if [[ ! -f $src ]]; then missing_src+=("$file"); continue; fi + [[ -n $checksum ]] || { refused+=("$file: no checksum in lockfile"); continue; } + have=$(sha256sum "$src" | cut -d' ' -f1) + if [[ $have != "$checksum" ]]; then refused+=("$file: sha256 $have, lockfile says $checksum"); continue; fi + rel=$(index_rel "$name") + if (( dry )); then say "would add $file"; added+=("$file"); continue; fi + # Add only: install refuses nothing, so check again right before the copy, then never overwrite. + [[ -e $JUDGE/cache/$idx/$file ]] && continue + $INSTALL -m 0444 "$src" "$JUDGE/cache/$idx/$file" + if [[ -f $OPER/index/$idx/.cache/$rel ]]; then + $INSTALL -d -m 0755 "$JUDGE/index/$idx/.cache/$(dirname "$rel")" + # The index-cache entry lists every version cargo has seen; the operator's copy is a superset. + $INSTALL -m 0444 "$OPER/index/$idx/.cache/$rel" "$JUDGE/index/$idx/.cache/$rel" + else + say "note: no operator index-cache entry for $name (cargo will still find the .crate by its lockfile checksum)" + fi + say "added $file (sha256 verified)" + added+=("$file") +done < <(packages) + +(( total > 0 )) || die "no crates.io packages found in $lock" + +for m in "${missing_src[@]}"; do say "cannot add $m: not in the operator cache (fetch it as the operator first)"; done +for r in "${refused[@]}"; do say "REFUSED $r"; done + +if (( ! dry )); then + mkdir -p "$(dirname "$JOURNAL")" + jq -nc --arg utc "$(date -u +%Y-%m-%dT%H:%M:%SZ)" --arg action registry-refresh --arg lockfile "$lock" \ + --arg lock_sha256 "$lock_digest" --arg packages "$total" --argjson added "$(printf '%s\n' "${added[@]:-}" | jq -R . | jq -sc 'map(select(. != ""))')" \ + --argjson missing "$(printf '%s\n' "${missing_src[@]:-}" | jq -R . | jq -sc 'map(select(. != ""))')" \ + --argjson refused "$(printf '%s\n' "${refused[@]:-}" | jq -R . | jq -sc 'map(select(. != ""))')" \ + '$ARGS.named' >> "$JOURNAL" +fi +say "lockfile $lock_digest: $total crates.io packages, ${#added[@]} added, ${#missing_src[@]} not in operator cache, ${#refused[@]} refused" +(( ${#refused[@]} == 0 )) || exit 1 diff --git a/tools/aien-local-ci/tests/registry_refresh_test.sh b/tools/aien-local-ci/tests/registry_refresh_test.sh new file mode 100755 index 00000000..50e6b55d --- /dev/null +++ b/tools/aien-local-ci/tests/registry_refresh_test.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash +# registry_refresh_test.sh: offline proofs for registry-refresh.sh on throwaway directories (no sudo, no network). +# bash tools/aien-local-ci/tests/registry_refresh_test.sh +set -euo pipefail +HERE=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +R=$HERE/../registry-refresh.sh +T=$(mktemp -d) +trap 'rm -rf "$T"' EXIT +pass=0 fail=0 +ok() { pass=$((pass + 1)); echo "ok $*"; } +bad() { fail=$((fail + 1)); echo "FAIL $*"; } +check() { local name=$1; shift; if "$@"; then ok "$name"; else bad "$name"; fi; } + +IDX=index.crates.io-1949cf8c6b5b557f +J=$T/judge O=$T/oper +mkdir -p "$J/cache/$IDX" "$J/index/$IDX/.cache" "$O/cache/$IDX" "$O/index/$IDX/.cache/ru/st" "$O/index/$IDX/.cache/2" "$O/index/$IDX/.cache/3/a" +export AIEN_JUDGE_REGISTRY=$J AIEN_OPERATOR_REGISTRY=$O AIEN_JOURNAL=$T/journal.jsonl AIEN_INSTALL="install" + +mk() { printf '%s' "$2" > "$O/cache/$IDX/$1.crate"; sha256sum "$O/cache/$IDX/$1.crate" | cut -d' ' -f1; } +sha_rustls=$(mk rustls-0.23.46 'rustls bytes') +sha_old=$(mk rustls-0.23.45 'old rustls') +sha_ab=$(mk ab-1.0.0 'two letter name') +sha_abc=$(mk abc-2.0.0 'three letter name') +_=$(mk tampered-1.0.0 'these bytes do not match the lockfile') +echo 'index entry rustls' > "$O/index/$IDX/.cache/ru/st/rustls" +echo 'index entry ab' > "$O/index/$IDX/.cache/2/ab" +echo 'index entry abc' > "$O/index/$IDX/.cache/3/a/abc" +# The judge already has the old rustls, with different bytes on purpose: it must never be replaced. +printf 'judge copy, keep me' > "$J/cache/$IDX/rustls-0.23.45.crate" + +pkg() { printf '[[package]]\nname = "%s"\nversion = "%s"\nsource = "registry+https://github.com/rust-lang/crates.io-index"\nchecksum = "%s"\n\n' "$@"; } +{ + printf 'version = 4\n\n' + pkg rustls 0.23.46 "$sha_rustls" + pkg rustls 0.23.45 "$sha_old" + pkg ab 1.0.0 "$sha_ab" + pkg abc 2.0.0 "$sha_abc" + pkg notcached 0.1.0 0000000000000000000000000000000000000000000000000000000000000000 + printf '[[package]]\nname = "aien-local"\nversion = "0.1.0"\n\n' + printf '[[package]]\nname = "gitdep"\nversion = "0.1.0"\nsource = "git+https://example.invalid/x#abc"\n\n' +} > "$T/Cargo.lock" + +# 1 dry run adds nothing and names what it would add +out=$(bash "$R" "$T/Cargo.lock" --dry-run 2>&1); rc=$? +check "dry run exits 0" test $rc -eq 0 +check "dry run names rustls 0.23.46" grep -q 'would add rustls-0.23.46.crate' <<<"$out" +check "dry run copies nothing" test ! -e "$J/cache/$IDX/rustls-0.23.46.crate" +check "dry run writes no journal" test ! -e "$AIEN_JOURNAL" + +# 2 real run: adds the missing verified crates with their index entries, keeps the existing one, reports the uncached one +out=$(bash "$R" "$T/Cargo.lock" 2>&1); rc=$? +check "real run exits 0" test $rc -eq 0 +check "rustls 0.23.46 added" cmp -s "$O/cache/$IDX/rustls-0.23.46.crate" "$J/cache/$IDX/rustls-0.23.46.crate" +check "added crate is read-only" test "$(stat -c %a "$J/cache/$IDX/rustls-0.23.46.crate" 2>/dev/null || stat -f %Lp "$J/cache/$IDX/rustls-0.23.46.crate")" = 444 +check "index entry copied (ru/st/rustls)" cmp -s "$O/index/$IDX/.cache/ru/st/rustls" "$J/index/$IDX/.cache/ru/st/rustls" +check "two-letter name index path (2/ab)" test -f "$J/index/$IDX/.cache/2/ab" +check "three-letter name index path (3/a/abc)" test -f "$J/index/$IDX/.cache/3/a/abc" +check "existing judge crate never replaced" test "$(cat "$J/cache/$IDX/rustls-0.23.45.crate")" = 'judge copy, keep me' +check "uncached crate reported, not fatal" grep -q 'cannot add notcached-0.1.0.crate' <<<"$out" +check "summary counts" grep -q '5 crates.io packages, 3 added, 1 not in operator cache, 0 refused' <<<"$out" +check "journal line written" test "$(wc -l < "$AIEN_JOURNAL")" -eq 1 +check "journal names the lockfile digest" test "$(jq -r .lock_sha256 "$AIEN_JOURNAL")" = "$(sha256sum "$T/Cargo.lock" | cut -d' ' -f1)" +check "journal lists the added crates" test "$(jq -r '.added|join(",")' "$AIEN_JOURNAL")" = 'rustls-0.23.46.crate,ab-1.0.0.crate,abc-2.0.0.crate' + +# 3 second run is a no-op +out=$(bash "$R" "$T/Cargo.lock" 2>&1); rc=$? +check "second run exits 0 with 0 added" grep -q ', 0 added,' <<<"$out" + +# 4 a checksum mismatch is refused: nothing copied, exit 1, named in the journal +pkg tampered 1.0.0 1111111111111111111111111111111111111111111111111111111111111111 >> "$T/Cargo.lock" +out=$(bash "$R" "$T/Cargo.lock" 2>&1) && rc=0 || rc=$? +check "mismatch exits 1" test $rc -eq 1 +check "mismatch is named REFUSED" grep -q 'REFUSED tampered-1.0.0.crate' <<<"$out" +check "mismatched crate not copied" test ! -e "$J/cache/$IDX/tampered-1.0.0.crate" +check "journal records the refusal" test "$(jq -r '.refused|length' <(tail -1 "$AIEN_JOURNAL"))" = 1 + +# 5 index directory mismatch is fatal before any copy +mkdir -p "$T/judge2/cache/index.crates.io-ffffffffffffffff" +out=$(AIEN_JUDGE_REGISTRY=$T/judge2 bash "$R" "$T/Cargo.lock" 2>&1) && rc=0 || rc=$? +check "index dir mismatch refused" test $rc -eq 1 +check "index dir mismatch message" grep -q 'index directory mismatch' <<<"$out" + +echo "registry_refresh_test: $pass passed, $fail failed" +(( fail == 0 )) ```