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 / tests / gates / step-home.sh
| 1 | # shellcheck shell=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 | # tests/gates/step-home.sh: sourced, defines functions only. The per-step HOME of tests/gates/run.sh |
| 18 | # and the checkpoint location it must not hide, in one place so scripts/gb10-serve-chat.sh and its |
| 19 | # host test scripts/test-gb10-model-dir.sh run the same code as the gate (sc#760 review). |
| 20 | |
| 21 | GB10_MODEL=qwen3.8-27b-fp8-017b9c7a |
| 22 | |
| 23 | # step_home: GitHub runners give every job a writable HOME; the sandbox's HOME (/var/lib/aien-run) is |
| 24 | # read-only on purpose. Tools that write under HOME (Chrome's crash database in aien-cli's browser_mirror |
| 25 | # test, which otherwise dies with SIGTRAP) get a fresh one for this step. The sandbox's git settings come |
| 26 | # along: its .gitconfig trusts the operator-owned checkout (safe.directory), and without it git refuses |
| 27 | # the tree ("not inside a git repository"). CARGO_HOME and RUSTUP_HOME are set by the sandbox and do not |
| 28 | # follow HOME. A writable HOME is left as it is. |
| 29 | step_home() { |
| 30 | local ro_home |
| 31 | if [ -z "${HOME:-}" ] || [ -w "$HOME" ]; then return 0; fi |
| 32 | ro_home="$HOME" |
| 33 | HOME="$(mktemp -d)"; export HOME |
| 34 | trap 'rm -rf "$HOME"' EXIT |
| 35 | if [ -f "$ro_home/.gitconfig" ]; then cp "$ro_home/.gitconfig" "$HOME/.gitconfig"; fi |
| 36 | # The miri sysroot that install.sh prebuilt under the read-only HOME (#600) stays the one miri uses; |
| 37 | # the fresh HOME would otherwise send `cargo miri setup` off to rebuild it offline, which cannot work. |
| 38 | if [ -z "${MIRI_SYSROOT:-}" ] && [ -d "$ro_home/.cache/miri/lib" ]; then |
| 39 | MIRI_SYSROOT="$ro_home/.cache/miri"; export MIRI_SYSROOT |
| 40 | fi |
| 41 | step_home_models "$ro_home" |
| 42 | } |
| 43 | |
| 44 | # step_home_models RO_HOME: the operator's checkpoints are mounted read-only at the sandbox home's |
| 45 | # models/ (aien-run-exec); a model gate looks there, not in the fresh HOME (2026-10-25: |
| 46 | # SC-GB10-SERVE-CHAT reported model_missing under /tmp/tmp.*/models on the first Alpha judge of #751). |
| 47 | step_home_models() { |
| 48 | if [ -z "${AIEN_MODELS_DIR:-}" ] && [ -d "$1/models" ]; then |
| 49 | AIEN_MODELS_DIR="$1/models"; export AIEN_MODELS_DIR |
| 50 | fi |
| 51 | } |
| 52 | |
| 53 | # gb10_model_dir: sets MODEL_DIR to the Qwen3.8-27B checkpoint SC-GB10-SERVE-CHAT serves and |
| 54 | # MODEL_DIR_SOURCE to where that came from, for the receipt: override (MODEL_DIR was set by the |
| 55 | # caller), models-mount (AIEN_MODELS_DIR, which step_home sets), home ($HOME/models). |
| 56 | gb10_model_dir() { |
| 57 | if [ -n "${MODEL_DIR:-}" ]; then |
| 58 | MODEL_DIR_SOURCE=override |
| 59 | elif [ -n "${AIEN_MODELS_DIR:-}" ]; then |
| 60 | MODEL_DIR="$AIEN_MODELS_DIR/$GB10_MODEL"; MODEL_DIR_SOURCE=models-mount |
| 61 | else |
| 62 | MODEL_DIR="$HOME/models/$GB10_MODEL"; MODEL_DIR_SOURCE=home |
| 63 | fi |
| 64 | } |