mirror of
https://github.com/hasso5703/alzeo.git
synced 2026-12-06 21:04:21 +01:00
The first version gave the image lane its own Start button inside the Image tab.
It started the lane by a path neither text lane uses, and through the unit's
Conflicts= it stopped a serving text lane silently, where the cockpit's rule for
every other lane is to refuse and say "stop it first". It is now driven from the
same three controls as the 27B and flash lanes, the switcher, Switch, and the
action bar's lane button, and the Image tab has no lane control of its own.
A THIRD ENGINE TO THE LIFECYCLE. The collector was written for docker engines:
a container, docker logs, a pool guard, a wedge canary on the text port. The
image lane gets its own facts (the unit's state, its own /health, its journal)
and produces the same entry shape, so every generic view picks it up unchanged:
the lane pill, the lane button, the Engines card, the Overview card, the badges.
Its boot is read off its own journal in eight named milestones, matched on what
a line says rather than when (the engine and uvicorn write two timestamp
formats), and the component being loaded travels as `detail`: "the 13.3 GB DiT"
says more than "weights" for the half minute it takes. Its boot duration is
learned like the others' (70 s, recorded on the reference box).
THREE ENGINES, ONE RULE. blocked_reasons picked "the other engine" with [0],
which with three of them checked one neighbour in two and let the third
through. It now checks every other engine. Starting the image lane while the
27B serves answers 409 blocked, and so does starting the 27B while the image
lane loads. Conflicts= stays on the unit as a second belt for a systemctl start
typed at a terminal, which the cockpit never reaches.
A TEXT ENGINE IS NOT ANY ENGINE. servingReady() answered "is an engine up",
and four callers meant "is the TEXT engine up": Flush cache, Abort all and
Smoke were enabled while the image lane served and would have hit a closed
port, and the Overview kept the previous LLM's model, pool and window under an
image engine. textReady() is the question they ask now.
switch-model.sh image verifies the checkpoint from the lane's own venv (no
docker image to inspect) and makes the image unit the one enabled at boot. It
leaves the proxy and opencode alone: both are text clients, and pointing
opencode's default at an image lane would break every session it opened. A
switch to a text target now takes the image lane off the boot too.
Found by running the real cycle through the cockpit's own action API, not by
reading the code:
- The image unit was installed 0600. mktemp creates 0600 and cp keeps the
mode, so the unit was readable by root alone. systemd did not mind; every
other reader did, and failed quietly: switch-model.sh could not find the
runtime, and the cockpit's reads of the port, the bind and the model all
fell back to their defaults, which happened to be right on the reference
box and would not have been on one installed with IMAGE_PORT= or
IMAGE_BIND=. Installed with install -m 644 now, and an already-installed
unit is chmod-ed even when its content has not changed.
- The image branch of switch-model.sh ran before install.sh's pins were
evaluated, so HF_CACHE was unbound under set -u.
- A plain ./install.sh on a box switched to images fell through to "27b",
enabled the 27B unit beside the image one, and left two engines set to
start at the next reboot, with the order systemd pulled them in deciding
which came up. That undid the operator's switch on a routine update, the
one thing install.sh promises not to do. It now brings the text lane up to
date without enabling or starting it, and the image lane stays the boot
lane.
- install-image.sh's smoke test stopped the image unit on the way out
unconditionally, so re-running the installer on a box whose image lane was
serving ended with it stopped. It now leaves the lane as it found it.
What the user saw during the two waits, fixed from screenshots taken in a real
browser at laptop and iPhone widths:
- The progress bar sat under the frame of the coming image, and a square
1024 frame at the panel's width is taller than a laptop screen: the bar was
below the fold for the whole generation. It now lives inside the frame,
where the eye already is, and the frame and the image are capped to the
viewport so the result and its facts are on screen. On a phone the result
panel is scrolled into view below the sticky bars at their real height.
- The bar was a node that moves into the frame, and emptying the output
panel detached it, so the second generation would have appended null. It
is held by reference.
- "Use a sample" ran for twenty seconds behind a one-line status with both
buttons live; a second click was a request the cockpit refused with 409 and
a toast that read like a failure. It waits like any generation now, timed
against its own 20 steps rather than the form's 40.
- The sample is a red teapot and the "Local edit" example asked to change a
book cover. The example is now the cookbook's own edit prompt, which is
about that teapot.
- Six strings said "about 9 minutes" to ready; the image lane takes about
70 seconds. Each lane now reports its own, learned from its boots once it
has some.
- Before a lane has booted in front of the cockpit, its bar used the
measured duration instead of reading "learning the duration".
- The estimate was linear in pixels and 20% short at 2048x2048 (153 s
against 190.9 measured). It is a power law fitted to nine measurements,
within 6.5% of every one of them.
- A target whose lane is not installed is marked so in the switcher and
cannot be picked, with the command that installs it. The image lane is
opt-in, so most boxes would otherwise offer a switch that fails a second
later.
- The opencode banner compared against the usable share of the pool, a
number printed nowhere else on the page, beside a panel showing the pool:
it read as the cockpit contradicting itself. It names both now.
Known and documented, not fixed: when the image engine wedged, its /health kept
answering 200. The lifecycle would read such a wedge as ready; the text lanes
have a generation canary for that and this lane does not yet.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1309 lines
85 KiB
YAML
1309 lines
85 KiB
YAML
name: ci
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
checks:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Shell syntax
|
|
run: |
|
|
for f in get.sh install.sh run.sh switch-model.sh uninstall.sh bench.sh bench-matrix.sh flash-sglang/build-image.sh extras/cake-ingress/cake-ingress extras/cake-ingress/setup.sh dashboard/install-dashboard.sh dashboard/install-agent.sh dashboard/pyspy-scheduler.sh dashboard/tests/smoke-http.sh; do
|
|
bash -n "$f"
|
|
done
|
|
|
|
- name: shellcheck (warning severity)
|
|
run: shellcheck -S warning get.sh install.sh run.sh switch-model.sh uninstall.sh bench.sh bench-matrix.sh flash-sglang/build-image.sh extras/cake-ingress/cake-ingress extras/cake-ingress/setup.sh dashboard/install-dashboard.sh dashboard/install-agent.sh dashboard/pyspy-scheduler.sh dashboard/tests/smoke-http.sh
|
|
|
|
- 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'
|
|
ruff check --select F,E9 patch-template.py patch-yarn.py keepalive-proxy.py oc-fit-limits.py oc-point-default.py bench-agent.py conc-check.py build-token-map.py tools-check.py systemone-check.py bench-systemone.py evals/*.py tests/*.py dashboard/*.py dashboard/tests/*.py
|
|
python3 -m py_compile patch-template.py patch-yarn.py keepalive-proxy.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: 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 $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; }
|
|
# Each file must also RUN its tests when invoked directly, the way a
|
|
# human and the old CI step do. A file without a __main__ block exits 0
|
|
# having run nothing, so only the reported count proves anything.
|
|
for f in $(cd tests && ls test_*.py | sed 's/\.py$//' | sort); do
|
|
d=$(grep -c 'def test_' "tests/$f.py")
|
|
o=$(python3 "tests/$f.py" 2>&1 || true)
|
|
r=$(echo "$o" | grep -oE 'Ran [0-9]+' | grep -oE '[0-9]+' || echo 0)
|
|
echo " $f.py run directly: ran $r of $d"
|
|
[ "$r" = "$d" ] || { echo "$f.py ran $r of its $d tests when invoked directly"; exit 1; }
|
|
done
|
|
|
|
- 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]+')
|
|
[ "$n" -ge 15 ] || { echo "only $n fuzz checks ran"; exit 1; }
|
|
|
|
- name: Coverage floors, the root modules
|
|
run: |
|
|
pip install 'coverage==7.16.0' 2>/dev/null || true
|
|
PY="$(./tests/testpy.sh coverage)"
|
|
rm -f .coverage*
|
|
for f in 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_tools.py tests/test_oc_fit_limits.py tests/test_oc_merge_limits.py; do
|
|
"$PY" -m coverage run --branch --parallel-mode --source=. \
|
|
--omit="dashboard/*,tests/*,.venv-test/*" "$f" >/dev/null 2>&1 || true
|
|
done
|
|
"$PY" -m coverage combine -q
|
|
"$PY" -m coverage report --sort=cover | tee /tmp/rootcov.txt
|
|
rm -f .coverage*
|
|
"$PY" - <<'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.
|
|
FLOORS = {"keepalive-proxy.py": 83, "patch-yarn.py": 90,
|
|
"oc-fit-limits.py": 37, "build-token-map.py": 35}
|
|
got, bad = {}, []
|
|
for line in open("/tmp/rootcov.txt"):
|
|
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
|
|
|
|
- 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: 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"
|
|
before="$(find "$witness" -type f -exec sha256sum {} + | sort)"
|
|
ports_before="$(ss -Htln 2>/dev/null | awk '{print $4}' | sort || true)"
|
|
(cd dashboard && python3 -m unittest \
|
|
$(cd tests && ls test_*.py | sed 's/\.py$//' | sed 's/^/tests./' | tr '\n' ' ') \
|
|
2>&1 | tail -3)
|
|
(for f in tests/test_*.py; do python3 "$f" >/dev/null 2>&1 || { echo "$f failed"; exit 1; }; done)
|
|
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)"
|
|
[ "$ports_before" = "$ports_after" ] || {
|
|
echo "the offline suite left a listening socket behind:"
|
|
diff <(echo "$ports_before") <(echo "$ports_after") || true
|
|
echo "(on the CI runner this is the suite. Running ci-local.sh ON a serving box,"
|
|
echo " an engine or cockpit finishing its boot mid-suite shows up here too: check"
|
|
echo " whether the port that appeared is one of this repo's own before digging.)"
|
|
exit 1; }
|
|
rm -rf "$witness"
|
|
echo " ok: HOME untouched, no socket left listening"
|
|
|
|
- name: Coverage floors (measured, per module)
|
|
run: |
|
|
pip install 'coverage==7.16.0' 2>/dev/null || true
|
|
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
|
|
"$PY" -m coverage run --branch --parallel-mode --source=. \
|
|
tests/property_checks.py >/dev/null
|
|
"$PY" -m coverage combine -q
|
|
"$PY" -m coverage report --sort=cover | tee /tmp/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" - <<'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("/tmp/cov.txt"):
|
|
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
|
|
|
|
- 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; }
|
|
|
|
- name: Pin contracts (every consumer's own block runs against install.sh)
|
|
run: |
|
|
n=$(grep -cE '^(IMAGE|STOCK_REPO|STOCK_REV|UNC_REPO|UNC_REV|FP8_REPO|FP8_REV|UNCFP8_REPO|UNCFP8_REV|MODEL_CHOICE|CONTEXT_MODE|DRAFT2_REPO|DRAFT2_REV|DRAFT2_QUANT|DRAFT2_TOKENS|SERVE_IMAGE|PORT|HF_CACHE|CONFIG_DIR)=' install.sh)
|
|
[ "$n" -eq 19 ] || { echo "run.sh pin contract broken: $n != 19"; exit 1; }
|
|
n=$(grep -cE '^(IMAGE|STOCK_REPO|STOCK_REV|UNC_REPO|UNC_REV|FP8_REPO|FP8_REV|UNCFP8_REPO|UNCFP8_REV|FLASH_REPO|FLASH_REV|FLASH_IMAGE|FLASH_SERVE_IMAGE|OVERLAY_FLASH_SERVE_IMAGE|MODEL_CHOICE|HF_CACHE|CONFIG_DIR)=' install.sh)
|
|
[ "$n" -eq 17 ] || { echo "switch-model.sh pin contract broken: $n != 17"; 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 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" > /tmp/pinblock.sh
|
|
[ -s /tmp/pinblock.sh ] || { echo "$consumer: no PINS block found"; exit 1; }
|
|
{ echo 'die() { echo "$*" >&2; exit 1; }'; cat /tmp/pinblock.sh; } > /tmp/pincheck.sh
|
|
REPO_DIR=. bash -euo pipefail /tmp/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"
|
|
[ -n "$UNC_REV" ] && [ -n "$STOCK_REV" ] && [ "$MODEL_CHOICE" = "stock" ]
|
|
# 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|OVERLAY_FLASH_BASE_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
|
|
# The overlay's files were diffed against ONE base image. If the rollback
|
|
# ever builds on the image the lane serves by default, it grafts them
|
|
# onto a layout nobody checked them against.
|
|
case "$OVERLAY_FLASH_BASE_IMAGE" in *@sha256:*) ;; *) echo "OVERLAY_FLASH_BASE_IMAGE is not digest-pinned"; exit 1 ;; esac
|
|
[ "$OVERLAY_FLASH_BASE_IMAGE" != "$FLASH_IMAGE" ] || { echo "the flash overlay rollback must not build on the image the lane serves"; exit 1; }
|
|
grep -q 'BASE_IMAGE="$OVERLAY_FLASH_BASE_IMAGE"' install.sh || { echo "the flash overlay build no longer uses its pinned base"; exit 1; }
|
|
# 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.
|
|
dl=$(sed -n '/^for repo, rev in ((os.environ/,/^)):/p' install.sh \
|
|
| grep -oE 'os\.environ\["[A-Z0-9_]+_REPO"\]' | grep -oE '[A-Z0-9_]+_REPO' | 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: |
|
|
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|__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" > /tmp/unit.rendered
|
|
if grep -q '__[A-Z_]*__' /tmp/unit.rendered; then
|
|
echo "unsubstituted placeholder in $t:"; grep '__[A-Z_]*__' /tmp/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: |
|
|
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|__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"
|
|
}
|
|
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 > /tmp/flash-unit.rendered
|
|
grep -q 'Restart=always' /tmp/flash-unit.rendered
|
|
grep -q 'launch-flash.sh' /tmp/flash-unit.rendered
|
|
render qwen38-flash-launch.sh.template > /tmp/flash.rendered
|
|
if grep -q '__[A-Z_]*__' /tmp/flash.rendered; then echo "unsubstituted placeholder in the flash launcher:"; grep '__[A-Z_]*__' /tmp/flash.rendered; exit 1; fi
|
|
bash -n /tmp/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' /tmp/flash.rendered
|
|
grep -q -- '--ple-offload-dir /ple' /tmp/flash.rendered
|
|
grep -q -- '--mamba-radix-cache-strategy extra_buffer' /tmp/flash.rendered
|
|
grep -q -- '--speculative-algorithm NEXTN' /tmp/flash.rendered
|
|
grep -q -- '--speculative-eagle-topk 1' /tmp/flash.rendered
|
|
grep -q -- '--chunked-prefill-size 4096' /tmp/flash.rendered
|
|
grep -q -- '--page-size 64' /tmp/flash.rendered
|
|
grep -q -- '--fp4-gemm-backend flashinfer_cutlass' /tmp/flash.rendered
|
|
grep -q -- '--mem-fraction-static 0.85' /tmp/flash.rendered
|
|
grep -q -- '--max-mamba-cache-size' /tmp/flash.rendered
|
|
grep -q -- '--speculative-token-map /out/token-map-65536.pt' /tmp/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
|
|
grep -q -- '--speculative-draft-model-quantization unquant' /tmp/flash.rendered
|
|
grep -q -- '--api-key' /tmp/flash.rendered
|
|
grep -q 'chat-template-flashnext.jinja' /tmp/flash.rendered
|
|
grep -q 'HF_HUB_OFFLINE=1' /tmp/flash.rendered
|
|
grep -q -- '--revision cafe' /tmp/flash.rendered
|
|
if grep -q -- '--language-only' /tmp/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_' /tmp/flash.rendered
|
|
grep -q 'SGLANG_QWEN4_PLE_FILE_RSS_BUDGET_GB=8' /tmp/flash.rendered
|
|
grep -q 'SGLANG_OPT_MAMBA_SKIP_DECODE_LOCK=1' /tmp/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 > /tmp/flash.thr
|
|
if grep -q -- '--speculative-token-map' /tmp/flash.thr; then
|
|
echo "the throughput tier must not carry a draft vocabulary"; exit 1
|
|
fi
|
|
bash -n /tmp/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 > /tmp/flash.nvda
|
|
grep -q -- '--moe-runner-backend flashinfer_cutlass' /tmp/flash.nvda
|
|
if grep -q -- '--quantization modelopt_fp4' /tmp/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' /tmp/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.
|
|
knob() { FLASH_TIER="$1" FLASH_REPLAYSSM_SPEC="$2" bash -c '
|
|
eval "$(sed -n "/^resolve_flash_tier_args() {/,/^}/p" install.sh)"
|
|
resolve_flash_tier_args >/dev/null 2>&1; echo "rc=$?|$FLASH_TIER_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)
|
|
|
|
html = pathlib.Path("dashboard/static/index.html").read_text()
|
|
m = re.search(r'<select id="switchsel".*?</select>', html, re.S)
|
|
if not m:
|
|
fail("no switchsel in index.html")
|
|
ui = re.findall(r'<option value="([^"]+)"', m.group(0))
|
|
|
|
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 lanes a flag
|
|
# installs, which today is one: `image`, installed by --with-image, switched
|
|
# to like any other, and not an LLM checkpoint (it has no recipe, no KV pool
|
|
# and no opencode default). Both sets are asserted, so a lane added to the
|
|
# switcher and forgotten in the cockpit's enum is still caught.
|
|
FLAG_LANES = ["image"]
|
|
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: |
|
|
# 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)" = "194048 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)" = "194048 64000 local" ] || { echo "fp8 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)" = "225000 32000 local" ] || { echo "$t/context drifted"; exit 1; }
|
|
[ "$(l "$t" concurrency)" = "100000 16000 local" ] || { echo "$t/concurrency drifted"; exit 1; }
|
|
[ "$(l "$t" throughput)" = "110000 32000 local" ] || { echo "$t/throughput drifted"; exit 1; }
|
|
done
|
|
# 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")" = "100000 16000 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")" = "194048 64000 local" ] || { echo "derived native wrong"; exit 1; }
|
|
[ "$(l flash --from /nonexistent)" = "225000 32000 local" ] || { echo "a missing invocation must fall back to the default tier"; exit 1; }
|
|
out="$(l flash --from /nonexistent 2>/tmp/oclim.err)"; rc=$?
|
|
[ "$rc" = "0" ] || { echo "a missing invocation must not fail the switch"; exit 1; }
|
|
grep -q "not a file" /tmp/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 _ _ <<<"$(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; }
|
|
# 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)[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; 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 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("|")} - {"*"})
|
|
helper = pathlib.Path("oc-point-default.py").read_text()
|
|
# not anchored: the first entry sits on the same line as "LABEL = {"
|
|
labels = set(re.findall(r'"([a-z0-9-]+)":\s*"Qwen', helper))
|
|
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: |
|
|
gen() { # engine, has27b, hasflash, ctx, out, context_mode
|
|
rm -f /tmp/octest/opencode.json; mkdir -p /tmp/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=/tmp/octest \
|
|
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 194048 64000 native
|
|
python3 - <<'PY'
|
|
import json
|
|
c = json.load(open("/tmp/octest/opencode.json"))
|
|
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": 43000, "prune": True}, c["compaction"]
|
|
PY
|
|
gen flash 0 1 110000 32000 native
|
|
python3 - <<'PY'
|
|
import json
|
|
c = json.load(open("/tmp/octest/opencode.json"))
|
|
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 - <<'PY'
|
|
import json
|
|
c = json.load(open("/tmp/octest/opencode.json"))
|
|
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
|
|
|
|
- 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; }
|
|
|
|
- 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|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; do
|
|
grep -q -- '--sleep-on-idle' "$f" || { echo "$f does not park its scheduler when idle"; exit 1; }
|
|
done
|
|
|
|
- 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; 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: python3 tests/test_patch_template.py
|
|
- name: keepalive proxy guards, size and the fields the engine dies on (offline, fake /tokenize)
|
|
run: python3 tests/test_proxy_guard.py
|
|
|
|
- name: keepalive proxy abort contract (offline, fake engine with #35255 rule)
|
|
run: python3 tests/test_proxy_abort.py
|
|
|
|
- name: keepalive proxy keepalive injection and silence ceiling (offline, scripted engine)
|
|
run: python3 tests/test_proxy_keepalive.py
|
|
|
|
- name: the measurement and build tools (BPE ranking, grading, YaRN patch)
|
|
run: python3 tests/test_tools.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: Neither entry point installs as root (faked uid, both shapes)
|
|
run: python3 tests/test_install_root_refusal.py
|
|
|
|
- name: install.sh port refusals name the value they reject
|
|
run: python3 tests/test_install_preflight.py
|
|
|
|
- name: The cockpit ships with a plain install (flags, marker, wiring)
|
|
run: python3 tests/test_install_cockpit.py
|
|
|
|
- name: The lean level, end to end (template, render, opencode, proxy)
|
|
run: python3 tests/test_lean_level.py
|
|
|
|
- name: A plain 27B install serves 1M, and refuses nobody for it
|
|
run: python3 tests/test_install_context_mode.py
|
|
|
|
- name: Everything install.sh leaves behind is in the uninstall inventory
|
|
run: python3 tests/test_uninstall_inventory.py
|
|
|
|
- name: keepalive proxy TLS surface
|
|
run: python3 tests/test_proxy_tls.py
|
|
|
|
- name: keepalive proxy System One endpoint (offline, fake engine with scripted first-token distributions)
|
|
run: |
|
|
# The wire-contract claim of this route rests on two tests that skip themselves
|
|
# when what they check is absent: the round trip through TypeSafe's own SDK, and
|
|
# the label list re-derived from the served tokenizer. The SDK is installed here
|
|
# so the first one runs on the runner too; the second needs the model's
|
|
# tokenizer.json and stays a box-side check (TESTING.md says so).
|
|
pip install 'typesafe-sdk==0.7.0' 2>/dev/null || echo "typesafe-sdk unavailable: the SDK round trip will skip"
|
|
python3 tests/test_proxy_systemone.py
|
|
|
|
- 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.
|
|
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
|
|
files=$(cd tests && grep -l 'def test_' test_*.py | sort | tr '\n' ' ')
|
|
mods=$(for f in $files; do printf 'tests.%s ' "${f%.py}"; done)
|
|
echo "unittest suites: $mods"
|
|
declared=$(cd tests && cat $files | grep -c 'def test_')
|
|
out=$(python3 -m unittest $mods 2>&1)
|
|
echo "$out" | grep -vF ResourceWarning | 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; }
|
|
# And each one must run its own tests when invoked directly: a file
|
|
# without a __main__ block exits 0 having run nothing. 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.
|
|
for f in $files; do
|
|
n="${f%.py}"
|
|
d=$(grep -c 'def test_' "tests/$f" || true)
|
|
o=$(python3 "tests/$f" 2>&1 || true)
|
|
r=$(echo "$o" | grep -oE 'Ran [0-9]+' | grep -oE '[0-9]+' || echo 0)
|
|
echo " $f run directly: ran $r of $d"
|
|
[ "$r" = "$d" ] || { echo "$f ran $r of its $d declared tests when invoked directly"; exit 1; }
|
|
done
|
|
|
|
- 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: tools-check.py tells its four failures apart (fake engine)
|
|
run: python3 tests/test_tools_check.py
|
|
|
|
- name: the eval drivers keep the contracts that make them work (stub sglang)
|
|
run: python3 tests/test_eval_drivers.py
|
|
|
|
- name: a native install says so before it strands an installed 1m unit
|
|
run: python3 tests/test_install_native_strands_1m_unit.py
|
|
|
|
- name: a checkpoint with one file over the CDN limit still downloads
|
|
run: python3 tests/test_install_xet_retry.py
|
|
|
|
- name: no test file moves HOME for the files that run after it
|
|
run: python3 tests/test_suite_isolation.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
|
|
! grep -q 'is_sm100_supported() or is_sm120_supported()' qwen_sparse_attn_backend.py
|
|
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.
|
|
# "qwen38-sglang" is not "qwen38-sglang.service" to sudo, and a blanket
|
|
# NOPASSWD hid that mismatch until the allowlist was tightened. Cross-check
|
|
# the two files instead of finding out from a failed switch.
|
|
python3 - <<'PY'
|
|
import re, sys, pathlib
|
|
script = pathlib.Path("switch-model.sh").read_text()
|
|
alw = pathlib.Path("dashboard/sudoers-cockpit.template").read_text()
|
|
allowed = set(re.findall(r"NOPASSWD:\s*(/usr/bin/systemctl \S+ \S+)", alw))
|
|
names = dict(re.findall(r'(TARGET_UNIT_NAME|OTHER_UNIT_NAME)="([^"]+)"', script))
|
|
units = set(re.findall(r'UNIT_NAME="([^"]+)"', script))
|
|
bad = []
|
|
for verb, var in re.findall(r"sudo systemctl (\w+) \"\$(\w+)\"", script):
|
|
if var.endswith("UNIT_NAME"):
|
|
for unit in units:
|
|
want = f"/usr/bin/systemctl {verb} {unit}"
|
|
if want not in allowed:
|
|
bad.append(want)
|
|
for line in re.findall(r"sudo systemctl (\w+) (qwen38-[\w.-]+)", script):
|
|
want = f"/usr/bin/systemctl {line[0]} {line[1]}"
|
|
if want not in allowed:
|
|
bad.append(want)
|
|
if bad:
|
|
print("not in dashboard/sudoers-cockpit.template:")
|
|
for b in sorted(set(bad)):
|
|
print(" " + b)
|
|
sys.exit(1)
|
|
print(f"switch-model.sh privileged calls: all covered ({len(allowed)} allowlist entries)")
|
|
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).
|
|
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 "*" in ln]
|
|
if bad:
|
|
print("wildcard 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")):
|
|
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",
|
|
"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)
|
|
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: |
|
|
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__|Environment='OPENCODE_PERMISSION={\"*\":\"allow\"}'|g" "$1"; }
|
|
for t in dashboard/qwen38-dashboard.service.template dashboard/opencode-web.service.template; do
|
|
r "$t" > /tmp/u.rendered
|
|
if grep -q '__[A-Z_]*__' /tmp/u.rendered; then echo "unsubstituted placeholder in $t:"; grep '__[A-Z_]*__' /tmp/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 -qF "Environment='OPENCODE_PERMISSION={\"*\":\"allow\"}'"
|
|
r dashboard/qwen38-dashboard.service.template | grep -q 'COCKPIT_AGENT_PORT=30091'
|
|
for ph in $(grep -ohE '__[A-Z_]+__' 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_]+__' 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: House typography (no em/en dashes in tracked files)
|
|
run: |
|
|
if git ls-files -z | xargs -0 grep -nP '[\x{2014}\x{2013}\x{2212}]' 2>/dev/null; then
|
|
echo "em/en dash found (house style forbids them)"; exit 1
|
|
fi
|