Files
alzeo/.github/workflows/ci.yml
T
Hasan BasbunarandClaude Opus 5.5 7f458a89bf DaisyRose 27B as a sixth target of the 27B lane (daisyrose)
RadixArk/DaisyRose-27B-NVFP4 @ c4d85c5, RadixArk's reinforcement-learning-only fine-tune of Qwen3.8-27B (Apache-2.0, no SFT and no distillation), in RadixArk's own NVFP4 of the 27B (MIXED_PRECISION, 401 layers: 208 FP8 and 193 NVFP4, identical layer to layer to RadixArk/Qwen3.8-27B-NVFP4; same architecture, tokenizer and chat template, byte for byte, 21.95 GB; its config loads with the lane image's transformers 5.19.0). Nothing measured on the reference box yet; RadixArk publishes Terminal-Bench 2.1 at 75.5 against 73.0 for Qwen3.8-27B (xhigh reasoning). Pinned where arete is: install.sh, switch-model.sh, run.sh, prepare-lane.sh, check-pins.sh, mirror-pins.sh (MIRROR.md, not yet checked), uninstall.sh, lane_registry.py, boxmem.py (a 64 GB box takes it: 21.95 GB, RadixArk's size), the CI's pin contracts and limits. Served by stock's unit with no --kv-cache-dtype: like arete, its checkpoint declares no KV cache either, so its switch and install.sh's apply_context_configs run patch-kv.py after the window's configs, and run.sh refuses it undeclared. Its limits are the 27B's (oc-limits.sh), opencode names it "DaisyRose-27B NVFP4 + DFlash2", the cockpit offers it as a sixth version (DaisyRose 27B NVFP4, RadixArk) with its recipe, pin and switch. stock stays the default. Tests that fail on the code before: test_daisyrose_target (new, 11), the target lists of test_boxmem, test_spark_64, test_target_names, test_recipes, test_page_behaviour, test_cockpit_box, test_install_oc_artifact (DaisyRose's name under a flash install), test_check_pins and test_mirror_pins (one checkpoint more), each run alone with python3 -m unittest.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 23:20:17 +01:00

1819 lines
124 KiB
YAML

name: ci
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
# The jobs run side by side, each on a runner of its own: the hour this took as one job was the
# sum of its steps (4,312 s for v1.40.3, 1,869 of them the pass that ran every module of tests/
# in one process, which runs them in groups since 2026-11-10, tests/run_single.py). `checks`,
# last, keeps the one name a reader or a script looks for.
# Every job runs on ubuntu-24.04-arm, the architecture of the boxes this repo serves (aarch64).
static:
# Every check that reads the tree: syntax, lint, templates, fixtures, pins, the small scripts.
# Named, not ubuntu-latest: that label moves to Ubuntu 26 from 2026-10-19 (GitHub's notice on
# the run of 2026-10-02), and a new image, its python and its browser, is a change this suite
# is asked to pass on purpose, in a commit of its own.
runs-on: ubuntu-24.04-arm
steps:
# v5 runs on Node 24; v4 targets Node 20, which the runners deprecate (same run)
- uses: actions/checkout@v5
# Node 24, the reference box's. The arm64 image's own is 20, and the x86 image this suite ran on
# before had 22 (their inventories, 2026-10-28). Every job that runs node has this step.
- uses: actions/setup-node@v7
with:
node-version: '24'
- name: Shell syntax
run: |
# Every tracked shell script, found rather than listed: the hand-kept list left
# out seven, install-image.sh among them, which ./install.sh --with-image runs and
# whose tests stop before its end (found in review, 2026-09-24).
files=$(git ls-files | while read -r f; do case "$f" in
*.sh) echo "$f" ;;
*.template|*.md|*.py|*.js|*.json|*.html|*.css|*.txt) ;;
*) [ -f "$f" ] && head -1 "$f" | grep -qE '^#!.*\b(ba)?sh\b' && echo "$f" ;;
esac; done)
[ "$(echo "$files" | wc -l)" -ge 21 ] || { echo "found only: $files"; exit 1; }
for f in $files; do bash -n "$f"; done
echo "$(echo "$files" | wc -l) scripts parse"
- name: Every step keeps its scratch files under TMPDIR
run: |
# ci-local.sh runs each step with a TMPDIR inside the throwaway HOME it removes
# afterwards. A step that wrote a fixed name in the system temporary directory
# left it on the developer's box after every run (the coverage reports, the
# rendered units, the opencode test config: 2026-10-03), and two runs side by
# side wrote over each other's. A runner sets no TMPDIR, so the fallback stays
# where it was. Every workflow, not this one alone: tests/test_check_pins.py runs
# pin-watch's step as written, and its pins.txt was left behind the same way.
# The needle is assembled, or this step would find itself.
python3 - <<'PY'
import pathlib, sys
needle = "/" + "tmp"
allowed = "${TMPDIR:-" + needle + "}"
bad = [f" {wf.name}:{n}: {line.strip()}"
for wf in sorted(pathlib.Path(".github/workflows").glob("*.yml"))
for n, line in enumerate(wf.read_text().splitlines(), 1)
if needle in line.replace(allowed, "")]
if bad:
print(f"a step names a fixed path in {needle}; write it under \"{allowed}\" instead:")
print("\n".join(bad))
sys.exit(1)
print("every step keeps its scratch files under TMPDIR")
PY
- name: shellcheck (warning severity)
run: |
files=$(git ls-files | while read -r f; do case "$f" in
*.sh) echo "$f" ;;
*.template|*.md|*.py|*.js|*.json|*.html|*.css|*.txt) ;;
*) [ -f "$f" ] && head -1 "$f" | grep -qE '^#!.*\b(ba)?sh\b' && echo "$f" ;;
esac; done)
[ "$(echo "$files" | wc -l)" -ge 21 ] || { echo "found only: $files"; exit 1; }
shellcheck -S warning $files
- name: opencode plugin syntax (node)
run: node --check extras/opencode/auto-continue.js
- name: Python correctness (ruff F,E9 + compile)
run: |
pip install 'ruff==0.5.0'
# Every tracked .py but the vendored SGLang overlay, from git: the hand-kept list
# left out engine-inputs.py and oc-merge-limits.py, both run by install.sh (found in
# review, 2026-09-24).
py=$(git ls-files '*.py' ':!flash-sglang/')
[ "$(echo "$py" | wc -l)" -ge 100 ] || { echo "found only: $py"; exit 1; }
ruff check --select F,E9 $py
python3 -m py_compile patch-template.py patch-yarn.py patch-kv.py keepalive-proxy.py engine-inputs.py oc-merge-limits.py oc-point-default.py oc-fit-limits.py bench-agent.py conc-check.py build-token-map.py tools-check.py systemone-check.py bench-systemone.py evals/mmlu.py evals/humaneval.py flash-sglang/qwen4_exp.py flash-sglang/qwen_sparse_attn_backend.py flash-sglang/sm121_varlen.py dashboard/cockpit.py dashboard/lifecycle.py dashboard/recipes.py dashboard/registry.py dashboard/agent_relay.py
- name: Pin contracts (every consumer's own block runs against install.sh)
run: |
scratch="${TMPDIR:-/tmp}" # ci-local.sh gives each step its own; a runner has none
n=$(grep -cE '^(IMAGE|STOCK_REPO|STOCK_REV|UNC_REPO|UNC_REV|FP8_REPO|FP8_REV|UNCFP8_REPO|UNCFP8_REV|ARETE_REPO|ARETE_REV|DAISYROSE_REPO|DAISYROSE_REV|MODEL_CHOICE|CONTEXT_MODE|DRAFT2_REPO|DRAFT2_REV|DRAFT2_QUANT|DRAFT2_TOKENS|SERVE_IMAGE|PORT|HF_CACHE|CONFIG_DIR)=' install.sh)
[ "$n" -eq 23 ] || { echo "run.sh pin contract broken: $n != 23"; exit 1; }
n=$(grep -cE '^(IMAGE|STOCK_REPO|STOCK_REV|UNC_REPO|UNC_REV|FP8_REPO|FP8_REV|UNCFP8_REPO|UNCFP8_REV|ARETE_REPO|ARETE_REV|DAISYROSE_REPO|DAISYROSE_REV|FLASH_REPO|FLASH_REV|FLASH_IMAGE|FLASH_SERVE_IMAGE|MODEL_CHOICE|HF_CACHE|CONFIG_DIR)=' install.sh)
[ "$n" -eq 20 ] || { echo "switch-model.sh pin contract broken: $n != 20"; exit 1; }
# This check must mirror the grep switch-model.sh actually runs, or a
# renamed pin passes CI and breaks the switch at runtime. It did: the
# four FP8 names were read by the script and guarded by nothing.
# What makes a pin reach switch-model.sh is its presence in that
# script's own PINS grep, which eval defines. Testing for the name
# anywhere in the file proves nothing: it also appears in the case
# arms that consume it.
SW_PAT="$(grep -E '^PINS=' switch-model.sh)"
for v in IMAGE STOCK_REPO STOCK_REV UNC_REPO UNC_REV FP8_REPO FP8_REV \
UNCFP8_REPO UNCFP8_REV ARETE_REPO ARETE_REV DAISYROSE_REPO DAISYROSE_REV FLASH_REPO FLASH_REV FLASH_IMAGE \
FLASH_SERVE_IMAGE MODEL_CHOICE HF_CACHE CONFIG_DIR; do
grep -qE "^$v=" install.sh || { echo "install.sh no longer defines $v"; exit 1; }
case "|$SW_PAT|" in
*"|$v|"*|*"($v|"*|*"|$v)"*) ;;
*) echo "switch-model.sh PINS grep no longer selects $v"; exit 1 ;;
esac
done
# Run each consumer's OWN pin block against the real install.sh, under
# set -u, and let its own name check speak. Two bugs shipped past a gate
# that only counted matching lines: a hardcoded count that adding a pin
# broke in both scripts, and an eval of an assignment interpolating
# another pin the grep did not select, which is unbound under set -u.
# A count sees neither; running the block sees both.
for consumer in run.sh switch-model.sh; do
awk '/^PINS=/{p=1} p{print} p && /^unset _v$/{exit}' "$consumer" > "$scratch/pinblock.sh"
[ -s "$scratch/pinblock.sh" ] || { echo "$consumer: no PINS block found"; exit 1; }
{ echo 'die() { echo "$*" >&2; exit 1; }'; cat "$scratch/pinblock.sh"; } > "$scratch/pincheck.sh"
REPO_DIR=. bash -euo pipefail "$scratch/pincheck.sh" \
|| { echo "$consumer: its own pin block does not run against install.sh"; exit 1; }
done
PINS="$(grep -E '^(IMAGE|STOCK_REPO|STOCK_REV|UNC_REPO|UNC_REV|MODEL_CHOICE|CONTEXT_MODE|DRAFT_REPO|DRAFT_REV|DRAFT2_REPO|DRAFT2_REV|SERVE_IMAGE|PORT|HF_CACHE|CONFIG_DIR)=' install.sh)"
eval "$PINS"
# one test per line: under bash -e an && list fails the step on its last test only,
# so two empty revisions went through (found in review, 2026-09-24)
[ -n "$UNC_REV" ] || { echo "UNC_REV is empty in install.sh"; exit 1; }
[ -n "$STOCK_REV" ] || { echo "STOCK_REV is empty in install.sh"; exit 1; }
[ "$MODEL_CHOICE" = "stock" ] || { echo "MODEL_CHOICE defaults to $MODEL_CHOICE, not stock"; exit 1; }
# CONTEXT_MODE is deliberately EMPTY here since v1.12.1. The pins at
# the top of install.sh are read by run.sh and switch-model.sh, which
# is why this block evals them, and the context mode is no longer one
# of them: empty means "not chosen yet", and the default (1m on the
# 27B lane) is resolved further down the installer, where the lane and
# --no-service are known. A value here would be the old bug back, a
# default decided above the flags that have to shape it.
[ -z "$CONTEXT_MODE" ] || { echo "CONTEXT_MODE must default to empty, got '$CONTEXT_MODE'"; exit 1; }
grep -q 'CONTEXT_MODE=1m$' install.sh || { echo "install.sh no longer resolves a 1m default"; exit 1; }
PINS_F="$(grep -E '^(FLASH_REPO|FLASH_REV|FLASH_IMAGE|FLASH_SERVE_IMAGE)=' install.sh)"
eval "$PINS_F"
[ "${#FLASH_REV}" -eq 40 ] || { echo "FLASH_REV is not a 40-char sha"; exit 1; }
case "$FLASH_IMAGE" in *@sha256:*) ;; *) echo "FLASH_IMAGE is not digest-pinned"; exit 1 ;; esac
# Every flash target must resolve to the flash lane, or install.sh would
# render a 27B unit for a 126 GiB checkpoint.
grep -qE '^ *flash\|flash-nvda\|flash-uncensored\) LANE=flash' install.sh \
|| { echo "install.sh: a flash target no longer selects the flash lane"; exit 1; }
# switch-model.sh rewrites the launcher's per-checkpoint flags in place, so
# its two strings must be install.sh's FLASH_QUANT_ARGS character for
# character. They drifted once: the switch dropped the draft's
# quantization when returning to the NVFP4 tree, which loads BF16 MTP
# tensors as if they were quantized, silently.
for pair in "flash-nvda" "flash\\|flash-uncensored"; do
inst=$(grep -A2 -E "^ *$pair\)$|^ *$pair\) " install.sh | sed -n 's/.*FLASH_QUANT_ARGS="\([^"]*\)".*/\1/p' | head -1)
[ -n "$inst" ] || { echo "install.sh: no FLASH_QUANT_ARGS for $pair"; exit 1; }
grep -qF "NEW_QUANT=\"$inst\"" switch-model.sh \
|| { echo "switch-model.sh does not carry install.sh's flags for $pair: [$inst]"; exit 1; }
done
# Same invariant on the 27B lane, and the direction that matters is the
# harmful one: a switch to Qwen's FP8 release that drops the flag serves
# a bf16 KV cache and half the pool (771,139 tokens against 382,706,
# measured). Until 2026-09-08 the switch did not rewrite this at all.
kvi=$(grep -oE 'fp8\|uncensored-fp8\) +KV_CACHE_ARGS="[^"]*"' install.sh | sed -n 's/.*KV_CACHE_ARGS="\([^"]*\)".*/\1/p' | head -1)
[ -n "$kvi" ] || { echo "install.sh: no KV_CACHE_ARGS for the fp8 pair"; exit 1; }
grep -qF "NEW_KV=\"$kvi\"" switch-model.sh \
|| { echo "switch-model.sh does not carry install.sh's KV args: [$kvi]"; exit 1; }
grep -q 'rewrite_27b_unit "$TARGET_UNIT"' switch-model.sh \
|| { echo "the 27B switch no longer goes through rewrite_27b_unit"; exit 1; }
- name: Every downloaded checkpoint is one something actually serves
run: |
# The DSpark drafter was fetched by every 27B install for six releases
# after DFlash2 replaced it: 6 GB and minutes of download that no
# serving path referenced, and run.sh refused to start without it.
# Downloads and serving must not drift apart again.
# (install.sh fetches each through ckpt-fetch.py, one dl_fetch call per repo, since v1.31;
# indented since v1.33, under the guard of a lane installed on demand, which fetches none)
dl=$(grep -oE '^[[:space:]]*dl_fetch "\$DL_[A-Z0-9_]+_REPO"' install.sh \
| grep -oE 'DL_[A-Z0-9_]+_REPO' | sed 's/^DL_//' | sort -u)
echo "downloaded: $dl"
[ "$(echo "$dl" | wc -l)" -eq 2 ] || { echo "expected exactly MODEL_REPO and DRAFT2_REPO"; exit 1; }
echo "$dl" | grep -qx MODEL_REPO || { echo "the target model is not downloaded"; exit 1; }
echo "$dl" | grep -qx DRAFT2_REPO || { echo "the served drafter is not downloaded"; exit 1; }
# and the drafter that IS downloaded must be the one the units serve.
# Since v1.9 the 27B templates carry the draft as placeholders (the
# depth and quantization are pins too), so resolve both symbolic
# shapes against install.sh before comparing.
pin_repo=$(sed -n 's/^DRAFT2_REPO="${DRAFT2_REPO:-\(.*\)}"$/\1/p' install.sh)
[ -n "$pin_repo" ] || { echo "install.sh: DRAFT2_REPO has no literal default"; exit 1; }
served=$(grep -hoE -- '--speculative-draft-model-path [^ \\]+' \
qwen38-sglang.service.template qwen38-sglang-1m.service.template run.sh \
| awk '{print $2}' \
| sed -e "s|__DRAFT2_REPO__|$pin_repo|" -e "s|\"\$DRAFT2_REPO\"|$pin_repo|" \
| sort -u)
[ "$(echo "$served" | wc -l)" -eq 1 ] || { echo "27B paths disagree on the drafter: $served"; exit 1; }
[ "$served" = "$pin_repo" ] \
|| { echo "the units serve $served but DRAFT2_REPO defaults to $pin_repo"; exit 1; }
# nothing may serve a checkpoint the installer never fetches
! grep -qE -- '--speculative-draft-model-path .*DSpark' \
qwen38-sglang.service.template qwen38-sglang-1m.service.template run.sh \
|| { echo "a 27B path serves DSpark, which is no longer downloaded"; exit 1; }
- name: Unit templates render with no leftover placeholder
run: |
scratch="${TMPDIR:-/tmp}" # ci-local.sh gives each step its own; a runner has none
render() {
sed -e "s|__HOME__|/home/u|g" -e "s|__USER__|u|g" -e "s|__GROUP__|u|g" \
-e "s|__PORT__|30000|g" -e "s|__PROXY_PORT__|30001|g" -e "s|__IMAGE__|img:v|g" \
-e "s|__ENGINE_BIND__|0.0.0.0|g" -e "s|__PROXY_BIND__|0.0.0.0|g" \
-e "s|__HF_CACHE__|/hf|g" -e "s|__DRAFT2_REV__|deadbeef|g" -e "s|__DRAFT2_REPO__|org/draft|g" -e "s|__DRAFT2_QUANT__|modelopt_fp4|g" -e "s|__DRAFT2_TOKENS__|16|g" -e "s|__PLE_DIR__|/ple|g" -e "s|__PROMPT_CEILING__|0|g" -e "s|__FLASH_PROMPT_CEILING__|250000|g" \
-e "s|__KV_CACHE_ARGS__||g" -e "s|__MODEL_REV_ARGS__|--revision cafe|g" -e "s|__MODEL_REV__|cafe|g" -e "s|__MODEL__|org/repo|g" \
-e "s|__FLASH_QUANT_ARGS__|--quantization modelopt_fp4 --speculative-draft-model-quantization unquant |g" \
-e "s|__FLASH_MEM_FRACTION__|0.85|g" -e "s|__PLE_RSS_BUDGET_GB__|8|g" \
-e "s|__SPEC_TOKEN_MAP_LINE__|TIER+=(--speculative-token-map /out/token-map-65536.pt)|g" \
-e "s|__FLASH_TIER_ARGS__|--max-running-requests 4 --max-mamba-cache-size 20 --mamba-radix-cache-strategy extra_buffer --speculative-algorithm NEXTN --speculative-num-steps 3 --speculative-eagle-topk 1 --speculative-num-draft-tokens 4|g" "$1"
}
for t in qwen38-sglang.service.template qwen38-sglang-1m.service.template qwen38-flash.service.template qwen38-keepalive.service.template; do
render "$t" > "$scratch/unit.rendered"
if grep -q '__[A-Z][A-Z0-9_]*__' "$scratch/unit.rendered"; then
echo "unsubstituted placeholder in $t:"; grep '__[A-Z][A-Z0-9_]*__' "$scratch/unit.rendered"; exit 1
fi
done
- name: No document ships a placeholder nobody filled in
run: |
# The same failure as an unsubstituted unit template, one directory up. The
# System One work left <MUTATION_SENTENCE> in TESTING.md and <PHASE3_MUTATION>
# under an empty "Mutation score of the block" heading in BENCHMARKS.md: a
# measurement that was going to be pasted in and never was. A reader cannot
# tell that from a sentence that is merely missing, so the gate is here.
hits=$(grep -rnE '<[A-Z][A-Z0-9_]{2,}>' --include='*.md' . || true)
if [ -n "$hits" ]; then
echo "a document still carries an unfilled placeholder:"; echo "$hits"; exit 1
fi
- name: Unit templates keep the flags their lane is measured with
run: |
scratch="${TMPDIR:-/tmp}" # ci-local.sh gives each step its own; a runner has none
render() {
sed -e "s|__HOME__|/home/u|g" -e "s|__USER__|u|g" -e "s|__GROUP__|u|g" \
-e "s|__PORT__|30000|g" -e "s|__PROXY_PORT__|30001|g" -e "s|__IMAGE__|img:v|g" \
-e "s|__ENGINE_BIND__|0.0.0.0|g" -e "s|__PROXY_BIND__|0.0.0.0|g" \
-e "s|__HF_CACHE__|/hf|g" -e "s|__DRAFT2_REV__|deadbeef|g" -e "s|__DRAFT2_REPO__|org/draft|g" -e "s|__DRAFT2_QUANT__|modelopt_fp4|g" -e "s|__DRAFT2_TOKENS__|16|g" -e "s|__PLE_DIR__|/ple|g" -e "s|__PROMPT_CEILING__|0|g" -e "s|__FLASH_PROMPT_CEILING__|250000|g" \
-e "s|__KV_CACHE_ARGS__||g" -e "s|__MODEL_REV_ARGS__|--revision cafe|g" -e "s|__MODEL_REV__|cafe|g" -e "s|__MODEL__|org/repo|g" \
-e "s|__FLASH_QUANT_ARGS__|$FLASH_QUANT_ARGS|g" \
-e "s|__FLASH_MEM_FRACTION__|$FLASH_MEM_FRACTION|g" -e "s|__PLE_RSS_BUDGET_GB__|8|g" \
-e "s|__SPEC_TOKEN_MAP_LINE__|$SPEC_TOKEN_MAP_LINE|g" \
-e "s|__FLASH_TIER_ARGS__|$FLASH_TIER_ARGS|g" "$1"
}
# The flash values the installer really renders, read from install.sh itself.
# They were literals written here, so the greps below checked this step's own
# strings: a 0.95 fraction, a tier that truncates, or one without
# --speculative-eagle-topk 1 in install.sh all stayed green (found in review,
# 2026-09-24).
eval "$(sed -n '/^resolve_flash_checkpoint_args() {/,/^}/p' install.sh)"
eval "$(sed -n '/^resolve_flash_tier_args() {/,/^}/p' install.sh)"
eval "$(grep -E '^(FLASH_MEM_FRACTION|FLASH_REPLAYSSM_SPEC|SPEC_TOKEN_MAP_SIZE|TOKEN_MAP_NAME)=' install.sh)"
eval "$(grep -oE 'SPEC_TOKEN_MAP_LINE="TIER\+=\(--speculative-token-map /out/\$TOKEN_MAP_NAME\)"' install.sh)"
MODEL_CHOICE=flash; resolve_flash_checkpoint_args
FLASH_TIER=context; resolve_flash_tier_args >/dev/null
[ -n "$FLASH_TIER_ARGS" ] && [ -n "$FLASH_QUANT_ARGS" ] && [ -n "$SPEC_TOKEN_MAP_LINE" ] \
|| { echo "could not read the flash values out of install.sh"; exit 1; }
render qwen38-sglang-1m.service.template | grep -q -- '--context-length 1010000'
render qwen38-sglang-1m.service.template | grep -q 'HF_HUB_OFFLINE=1'
render qwen38-sglang.service.template | grep -q 'Restart=always'
# The FP8 pair must ask for an fp8 KV cache and the NVFP4 pair must not:
# Qwen's FP8 checkpoint carries no KV scales, so without the flag the KV
# cache falls back to bf16 and costs about half the pool (measured: 771,139
# with, 382,706 without, same 1m unit). The NVFP4 checkpoints get it from
# their own quant config and must stay untouched.
kv() { sed -e "s|__KV_CACHE_ARGS__|$2|g" "$1" | grep -c -- '--kv-cache-dtype fp8_e4m3' || true; }
for t in qwen38-sglang.service.template qwen38-sglang-1m.service.template; do
[ "$(kv "$t" '--kv-cache-dtype fp8_e4m3 ')" -eq 1 ] || { echo "$t: FP8 render lost the fp8 KV cache"; exit 1; }
[ "$(kv "$t" '')" -eq 0 ] || { echo "$t: NVFP4 render must not force a KV dtype"; exit 1; }
grep -q '__KV_CACHE_ARGS__' "$t" || { echo "$t: lost the KV cache placeholder"; exit 1; }
done
for f in install.sh run.sh; do
grep -qE 'fp8\|uncensored-fp8\) +KV_CACHE_ARGS="--kv-cache-dtype fp8_e4m3' "$f" \
|| { echo "$f: the fp8 targets no longer request an fp8 KV cache"; exit 1; }
done
# Flash: the unit is a thin pointer at the rendered launch script
# (an argument in ExecStart bash -c would go through systemd's own
# unescaping first, learned live on the reference box). The GB10 and
# correctness-critical serving flags live in the launch template and
# must never regress (see flash-sglang/ATTRIBUTION.md for each one).
render qwen38-flash.service.template > "$scratch/flash-unit.rendered"
grep -q 'Restart=always' "$scratch/flash-unit.rendered"
grep -q 'launch-flash.sh' "$scratch/flash-unit.rendered"
render qwen38-flash-launch.sh.template > "$scratch/flash.rendered"
if grep -q '__[A-Z][A-Z0-9_]*__' "$scratch/flash.rendered"; then echo "unsubstituted placeholder in the flash launcher:"; grep '__[A-Z][A-Z0-9_]*__' "$scratch/flash.rendered"; exit 1; fi
bash -n "$scratch/flash.rendered"
# The table must be file-backed: pinned host RAM is the upstream default and
# frees nothing on unified memory, so a launcher that lost this pair does not
# boot at all on a 128 GB box (sglang#37068).
grep -q -- '--ple-offload-embedding --ple-offload-backend file' "$scratch/flash.rendered"
grep -q -- '--ple-offload-dir /ple' "$scratch/flash.rendered"
grep -q -- '--mamba-radix-cache-strategy extra_buffer' "$scratch/flash.rendered"
grep -q -- '--speculative-algorithm NEXTN' "$scratch/flash.rendered"
grep -q -- '--speculative-eagle-topk 1' "$scratch/flash.rendered"
grep -q -- '--chunked-prefill-size 4096' "$scratch/flash.rendered"
grep -q -- '--page-size 64' "$scratch/flash.rendered"
grep -q -- '--fp4-gemm-backend flashinfer_cutlass' "$scratch/flash.rendered"
grep -q -- '--mem-fraction-static 0.85' "$scratch/flash.rendered"
grep -q -- '--max-mamba-cache-size' "$scratch/flash.rendered"
grep -q -- '--speculative-token-map /out/token-map-65536.pt' "$scratch/flash.rendered"
# No --allow-auto-truncate, ever. A prompt above the window must come back
# as an error, not as a confident answer from a context the engine quietly
# cut: probed 2026-09-13, an over-long prompt returned prompt_tokens exactly
# equal to max_req_input_len (262,138) with the needle gone and no warning.
# The keepalive proxy refuses above the lane's ceiling with a clear 400, so
# the flag only ever bought silence.
for f in qwen38-flash-launch.sh.template qwen38-sglang.service.template \
qwen38-sglang-1m.service.template run.sh; do
# comments are allowed to name the flag; a live line is not
! grep -v '^[[:space:]]*#' "$f" | grep -q -- '--allow-auto-truncate' \
|| { echo "$f truncates an over-long prompt silently instead of refusing it"; exit 1; }
done
# and none of the tiers install.sh renders into the launcher carries it either
for tier in context concurrency throughput; do
( FLASH_TIER=$tier; resolve_flash_tier_args >/dev/null
! render qwen38-flash-launch.sh.template | grep -v '^[[:space:]]*#' | grep -q -- '--allow-auto-truncate' ) \
|| { echo "the $tier tier renders --allow-auto-truncate into the launcher"; exit 1; }
done
grep -q -- '--speculative-draft-model-quantization unquant' "$scratch/flash.rendered"
# the key comes through a file SGLang merges in memory, never the command line
grep -q -- '--config /out/engine-secrets.yaml' "$scratch/flash.rendered"
! grep -q -- '--api-key' "$scratch/flash.rendered" || { echo "the flash launcher puts the key on a command line"; exit 1; }
grep -q 'engine-secrets.sh' "$scratch/flash.rendered"
grep -q 'chat-template-flashnext.jinja' "$scratch/flash.rendered"
grep -q 'HF_HUB_OFFLINE=1' "$scratch/flash.rendered"
grep -q -- '--revision cafe' "$scratch/flash.rendered"
if grep -q -- '--language-only' "$scratch/flash.rendered"; then
echo "flash launcher must NOT pass --language-only (vision stays on)"; exit 1
fi
# The previous table file goes before every boot: the server rewrites the whole
# table each time, and over a cold populated file that is ~17 MB/s (~55 min)
# against GB/s on a fresh sparse one. This replaced the poisoned-table guard.
grep -q 'rm -f "$PLE_DIR"/ple_table_' "$scratch/flash.rendered"
grep -q 'SGLANG_QWEN4_PLE_FILE_RSS_BUDGET_GB=8' "$scratch/flash.rendered"
grep -q 'SGLANG_OPT_MAMBA_SKIP_DECODE_LOCK=1' "$scratch/flash.rendered"
# A tier that does not speculate must not receive the draft vocabulary.
sed -e "s|__FLASH_TIER_ARGS__|--max-running-requests 24 --max-mamba-cache-size 96 --mamba-radix-cache-strategy extra_buffer_lazy|g" \
-e "s|__SPEC_TOKEN_MAP_LINE__||g" qwen38-flash-launch.sh.template > "$scratch/flash.thr"
if grep -q -- '--speculative-token-map' "$scratch/flash.thr"; then
echo "the throughput tier must not carry a draft vocabulary"; exit 1
fi
bash -n "$scratch/flash.thr"
# Each flash checkpoint keeps its own flag pair. The NVDA export resolves its
# own scheme and pins the MoE runner; the two NVFP4 ones declare the scheme and
# must tell the draft their in-checkpoint MTP tensors are BF16. Swapping either
# is silent: an fp8 head loaded as dense, or an autotune rejection.
sed -e "s|__FLASH_QUANT_ARGS__|--moe-runner-backend flashinfer_cutlass |g" qwen38-flash-launch.sh.template > "$scratch/flash.nvda"
grep -q -- '--moe-runner-backend flashinfer_cutlass' "$scratch/flash.nvda"
if grep -q -- '--quantization modelopt_fp4' "$scratch/flash.nvda"; then
echo "the NVDA render must not pass --quantization (it resolves to modelopt_mixed)"; exit 1
fi
if grep -q -- '--speculative-draft-model-quantization' "$scratch/flash.nvda"; then
echo "the NVDA render must not pass a draft quantization"; exit 1
fi
arm() { grep -A2 -E "^ *$1\)$|^ *$1\) " install.sh; }
# The replayssm-spec knob: off by default, on for speculating tiers,
# refused with throughput (no speculation there) and on bad values.
# Sourced as a function so the gate exercises the real code path.
# In a subshell, so a refusal that exits (install.sh refuses a bad value by name
# and exits, which keeps the ERR trap's "Install failed at line" off it) is read
# as its status like one that returns.
knob() { FLASH_TIER="$1" FLASH_REPLAYSSM_SPEC="$2" bash -c '
eval "$(sed -n "/^resolve_flash_tier_args() {/,/^}/p" install.sh)"
args=$(resolve_flash_tier_args >/dev/null 2>&1 || exit; printf %s "$FLASH_TIER_ARGS"); echo "rc=$?|$args"'; }
case "$(knob context 0)" in rc=0*"replayssm"*) echo "replayssm on at explicit off"; exit 1;; esac
knob context 0 | grep -q "rc=0" || { echo "context/off must succeed"; exit 1; }
knob context 1 | grep -q "enable-linear-replayssm-spec" || { echo "context/on must carry the flag"; exit 1; }
knob concurrency 1 | grep -q "enable-linear-replayssm-spec" || { echo "concurrency/on must carry the flag"; exit 1; }
out="$(knob throughput 1)"; echo "$out" | grep -q "rc=0" || { echo "throughput/on must succeed (skip, not fail)"; exit 1; }
echo "$out" | grep -q "enable-linear-replayssm-spec" && { echo "throughput must not carry the flag"; exit 1; }
knob context 2 | grep -q "rc=1" || { echo "a bad knob value must be refused"; exit 1; }
# The default lives once, in install.sh; recipes.py only repeats it.
grep -q '^FLASH_REPLAYSSM_SPEC="${FLASH_REPLAYSSM_SPEC:-1}"$' install.sh || { echo "install.sh default moved"; exit 1; }
grep -q 'assigns.get("FLASH_REPLAYSSM_SPEC", "1")' dashboard/recipes.py || { echo "recipes.py default disagrees"; exit 1; }
arm 'flash-nvda' | grep -qE 'FLASH_QUANT_ARGS="--moe-runner-backend flashinfer_cutlass ' \
|| { echo "install.sh: the NVDA arm no longer pins the MoE runner"; exit 1; }
if arm 'flash-nvda' | grep -q 'speculative-draft-model-quantization'; then
echo "install.sh: the NVDA arm must not set a draft quantization"; exit 1
fi
arm 'flash\|flash-uncensored' | grep -qE 'FLASH_QUANT_ARGS="--quantization modelopt_fp4 --speculative-draft-model-quantization unquant ' \
|| { echo "install.sh: the NVFP4 flash arm lost its scheme or its BF16 draft"; exit 1; }
if grep -qE 'FLASH_TIER_ARGS=.*speculative-draft-model-quantization' install.sh; then
echo "the draft quantization belongs to the checkpoint, not to a tier"; exit 1
fi
for tier in context concurrency throughput; do
grep -qE "^ *$tier\)" install.sh || { echo "install.sh lost the $tier tier"; exit 1; }
done
# A name that interpolates a variable must come after it. ${x:-0} makes this
# class of bug silent: it shipped a token-map-0.pt once.
n_size=$(grep -n '^SPEC_TOKEN_MAP_SIZE=' install.sh | cut -d: -f1)
n_name=$(grep -n '^TOKEN_MAP_NAME=' install.sh | cut -d: -f1)
[ -n "$n_size" ] && [ -n "$n_name" ] || { echo "install.sh lost the token map size or name"; exit 1; }
[ "$n_size" -lt "$n_name" ] || { echo "TOKEN_MAP_NAME (line $n_name) interpolates SPEC_TOKEN_MAP_SIZE (line $n_size) before it is set"; exit 1; }
grep -qE '^TOKEN_MAP_NAME="token-map-\$\{SPEC_TOKEN_MAP_SIZE\}\.pt"$' install.sh \
|| { echo "the token map file name must carry the size"; exit 1; }
# The per-checkpoint and per-tier flags must be RESOLVED AFTER the
# convergence block, which can change MODEL_CHOICE: a plain
# ./install.sh on a flash box converges from "stock" to "flash", and
# computing the flags once left the launcher without --quantization
# modelopt_fp4. That boots for ten minutes and dies at MoE autotune,
# so the resolution is a function, called again before any render, and
# an empty result refuses to write the launcher at all.
grep -q '^resolve_flash_checkpoint_args() {' install.sh \
|| { echo "install.sh: the checkpoint flags are not a function any more"; exit 1; }
grep -q '^resolve_flash_tier_args() {' install.sh \
|| { echo "install.sh: the tier flags are not a function any more"; exit 1; }
n_render=$(grep -n '^render_tpl() {' install.sh | cut -d: -f1)
n_last=$(grep -n '^resolve_flash_checkpoint_args$' install.sh | tail -1 | cut -d: -f1)
[ -n "$n_render" ] && [ -n "$n_last" ] && [ "$n_last" -lt "$n_render" ] \
|| { echo "install.sh: the checkpoint flags are not re-resolved before rendering"; exit 1; }
n_conv=$(grep -n 'INSTALLED_CHOICE' install.sh | head -1 | cut -d: -f1)
[ "$n_last" -gt "$n_conv" ] \
|| { echo "install.sh: the flags are resolved before the convergence block, not after"; exit 1; }
grep -q 'resolved no checkpoint flags for MODEL_CHOICE' install.sh \
|| { echo "install.sh: nothing refuses to write a flash launcher with no checkpoint flags"; exit 1; }
# The 27B lane has the same shape of decision and got it right from the
# start (its KV dtype is resolved late, after convergence). Lock that
# placement too, so the two lanes cannot drift apart again.
n_kv=$(grep -n 'fp8|uncensored-fp8) *KV_CACHE_ARGS=' install.sh | cut -d: -f1)
[ -n "$n_kv" ] && [ "$n_kv" -gt "$n_conv" ] && [ "$n_kv" -lt "$n_render" ] \
|| { echo "install.sh: KV_CACHE_ARGS must be resolved after the convergence block and before rendering (line $n_kv, convergence $n_conv, render $n_render)"; exit 1; }
- name: One list of targets, in all four places that must agree
run: |
# The switch selector in the cockpit's HTML, the closed enum the cockpit
# validates an action against, install.sh's MODEL_CHOICE case and
# switch-model.sh's are four independent lists of the same set. Nothing
# checked that they agreed, and a target added to three of them is a
# button that either does not exist or is refused when pressed.
python3 - <<'PYEOF'
import re, sys, pathlib
def fail(msg):
print("target lists disagree:", msg); sys.exit(1)
jsc = pathlib.Path("dashboard/static/js/base.js").read_text()
m = re.search(r"const LANE_TARGETS = \{(.*?)\};", jsc, re.S)
if not m:
fail("no LANE_TARGETS in js/base.js")
ui = re.findall(r"'([a-z0-9|-]+)'", m.group(1))
cock = pathlib.Path("dashboard/cockpit.py").read_text()
m = re.search(r'"switch":\s*\{.*?"params":\s*\{"target":\s*\[(.*?)\]\}', cock, re.S)
if not m:
fail("no switch action enum in cockpit.py")
enum = re.findall(r'"([^"]+)"', m.group(1))
inst = pathlib.Path("install.sh").read_text()
m = re.search(r'^case "\$MODEL_CHOICE" in\n(.*?)^esac', inst, re.M | re.S)
if not m:
fail("no MODEL_CHOICE case in install.sh")
arms = re.findall(r'^\s{2}([a-z0-9|-]+)\)', m.group(1), re.M)
choices = sorted({c for arm in arms for c in arm.split("|")} - {"*"})
sw = pathlib.Path("switch-model.sh").read_text()
m = re.search(r'case "\$CHOICE" in ([a-z0-9|-]+)\)', sw)
if not m:
fail("no CHOICE guard in switch-model.sh")
guard = sorted(m.group(1).split("|"))
rec = pathlib.Path("dashboard/recipes.py").read_text()
m = re.search(r"BUILTIN_IDS = \((.*?)\)", rec, re.S)
if not m:
fail("no BUILTIN_IDS in recipes.py")
builtins = re.findall(r'"([^"]+)"', m.group(1))
# Two kinds of target since the image lane. The TEXT targets are what
# install.sh can serve as its LLM (MODEL_CHOICE) and what the Models tab
# builds a recipe for. The SWITCH targets are those plus the targets of the
# lanes a flag installs: `image` and its Turbo `image-turbo`, the lane
# --with-image installs, `video`, installed by --with-video, `kolibri`
# and `kolibri-nvfp4`, the Kolibri lane's two checkpoints (--with-kolibri),
# `nemotron`, the Nemotron lane's (--with-nemotron), `nemotron-super`, the
# Nemotron Super lane's (--with-nemotron-super), `flash-local`, the Flash
# FP4-Local lane's (--with-flash-local), `ornith-122b`, the Ornith lane's
# (--with-ornith-122b), and `flash-unsloth` and `flash-unsloth-iq3`, the Qwen3.8
# Flash-Next Unsloth GGUF lane's two quantizations (--with-flash-unsloth), and the MiniMax-H3-Image
# lane's `image-h3` (--with-image-h3), the NVIDIA Nemotron Transcribe lane's `transcribe`
# (--with-transcribe), the Liquid AI LFM2.5 24B-A2B lane's `lfm25` (--with-lfm25) and the Liquid AI
# LFM3 lane's `lfm3` (--with-lfm3), each
# switched to like any other, and none a MODEL_CHOICE (none has a recipe; Kolibri, the Nemotron
# lanes, Flash FP4-Local and Ornith serve text from vLLM, the Unsloth GGUF lane from llama.cpp,
# and the LFM2.5 lane from SGLang, under their own installers). Both sets are asserted, so a
# target added to the switcher and forgotten in the cockpit's enum is
# still caught.
FLAG_LANES = ["image", "image-turbo", "video", "kolibri", "kolibri-nvfp4", "nemotron", "nemotron-super", "flash-local",
"ornith-122b", "flash-unsloth", "flash-unsloth-iq3", "image-h3", "transcribe", "lfm25", "lfm3"]
ref = choices
switch_ref = sorted(ref + FLAG_LANES)
text_lists = {"install.sh MODEL_CHOICE": choices, "recipes BUILTIN_IDS": sorted(builtins)}
switch_lists = {"index.html select": sorted(ui), "cockpit switch enum": sorted(enum),
"switch-model.sh guard": guard}
for name, got in text_lists.items():
if got != ref:
fail(f"{name} is {got}, install.sh says {ref}")
for name, got in switch_lists.items():
if got != switch_ref:
fail(f"{name} is {got}, the switch targets are {switch_ref}")
for lane in FLAG_LANES:
if lane in ref:
fail(f"{lane} is installed by a flag, not MODEL_CHOICE; install.sh must not list it")
if len(ui) != len(set(ui)):
fail("duplicate option in the selector")
# And the prose must not lag the list: "any of the six" outlived the
# sixth target by one commit.
words = {5: "five", 6: "six", 7: "seven", 8: "eight", 9: "nine"}
n = len(ref)
for path in ("install.sh", "README.md"):
body = pathlib.Path(path).read_text()
for count, word in words.items():
if count != n and (f"any of the {word}" in body
or f"the {word} targets" in body
or f"{word} switchable targets" in body):
fail(f"{path} still says {word} targets, there are {n}")
print(f"{len(ref)} text targets and {len(FLAG_LANES)} flag lane, five lists agree: "
f"{', '.join(switch_ref)}")
PYEOF
- name: opencode limits, the one table and both callers
run: |
scratch="${TMPDIR:-/tmp}" # ci-local.sh gives each step its own; a runner has none
# The limits are not decoration: opencode compacts at limit.context, so a
# limit above what the lane serves means the proxy answers 400 before
# opencode ever compacts. One table (oc-limits.sh), and both callers must
# use it: install.sh at install time, switch-model.sh at switch time. The
# switch did not write them at all until 2026-09-08.
l() { ./oc-limits.sh "$@"; }
[ "$(l stock native)" = "173000 64000 local" ] || { echo "27B native limits drifted"; exit 1; }
[ "$(l stock 1m)" = "700000 200000 local, 1M" ] || { echo "27B 1m limits drifted"; exit 1; }
[ "$(l uncensored 1m)" = "700000 200000 local, 1M" ] || { echo "uncensored 1m drifted"; exit 1; }
[ "$(l fp8 1m)" = "480000 160000 local, 1M" ] || { echo "fp8 1m limits drifted"; exit 1; }
[ "$(l uncensored-fp8 1m)" = "480000 160000 local, 1M" ] || { echo "uncensored-fp8 1m drifted"; exit 1; }
[ "$(l fp8 native)" = "173000 64000 local" ] || { echo "fp8 native drifted"; exit 1; }
# Arete's NVFP4 serves the NVFP4 pool (905,941 tokens at 0.76, measured 2026-11-14): the 27B's pair
[ "$(l arete 1m)" = "700000 200000 local, 1M" ] || { echo "arete 1m drifted"; exit 1; }
[ "$(l arete native)" = "173000 64000 local" ] || { echo "arete native drifted"; exit 1; }
# DaisyRose's NVFP4 is RadixArk's own recipe at RadixArk's size (21.95 GB, same pool as stock): the 27B's pair
[ "$(l daisyrose 1m)" = "700000 200000 local, 1M" ] || { echo "daisyrose 1m drifted"; exit 1; }
[ "$(l daisyrose native)" = "173000 64000 local" ] || { echo "daisyrose native drifted"; exit 1; }
# Every flash target, every tier: the default tier was never asserted
# before (the old gate fell through to the throughput arm).
for t in flash flash-uncensored flash-nvda; do
[ "$(l "$t" context)" = "205000 32000 local" ] || { echo "$t/context drifted"; exit 1; }
[ "$(l "$t" concurrency)" = "205000 32000 local" ] || { echo "$t/concurrency drifted"; exit 1; }
[ "$(l "$t" throughput)" = "110000 32000 local" ] || { echo "$t/throughput drifted"; exit 1; }
done
# The Qwen3.8 Flash-Next FP4-Local lane, at its native window and at its 1M one (FLASH_LOCAL_CONTEXT=1m,
# v1.45.2), whose pair is sized on its pool: the cockpit's check (fit_verdict) with a pool 10 % smaller
# than the 1,061,819 measured (2026-11-09), and the window holding the prompt at opencode's compaction
# point, one agent step and the answer.
[ "$(l flash-local)" = "205000 32000 local, 262K" ] || { echo "flash-local's default drifted"; exit 1; }
[ "$(l flash-local native)" = "205000 32000 local, 262K" ] || { echo "flash-local native drifted"; exit 1; }
[ "$(l flash-local 1m)" = "840000 32000 local, 1M" ] || { echo "flash-local 1m drifted"; exit 1; }
read -r C O _ <<<"$(l flash-local 1m)"
LOW=$(( 1061819 * 92 / 100 * 90 / 100 ))
[ $(( C + O )) -le "$LOW" ] || { echo "flash-local 1m: $C + $O passes $LOW, its pool less 10 %"; exit 1; }
[ $(( C - 20000 + 43863 + O )) -le 1048576 ] || { echo "flash-local 1m: past its 1,048,576 window"; exit 1; }
! l flash-local nonsense 2>/dev/null || { echo "an unknown flash-local mode must be refused"; exit 1; }
# The Qwen3.8 Flash-Next Unsloth GGUF lane, at its native window for each of its two requests and at its 1M
# for one request (FLASH_UNSLOTH_CONTEXT=1m, decisions 1316 and 1318, 2026-11-12), by the same rule: a
# llama.cpp pool at one request is its window, held whole by its -c, and the pair fits it less 10 %, and the
# window the prompt at opencode's compaction point, one agent step and the answer.
[ "$(l flash-unsloth)" = "205000 32000 local, 262K" ] || { echo "flash-unsloth's default drifted"; exit 1; }
[ "$(l flash-unsloth native)" = "205000 32000 local, 262K" ] || { echo "flash-unsloth native drifted"; exit 1; }
[ "$(l flash-unsloth 1m)" = "830000 32000 local, 1M" ] || { echo "flash-unsloth 1m drifted"; exit 1; }
read -r C O _ <<<"$(l flash-unsloth 1m)"
LOW=$(( 1048576 * 92 / 100 * 90 / 100 ))
[ $(( C + O )) -le "$LOW" ] || { echo "flash-unsloth 1m: $C + $O passes $LOW, its pool less 10 %"; exit 1; }
[ $(( C - 20000 + 43863 + O )) -le 1048576 ] || { echo "flash-unsloth 1m: past its 1,048,576 window"; exit 1; }
! l flash-unsloth nonsense 2>/dev/null || { echo "an unknown flash-unsloth mode must be refused"; exit 1; }
# its second target, UD-IQ3_XXS (v1.49): more requests at once, the same window for each, the same pairs
[ "$(l flash-unsloth-iq3)" = "$(l flash-unsloth)" ] || { echo "flash-unsloth-iq3's default drifted"; exit 1; }
[ "$(l flash-unsloth-iq3 1m)" = "$(l flash-unsloth 1m)" ] || { echo "flash-unsloth-iq3 1m drifted"; exit 1; }
# The Liquid AI LFM2.5 24B-A2B lane, at its one window (131,072 tokens), by the same rule, and the pair
# oc-fit-limits.py reaches from a pool far past it (its worst step rounded to 25,000)
[ "$(l lfm25)" = "74000 32000 local, 131K" ] || { echo "lfm25 drifted"; exit 1; }
read -r C O _ <<<"$(l lfm25)"
[ $(( C - 20000 + 43863 + O )) -le 131072 ] || { echo "lfm25: past its 131,072 window"; exit 1; }
[ $(( C + 25000 + O )) -le 131072 ] || { echo "lfm25: past its window by oc-fit-limits.py's rule"; exit 1; }
# The Liquid AI LFM3 lane, at its one window (262,144 tokens), by the same two rules
[ "$(l lfm3)" = "205000 32000 local, 262K" ] || { echo "lfm3 drifted"; exit 1; }
read -r C O _ <<<"$(l lfm3)"
[ $(( C - 20000 + 43863 + O )) -le 262144 ] || { echo "lfm3: past its 262,144 window"; exit 1; }
[ $(( C + 25000 + O )) -le 262144 ] || { echo "lfm3: past its window by oc-fit-limits.py's rule"; exit 1; }
# Nonsense is refused rather than defaulted, or a typo silently serves
# the wrong budget.
! l banana native 2>/dev/null || { echo "an unknown target must be refused"; exit 1; }
! l flash nonsense 2>/dev/null || { echo "an unknown tier must be refused"; exit 1; }
! l stock nonsense 2>/dev/null || { echo "an unknown context mode must be refused"; exit 1; }
! l 2>/dev/null || { echo "no argument must be refused"; exit 1; }
# Derived from an invocation, which is how the switch reads it.
tmp=$(mktemp -d)
printf ' --max-running-requests 8 \\\n python3 -m sglang.launch_server \\\n' > "$tmp/l8.sh"
printf ' --max-running-requests 24 \\\n python3 -m sglang.launch_server \\\n' > "$tmp/l24.sh"
printf ' --context-length 1010000 \\\n python3 -m sglang.launch_server \\\n' > "$tmp/u1m.service"
printf ' --context-length 262144 \\\n python3 -m sglang.launch_server \\\n' > "$tmp/unat.service"
[ "$(l flash --from "$tmp/l8.sh")" = "205000 32000 local" ] || { echo "derived tier (8) wrong"; exit 1; }
[ "$(l flash --from "$tmp/l24.sh")" = "110000 32000 local" ] || { echo "derived tier (24) wrong"; exit 1; }
[ "$(l stock --from "$tmp/u1m.service")" = "700000 200000 local, 1M" ] || { echo "derived 1m wrong"; exit 1; }
[ "$(l stock --from "$tmp/unat.service")" = "173000 64000 local" ] || { echo "derived native wrong"; exit 1; }
printf ' --max-model-len 1048576 \\\n --host 127.0.0.1 \\\n' > "$tmp/fl1m.service"
printf ' --max-model-len 262144 \\\n --host 127.0.0.1 \\\n' > "$tmp/flnat.service"
[ "$(l flash-local --from "$tmp/fl1m.service")" = "840000 32000 local, 1M" ] || { echo "derived flash-local 1m wrong"; exit 1; }
[ "$(l flash-local --from "$tmp/flnat.service")" = "205000 32000 local, 262K" ] || { echo "derived flash-local native wrong"; exit 1; }
# and both writers read the FP4-Local pair from its unit, which says its window
grep -qF 'oc-limits.sh" flash-local --from "$FLASH_LOCAL_UNIT_PATH"' install.sh \
|| { echo "install.sh does not read the FP4-Local pair from its unit"; exit 1; }
grep -qF 'oc-limits.sh" flash-local --from "$FLASH_LOCAL_UNIT"' switch-model.sh \
|| { echo "switch-model.sh does not read the FP4-Local pair from its unit"; exit 1; }
[ "$(l flash --from /nonexistent)" = "205000 32000 local" ] || { echo "a missing invocation must fall back to the default tier"; exit 1; }
out="$(l flash --from /nonexistent 2>"$scratch/oclim.err")"; rc=$?
[ "$rc" = "0" ] || { echo "a missing invocation must not fail the switch"; exit 1; }
grep -q "not a file" "$scratch/oclim.err" || { echo "a missing invocation must say so on stderr"; exit 1; }
rm -rf "$tmp"
# The FP8 pair must ask for strictly less than the NVFP4 pair and fit the
# measured FP8 pool. We do NOT assert an absolute NVFP4 pool: the repo
# documents two non-overlapping ranges and picking one would bake an
# unresolved measurement into CI.
read -r NV_CTX NV_OUT _ <<<"$(l stock 1m)"
for c in fp8 uncensored-fp8; do
read -r CTX OUT _ <<<"$(l $c 1m)"
[ "$CTX" -lt "$NV_CTX" ] && [ "$OUT" -lt "$NV_OUT" ] \
|| { echo "$c must ask for less than NVFP4"; exit 1; }
# opencode compacts when the last usage reaches limit.input minus
# min(20,000, its output cap), so the threshold is CTX - 20,000 exactly
# (opencode 1.18.27, SessionCompaction), not a percentage.
worst=$(( CTX - 20000 + OUT ))
# 771,139 is the FP8 pool on the retired image at 0.70. Re-measured
# 2026-09-18 on v0.5.19 at 0.76: 881,895, so this bound is now the
# stricter one and is kept deliberately.
[ "$worst" -le 771139 ] \
|| { echo "$c: 1m worst case $worst exceeds the measured FP8 pool"; exit 1; }
done
# A lane with a prompt ceiling must leave one whole agent step between
# opencode's compaction threshold and that ceiling. opencode decides
# between turns; the turn that follows appends its tool results and
# sends, and that step is measured at up to 43,863 tokens on this lane
# (2,156 steps, opencode's session store, 2026-09). 190,000 did not
# leave it and sessions died mid-conversation with a proxy 400.
CEILING=250000; RESERVE=20000; WORST_STEP=43863
read -r FCTX FOUT _ <<<"$(l flash context)"
[ $(( FCTX - RESERVE + WORST_STEP )) -le "$CEILING" ] \
|| { echo "flash/context $FCTX leaves no room for one agent step under the $CEILING ceiling"; exit 1; }
# The engine's own window holds that same prompt plus the answer: SGLang refuses
# any request whose input + max_tokens passes context_length, and opencode asks
# for max_tokens = limit.output. 225,000/32,000 met the ceiling and not this, so a
# prompt past 230,144 was refused (found in review, 2026-09-24). Every pair served
# on a 262,144 window has to hold it.
WINDOW=262144
for pair in "flash context" "flash concurrency" "flash throughput" "stock native" "fp8 native"; do
read -r C O _ <<<"$(l $pair)"
R=$(( O < RESERVE ? O : RESERVE ))
[ $(( C - R + WORST_STEP + O )) -le "$WINDOW" ] \
|| { echo "$pair: $C/$O puts $(( C - R + WORST_STEP + O )) in front of the $WINDOW window"; exit 1; }
done
# And the number the installer and the switch actually write must be that
# same ceiling, or the table is sized against a ceiling nothing enforces.
for f in install.sh switch-model.sh; do
grep -q "PROMPT_CEILING_TOKENS:-$CEILING" "$f" \
|| { echo "$f does not default the flash ceiling to $CEILING"; exit 1; }
done
# preserve_recent_tokens: opencode caps its own default at 15,000 whatever
# the window, which on this lane would summarise 190,000 tokens to keep
# 15,000. The table's value must be a real share of the threshold and must
# stay below it, or select() keeps everything and summarises the lot.
KEEP=$(l --preserve "$FCTX")
[ "$KEEP" -gt 15000 ] || { echo "preserve $KEEP is no better than opencode's own cap"; exit 1; }
[ "$KEEP" -lt $(( FCTX - RESERVE )) ] || { echo "preserve $KEEP is not below the threshold"; exit 1; }
[ "$(l --preserve 100000)" = "20000" ] || { echo "--preserve drifted on a small window"; exit 1; }
! l --preserve nope 2>/dev/null || { echo "--preserve must refuse a non-number"; exit 1; }
# Both writers must go through it rather than carrying their own number.
grep -q 'oc-limits.sh" --preserve' install.sh \
|| { echo "install.sh does not size the compaction block from the table"; exit 1; }
grep -q 'oc-limits.sh" --preserve' switch-model.sh \
|| { echo "switch-model.sh does not size the compaction block from the table"; exit 1; }
# Writing the limits is not delivering them: `opencode serve` reads
# opencode.json once at startup and never again (2026-09-13: the file said
# 225,000 while the running server still answered 175,000 on /config), so
# both writers must restart it.
for f in install.sh switch-model.sh; do
grep -q 'systemctl restart opencode-web.service' "$f" \
|| { echo "$f rewrites the opencode limits without restarting the server that reads them"; exit 1; }
done
# The fit tool must land on the same number as the table, or one click
# of the cockpit's fit button quietly restores the bug.
FIT=$(python3 -c "import importlib.util as i; s = i.spec_from_file_location('f', 'oc-fit-limits.py'); m = i.module_from_spec(s); s.loader.exec_module(m); print(m.fit(564352, 250000, 262144, ($FCTX, $FOUT))[0])")
[ "$FIT" = "$FCTX" ] \
|| { echo "oc-fit-limits fits $FIT where the table says $FCTX"; exit 1; }
# And both callers go through it, rather than carrying a second copy.
grep -q 'oc-limits.sh" "$MODEL_CHOICE" "$OC_SELECTOR"' install.sh \
|| { echo "install.sh no longer reads the shared limits table"; exit 1; }
grep -q 'oc-limits.sh" "$CHOICE" --from "$INVOCATION"' switch-model.sh \
|| { echo "switch-model.sh no longer reads the shared limits table"; exit 1; }
for f in install.sh switch-model.sh; do
if grep -qE 'OC_CTX=[0-9]+|SW_CTX=[0-9]+' "$f"; then
echo "$f carries its own limit numbers again; they belong in oc-limits.sh"; exit 1
fi
done
# The output CEILING is the table's maximum, not the installed target's
# own limit. opencode sends max_tokens = min(limit.output, ceiling):
# limit.output follows a switch, the ceiling does not, so a ceiling
# derived from the installed target cuts the next lane's turn in
# silence, which is the hidden 32000 default's exact failure mode. Seen
# on the Agent tab: a flash install handed it 64000, and a switch to a
# 27B box in 1M mode then asked for 200000.
CAP="$(l --max-out)"
[ "$CAP" -gt 32000 ] || { echo "the ceiling must lift opencode's hidden 32000 cap"; exit 1; }
for c in flash flash-uncensored flash-nvda; do
for t in context concurrency throughput; do
read -r _ OUT _ <<<"$(l "$c" "$t")"
[ "$OUT" -le "$CAP" ] || { echo "$c/$t asks for $OUT, above the ceiling $CAP"; exit 1; }
done
done
for c in stock uncensored fp8 uncensored-fp8 arete daisyrose; do
for t in native 1m; do
read -r _ OUT _ <<<"$(l "$c" "$t")"
[ "$OUT" -le "$CAP" ] || { echo "$c/$t asks for $OUT, above the ceiling $CAP"; exit 1; }
done
done
grep -qF 'OC_OUT_CAP="$("$REPO_DIR/oc-limits.sh" --max-out)"' install.sh \
|| { echo "install.sh no longer takes the output ceiling from the table"; exit 1; }
grep -qF 'OPENCODE_EXPERIMENTAL_OUTPUT_TOKEN_MAX:-$OC_OUT_CAP' install.sh \
|| { echo "the oc launcher no longer exports the shared ceiling"; exit 1; }
grep -qF 'oc-limits.sh" --max-out' dashboard/install-agent.sh \
|| { echo "install-agent.sh no longer takes the Agent tab ceiling from the table"; exit 1; }
# Every target the installer knows must have a picker label, or it
# silently keeps the previous target's name. The table lives in
# oc-point-default.py (install.sh and switch-model.sh both call it).
python3 - <<'PYEOF'
import ast, re, pathlib, sys
inst = pathlib.Path("install.sh").read_text()
m = re.search(r'^case "\$MODEL_CHOICE" in\n(.*?)^esac', inst, re.M | re.S)
arms = re.findall(r'^\s{2}([a-z0-9|-]+)\)', m.group(1), re.M)
choices = sorted({c for a in arms for c in a.split("|")} - {"*"})
# the LABEL table itself, read as Python: a label need not start with "Qwen"
# (Arete-27B, v1.49.0), and an entry outside it is no label
tree = ast.parse(pathlib.Path("oc-point-default.py").read_text())
labels = {k for n in tree.body if isinstance(n, ast.Assign)
and any(getattr(t, "id", None) == "LABEL" for t in n.targets)
for k in ast.literal_eval(n.value)}
missing = [c for c in choices if c not in labels]
if missing:
print("oc-point-default.py has no picker label for:", missing); sys.exit(1)
print(f" {len(choices)} targets, all with a picker label")
PYEOF
echo " the limits table is shared, complete on every target and tier, and refuses nonsense"
- name: opencode generator produces a valid config (all three install shapes)
run: |
scratch="${TMPDIR:-/tmp}" # ci-local.sh gives each step its own; a runner has none
# the rules install.sh hands the generator (OC_DENY), checked in every shape below
OC_DENY="$(python3 oc-merge-limits.py --deny-permission)"; export OC_DENY
gen() { # engine, has27b, hasflash, ctx, out, context_mode
rm -f "$scratch/octest/opencode.json"; mkdir -p "$scratch/octest"
OC_LANE="$1" OC_27B="$2" OC_FLASH="$3" OC_PORT=30001 OC_CTX="$4" OC_OUT="$5" \
OC_LABEL=local OC_CONTEXT_MODE="$6" OC_CONFIG_DIR="$scratch/octest" \
OC_27B_CTX="$(./oc-limits.sh stock "$6" | cut -d' ' -f1)" OC_27B_OUT="$(./oc-limits.sh stock "$6" | cut -d' ' -f2)" \
OC_KEEP="$(./oc-limits.sh --preserve "$4")" \
python3 <(sed -n '/^OC_LANE=/,/^PYEOF$/p' install.sh | sed -n '/^import json$/,/^PYEOF$/p' | sed '$d')
}
gen 27b 1 0 173000 64000 native
python3 - "$scratch/octest/opencode.json" <<'PY'
import json, os, sys
c = json.load(open(sys.argv[1]))
assert c.get("permission") == json.loads(os.environ["OC_DENY"]), c.get("permission")
assert set(c["provider"]) == {"qwen38"}, c["provider"].keys()
m = c["provider"]["qwen38"]["models"]["qwen3.8-27b"]
assert set(m["variants"]) == {"lean", "low", "medium", "xhigh"}, m["variants"]
assert c["model"] == "qwen38/qwen3.8-27b"
# the compaction block is sized from the installed target, never left to
# opencode's 15,000 default (which would summarise most of this window)
assert c["compaction"] == {"preserve_recent_tokens": 38000, "prune": False}, c["compaction"]
PY
gen flash 0 1 110000 32000 native
python3 - "$scratch/octest/opencode.json" <<'PY'
import json, os, sys
c = json.load(open(sys.argv[1]))
assert c.get("permission") == json.loads(os.environ["OC_DENY"]), c.get("permission")
assert set(c["provider"]) == {"flashnext"}, c["provider"].keys()
m = c["provider"]["flashnext"]["models"]["qwen3.8-flash-next"]
assert m["limit"] == {"context": 110000, "input": 110000, "output": 32000}
assert set(m["variants"]) == {"lean", "low", "medium", "xhigh"}, m["variants"]
assert c["model"] == "flashnext/qwen3.8-flash-next"
assert c["compaction"]["preserve_recent_tokens"] == 22000, c["compaction"]
PY
gen flash 1 1 110000 32000 1m
python3 - "$scratch/octest/opencode.json" <<'PY'
import json, os, sys
c = json.load(open(sys.argv[1]))
assert c.get("permission") == json.loads(os.environ["OC_DENY"]), c.get("permission")
assert set(c["provider"]) == {"qwen38", "flashnext"}
assert c["provider"]["qwen38"]["models"]["qwen3.8-27b"]["limit"]["context"] == 700000
assert c["model"] == "flashnext/qwen3.8-flash-next"
PY
# the lane not being installed keeps its checkpoint's name, from the one table
# (a generic name here flipped at every first update after a switch, 2026-09-30)
OC_27B_NAME="$(python3 oc-point-default.py --label uncensored 1010000)" gen flash 1 1 110000 32000 1m
python3 - "$scratch/octest/opencode.json" <<'PY'
import json, os, sys
c = json.load(open(sys.argv[1]))
assert c.get("permission") == json.loads(os.environ["OC_DENY"]), c.get("permission")
assert c["provider"]["qwen38"]["models"]["qwen3.8-27b"]["name"] == "Qwen3.8-27B NVFP4 abliterated + DFlash2 (local, 1M)", c["provider"]["qwen38"]["models"]["qwen3.8-27b"]["name"]
PY
- name: Anti-drift, the two unit templates differ only on the four known lines
run: |
filt() { grep -vE 'Description=|--mem-fraction-static|--model-path|TORCHINDUCTOR_CACHE_DIR|HF_HUB_OFFLINE'; }
# HF_HUB_OFFLINE rides on the filtered TORCHINDUCTOR line in 1m and stands
# alone in native: presence is asserted below, not by the diff.
diff <(filt < qwen38-sglang.service.template) <(filt < qwen38-sglang-1m.service.template)
grep -q -- '--mem-fraction-static 0.50' qwen38-sglang.service.template
grep -q -- '--mem-fraction-static 0.76' qwen38-sglang-1m.service.template
grep -q -- '--context-length 1010000 --model-path __MODEL__ __MODEL_REV_ARGS__' qwen38-sglang-1m.service.template
grep -q 'HF_HUB_OFFLINE=1' qwen38-sglang-1m.service.template
grep -q 'HF_HUB_OFFLINE=1' qwen38-sglang.service.template \
|| { echo "the native template lost HF_HUB_OFFLINE"; exit 1; }
# the 64 GB DGX Spark's unit (boxmem.py): the native one, with memory knobs of its own
# its comments are its own too: each measured value says where it comes from (found in review, 2026-10-23)
filt64() { grep -vE '^[[:space:]]*#|Description=|--memory |--mem-fraction-static|--cuda-graph-max-bs-decode|--max-mamba-cache-size'; }
diff <(filt64 < qwen38-sglang.service.template) <(filt64 < qwen38-sglang-64.service.template)
- name: Anti-drift, run.sh serves the native unit's exact flag set and constants
run: |
tpl_flags() { sed 's|__MODEL_REV_ARGS__|--revision X|' qwen38-sglang.service.template | sed -n '/ExecStart=/,/--port/p' | grep -oE -- '--[a-z][a-z-]*' | sort -u; }
run_flags() { sed -n '/exec docker run/,/--port/p' run.sh | grep -oE -- '--[a-z][a-z-]*' | sort -u; }
diff <(tpl_flags) <(run_flags)
vals() { grep -oE -- '--(memory-swap|memory|shm-size|mem-fraction-static|chunked-prefill-size|cuda-graph-max-bs-decode|max-mamba-cache-size|max-running-requests|torch-compile-max-bs|num-continuous-decode-steps) [^ \\]+' "$1" | sort; }
diff <(vals qwen38-sglang.service.template) <(vals run.sh)
# The draft triple is symbolic on both sides (placeholders in the
# templates, "$VARS" in run.sh), so vals() above cannot compare it:
# assert the wiring and the measured v1.9 defaults instead.
for t in qwen38-sglang.service.template qwen38-sglang-1m.service.template; do
grep -q -- '--speculative-draft-model-path __DRAFT2_REPO__' "$t" || { echo "$t lost the draft repo placeholder"; exit 1; }
grep -q -- '--speculative-num-draft-tokens __DRAFT2_TOKENS__' "$t" || { echo "$t lost the draft depth placeholder"; exit 1; }
grep -q -- '--speculative-draft-model-quantization __DRAFT2_QUANT__' "$t" || { echo "$t lost the draft quantization placeholder"; exit 1; }
done
grep -q -- '--speculative-draft-model-path "$DRAFT2_REPO"' run.sh || { echo "run.sh no longer serves the pinned draft repo"; exit 1; }
grep -q -- '--speculative-num-draft-tokens "$DRAFT2_TOKENS"' run.sh || { echo "run.sh no longer serves the pinned draft depth"; exit 1; }
grep -q -- '--speculative-draft-model-quantization "$DRAFT2_QUANT"' run.sh || { echo "run.sh no longer serves the pinned draft quantization"; exit 1; }
grep -q 'DRAFT2_REPO="${DRAFT2_REPO:-maurienne-ai/Qwen3.8-27B-DFlash2-NVFP4-RTNcal}"' install.sh || { echo "install.sh: the 27B draft is no longer the calibrated NVFP4 build"; exit 1; }
grep -q 'DRAFT2_REV="${DRAFT2_REV:-bd7a934213c47a9e7ef69eef36bb3325f47fd1f1}"' install.sh || { echo "install.sh: the 27B draft revision moved"; exit 1; }
grep -q 'DRAFT2_QUANT="${DRAFT2_QUANT:-modelopt_fp4}"' install.sh || { echo "install.sh: the 27B draft quantization moved"; exit 1; }
grep -q 'DRAFT2_TOKENS="${DRAFT2_TOKENS:-16}"' install.sh || { echo "install.sh: the 27B draft depth moved"; exit 1; }
# checkpoint validation must stay pinned-revision-aware (issue #5)
grep -q 'snapshots/\$REV_SHA' run.sh
- name: Every serving lane parks its scheduler when idle
run: |
# Without --sleep-on-idle SGLang's scheduler busy-spins a full core while
# doing nothing. The 27B lane has carried the flag since v1.2.6 (A/B on the
# reference box: scheduler CPU 101% -> 1.7%, TTFT unchanged); the flash lane
# shipped without it and burned a core for 12 h 21 min of measured idle on
# 2026-09-10. This lane grew from an experiment into the one in production,
# so the flag is a gate now, not a habit.
for f in qwen38-sglang.service.template qwen38-sglang-1m.service.template \
qwen38-flash-launch.sh.template run.sh qwen38-image-h3.service.template \
qwen38-lfm25.service.template; do
grep -q -- '--sleep-on-idle' "$f" || { echo "$f does not park its scheduler when idle"; exit 1; }
done
# The image and video lanes' runtime (v0.5.21) has no such flag: their scheduler-idle-poll
# patch is their gate, in the step that checks each patch against its pin. The
# MiniMax-H3-Image lane's runtime has it (SGLang main, PR 46007), off by default.
- name: Every serving lane exports its Prometheus metrics
run: |
# --enable-metrics gives the fleet its scrape endpoint (/metrics on the
# engine port), the observability hook local production asks for before
# anything else. It travels as a gate, not a habit: an unmeasured flag is
# exactly what this lane of gates exists to keep from drifting in and out
# unnoticed, and its exposure is stated (unauthenticated on a port whose
# whole surface already assumes a trusted network: SECURITY.md).
for f in qwen38-sglang.service.template qwen38-sglang-1m.service.template \
qwen38-flash-launch.sh.template run.sh qwen38-lfm25.service.template; do
grep -q -- '--enable-metrics' "$f" || { echo "$f exports no metrics"; exit 1; }
done
- name: patch-yarn fixtures (both config shapes, idempotence, revision pin)
run: |
python3 tests/test_patch_yarn.py
# A native install coming home from 1m must restore the pre-YaRN
# originals (a patched config crashes a native server at load,
# measured 2026-09-11), and run.sh must refuse a patched cache
# before booting instead of ten minutes in.
grep -q 'patch-yarn.py" --restore "\$HF_CACHE" "\$MODEL_REPO' install.sh \
|| { echo "install.sh native path no longer restores the target"; exit 1; }
grep -q 'patch-yarn.py" --restore "\$HF_CACHE" "\$DRAFT2_REPO' install.sh \
|| { echo "install.sh native path no longer restores the draft"; exit 1; }
grep -q 'patch-yarn.py" --check "\$HF_CACHE" "\$REPO" "\$REV"' run.sh \
|| { echo "run.sh no longer preflights the YaRN state"; exit 1; }
- name: patch-template fixture (anchors, idempotence, revision pin)
run: |
# it renders the tool_reference fix with jinja2 (v1.40.3), which the runner's python3 is not
# known to carry before the step that installs it for the others (code review, 2026-10-26)
pip install 'jinja2==3.1.6'
python3 tests/test_patch_template.py
- name: opencode limits fit the served pool (offline)
run: python3 tests/test_oc_fit_limits.py
- name: get.sh guards (git fixture, stubbed installer)
run: python3 tests/test_get_sh.py
- name: bench.sh names the lane it measures (fake engine)
run: python3 tests/test_bench_lane.py
- name: needle.sh separates a lane refusal from a retrieval failure (fake engine)
run: python3 tests/test_needle_refusal.py
- name: uninstall inventory runs clean on a bare machine
run: ./uninstall.sh --list
- name: opencode limits merge helper (config shapes, JSONC)
run: python3 tests/test_oc_merge_limits.py
- name: No grep pipeline can die on zero matches (set -e + pipefail)
run: |
# The class, not the instance. `grep` exits 1 when it matches nothing,
# and under `set -e` with `pipefail` a VAR="$(... grep ... | ...)"
# assignment then kills the script on the spot, with no message,
# wherever it happens to sit. It has now shipped twice:
# install.sh, 2026-09-12: UNIT_CTX, so every native install died at
# step 8 (only 1m units, which carry --context-length, got through).
# switch-model.sh, 2026-09-14: OC_WINDOW, same flag, same reason, so
# a switch to a native 27B target reported failure three lines from
# the end, having already swapped and enabled the lane, leaving
# opencode's default model pointed at the lane it had just left.
# Both were fixed one line at a time. This gate is the class: every
# such assignment in the scripts that set pipefail must tolerate zero
# matches. It also found LAUNCH_IMAGE, which had the same hole and an
# explicit empty-case guard three lines below that could never run.
python3 - <<'PY'
import pathlib, re, sys
bad = []
for name in ("install.sh", "switch-model.sh", "run.sh", "uninstall.sh", "get.sh", "bench.sh"):
src = pathlib.Path(name).read_text()
if "pipefail" not in src:
continue
for n, line in enumerate(src.splitlines(), 1):
if line.lstrip().startswith("#"):
continue
# VAR="$( ... grep ... )" on one line
if not re.match(r'^\s*[A-Za-z_][A-Za-z0-9_]*="\$\(.*\bgrep\b.*\)"\s*$', line):
continue
if "|| true" in line or "||true" in line:
continue
bad.append(f"{name}:{n}: {line.strip()[:110]}")
if bad:
print("these die on zero matches under set -e + pipefail; end them with `|| true`:")
for b in bad:
print(" " + b)
sys.exit(1)
print("every grep command substitution tolerates zero matches")
PY
- name: Native units carry no context-length flag (install must survive that)
run: |
# install.sh reads the installed unit's --context-length to protect 1m
# users from a shrinking native reinstall. A native unit has no such
# flag (262144 is the engine default), so the grep matches nothing,
# and under pipefail that killed every native install at step 8/10
# (found live 2026-09-12: only 1m units, which carry 1010000, passed).
grep -q 'UNIT_CTX="$(grep -oE.*head -1 || true)"' install.sh \
|| { echo "UNIT_CTX pipeline must tolerate zero matches"; exit 1; }
probe() { PROBE_TEXT="$1" bash -e -o pipefail -c '
UNIT_CTX="$(printf "%s\n" "$PROBE_TEXT" | grep -oE -- "--context-length [0-9]+" | awk "{print \$2}" | head -1 || true)"
printf "%s" "${UNIT_CTX:-empty}"'; }
[ "$(probe '--mem-fraction-static 0.50')" = "empty" ] || { echo "native unit must yield empty, not death"; exit 1; }
[ "$(probe '--context-length 1010000')" = "1010000" ] || { echo "1m unit must still yield its window"; exit 1; }
- name: opencode default model follows the lane (picker names, one table)
run: |
python3 tests/test_oc_point_default.py
# The picker names live in oc-point-default.py and ONLY there:
# install.sh and switch-model.sh call it, so the three spellings
# (artifact, user config via install, both via switch) cannot drift.
grep -q 'oc-point-default.py" "\$CONFIG_DIR/opencode.json"' install.sh \
|| { echo "install.sh no longer points its artifact at the lane"; exit 1; }
grep -q 'oc-point-default.py" "\$OC_USER_CFG"' install.sh \
|| { echo "install.sh no longer points the user config at the lane"; exit 1; }
grep -q 'oc-point-default.py" "\$OC_JSON"' switch-model.sh \
|| { echo "switch-model.sh no longer points configs at the lane"; exit 1; }
if grep -q '^LABEL = {' switch-model.sh; then
echo "switch-model.sh carries its own label table again"; exit 1;
fi
- name: Vendored Flash overlay integrity
run: |
cd flash-sglang && sha256sum -c MANIFEST.sha256
# the two upstream-fix edits can never silently vanish
# `! cmd` alone never fails a step under bash -e (the shell ignores a negated
# status), so this line checked nothing until v1.18.7 (found in review, 2026-09-24)
! grep -q 'is_sm100_supported() or is_sm120_supported()' qwen_sparse_attn_backend.py \
|| { echo "the widened sm120 condition is back in qwen_sparse_attn_backend.py"; exit 1; }
grep -q 'qsa.sm121_varlen' qwen_sparse_attn_backend.py
grep -q 'kda_kernels.qwen38_qsa_sm121' qwen_sparse_attn_backend.py
test -f sm121_varlen.py
# the KDA route and the Triton fallback it calls must both be shipped
test -f kda_kernels/__init__.py
test -f kda_kernels/qwen38_qsa_sm121/__init__.py
test -f kda_kernels/qwen38_qsa_sm121/kernel.py
python3 -c 'import ast,sys; [ast.parse(open(p).read()) for p in sys.argv[1:]]' \
kda_kernels/qwen38_qsa_sm121/__init__.py kda_kernels/qwen38_qsa_sm121/kernel.py
grep -q 'SGLANG_QWEN4_PLE_MMAP_DIR' qwen4_exp.py
- name: Every privileged call of switch-model.sh is in the cockpit allowlist
run: |
# The cockpit runs switch-model.sh under an exact-argv sudoers allowlist, so a
# call that differs by one character stops the Switch at a password prompt.
# Every sudo command of the script is rendered to the argv sudo will match,
# its variables substituted, and must be a line of the allowlist, character for
# character. The regexes this replaces never saw `daemon-reload` and only looked
# for the staging paths as substrings (found in review, 2026-09-24).
python3 - <<'PY'
import re, shlex, sys, pathlib
script = pathlib.Path("switch-model.sh").read_text()
alw = pathlib.Path("dashboard/sudoers-cockpit.template").read_text()
allowed = {m.strip() for m in re.findall(r"NOPASSWD:\s*(.+)$", alw, re.M)}
stage = dict(re.findall(r'^(STAGE_UNIT|STAGE_CEIL|IMG_STAGE|KOL_STAGE|NEM_STAGE|NSV_STAGE|FLL_STAGE|ORN_STAGE|FLU_STAGE|VID_STAGE|H3_STAGE|TRANSCRIBE_STAGE|LFM25_STAGE|LFM3_STAGE)="\$CONFIG_DIR/([^"]+)"', script, re.M))
units = {"qwen38-sglang.service", "qwen38-flash.service"}
engines = units | {"qwen38-image.service", "qwen38-video.service", "qwen38-kolibri.service", "qwen38-nemotron.service",
"qwen38-nemotron-super.service", "qwen38-flash-local.service", "qwen38-ornith-122b.service",
"qwen38-flash-unsloth.service", "qwen38-image-h3.service", "qwen38-transcribe.service",
"qwen38-lfm25.service", "qwen38-lfm3.service"}
values = {
"TEXT_UNIT_NAME": engines, "TARGET_UNIT_NAME": units, "OTHER_UNIT_NAME": engines,
"IMAGE_UNIT_NAME": {"qwen38-image.service"},
"VIDEO_UNIT_NAME": {"qwen38-video.service"},
"KOLIBRI_UNIT_NAME": {"qwen38-kolibri.service"},
"NEMOTRON_UNIT_NAME": {"qwen38-nemotron.service"},
"NEMOTRON_SUPER_UNIT_NAME": {"qwen38-nemotron-super.service"},
"FLASH_LOCAL_UNIT_NAME": {"qwen38-flash-local.service"},
"ORNITH_122B_UNIT_NAME": {"qwen38-ornith-122b.service"},
"FLASH_UNSLOTH_UNIT_NAME": {"qwen38-flash-unsloth.service"},
"IMAGE_H3_UNIT_NAME": {"qwen38-image-h3.service"},
"TRANSCRIBE_UNIT_NAME": {"qwen38-transcribe.service"},
"LFM25_UNIT_NAME": {"qwen38-lfm25.service"},
"LFM3_UNIT_NAME": {"qwen38-lfm3.service"},
"TARGET_UNIT": {re.search(r'^SGL_UNIT="([^"]+)"', script, re.M).group(1)},
"IMAGE_UNIT": {re.search(r'^IMAGE_UNIT="([^"]+)"', script, re.M).group(1)},
"VIDEO_UNIT": {re.search(r'^VIDEO_UNIT="([^"]+)"', script, re.M).group(1)},
"IMAGE_H3_UNIT": {re.search(r'^IMAGE_H3_UNIT="([^"]+)"', script, re.M).group(1)},
"KOLIBRI_UNIT": {re.search(r'^KOLIBRI_UNIT="([^"]+)"', script, re.M).group(1)},
"NEMOTRON_UNIT": {re.search(r'^NEMOTRON_UNIT="([^"]+)"', script, re.M).group(1)},
"NEMOTRON_SUPER_UNIT": {re.search(r'^NEMOTRON_SUPER_UNIT="([^"]+)"', script, re.M).group(1)},
"FLASH_LOCAL_UNIT": {re.search(r'^FLASH_LOCAL_UNIT="([^"]+)"', script, re.M).group(1)},
"ORNITH_122B_UNIT": {re.search(r'^ORNITH_122B_UNIT="([^"]+)"', script, re.M).group(1)},
"FLASH_UNSLOTH_UNIT": {re.search(r'^FLASH_UNSLOTH_UNIT="([^"]+)"', script, re.M).group(1)},
"TRANSCRIBE_UNIT": {re.search(r'^TRANSCRIBE_UNIT="([^"]+)"', script, re.M).group(1)},
"LFM25_UNIT": {re.search(r'^LFM25_UNIT="([^"]+)"', script, re.M).group(1)},
"LFM3_UNIT": {re.search(r'^LFM3_UNIT="([^"]+)"', script, re.M).group(1)},
"STAGE_UNIT": {"__HOME__/.config/qwen38/" + stage["STAGE_UNIT"]},
"STAGE_CEIL": {"__HOME__/.config/qwen38/" + stage["STAGE_CEIL"]},
"IMG_STAGE": {"__HOME__/.config/qwen38/" + stage["IMG_STAGE"]},
"KOL_STAGE": {"__HOME__/.config/qwen38/" + stage["KOL_STAGE"]},
"NEM_STAGE": {"__HOME__/.config/qwen38/" + stage["NEM_STAGE"]},
"NSV_STAGE": {"__HOME__/.config/qwen38/" + stage["NSV_STAGE"]},
"FLL_STAGE": {"__HOME__/.config/qwen38/" + stage["FLL_STAGE"]},
"ORN_STAGE": {"__HOME__/.config/qwen38/" + stage["ORN_STAGE"]},
"FLU_STAGE": {"__HOME__/.config/qwen38/" + stage["FLU_STAGE"]},
"VID_STAGE": {"__HOME__/.config/qwen38/" + stage["VID_STAGE"]},
"H3_STAGE": {"__HOME__/.config/qwen38/" + stage["H3_STAGE"]},
"TRANSCRIBE_STAGE": {"__HOME__/.config/qwen38/" + stage["TRANSCRIBE_STAGE"]},
"LFM25_STAGE": {"__HOME__/.config/qwen38/" + stage["LFM25_STAGE"]},
"LFM3_STAGE": {"__HOME__/.config/qwen38/" + stage["LFM3_STAGE"]},
}
seen, bad = 0, []
for raw in script.splitlines():
line = raw.split(" #", 1)[0].strip()
if not line or line.startswith(("#", "echo ")):
continue
for part in re.split(r"\|\||&&|\|", line):
part = part.strip().rstrip("\\").strip()
if not part.startswith("sudo "):
continue
words = [w for w in shlex.split(part)[1:] if not re.fullmatch(r"\d?>(&\d|/dev/null)", w)]
names = sorted({v for w in words for v in re.findall(r"\$\{?(\w+)\}?", w)})
unknown = [n for n in names if n not in values]
if unknown:
bad.append(f"{part} (no known value for {', '.join(unknown)}: add it to this gate)")
continue
combos = [dict()]
for n in names:
combos = [{**c, n: v} for c in combos for v in sorted(values[n])]
for c in combos:
argv = [re.sub(r"\$\{?(\w+)\}?", lambda m: c[m.group(1)], w) for w in words]
want = " ".join(["/usr/bin/" + argv[0]] + argv[1:])
seen += 1
if want not in allowed:
bad.append(want)
if not seen:
print("found no sudo call in switch-model.sh: the parser is broken"); sys.exit(1)
if bad:
print("not in dashboard/sudoers-cockpit.template, character for character:")
for b in sorted(set(bad)):
print(" " + b)
sys.exit(1)
print(f"switch-model.sh: {seen} privileged argv, every one an allowlist line")
PY
- name: Sudoers allowlist has no wildcards and matches its callers
run: |
# The cockpit runs switch-model.sh under NOPASSWD sudo, so every
# privileged argv there must appear here character for character, and
# no line may hide a wildcard (a glob on install sources once allowed
# any file; a glob on sed arguments is still root, its w command
# writes any file, so the ceiling edit is a drop-in now). sudoers
# globs with ? and [...] as with *, and since sudo 1.9.10 reads an
# argument from ^ to $ as a regular expression (^.+$ allows any):
# a line with any of the four fails.
python3 - <<'PY'
import pathlib, re, sys
alw = pathlib.Path("dashboard/sudoers-cockpit.template").read_text()
bad = [ln for ln in alw.splitlines()
if ln.strip().startswith("__USER__") and any(c in ln for c in "*?[^")]
if bad:
print("wildcard or regular expression in sudoers allowlist:")
print("\n".join(" " + b for b in bad)); sys.exit(1)
sw = pathlib.Path("switch-model.sh").read_text()
for var, tail in (("STAGE_UNIT", "qwen38-sglang.service.switch-stage"),
("STAGE_CEIL", "keepalive-ceiling.conf.switch-stage"),
("IMG_STAGE", "qwen38-image.service.switch-stage")):
m = re.search(rf'^{var}="\$CONFIG_DIR/([^"]+)"', sw, re.M)
if not m or not m.group(1).endswith(tail):
print(f"{var} staging path changed or missing in switch-model.sh"); sys.exit(1)
want = f"__HOME__/.config/qwen38/{m.group(1)}"
if want not in alw:
print(f"staging source not in allowlist: {want}"); sys.exit(1)
ck = pathlib.Path("dashboard/cockpit.py").read_text()
calls = re.findall(r'run\(\["sudo", "-n", "/usr/bin/journalctl", ([^\]]+)\]', ck)
if not calls:
print("cockpit sudo journalctl call not found"); sys.exit(1)
for c in calls:
args = " ".join(re.findall(r'"([^"]+)"', c))
if f"/usr/bin/journalctl {args}" not in alw:
print(f"cockpit journalctl argv not in allowlist: {args}"); sys.exit(1)
if re.search(r"^ *sudo sed ", sw, re.M):
print("sudo sed in switch-model.sh: use the ceiling drop-in instead"); sys.exit(1)
unit = pathlib.Path("dashboard/qwen38-dashboard.service.template").read_text()
# Inverted on 2026-09-14, because the old assertion was the bug. It
# read "cockpit only reads there", and the cockpit's own Switch button
# writes there through the allowlist above. ProtectSystem=full gives
# the unit a mount namespace with /etc bound read-only, and sudo does
# not leave a mount namespace, so root inside it cannot write either:
# every allowlisted write below failed with "Read-only file system"
# while this gate certified the unit as correct.
if "ReadWritePaths=/etc/systemd/system" not in unit:
print("dashboard unit cannot write /etc/systemd/system, so its own"
" allowlisted writes fail inside ProtectSystem's namespace"); sys.exit(1)
# And every path the switch writes under /etc has to be inside it.
rw = {l.split("=", 1)[1] for l in unit.splitlines() if l.startswith("ReadWritePaths=")}
for dest in re.findall(r"sudo install [^\n]*?(/etc/[A-Za-z0-9_./$-]+)", sw):
if not any(dest == r or dest.startswith(r.rstrip("/") + "/") for r in rw):
print(f"switch-model.sh writes {dest}, which no ReadWritePaths of the"
f" cockpit unit covers: the Switch button cannot do it"); sys.exit(1)
print("sudoers allowlist: no wildcards, staging paths and journalctl argv match their callers")
PY
- name: Uninstall inventory knows the current pins
run: |
# --list is the authority on what belongs to the project: when a pin
# moves in install.sh, the inventory must follow or image/weight
# orphans go silent (seen 2026-09-12: the served 126G dealignai
# weights and the served digest image were both invisible).
python3 - <<'PY'
import pathlib, re, sys
inst = pathlib.Path("install.sh").read_text()
un = pathlib.Path("uninstall.sh").read_text()
bad = []
for var in ("IMAGE", "FLASH_IMAGE"):
m = re.search(rf'^{var}.*?(lmsysorg/sglang@sha256:[0-9a-f]{{64}})', inst, re.M)
if not m or m.group(1) not in un:
bad.append(var)
def pin_repo(var):
# plain ="..." form, else the ${VAR:-default} form (matched with
# a literal prefix search: an f-string cannot spell those braces)
m = re.search(rf'^{var}="([^"]+)"', inst, re.M)
if m and not m.group(1).startswith("${"):
return m.group(1)
pre = var + '="${' + var + ':-'
for line in inst.splitlines():
if line.startswith(pre) and line.endswith('}"'):
return line[len(pre):-2]
return None
for var in ("STOCK_REPO", "UNC_REPO", "FP8_REPO", "UNCFP8_REPO", "ARETE_REPO", "DAISYROSE_REPO",
"FLASH_REPO", "FLASH_NVDA_REPO", "FLASH_UNC_REPO", "DRAFT2_REPO"):
val = pin_repo(var)
if not val or val not in un:
bad.append(var)
# The image lane's checkpoint is pinned by install-image.sh, not install.sh, and
# was the one the inventory missed (2026-09-23: 31 GB left behind, unnamed).
# The video lane's checkpoint is pinned by install-video.sh the same way.
m = re.search(r'\bMODEL="\$\{MODEL:-([^}]+)\}"', pathlib.Path("install-image.sh").read_text())
if not m or m.group(1) not in un.split('HF_REPOS="', 1)[-1].split('"', 1)[0].split():
bad.append("install-image.sh MODEL")
m = re.search(r'\bMODEL="\$\{MODEL:-([^}]+)\}"', pathlib.Path("install-video.sh").read_text())
if not m or m.group(1) not in un.split('HF_REPOS="', 1)[-1].split('"', 1)[0].split():
bad.append("install-video.sh MODEL")
# and the image lane's second checkpoint, the Turbo of ./switch-model.sh image-turbo
m = re.search(r'^IMAGE_TURBO_PIN="([^"]+)"', pathlib.Path("install-image.sh").read_text(), re.M)
if not m or m.group(1) not in un.split('HF_REPOS="', 1)[-1].split('"', 1)[0].split():
bad.append("install-image.sh IMAGE_TURBO_PIN")
# and the MiniMax-H3-Image lane's (its text encoder is MiniMax-H3's, the video lane's, above)
m = re.search(r'^IMAGE_H3_MODEL_PIN="([^"]+)"', pathlib.Path("install-image-h3.sh").read_text(), re.M)
if not m or m.group(1) not in un.split('HF_REPOS="', 1)[-1].split('"', 1)[0].split():
bad.append("install-image-h3.sh IMAGE_H3_MODEL_PIN")
# and the Liquid AI LFM2.5 24B-A2B lane's checkpoint and draft
for var in ("LFM25_REPO", "LFM25_DRAFT_REPO"):
m = re.search(rf'^{var}="([^"]+)"', pathlib.Path("install-lfm25.sh").read_text(), re.M)
if not m or m.group(1) not in un.split('HF_REPOS="', 1)[-1].split('"', 1)[0].split():
bad.append(f"install-lfm25.sh {var}")
# and the Liquid AI LFM3 lane's checkpoint, and its image, vLLM's nightly, by its digest
m = re.search(r'^LFM3_REPO="([^"]+)"', pathlib.Path("install-lfm3.sh").read_text(), re.M)
if not m or m.group(1) not in un.split('HF_REPOS="', 1)[-1].split('"', 1)[0].split():
bad.append("install-lfm3.sh LFM3_REPO")
m = re.search(r'^LFM3_IMAGE="([^"]+)"', pathlib.Path("install-lfm3.sh").read_text(), re.M)
if not m or m.group(1) not in un.split('BASE_IMAGES="', 1)[-1].split('"', 1)[0].split():
bad.append("install-lfm3.sh LFM3_IMAGE")
# and the NVIDIA Nemotron Transcribe lane's GGUF repository
m = re.search(r'^TRANSCRIBE_REPO="([^"]+)"', pathlib.Path("install-transcribe.sh").read_text(), re.M)
if not m or m.group(1) not in un.split('HF_REPOS="', 1)[-1].split('"', 1)[0].split():
bad.append("install-transcribe.sh TRANSCRIBE_REPO")
if bad:
print("install.sh pins missing from uninstall.sh inventory:")
print("\n".join(" " + b for b in bad)); sys.exit(1)
print("uninstall inventory: all serving pins covered")
PY
- name: Cockpit and agent unit templates render, and their installers know every placeholder
run: |
scratch="${TMPDIR:-/tmp}" # ci-local.sh gives each step its own; a runner has none
# AGENT_AUTO=1's line as install-agent.sh builds it, the shell rules after its "*"
auto="Environment='OPENCODE_PERMISSION=$(python3 oc-merge-limits.py --agent-auto-permission)'"
r() { sed -e "s|__HOME__|/home/u|g" -e "s|__USER__|u|g" -e "s|__GROUP__|u|g" -e "s|__PORT__|30090|g" \
-e "s|__BIND__|127.0.0.1|g" -e "s|__REPO_DIR__|/r|g" -e "s|__AGENT_PORT__|30091|g" \
-e "s|__AGENT_BIND__|tailscale|g" -e "s|__AGENT_UPSTREAM__|http://127.0.0.1:4096|g" \
-e "s|__OPENCODE_BIN__|/home/u/.opencode/bin/opencode|g" -e "s|__OPENCODE_PORT__|4096|g" \
-e "s|__PATH__|/usr/bin:/bin|g" -e "s|__OUTPUT_TOKEN_MAX__|160000|g" \
-e "s|__AUTO_LINE__|$auto|g" "$1"; }
for t in dashboard/qwen38-dashboard.service.template dashboard/opencode-web.service.template; do
r "$t" > "$scratch/u.rendered"
if grep -q '__[A-Z][A-Z0-9_]*__' "$scratch/u.rendered"; then echo "unsubstituted placeholder in $t:"; grep '__[A-Z][A-Z0-9_]*__' "$scratch/u.rendered"; exit 1; fi
done
# opencode stays on loopback: the relay is the one way in
r dashboard/opencode-web.service.template | grep -q -- 'serve --hostname 127.0.0.1 --port 4096'
r dashboard/opencode-web.service.template | grep -q 'EnvironmentFile=/home/u/.config/qwen38/opencode-web.env'
r dashboard/opencode-web.service.template | grep -q 'OPENCODE_EXPERIMENTAL_OUTPUT_TOKEN_MAX=160000'
# AGENT_AUTO=1 renders a single-quoted assignment so the JSON's double quotes survive systemd's parser
r dashboard/opencode-web.service.template | grep -qxF "$auto"
case "$auto" in *'"*bash":{'*) ;; *) echo "AGENT_AUTO's line lacks the shell rules: $auto"; exit 1 ;; esac
r dashboard/qwen38-dashboard.service.template | grep -q 'COCKPIT_AGENT_PORT=30091'
for ph in $(grep -ohE '__[A-Z][A-Z0-9_]*__' dashboard/qwen38-dashboard.service.template | sort -u); do
grep -q "$ph" dashboard/install-dashboard.sh || { echo "install-dashboard.sh does not render $ph"; exit 1; }
done
for ph in $(grep -ohE '__[A-Z][A-Z0-9_]*__' dashboard/opencode-web.service.template | sort -u); do
grep -q "$ph" dashboard/install-agent.sh || { echo "install-agent.sh does not render $ph"; exit 1; }
done
- name: Every unit the cockpit can start, stop or restart is in the sudoers allowlist
run: |
# The unit action takes its unit from a closed set; each member needs its
# three exact sudoers lines or the button fails with "a password is required".
cd dashboard
COCKPIT_DRY_RUN=1 python3 - <<'PY'
import re, sys, pathlib
sys.path.insert(0, ".")
import cockpit
allowed = set(re.findall(r"NOPASSWD:\s*(/usr/bin/systemctl \S+ \S+)", pathlib.Path("sudoers-cockpit.template").read_text()))
bad = sorted(f"/usr/bin/systemctl {v} {u}" for u in cockpit.SERVING_UNITS for v in cockpit.UNIT_VERBS
if f"/usr/bin/systemctl {v} {u}" not in allowed)
if bad:
print("not in dashboard/sudoers-cockpit.template:", *bad, sep="\n "); sys.exit(1)
print(f"cockpit unit actions: all {len(cockpit.SERVING_UNITS) * len(cockpit.UNIT_VERBS)} covered")
PY
- name: Every SGLang patch of the image and video lanes applies to its pinned commit
# install-image.sh and install-video.sh only note a patch that no longer applies
# (the lane serves either way), so a pin moved without them would ship a lane that
# holds a CPU core at rest (and, for the image lane, times out on a Stop during a
# generation). This fetches each patched file at each lane's own pin and checks the
# hunk against it. Both lanes take their patches from image-sglang/.
run: |
for inst in install-image.sh install-video.sh; do
pin=$(grep -oE 'SGLANG_DIFFUSION_PIN:-[0-9a-f]{40}' "$inst" | cut -d- -f2)
test -n "$pin" || { echo "$inst names no SGLANG_DIFFUSION_PIN"; exit 1; }
listed=$(grep -oE '^PATCHES=\(.*\)' "$inst" | tr -d '()' | cut -d= -f2)
test -n "$listed" || { echo "$inst lists no PATCHES"; exit 1; }
for name in $listed; do
patch="$PWD/image-sglang/$name.patch"
test -f "$patch" || { echo "$inst lists $name, and image-sglang/$name.patch does not exist"; exit 1; }
test "$(grep -c '^+++ ' "$patch")" = 1 || { echo "$name touches more than one file"; exit 1; }
f=$(grep -m1 '^+++ b/' "$patch" | cut -c7-)
d=$(mktemp -d); mkdir -p "$d/$(dirname "$f")"
curl -fsSL --retry 3 "https://raw.githubusercontent.com/sgl-project/sglang/$pin/$f" -o "$d/$f"
(cd "$d" && git init -q && git apply --check "$patch")
echo "$inst: $name applies to ${pin:0:12} ($f)"
done
done
listed=$(grep -oE '^PATCHES=\(.*\)' install-image.sh | tr -d '()' | cut -d= -f2)
for f in image-sglang/*.patch; do
name=$(basename "$f" .patch)
echo " $listed " | grep -q " $name " || { echo "$f is in the repo and install-image.sh never applies it"; exit 1; }
done
- name: Every text lane's chat template takes the message shapes the real clients send
# opencode 1.19.4 sends two system messages before the user's, and the Ornith lane's
# published template refused the second: a 400 on every opencode request from v1.38.6 to
# v1.40.1, as each release proved the clients on the lane that served (found 2026-10-24).
# This fetches each text target's template at its pin (each of switch-model.sh's targets
# but the image and video lanes), patches it as its installer does, and renders the shapes
# the real clients send (tests/fixtures/client-shapes.json), with tools and without, sent as
# strings and as lists of parts and handed on as each engine hands them (vLLM's and SGLang's
# own reading of the template and conversion of the messages), the way transformers does
# (364 renders identical to its own on the reference box). A template that raises fails
# here, and so do a text target the check does not know and an installer it cannot read.
run: |
pip install 'jinja2==3.1.6'
"$(./tests/testpy.sh jinja2)" tests/lane-templates-check.py
- name: The pinned opencode release is the one its sha256 names
# install.sh installs this exact asset on every box that has no opencode or an
# older one, and refuses a download that does not match. A pin bumped without
# its checksum, or a release asset replaced upstream, fails here instead of on a
# user's box. The asset itself is checked, not the API's word for it.
run: |
v=$(grep -oE '^OPENCODE_VERSION="\$\{OPENCODE_VERSION:-[0-9.]+\}"' install.sh | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
sha=$(grep -oE '^OPENCODE_SHA256="\$\{OPENCODE_SHA256:-[0-9a-f]{64}\}"' install.sh | grep -oE '[0-9a-f]{64}')
test -n "$v" && test -n "$sha" || { echo "install.sh no longer declares OPENCODE_VERSION and OPENCODE_SHA256 the way this step reads them"; exit 1; }
d=$(mktemp -d)
curl -fsSL --retry 3 -o "$d/oc.tar.gz" "https://github.com/anomalyco/opencode/releases/download/v$v/opencode-linux-arm64.tar.gz"
echo "$sha $d/oc.tar.gz" | sha256sum -c --quiet -
tar -tzf "$d/oc.tar.gz" | grep -qx opencode || { echo "the asset no longer holds an opencode binary at its top"; exit 1; }
echo "opencode $v: the release asset matches its pinned sha256"
- name: House typography (no em/en dashes in tracked files)
run: |
# In a locale that is not UTF-8, grep -P refuses these escapes with exit 2, and the
# `if` read that as "no dash" (found in review, 2026-09-24): the grep runs in
# C.UTF-8, and first proves on a real em dash that it can see one.
printf 'a\xe2\x80\x94b\n' | LC_ALL=C.UTF-8 grep -qP '[\x{2014}\x{2013}\x{2212}]' \
|| { echo "grep -P cannot see an em dash here: the check would read everything as clean"; exit 1; }
# -I: the check reads text files, as its name says. A PNG carries arbitrary compressed
# bytes, and three of them spelled an en dash inside the 2026-10-11 cockpit capture,
# which failed the v1.27.1 CI. No text file is spared: grep -I only skips what grep
# itself refuses to call text.
if git ls-files -z | LC_ALL=C.UTF-8 xargs -0 grep -InP '[\x{2014}\x{2013}\x{2212}]' 2>/dev/null; then
echo "em/en dash found (house style forbids them)"; exit 1
fi
suite:
# Each test file once, in its own process, under the offline guard (tests/run_suite.py).
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v7 # Node 24, the reference box's (static says why)
with:
node-version: '24'
- name: The offline suite touches nothing outside itself
run: |
# This repo's tests are run on the box that serves production, so
# "offline" has to be a checked property and not an intention. The
# suite gets a witness tree, runs, and the tree must be identical
# afterwards. It also must not have written into HOME, which is how
# three diagnostics bundles were once found in a developer's home
# directory, and must not have contacted the serving ports.
witness="$(mktemp -d)"
export HOME="$witness/home"
mkdir -p "$HOME/.config/qwen38"
echo "not-the-real-key" > "$HOME/.config/qwen38/api-key"
# The listening sockets compared below cannot see a connection to a port that
# was already listening, the engine's on the box that runs ci-local.sh (found in
# review, 2026-09-24). Every python the suite starts carries an audit hook that
# records a connect() to a serving port, with the test line that made it; a
# shell test's curl is not seen. Kept outside the witness, which is hashed.
probe="$(mktemp -d)"
# tests/run_suite.py loads the same hook into every python it starts (its sitecustomize.py),
# beside the one that compares each file's environment at its start and at its exit.
export QWEN38_CONTACT_LOG="$probe/contacts" QWEN38_SERVING_PORTS=30000,30001,30002,30020,30022,30024,30025,30026,30036,30090,30091,4096
before="$(find "$witness" -type f -exec sha256sum {} + | sort)"
ports_before="$(ss -Htln 2>/dev/null | awk '{print $4}' | sort || true)"
# The suite runs under tests/suite_reaper.py, a child subreaper: every process it
# starts stays its descendant, so what still runs once the suite is over is the
# suite's own, named with the sockets it listens on, then stopped. Comparing every
# listener of the machine instead failed twice on the reference box on 2026-10-03,
# for ports VS Code opened while the suite ran.
# Every test file runs once, on its own, as a human runs it, up to four at a time, the
# longest first, the files that take a port number out of a socket they close one at a
# time at the end (tests/run_suite.py): it fails, runs fewer tests than it declares, or
# leaves an environment variable changed, and it is named with what it did. The suite ran
# about four times per CI run until 2026-10-24: here, then each module again in
# tests/test_suite_isolation.py, which this step and the single-process pass both ran.
python3 tests/suite_reaper.py python3 tests/run_suite.py
after="$(find "$witness" -type f -exec sha256sum {} + | sort)"
if [ "$before" != "$after" ]; then
echo "the offline suite wrote into HOME:"
diff <(echo "$before") <(echo "$after") || true
exit 1
fi
ports_after="$(ss -Htln 2>/dev/null | awk '{print $4}' | sort || true)"
if [ "$ports_before" != "$ports_after" ]; then
# Not the suite's: the reaper above names and stops those. Another program
# opened or closed a port meanwhile; shown, and fatal on a runner only, where
# nothing else runs.
echo "listeners other programs opened (>) or closed (<) while the suite ran:"
diff <(echo "$ports_before") <(echo "$ports_after") | grep '^[<>]' || true
for addr in $(comm -13 <(echo "$ports_before") <(echo "$ports_after")); do
ss -Htlnp "sport = :${addr##*:}" 2>/dev/null | awk '{print " held by:", $4, $6}'
done
[ "${GITHUB_ACTIONS:-}" != "true" ] || { echo "(nothing else runs on a runner)"; exit 1; }
fi
if [ -s "$probe/contacts" ]; then
echo "the offline suite contacted a serving port:"
sort "$probe/contacts" | uniq -c | sort -rn | head -20
exit 1
fi
rm -rf "$witness" "$probe"
echo " ok: HOME untouched, nothing left running or listening, no serving port contacted"
single:
# Every unittest module of tests/ beside the others, in groups, each group one process: what a
# module does to another one of its group shows here, and to any other one in the pass that runs
# them all in ONE process, every night (nightly.yml) and before a release (tests/run_single.py).
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v7 # Node 24, the reference box's (static says why)
with:
node-version: '24'
- name: No test file in tests/ is left unrun
run: |
# Gate 8 counts declared against ran for dashboard/tests. tests/ had
# no equivalent, only the hand-kept list of named steps above, and on
# 2026-09-14 four tracked files sat in that directory with no step
# naming them: test_install_preflight.py, test_install_sudo.py,
# test_proxy_tls.py and test_uninstall_inventory.py. A test nobody
# runs is worse than no test, because it reads as coverage.
#
# tests/ holds two shapes. Most files are unittest modules, and those
# are discovered below, so they cannot be forgotten. The rest are
# plain scripts with a main() that exits non-zero (fake engines for
# bench.sh, needle.sh and the tools), which unittest cannot discover,
# so each of those has to be named by a step of its own.
pip install 'jinja2==3.1.6' # tests/test_lean_level.py renders with it
# tests/test_proxy_systemone.py's round trip through TypeSafe's own SDK. A failed
# install is refused below on the runner, where the SDK is not optional.
pip install 'typesafe-sdk==0.7.0' 2>/dev/null || echo "typesafe-sdk unavailable: the SDK round trip will skip"
python3 - <<'PY'
import pathlib, sys
ci = pathlib.Path(".github/workflows/ci.yml").read_text()
orphans = []
for f in sorted(pathlib.Path("tests").glob("test_*.py")):
if "def test_" in f.read_text():
continue # unittest module: the discovery below runs it
if f.name not in ci:
orphans.append(f.name)
if orphans:
print("script-style test files that no CI step names:")
for o in orphans:
print(" tests/" + o + " -> add: run: python3 tests/" + o)
sys.exit(1)
print("every script-style test file is named by a step")
PY
# The modules in groups, each group one process, the groups side by side: in ONE process
# they were the longest job of a run, 1,808 s of its 30 minutes (2026-11-10), half of it
# the pair's tests. The run fails when a group fails, when fewer tests ran than the files
# declare (a skip decorator on a whole class stayed green until that was counted,
# 2026-09-24), and when a test was skipped for a reason its list does not name: what a
# runner cannot have (the reference box, its cache, its units, opencode), or a case that
# only the in-process twin of its class runs. It reads a reason whatever quotes unittest
# writes it in: this step read single quotes alone, and saw none of the reasons that hold
# an apostrophe, 85 of the 95 that tests/ gives (found in review, 2026-11-10).
python3 tests/run_single.py
# Each one must also run its own tests when invoked directly: a file
# without a __main__ block exits 0 having run nothing, and a SkipTest out
# of setUpClass counts as one skip with testsRun 0, which is how
# test_install_sudo.py declared two tests and ran none on every runner
# until this gate existed (skip with a class decorator). The offline step
# runs every file on its own and checks that count; it was run again
# here until 2026-10-18.
coverage:
# The coverage floors of the root modules (the cockpit's are the next job's).
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v7 # Node 24, the reference box's (static says why)
with:
node-version: '24'
- name: Coverage floors, the root modules
run: |
scratch="${TMPDIR:-/tmp}" # ci-local.sh gives each step its own; a runner has none
pip install 'coverage==7.16.0' 2>/dev/null || true
PY="$(./tests/testpy.sh coverage)"
rm -f .coverage*
# Four files at a time, the pair's four files first: one after the other the files took
# 1,283 s on 2026-11-10, when the pair's tests were one file, 892 s of the pass that ran
# every module in one process. --parallel-mode gives every run a data file of its own,
# which combine reads below.
files="tests/test_proxy_pair_one_model_inprocess.py tests/test_proxy_pair_one_model.py \
tests/test_proxy_pair.py tests/test_proxy_pair_inprocess.py tests/test_proxy_hold.py \
tests/test_proxy_guard.py tests/test_proxy_abort.py tests/test_proxy_keepalive.py \
tests/test_proxy_client_keys.py tests/test_proxy_systemone.py \
tests/test_proxy_short_body.py tests/test_proxy_engine_withholds_headers.py \
tests/test_proxy_door.py tests/test_proxy_follows_engine_restarts.py \
tests/test_proxy_vllm_lane.py tests/test_proxy_body_budget.py \
tests/test_proxy_connection_ceiling.py tests/test_proxy_content_encoding.py \
tests/test_proxy_count_routes_cap.py tests/test_proxy_rejudge_after_hold.py \
tests/test_proxy_score_guard.py tests/test_proxy_uncountable_shapes.py \
tests/test_proxy_unknown_vocab.py tests/test_proxy_video_guard.py \
tests/test_proxy_override_headers.py tests/test_proxy_floor_stop.py \
tests/test_proxy_tool_targets.py tests/test_tools.py tests/test_oc_fit_limits.py \
tests/test_oc_merge_limits.py tests/test_patch_kv.py"
echo $files | tr ' ' '\n' | xargs -P 4 -n 1 sh -c \
'"$0" -m coverage run --branch --parallel-mode --source=. --omit="dashboard/*,tests/*,.venv-test/*" "$1" >/dev/null 2>&1 || true' "$PY"
"$PY" -m coverage combine -q
"$PY" -m coverage report --sort=cover | tee "$scratch/rootcov.txt"
rm -f .coverage*
"$PY" - "$scratch/rootcov.txt" <<'PYEOF'
import re, sys
# Measured 2026-09-10. keepalive-proxy.py is the production serving path
# and had no floor at all until this step; it went 68 to 75% when the
# keepalive injection, the silence ceiling and the non-streamed relay
# finally got tests. patch-yarn went 0 to 94% the same day.
# 2026-09-19: the System One endpoint and its suite took the module from 75 to
# 83% branch coverage, so the floor moves up with it. A floor that trails the
# measured number by ten points stops being a floor.
# 2026-09-21: 84% once the refusals for the unbounded sampling fields landed
# with their own tests, so the floor follows again.
# 2026-10-01: 87% with the hold of v6.28 and its suite run in-process as well
# (run only as a process, it took the module down to 81%): the floor follows.
# 2026-10-17: 87% again with the nine suites of v6.41's guards in the list above;
# without them its new code read as untested, 81%.
# 2026-11-02: role 10 (v6.50, the pair) read as untested, 80%, until test_proxy_pair.py ran its
# entry in-process too and joined the list (its in-process cases are two files of their own
# since 2026-11-10: test_proxy_pair_inprocess.py and test_proxy_pair_one_model_inprocess.py).
# 2026-11-14: patch-kv.py, which writes the Arete target's fp8 KV declaration into the
# config the engine reads, gets patch-yarn.py's floor for patch-yarn.py's reason (98% measured).
FLOORS = {"keepalive-proxy.py": 85, "patch-yarn.py": 90, "patch-kv.py": 90,
"oc-fit-limits.py": 37, "build-token-map.py": 35}
got, bad = {}, []
for line in open(sys.argv[1]):
m = re.match(r"^(\S+\.py)\s+\d+\s+\d+\s+\d+\s+\d+\s+(\d+)%", line)
if m:
got[m.group(1)] = int(m.group(2))
for name, floor in FLOORS.items():
have = got.get(name)
if have is None:
bad.append(f"{name}: not measured at all")
elif have < floor:
bad.append(f"{name}: {have}% is under its {floor}% floor")
else:
print(f" ok {name}: {have}% (floor {floor}%)")
if bad:
print("\n".join(" FAIL " + b for b in bad))
sys.exit(1)
PYEOF
coverage-cockpit:
# The coverage floors of the cockpit's modules: a job of its own since 2026-11-10, beside the
# root modules' and not after them (338 s after 1,283 s that day, in one job).
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v7 # Node 24, the reference box's (static says why)
with:
node-version: '24'
- name: Coverage floors (measured, per module)
run: |
scratch="${TMPDIR:-/tmp}" # ci-local.sh gives each step its own; a runner has none
pip install 'coverage==7.16.0' 2>/dev/null || true
# the property checks below need it: in one job, the proxy fuzz had installed it before
pip install 'hypothesis==6.168.0'
PY="$(./tests/testpy.sh coverage)"
cd dashboard
rm -f .coverage*
"$PY" -m coverage run --branch --parallel-mode --source=. -m unittest \
$(cd tests && ls test_*.py | sed 's/\.py$//' | sed 's/^/tests./' | tr '\n' ' ')
# the property checks are a suite too: leaving them out of the
# measurement reported three validate() branches as uncovered while
# they were being exercised 300 times each. Without hypothesis they say
# SKIPPED and exit 0, having measured nothing (code review, 2026-10-28).
out=$("$PY" -m coverage run --branch --parallel-mode --source=. tests/property_checks.py) \
|| { echo "$out" | tail -20; exit 1; }
case "$out" in *SKIPPED*) echo "$out"; exit 1 ;; esac
"$PY" -m coverage combine -q
"$PY" -m coverage report --sort=cover | tee "$scratch/cov.txt"
rm -f .coverage*
# A floor per module, raised in a commit and never lowered quietly.
# These are what was measured on 2026-09-10, minus a point of slack.
"$PY" - "$scratch/cov.txt" <<'PYEOF'
import re, sys
# Raised in a commit, never lowered quietly. cockpit.py went
# 14 -> 30 -> 53 -> 59 -> 71 over one day of writing tests.
#
# lifecycle.py and recipes.py are at 100% BRANCH coverage and are held
# there: they are pure logic, so there is no excuse, and the two
# branches that cannot be taken by any input carry a "pragma: no
# branch" whose reason is itself guarded by a test
# (test_every_marker_is_handled_by_the_chain). A module that reaches
# 100% and is then allowed to slip is worse than one that never got
# there, because the number stops meaning anything.
# A floor belongs to the MOST CONSTRAINED environment that has to pass
# it, which is the runner and not a developer's box: cockpit.py reads
# 71% here and 69% on a GitHub runner, because the runner has no
# docker, no systemctl and no nvidia-smi, so several collector branches
# never run there. The gate caught exactly that on the first push. Note
# that lifecycle.py and recipes.py read 100% in both, which is what
# being pure logic buys.
FLOORS = {"cockpit.py": 68, "agent_relay.py": 88, "registry.py": 88,
"lifecycle.py": 100, "recipes.py": 100}
TOTAL_FLOOR = 89
got, bad = {}, []
for line in open(sys.argv[1]):
m = re.match(r"^(\S+\.py|TOTAL)\s+\d+\s+\d+\s+\d+\s+\d+\s+(\d+)%", line)
if m:
got[m.group(1)] = int(m.group(2))
for name, floor in FLOORS.items():
have = got.get(name)
if have is None:
bad.append(f"{name}: not measured at all")
elif have < floor:
bad.append(f"{name}: {have}% is under its {floor}% floor")
else:
print(f" ok {name}: {have}% (floor {floor}%)")
total = got.get("TOTAL")
if total is None:
bad.append("no TOTAL line in the coverage report")
elif total < TOTAL_FLOOR:
bad.append(f"total {total}% is under the {TOTAL_FLOOR}% floor")
else:
print(f" ok TOTAL: {total}% (floor {TOTAL_FLOOR}%)")
if bad:
print("\n".join(" FAIL " + b for b in bad))
sys.exit(1)
PYEOF
cockpit:
# The cockpit's unit tests, then the cockpit in a headless browser.
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v7 # Node 24, the reference box's (static says why)
with:
node-version: '24'
- name: Google Chrome for arm64 (the arm64 runner has none)
# On 2026-11-11 this step hung four times in apt-get, on a name the runner could not resolve
# (ports.ubuntu.com), until each attempt was cancelled by hand. It now ends by itself after 10
# minutes, and the download of Google's key has a deadline and three tries. apt's own tries and
# timeouts (3, and 30 s) are the runner's already and bound no name that does not resolve, so
# none is set here. tests/test_chrome_step.py holds the two guards.
timeout-minutes: 10
run: |
# The headless browser steps read CHROME, or the first of google-chrome, chromium and
# chromium-browser. GitHub's arm64 image ships none: Chrome comes from Google's own arm64
# repository, the one the reference box installs it from, once the key that signs it is the one
# the box trusts (its primary key, checked against the box's keyring on 2026-10-28). A machine
# that has one of them keeps it and gets nothing installed: ci-local.sh runs this step on a
# contributor's machine too, and one with only Chromium went to sudo apt (review of PR #60).
browser="${CHROME:-}"
[ -n "$browser" ] && [ -x "$browser" ] \
|| browser="$(command -v google-chrome || command -v chromium || command -v chromium-browser || true)"
if [ -z "$browser" ]; then
key="${RUNNER_TEMP:-${TMPDIR:-.}}/google-linux-signing-key.pub"
curl -fsSL --retry 3 --max-time 60 https://dl.google.com/linux/linux_signing_key.pub -o "$key"
fpr=$(gpg --show-keys --with-colons "$key" | awk -F: '$1 == "fpr" { print $10; exit }')
[ "$fpr" = EB4C1BFD4F042F6DDDCCEC917721F63BD38B4796 ] || { echo "Google's signing key is $fpr, not the one the box trusts"; exit 1; }
sudo gpg --dearmor -o /usr/share/keyrings/google-chrome.gpg < "$key"
echo "deb [arch=arm64 signed-by=/usr/share/keyrings/google-chrome.gpg] https://dl.google.com/linux/chrome-repo/deb/ stable main" \
| sudo tee /etc/apt/sources.list.d/google-chrome.list > /dev/null
sudo apt-get update -qq
sudo apt-get install -y -qq google-chrome-stable
browser="$(command -v google-chrome)"
fi
"$browser" --version
- name: The cockpit page survives losing its server (headless browser, a cockpit of its own)
run: |
# The browser checks in dashboard/tests/*.mjs ran nowhere (found in review,
# 2026-09-24). This one and the three below own what they drive: a dry-run
# cockpit on loopback with a key of its own, a PATH whose box commands answer
# nothing and no network, and a browser that resolves no name. The other two
# drive the live cockpit of a box and stay manual; they are parsed here. Parsing
# is not running: the update banner check called functions the redesign of
# 2026-09-30 renamed and failed 7 of 9 since, parsed green, and the monkey check
# found a page that read '…' for good with no text engine (both 2026-10-02):
# they own their cockpit now and run below.
for f in dashboard/tests/*.mjs; do node --check "$f"; done
node dashboard/tests/resilience-check.mjs
- name: The cockpit says when a newer version exists (headless browser, a cockpit of its own)
run: node dashboard/tests/update-banner-check.mjs
- name: The cockpit survives a click storm on every view (headless browser, a cockpit of its own)
run: node dashboard/tests/monkey-check.mjs
- name: The cockpit page works under a finger (headless browser, real taps, a cockpit of its own)
run: |
# Every browser check switched views with element.click() from script, which
# ignores what covers the element: on a phone the drawer's veil covered every rail
# item and all of them stayed green (2026-09-30). This one taps where a finger
# lands, on five touch screens and a laptop, and reads what the page did.
node dashboard/tests/touch-check.mjs
- name: The Agent tab against a real opencode (headless browser, a cockpit and an opencode of its own)
timeout-minutes: 15
run: |
# The Agent checks drove the live cockpit of a box, by hand: opencode 1.19 sent its page
# chunked, and the relay dropped the phone layer, and it checks the Origin of every terminal
# connection; both were found on a box after an update (2026-10-11 and 2026-10-22). This one
# fetches the opencode release install.sh pins, checked against its sha256, and drives it
# through a dry-run cockpit whose relay answers on 127.0.0.2: the relay's gate, the Agent tab,
# the phone layer in the page opencode sends, and a terminal with a command run in it.
node dashboard/tests/agent-bench.mjs
- name: Cockpit unit tests (every tests/test_*.py, discovered)
run: |
cd dashboard
# Count what unittest actually runs against what the files declare.
# test_lifecycle.py had 58 tests and no __main__ block, so running it
# as a script executed nothing and exited 0: the largest suite in the
# repo was green because it never ran. Silence is not a pass.
# Discovered, not listed: a fourth test file that nobody runs is worse
# than no fourth file, and the list was hardcoded until 2026-09-08.
files=$(cd tests && ls test_*.py | sort | tr '\n' ' ')
mods=$(for f in $files; do printf 'tests.%s ' "${f%.py}"; done)
echo "suites: $mods"
declared=$(cd tests && cat $files | grep -c 'def test_')
out=$(python3 -m unittest -v $mods 2>&1)
echo "$out" | tail -5
ran=$(echo "$out" | grep -oE '^Ran [0-9]+' | grep -oE '[0-9]+' || echo 0)
echo "declared $declared, ran $ran"
[ "$ran" = "$declared" ] || { echo "unittest ran $ran of $declared declared tests"; exit 1; }
# "Ran" counts a skipped test as run, so a skip on a whole class stayed green
# (found in review, 2026-09-24). No cockpit test has a reason to skip here.
skips=$(echo "$out" | grep -E "\.\.\. skipped '" || true)
[ -z "$skips" ] || { echo "cockpit tests skipped:"; echo "$skips"; exit 1; }
# Each file is also run on its own, the way a human runs it, by the suite job's
# offline step, under its witness HOME, with the count it reports checked: a
# file without a __main__ block exits 0 having run nothing, and a file that
# fails on its own but passes after the modules before it in the run above
# fails there. It ran here as well until 2026-10-18, so each file ran three
# times in all.
fuzz:
# Generated inputs: the proxy fuzz, the mutation score, the property checks.
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v5
- name: Proxy fuzz and relay simulation (hypothesis, generated bytes and clients)
run: |
pip install 'hypothesis==6.168.0'
out=$(python3 tests/proxy_fuzz.py 2>&1) || { echo "$out" | tail -40; exit 1; }
echo "$out" | tail -3
echo "$out" | grep -qE '^proxy fuzz: [0-9]+ passed of [0-9]+, [0-9]+ generated examples each$' \
|| { echo "the fuzz suite did not report a run"; echo "$out" | tail -20; exit 1; }
n=$(echo "$out" | grep -oE '^proxy fuzz: [0-9]+' | grep -oE '[0-9]+')
# every one of the 16: a floor of 15 let one of them disappear
[ "$n" -ge 16 ] || { echo "only $n fuzz checks ran"; exit 1; }
- name: Mutation score (do the tests catch a wrong operator?)
run: |
# The only question that matters for a suite written alongside its code:
# if the code were wrong, would the tests notice? This edits one operator
# at a time and runs the suite after each edit. Measured 2026-09-10:
# lifecycle.py 74.8% before the two MutantsThatSurvived classes were
# written from a first run's survivors, 90.8% after. The remainder are
# largely equivalent mutants (an `or` clause that already covers the
# threshold next to it), which is the known ceiling of the method.
python3 tests/mutation.py --all
- name: Property-based checks (hypothesis, generated inputs)
run: |
pip install 'hypothesis==6.168.0'
out=$(python3 dashboard/tests/property_checks.py 2>&1) || { echo "$out"; exit 1; }
echo "$out" | tail -3
# A suite that could not run must not pass: the runner prints this line
# only after it has actually generated and checked its examples.
echo "$out" | grep -qE '^property checks: [0-9]+ passed of [0-9]+, [0-9]+ generated examples each$' \
|| { echo "the property suite did not report a run"; echo "$out" | tail -20; exit 1; }
n=$(echo "$out" | grep -oE '^property checks: [0-9]+' | grep -oE '[0-9]+')
[ "$n" -ge 40 ] || { echo "only $n property checks ran"; exit 1; }
checks:
# Every job above passed: the status of the run, under the name it always had. It runs when one
# of them failed too, and fails then: a job skipped because a job it needs failed reads as
# passed to a rule that requires it (code review, 2026-10-28).
needs: [static, suite, single, coverage, coverage-cockpit, cockpit, fuzz]
if: always()
runs-on: ubuntu-24.04-arm
steps:
- name: Every job passed
env:
RESULTS: ${{ join(needs.*.result, ' ') }}
run: |
# ci-local.sh runs this job once the seven have passed, and only then, with no RESULTS
echo "static, suite, single, coverage, coverage-cockpit, cockpit and fuzz: ${RESULTS:-passed}"
for r in $RESULTS; do [ "$r" = success ] || exit 1; done