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 / docs / release / BUILD_RECIPE.md
| 1 | # Release build recipe and checks |
| 2 | |
| 3 | One recipe builds the release and one script checks it. The workflow, a person reproducing a digest and the |
| 4 | checks all use the same commands. |
| 5 | |
| 6 | ## Build |
| 7 | |
| 8 | One command materializes every pin a native build needs (sovereign-core #92, "clean checkout plus one command"): |
| 9 | |
| 10 | ``` |
| 11 | scripts/pins.sh --gpu # omega at omega.lock, physics and aienos at omega's locks, under target/pins |
| 12 | . target/pins/env.sh # AIEN_OMEGA_DIR, AIEN_OMEGA_COMPOSE_DIR, AIEN_PHYSICS_DIR, AIEN_AIENOS_LOCK_REPO, AIEN_REQUIRE_NATIVE_LIBS=1 |
| 13 | ``` |
| 14 | |
| 15 | Without `--gpu` only the composition library is linked (the CI gate shape). `scripts/pins.sh --check` verifies the |
| 16 | three checkouts are at their pins without touching the network. `AIEN_REQUIRE_NATIVE_LIBS=1` makes a build that |
| 17 | would silently fall back to a CPU stub fail instead; `scripts/golden_path.sh` sources `target/pins/env.sh` when |
| 18 | present. `scripts/test-pins.sh` is the offline self-test (throwaway repositories, no network). |
| 19 | |
| 20 | `scripts/release-build.sh` (needs the pinned toolchain from `rust-toolchain.toml`, `cargo fetch --locked` into the |
| 21 | CARGO_HOME in use, and for the native engine `AIEN_OMEGA_DIR` at `omega.lock` and `AIEN_PHYSICS_DIR` at omega's |
| 22 | `physics.lock`; `AIEN_DEV_FALLBACK` and `AIEN_FORCE_CPU_STUB` unset, no mojo on PATH): |
| 23 | |
| 24 | 1. `scripts/repro-build.sh -p spark-cockpit-rs -p spark-inquisitor -p cortex-encoder-rs -p cortex-rs -p spark-supervisor -p spark-debugger` |
| 25 | 2. `scripts/repro-build.sh -p aien-cli` |
| 26 | |
| 27 | `repro-build.sh` is `cargo build --release --locked` with `--remap-path-prefix` for CARGO_HOME and the repo root. |
| 28 | Cargo unifies features across all `-p` packages in one command, so a binary's digest depends on its group |
| 29 | (`F1-binary-digest-difference.md`: one seven-package command gives a different aien-cli). Packages are therefore built |
| 30 | in fixed groups and `aien-cli` alone and last. That aien-cli digest equals CAND-3's `aien-cli-native-release` |
| 31 | (F1, build A). The CAND-3 manifest `[build]` line lists `-p aien-cli -p aien-proof -p aien-test` in one command; |
| 32 | whether that group gives the same aien-cli digest as `-p aien-cli` alone is UNVERIFIED here, and the release does not |
| 33 | package aien-proof or aien-test. |
| 34 | |
| 35 | ## Serving engine, built in a container (DRA-43) |
| 36 | |
| 37 | `scripts/repro-container-build.sh [--plain] WORK` builds `aien-serve-http` the way the SI installer ships it: |
| 38 | `libomega_gpu.a` from omega's Makefile at `OMEGA_REV` (physics at that commit's `physics.lock`), linked through |
| 39 | `AIEN_OMEGA_GPU_LIB` and `AIEN_OMEGA_GPU_LIB_SHA256`, then `scripts/repro-build.sh -p aien-serve-http` from the core |
| 40 | tree at `CORE_REV`. It runs in the `release/repro/Dockerfile` image (ubuntu 24.04 by digest, every Ubuntu package by |
| 41 | exact `.deb` sha256, rustup-init by sha256, Rust from `rust-toolchain.toml`; CPU only, no device) with `WORK` mounted |
| 42 | at the same path, and keeps CARGO_HOME, CARGO_TARGET_DIR and HOME under `WORK`. Two runs from two `WORK` paths |
| 43 | therefore differ only in their paths, and their `WORK/out/BUILD-INFO.txt` digests must be equal. `--plain` is the |
| 44 | negative control: the same build with plain `cargo build --release --locked` (no `--remap-path-prefix`), whose |
| 45 | digests differ between paths. |
| 46 | |
| 47 | For SI alpha-20261029.1 (core `59b05a71`, omega `6de999da`, physics `6d7cf0d4`), runs from two paths gave |
| 48 | `libomega_gpu.a` `110295ef23dc7561eea371636347c005835f37b82c22f92401aa8a887a3ca990` (the shipped library) and |
| 49 | `aien-serve-http` `b6e971976e2fb7d2ae8a6b07d8a015a1f09b4192d4e6fcaa4154ad2a5187575f` both times; the `--plain` runs |
| 50 | gave `9555c030...` and `7781ae77...`. The remapped engine is not the shipped `19173f9e...`: that binary carries |
| 51 | 241 `/home/.../.cargo/registry/src` paths, which the remap replaces with `/cargo/registry/src`. |
| 52 | |
| 53 | Ubuntu packages (DRA-108): `release/repro/apt-packages.in` names the eight packages the image needs. |
| 54 | `release/repro/apt-lock.sh SNAPSHOT` resolves them, with every dependency apt pulls in, against one |
| 55 | snapshot.ubuntu.com timestamp (which carries arm64) and writes `apt-packages.lock` (package, version, architecture, |
| 56 | sha256, size and pool path of each `.deb`, each sha256 checked against the signed snapshot index) and |
| 57 | `dpkg-manifest.tsv` (the whole image's `dpkg-query` listing). The image build reads no apt index: |
| 58 | `apt-install.sh` fetches each file from that snapshot, else ports.ubuntu.com, else Launchpad's archive file store, |
| 59 | accepts it only at the locked sha256, and fails unless the image's package listing equals `dpkg-manifest.tsv`. |
| 60 | The image tag in `repro-container-build.sh` hashes the Dockerfile and these three files. To move the toolchain, |
| 61 | rerun `apt-lock.sh` with a newer snapshot and rebuild; the engine sha256 then has to be re-established. The lock is at |
| 62 | snapshot `20261031T120000Z` (64 packages, the versions of the 2026-10-31 build); two clean rebuilds from it on |
| 63 | 2026-11-04 gave `aien-serve-http` `6fb04197...` both times (RECHECK.md, recheck-transcripts/2026-11-04-pinned-*.txt). |
| 64 | |
| 65 | `REPRO_MEMORY` (for example `3g`) caps the container's memory and swap. [release/repro/RECHECK.md](../../release/repro/RECHECK.md) |
| 66 | is the outsider recheck kit for the engine SI pins (core `d3dec0eb`, `aien-serve-http` `6fb04197...`): every receipt |
| 67 | field the Crumb Doctrine requires, and the exact commands, with public URLs only. |
| 68 | |
| 69 | ## Package and check |
| 70 | |
| 71 | - `scripts/package-release.sh <out.tar.gz>` runs the release gate itself and writes the candidate id and `[model]` |
| 72 | table from `release/candidate.toml` into `release.toml`. A failing gate means no package (`AIEN_DRY_RUN=1` only |
| 73 | labels it `NOT-RELEASABLE`, which the checks reject). |
| 74 | - `scripts/check-release-candidate.sh` (tree): candidate named, `omega.lock` equals `omega-commit`, `Cargo.lock` |
| 75 | holds exactly the `[pins]` revisions (aien-protocols, crumb-spec, spark-crumbs), `[model]` complete. |
| 76 | - `scripts/check-release-candidate.sh --package A.tar.gz --native`: candidate id, `[model]` table (model id, |
| 77 | safetensors, tokenizer, config, oracle fixture digests), `aien-cli-sha256` equals the digest of `bin/aien`, every |
| 78 | listed file, no unlisted file; `--native` is required (linux aarch64, omega linked): the digest must equal |
| 79 | `[executables] aien-cli-native-release`, and each helper binary must equal its `sc-<name>` entry. A package without `--native` is refused (no candidate digest for that kind); the release matrix builds only the native target. |
| 80 | - `scripts/verify-release-assets.sh <dir> <allowed_signers>`: signature on `SHA256SUMS.txt` valid for the pinned |
| 81 | signer, every listed file matches, every `sovereign-*` archive is covered. |
| 82 | - `scripts/release-publish-gate.sh <dir> <allowed_signers>`: the stage-3 publish decision (see `RELEASE_SIGNING.md`). |
| 83 | - `scripts/test-release-checks.sh` (also in CI) proves each of these rejects: wrong omega.lock or Cargo.lock pins, |
| 84 | executable digest mismatch, model input mismatch, missing, corrupt or foreign signature, tampered files. |
| 85 | |
| 86 | ## Release workflow modes |
| 87 | |
| 88 | - Tag push `v*` (stage 1 of the offline-signing handoff, `RELEASE_SIGNING.md`): build, check, write `SHA256SUMS.txt` |
| 89 | and create a DRAFT release holding the archives and checksums. No signature is made in CI and no key is in CI or a |
| 90 | secret. The draft is not public. A manual run with `dry_run` false does the same, and only from a `v*` tag. |
| 91 | - Stage 2, the operator, offline: sign `SHA256SUMS.txt` with the public-release key (`scripts/key-ceremony.sh sign`) |
| 92 | and attach `SHA256SUMS.txt.sig` to the draft. |
| 93 | - Stage 3, `release-publish.yml` (manual, input `tag`): checks out the tag, downloads the draft, runs |
| 94 | `scripts/release-publish-gate.sh` against that commit's `docs/release/allowed_signers` and publishes only if it |
| 95 | passes. It refuses unsigned, mismatched, dry-run, internal-test-key and placeholder-key releases. |
| 96 | - Manual run (`workflow_dispatch`): input `dry_run`, default true. Builds, packages with the manifest labelled |
| 97 | `dry-run = true`, checks, writes `DRY-RUN-NOT-A-RELEASE.txt` into the signed checksum list, signs with a throwaway |
| 98 | key generated in the job (public half uploaded as `dry-run-signers`, private half deleted), verifies, shows that the |
| 99 | publish gate refuses it, uploads workflow artifacts only. Gate or package-check failures are recorded in |
| 100 | `DRY-RUN-STATUS-<target>.txt` instead of stopping the run. It never creates a release. Installed with |
| 101 | `AIEN_DRY_RUN_SIGNERS=dry-run-signers`, it is recorded as `signature_check: dry-run-key`. |
| 102 | - Pull requests (`release-dry-run.yml`): the publish guard, `scripts/test-release-gate-wiring.sh` and the refusal suite |
| 103 | (`scripts/test-release-real-tree.sh`, run on a fixture tree pinned to the candidate) block. The tree gate on the PR's |
| 104 | own revision only reports "IS / is NOT releasable as <candidate>" in the step summary: main may move ahead of the |
| 105 | candidate's omega-commit. A release must be cut from a commit whose tree passes the gate; the tag-push path enforces |
| 106 | it, and `test-release-gate-wiring.sh` fails if that step ever becomes non-blocking (only the manual dry run may |
| 107 | continue past it). |