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 / tools / aien-local-ci / desk-loop.sh
| 1 | #!/usr/bin/env 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 | # desk-loop.sh: one continuous merge desk for the Spark (2026-10-24, Queen takeover on Drake's word: |
| 18 | # "make it continuous"). |
| 19 | # |
| 20 | # Each pass: rebase-train.sh (move ready-to-merge PRs that are behind or conflict only in generated |
| 21 | # .crumb files onto main, recompile crumbs with the pinned tool, push with lease) and then one |
| 22 | # pipeline.sh round (publish signed bundles, merge ready-to-merge PRs that merge cleanly, tag Alpha builds). |
| 23 | # It never merges anything itself: pipeline.sh decides. |
| 24 | # |
| 25 | # One instance only (flock on $STATE/desk-loop.lock). Stops on $STATE/PAUSE or on removing the |
| 26 | # KEEP-RUNNING flag; the cron tick restarts it when the flag is present and nothing is running. |
| 27 | # Interval defaults to 90 s and is a floor, not a sleep loop: the two scripts take as long as they take. |
| 28 | set -u |
| 29 | STATE=${AIEN_STATE:-$HOME/.local/state/aien-local-ci} |
| 30 | L=${AIEN_LIB:-$HOME/.local/lib/aien-local-ci} |
| 31 | INTERVAL=${AIEN_DESK_INTERVAL:-90} |
| 32 | mkdir -p "$STATE" |
| 33 | exec 9>>"$STATE/desk-loop.lock" |
| 34 | flock -n 9 || { echo "desk-loop: already running"; exit 0; } |
| 35 | echo "$$" > "$STATE/desk-loop.pid" |
| 36 | trap 'rm -f "$STATE/desk-loop.pid"' EXIT |
| 37 | export PATH=$HOME/.local/bin:/usr/local/bin:/usr/bin:/bin |
| 38 | export GH_DESK_KEY=$(cat "$STATE/DESK.key" 2>/dev/null) |
| 39 | while :; do |
| 40 | [[ -e $STATE/PAUSE ]] && { echo "$(date -u +%FT%TZ) desk-loop: PAUSE present, stopping"; break; } |
| 41 | [[ -e $STATE/KEEP-RUNNING ]] || { echo "$(date -u +%FT%TZ) desk-loop: KEEP-RUNNING removed, stopping"; break; } |
| 42 | echo "$(date -u +%FT%TZ) desk-loop: pass start" |
| 43 | nice -n 10 /bin/bash "$L/rebase-train.sh" || echo "desk-loop: rebase-train exit $?" |
| 44 | nice -n 10 /bin/bash "$L/pipeline.sh" round || echo "desk-loop: pipeline round exit $?" |
| 45 | echo "$(date -u +%FT%TZ) desk-loop: pass done" |
| 46 | sleep "$INTERVAL" |
| 47 | done |