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
GitHub aien-dev/aien-sovereign-core-mv#308 (code only)
Apply it
git checkout -b patch-5d994d8da6523f70 12c1a5ff18b70e748b678280c4210788f820c712 curl -fsSL https://interplane.io/drakestapleton/aien-sovereign-core-mv/patches/5d994d8da6523f70.patch | git am
Provenance
github-import 1
aien-dev/aien-sovereign-core-mv
308
aa2b446b351338df1ff5f419e4223957bca1db68
{"kind":"github-import","owner":"aien-dev","repo":"aien-sovereign-core-mv","number":308,"url":"https://github.com/aien-dev/aien-sovereign-core-mv/pull/308","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:45Z","metadata":"unavailable","state_derived":true}
Changes
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index cba92ef2..bc1c4a37 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -56,7 +56,7 @@ The runtime includes dynamic silicon probing via `ExecutionSurface::detect()`: - Pure Mojo LLaMA execution kernels are authored by Audrey (`a730/MojoLlama`). - Neural graph execution utilizes Modular MAX. -- This release is published under the Apache License, Version 2.0 (with LLVM Exception). +- Licence history: v0.1.0 (tag 2026-09-20) carried the Sovereign Resource Commons License 1.0 (SRCL-1.0): `git show v0.1.0:LICENSE` and its own notes say so. v0.1.1 (tag 2026-10-03) carried Apache-2.0 (`git show v0.1.1:LICENSE`). The Apache wording in this file dates from 2026-09-23 (commit 3419488). The project was relicensed to AGPL-3.0-or-later on 2026-10-04 (commit f571b94, #197); releases cut after that are AGPL-3.0-or-later (`LICENSE`, `NOTICE`, `ARTIFACT_LICENSING.md`). Archives already published keep the terms they carried. Third-party model licences are separate: see `THIRD_PARTY.md`. - Detailed provenance documentation resides in `docs/PROVENANCE.md`. --- diff --git a/THIRD_PARTY.md b/THIRD_PARTY.md new file mode 100644 index 00000000..7496d0e9 --- /dev/null +++ b/THIRD_PARTY.md @@ -0,0 +1,42 @@ +# Third-Party Model Notices + +AIEN code is AGPL-3.0-or-later (`LICENSE`, `NOTICE`). The models below are separate +third-party works. Each keeps its publisher's licence; running one on AIEN does not +relicense it. The SmolLM2 attribution detail lives in `ATTRIBUTION.md` and `NOTICE`. + +## What the release package contains + +Read from `scripts/package-release.sh`: the release tarball holds the seven built +binaries, `CONSTITUTION.md`, `README.md`, `install.sh`, `LICENSE`, `NOTICE`, `THIRD_PARTY.md`, `imprints/en2-trinity/` +(6,275 bytes of text) and a generated `release.toml`. `release.toml` carries a `[model]` +table copied from `release/candidate.toml`; that table is **metadata only** (model id, +snapshot, SHA-256 digests, geometry, licence name). **No model weights are packaged in +any release artifact built by this script.** Weights are fetched or supplied +separately by the operator. + +| Model | Licence | Upstream | Weights in a release artifact? | Where referenced | +|---|---|---|---|---| +| SmolLM2-1.7B-Instruct (HuggingFaceTB), rev `31b70e2e869a7173562077fd711b654946d38674` | Apache-2.0 (model card `license: apache-2.0`) | https://huggingface.co/HuggingFaceTB/SmolLM2-1.7B-Instruct | No | `NOTICE`, `ATTRIBUTION.md`, `docs/campaigns/smollm2-qualification/` | +| Llama 3.2 1B Instruct, as `unsloth/Llama-3.2-1B-Instruct`, snapshot `5a8abab4a5d6f164389b1079fb721cfab8d7126c` (CAND-4) | Llama 3.2 Community License (`licence` in `release/candidate.toml`) | https://huggingface.co/unsloth/Llama-3.2-1B-Instruct (re-host of Meta's model) | No. Digests only in `release.toml` | `release/candidate.toml`, `docs/release/ORACLE-FIXTURE-CAND4.md` | +| Qwen3-4B-Instruct-2507 (Qwen), HF revision `cdbee75f` | Apache-2.0 per `docs/campaigns/open-model-qwen3/VERDICT-v2.md` line 31 (upstream card not re-checked) | https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507 | No. Referenced in campaign docs only; not qualified, not distributed, no notice shipped (no Qwen3 entry in `NOTICE`) | `docs/campaigns/open-model-qwen3/` | + +## CAND-4 (Llama 3.2 1B): internal only + +`release/candidate.toml` records `distribution = "internal-only until an open-licence +model passes"`. CAND-4 is used for internal qualification and is **never distributed** +by this project, in a release archive or otherwise. + +If it were ever distributed (weights or a product built on them), the Llama 3.2 +Community License would apply and would need at least: a copy of that licence given +to every recipient, and the "Built with Llama" attribution. These requirements are +from general knowledge of the licence and are **UNVERIFIED**: the official page +(`https://www.llama.com/llama3_2/license/`) redirected through developer.meta.com to +dev.meta.ai, which returned HTTP 404 on 2026-10-07, so the text could not be checked. +Re-read the official licence before any distribution. Its text is not reproduced here. + +## Follow-up + +Packages built after this change carry `LICENSE`, `NOTICE` and this file (sha256 listed in +`release.toml`). `package-release.sh` refuses to package without them, but `install.sh` and +`verify-release-assets.sh` do not yet require `LICENSE` in a package; that would also reject +the published v0.1.x archives. Published v0.1.0 and v0.1.1 are unchanged. diff --git a/docs/release/receipts/2026-10-07-final-switch-kill-and-offline-build.md b/docs/release/receipts/2026-10-07-final-switch-kill-and-offline-build.md new file mode 100644 index 00000000..49d2bdb8 --- /dev/null +++ b/docs/release/receipts/2026-10-07-final-switch-kill-and-offline-build.md @@ -0,0 +1,20 @@ +# Receipt: kill -9 at the final install switch, and offline build (2026-10-07) + +Tree: branch c3/release-prep from main 12c1a5f. + +## Kill -9 at the final switch +install.sh switches `releases/current` with one rename(2) of a temp symlink (`mv -T`). That step is atomic; no bug found. +New hold points (env `AIEN_TEST_PAUSE_AT`): `pre-rename` (temp link made, rename not done), `after-links`, and `after-swap` inside `--rollback`. +`scripts/test-install-release.sh` case 12b kills -9 at each, in a scratch prefix only: +- install killed at pre-rename: wholly old, runs, record unchanged; rerun gives wholly new, no stray temp link. +- install killed at after-links: wholly new, runs; rerun repairs the record. +- rollback killed at pre-rename: wholly old; rerun completes. +- rollback killed at after-swap: wholly switched; rerun leaves live release and record in agreement. +Result: PASS (about 3 s). Still NOT_RUN: real power loss / filesystem-level crash (kill -9 does not test unflushed data). +Small change: set_current now removes leftover `.current.new.*` temp links. + +## Offline build +`scripts/test-offline-build.sh`: offline build from a warm cargo cache (cargo fetch --locked, then --offline --locked). Not vendored. +Result: PASS, 170 s, crates aien-cli spark-cockpit-rs spark-inquisitor cortex-encoder-rs cortex-rs spark-supervisor spark-debugger. +Network denial NOT enforced: `unshare -rn` fails here (uid_map write not permitted); only `--offline` was used. +Not added to CI: needs network for the fetch and takes about 3 minutes. diff --git a/install.sh b/install.sh index 3470537a..45d70085 100755 --- a/install.sh +++ b/install.sh @@ -96,8 +96,10 @@ verify_release_dir() { # Switch $REL_DIR/current to <id> with one rename. set_current() { local id="$1" tmp="$REL_DIR/.current.new.$$" + rm -f "$REL_DIR"/.current.new.* # leftovers of an interrupted switch; never live rm -f "$tmp" ln -s "$id" "$tmp" + pause_at pre-rename if mv --help 2>&1 | grep -q -- ' -T'; then mv -T "$tmp" "$REL_DIR/current"; else mv -fh "$tmp" "$REL_DIR/current"; fi } @@ -217,6 +219,7 @@ activate_release() { pause_at after-swap echo "[+] Live release is now $id (candidate $cand); binaries:" link_bins "$cur" "$id" + pause_at after-links if [[ -n "$cur" && "$cur" != "$id" ]]; then write_record "$id" "$cur" install prune_releases "$id" "$cur" @@ -233,6 +236,7 @@ do_rollback() { [[ -d "$REL_DIR/$prev" ]] || { echo "Error: previous release $prev is missing from $REL_DIR." >&2; exit 1; } verify_release_dir "$REL_DIR/$prev" || { echo "Error: previous release $prev failed verification. Nothing was changed." >&2; exit 1; } set_current "$prev" + pause_at after-swap echo "[+] Rolled back: live release is now $prev (was $cur); binaries:" link_bins "$cur" "$prev" write_record "$prev" "$cur" rollback diff --git a/scripts/package-release.sh b/scripts/package-release.sh index 430e07af..b6e6f287 100755 --- a/scripts/package-release.sh +++ b/scripts/package-release.sh @@ -43,7 +43,8 @@ for binary in aien-cli spark-cockpit-rs spark-inquisitor cortex-encoder-rs corte [[ "$binary" != aien-cli ]] || name=aien cp "$BIN_DIR/$binary" "$PACKAGE_DIR/bin/$name" done -cp CONSTITUTION.md README.md install.sh "$PACKAGE_DIR/" +for f in LICENSE NOTICE THIRD_PARTY.md; do [[ -f "$f" ]] || { echo "Missing $f; a release must carry its licence notices" >&2; exit 1; }; done +cp CONSTITUTION.md README.md install.sh LICENSE NOTICE THIRD_PARTY.md "$PACKAGE_DIR/" if [[ -d imprints/en2-trinity ]]; then mkdir -p "$PACKAGE_DIR/imprints" cp -R imprints/en2-trinity "$PACKAGE_DIR/imprints/" diff --git a/scripts/test-install-release.sh b/scripts/test-install-release.sh index f94a408b..88acf172 100755 --- a/scripts/test-install-release.sh +++ b/scripts/test-install-release.sh @@ -219,6 +219,64 @@ fi grep -q "was not overwritten" "$WORK/log" || fail "incomplete release directory not reported" [[ "$(live "$WORK/cfg-good")" == "$ID3" && -f "$WORK/cfg-good/releases/$ID4/junk" ]] || fail "refusal changed state" +# 12b. kill -9 at the final switch itself. install.sh switches releases with one rename(2) of a +# temp symlink over releases/current. After every kill the install is wholly old or wholly new: +# it runs, its record is readable, and a rerun (or --rollback) finishes cleanly. +kill_at() { # point release-dir [install.sh args...]: run install.sh held at point, then kill -9 it + local point="$1" rel="$2" ipid + shift 2 + env AIEN_TEST_PAUSE_AT="$point" AIEN_RELEASE_TAG=v0.0.0-test AIEN_RELEASE_BASE_URL="file://$rel" \ + AIEN_BIN_DIR="$WORK/bin-good" AIEN_CONFIG_DIR="$WORK/cfg-good" AIEN_INSTALL_NO_PROFILE=1 \ + AIEN_SOURCE_DIR="$ROOT" AIEN_ALLOWED_SIGNERS="$WORK/allowed_signers" HOME="$WORK/home" \ + bash "$ROOT/install.sh" "$@" > "$WORK/log-int" 2>&1 & + ipid=$! + for _ in $(seq 1 100); do grep -q "paused at $point" "$WORK/log-int" 2>/dev/null && break; sleep 0.1; done + grep -q "paused at $point" "$WORK/log-int" || fail "installer never reached $point" + pkill -9 -P "$ipid" 2>/dev/null || true; kill -9 "$ipid"; wait "$ipid" 2>/dev/null || true +} +rec_cur() { sed -n 's/^current = "\(.*\)"$/\1/p' "$WORK/cfg-good/installed.toml"; } +strays() { ls -A "$WORK/cfg-good/releases" | grep -c '^\.current\.new\.' || true; } + +# A. install killed after the temp link exists, before the rename: wholly old +make_release "$WORK/rel5" "$WORK/key" CAND-5 g +ID5="$(sha256sum "$WORK/pkg/bin/aien" | cut -c1-12)" +ID_OLD="$(live "$WORK/cfg-good")" +kill_at pre-rename "$WORK/rel5" +[[ "$(live "$WORK/cfg-good")" == "$ID_OLD" && "$("$WORK/bin-good/aien")" == "aien-e" ]] || fail "pre-rename kill: install is not wholly old" +[[ "$(strays)" -ge 1 ]] || fail "pre-rename: no temp link, the hold is not at the rename" +[[ "$(rec_cur)" == "$ID_OLD" ]] || fail "pre-rename kill: record changed" +run_install "$WORK/rel5" "$WORK/bin-good" "$WORK/cfg-good" "$ROOT/install.sh" "${SIGN_ENV[@]}" \ + || { cat "$WORK/log" >&2; fail "rerun after pre-rename kill failed"; } +[[ "$(live "$WORK/cfg-good")" == "$ID5" && "$("$WORK/bin-good/aien")" == "aien-g" && "$(rec_cur)" == "$ID5" ]] || fail "rerun after pre-rename kill is not wholly new" +[[ "$(strays)" -eq 0 ]] || fail "temp link left after rerun" + +# B. install killed after the rename and the links, before the record: wholly new, record repaired by rerun +make_release "$WORK/rel6" "$WORK/key" CAND-6 h +ID6="$(sha256sum "$WORK/pkg/bin/aien" | cut -c1-12)" +kill_at after-links "$WORK/rel6" +[[ "$(live "$WORK/cfg-good")" == "$ID6" && "$("$WORK/bin-good/aien")" == "aien-h" ]] || fail "after-links kill: install is not wholly new" +[[ "$(rec_cur)" == "$ID5" && -d "$WORK/cfg-good/releases/$ID5" ]] || fail "after-links kill: record or previous release lost" +run_install "$WORK/rel6" "$WORK/bin-good" "$WORK/cfg-good" "$ROOT/install.sh" "${SIGN_ENV[@]}" \ + || { cat "$WORK/log" >&2; fail "rerun after after-links kill failed"; } +[[ "$(rec_cur)" == "$ID6" ]] && grep -q "^previous = \"$ID5\"" "$WORK/cfg-good/installed.toml" || fail "rerun did not repair the record" + +# C. --rollback killed before its rename: wholly old (the release it was leaving); rerun completes +kill_at pre-rename "$WORK/none" --rollback +[[ "$(live "$WORK/cfg-good")" == "$ID6" && "$("$WORK/bin-good/aien")" == "aien-h" && "$(rec_cur)" == "$ID6" ]] || fail "rollback killed pre-rename: not wholly old" +inst_args "$WORK/bin-good" "$WORK/cfg-good" --rollback || { cat "$WORK/log" >&2; fail "rollback rerun failed"; } +[[ "$(live "$WORK/cfg-good")" == "$ID5" && "$("$WORK/bin-good/aien")" == "aien-g" && "$(rec_cur)" == "$ID5" ]] || fail "rollback rerun: not wholly rolled back" +[[ "$(strays)" -eq 0 ]] || fail "temp link left after rollback rerun" + +# D. --rollback killed after its rename, before the record: wholly new (the target); rerun is safe and +# leaves a consistent record; a further rollback still swaps back and verifies +kill_at after-swap "$WORK/none" --rollback +[[ "$(live "$WORK/cfg-good")" == "$ID6" && "$("$WORK/bin-good/aien")" == "aien-h" ]] || fail "rollback killed after-swap: not wholly switched" +inst_args "$WORK/bin-good" "$WORK/cfg-good" --rollback || { cat "$WORK/log" >&2; fail "rollback rerun after after-swap kill failed"; } +[[ "$(live "$WORK/cfg-good")" == "$(rec_cur)" ]] || fail "record and live release disagree after the rerun" +[[ "$("$WORK/bin-good/aien")" == "aien-h" || "$("$WORK/bin-good/aien")" == "aien-g" ]] || fail "install does not run after the rerun" +inst_args "$WORK/bin-good" "$WORK/cfg-good" --rollback || fail "rollback after recovery failed" +[[ "$(live "$WORK/cfg-good")" == "$(rec_cur)" ]] || fail "record and live release disagree after a further rollback" + # 13. release gate: the candidate must be named and omega.lock must be the candidate's omega commit GT="$WORK/gate"; mkdir -p "$GT/scripts" "$GT/release" cp "$ROOT/scripts/check-release-candidate.sh" "$GT/scripts/"; cp "$ROOT/release/candidate.toml" "$GT/release/"; cp "$ROOT/Cargo.lock" "$GT/" @@ -235,4 +293,4 @@ sed -i 's/^candidate = .*/candidate = "unknown"/' "$GT/release/candidate.toml" if gate; then fail "gate accepted candidate unknown"; fi rm "$GT/release/candidate.toml" if gate; then fail "gate accepted a missing candidate file"; fi -echo "PASS: release gate fails closed, release install verifies signature, checksum and every package file, rejects tampered and forged releases, installs standalone offline, pinned key matches allowed_signers, upgrades atomically, keeps one previous release, rolls back, refuses downgrades, survives an interrupted install (including a kill after the swap)" +echo "PASS: release gate fails closed, release install verifies signature, checksum and every package file, rejects tampered and forged releases, installs standalone offline, pinned key matches allowed_signers, upgrades atomically, keeps one previous release, rolls back, refuses downgrades, survives an interrupted install (including kill -9 just before the rename, just after it, and during rollback)" diff --git a/scripts/test-offline-build.sh b/scripts/test-offline-build.sh new file mode 100755 index 00000000..8ccfc37d --- /dev/null +++ b/scripts/test-offline-build.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# Offline build check: fetch locked dependencies into a temp CARGO_HOME (needs network, once), +# then build the release crates with --offline --locked and, where possible, with the network +# namespace denied. This is an offline build from a warm cargo cache, not a vendored build. +# scripts/test-offline-build.sh (slow; not run in CI) +set -euo pipefail +cd "$(dirname "${BASH_SOURCE[0]}")/.." +CRATES=(aien-cli spark-cockpit-rs spark-inquisitor cortex-encoder-rs cortex-rs spark-supervisor spark-debugger) +WORK="$(mktemp -d "${TMPDIR:-/tmp}/aien-offline-build.XXXXXX")" +[[ -n "${KEEP:-}" ]] || trap 'rm -rf "$WORK"' EXIT +export CARGO_HOME="$WORK/cargo-home" CARGO_TARGET_DIR="$WORK/target" +# keep the toolchain from the real rustup home +export RUSTUP_HOME="${RUSTUP_HOME:-$HOME/.rustup}" +start=$SECONDS +echo "[*] cargo fetch --locked (network allowed)" +cargo fetch --locked +echo "[+] fetched in $((SECONDS - start))s" +args=(); for c in "${CRATES[@]}"; do args+=(-p "$c"); done +build=(cargo build --release --offline --locked "${args[@]}") +if unshare -rn true 2>/dev/null; then + echo "[*] building with the network namespace denied (unshare -rn)" + NETMODE="network denied (unshare -rn)" + unshare -rn "${build[@]}" +else + echo "WARNING: unshare -rn unavailable; network denial NOT enforced, only --offline was used" >&2 + NETMODE="only --offline (network denial not enforced)" + "${build[@]}" +fi +echo "PASS: offline build from a warm cargo cache (cargo fetch --locked, then --offline --locked), $NETMODE, crates: ${CRATES[*]}, $((SECONDS - start))s total" diff --git a/scripts/test-release-checks.sh b/scripts/test-release-checks.sh index 048e1840..266d1fd5 100755 --- a/scripts/test-release-checks.sh +++ b/scripts/test-release-checks.sh @@ -12,7 +12,7 @@ pass() { echo "ok: $*"; } # fixture tree T="$W/tree"; mkdir -p "$T/scripts" "$T/release" "$W/bins" cp "$ROOT/scripts/check-release-candidate.sh" "$ROOT/scripts/package-release.sh" "$ROOT/scripts/verify-release-assets.sh" "$T/scripts/" -echo constitution > "$T/CONSTITUTION.md"; echo readme > "$T/README.md"; echo '#!/bin/sh' > "$T/install.sh" +echo licence > "$T/LICENSE"; echo notice > "$T/NOTICE"; echo third > "$T/THIRD_PARTY.md"; echo constitution > "$T/CONSTITUTION.md"; echo readme > "$T/README.md"; echo '#!/bin/sh' > "$T/install.sh" OM=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa PR=bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb; CS=cccccccccccccccccccccccccccccccccccccccc; SC=dddddddddddddddddddddddddddddddddddddddd H64() { printf '%064d' "$1"; } diff --git a/scripts/test-release-real-tree.sh b/scripts/test-release-real-tree.sh index dfb3fd4b..33b9ddcd 100755 --- a/scripts/test-release-real-tree.sh +++ b/scripts/test-release-real-tree.sh @@ -33,7 +33,7 @@ cp "$ROOT/release/candidate.toml" "$T/release/"; cp "$ROOT/Cargo.lock" "$T/" # and enforced at tag time by release.yml. sed -n 's/^omega-commit = "\([0-9a-f]\{40\}\)"$/\1/p' "$T/release/candidate.toml" > "$T/omega.lock" [[ -s "$T/omega.lock" ]] || fail "release/candidate.toml has no full omega-commit" -echo constitution > "$T/CONSTITUTION.md"; echo readme > "$T/README.md"; echo '#!/bin/sh' > "$T/install.sh" +echo licence > "$T/LICENSE"; echo notice > "$T/NOTICE"; echo third > "$T/THIRD_PARTY.md"; echo constitution > "$T/CONSTITUTION.md"; echo readme > "$T/README.md"; echo '#!/bin/sh' > "$T/install.sh" for b in aien-cli spark-cockpit-rs spark-inquisitor cortex-encoder-rs cortex-rs spark-supervisor spark-debugger; do printf '#!/bin/sh\necho throwaway %s\n' "$b" > "$W/bins/$b"; chmod 755 "$W/bins/$b" done