From a8469d55b5e89dd63bb7b6806ee32c7779f69cc7 Mon Sep 17 00:00:00 2001 From: Robert Karl Date: Sun, 18 Oct 2026 19:19:36 -0700 Subject: [PATCH] step 13: acceptance harness (pi in Docker, four tasks, judges), API-only acceptance script, GLM vocabulary load fix tools/acceptance/: Dockerfile (pi 0.85.1 image), run-task.sh / run-all.sh / judge.sh / pretty.py, tasks md-toc, kvstore, bugfix (seeded), minesweeper with hidden tests / black-box judges, models.tsv, README. Runs go to runs/ (ignored); curated results land under bench/unbiased/ when the campaign closes. frontend/tests/acceptance-real-engine.sh: PLAN.md step 13 (c): sampled checks, seeded repeat, tool call, decode and prompt-reading speed against an expected figure with a 15 % band. frontend/strata_context.cpp: the vocabulary-only load is retried with general.architecture overridden to "llama" when llama.cpp does not know the file's architecture; GLM 5.3 Flash's file says glm5-next (neurall's fork) and the front end refused to start (USTRAT-6). Verified on the 2x B200 pod: GLM starts, template renders, answers. tools/pod/README.md: pod-to-pod tree copy (90 s against hours from the laptop), bringup must wait for the tree. Co-Authored-By: Claude Fable 5.1 --- frontend/strata_context.cpp | 13 ++++ frontend/tests/acceptance-real-engine.sh | 71 +++++++++++++++++ tools/acceptance/.gitignore | 1 + tools/acceptance/Dockerfile | 12 +++ tools/acceptance/README.md | 34 ++++++++ tools/acceptance/judge.sh | 34 ++++++++ tools/acceptance/models.tsv | 7 ++ tools/acceptance/pretty.py | 21 +++++ tools/acceptance/run-all.sh | 23 ++++++ tools/acceptance/run-task.sh | 77 +++++++++++++++++++ .../tasks/bugfix/hidden/test_hidden.py | 16 ++++ tools/acceptance/tasks/bugfix/prompt.md | 1 + .../tasks/bugfix/seed/pkg/__init__.py | 0 .../tasks/bugfix/seed/pkg/duration.py | 15 ++++ .../tasks/bugfix/seed/pkg/intervals.py | 13 ++++ .../acceptance/tasks/bugfix/seed/pkg/slug.py | 8 ++ .../tasks/bugfix/seed/tests/test_pkg.py | 26 +++++++ tools/acceptance/tasks/kvstore/blackbox.py | 43 +++++++++++ tools/acceptance/tasks/kvstore/prompt.md | 5 ++ .../tasks/md-toc/hidden/test_hidden.py | 26 +++++++ tools/acceptance/tasks/md-toc/prompt.md | 13 ++++ tools/acceptance/tasks/minesweeper/prompt.md | 5 ++ tools/pod/README.md | 12 ++- 23 files changed, 474 insertions(+), 2 deletions(-) create mode 100755 frontend/tests/acceptance-real-engine.sh create mode 100644 tools/acceptance/.gitignore create mode 100644 tools/acceptance/Dockerfile create mode 100644 tools/acceptance/README.md create mode 100755 tools/acceptance/judge.sh create mode 100644 tools/acceptance/models.tsv create mode 100755 tools/acceptance/pretty.py create mode 100755 tools/acceptance/run-all.sh create mode 100755 tools/acceptance/run-task.sh create mode 100644 tools/acceptance/tasks/bugfix/hidden/test_hidden.py create mode 100644 tools/acceptance/tasks/bugfix/prompt.md create mode 100644 tools/acceptance/tasks/bugfix/seed/pkg/__init__.py create mode 100644 tools/acceptance/tasks/bugfix/seed/pkg/duration.py create mode 100644 tools/acceptance/tasks/bugfix/seed/pkg/intervals.py create mode 100644 tools/acceptance/tasks/bugfix/seed/pkg/slug.py create mode 100644 tools/acceptance/tasks/bugfix/seed/tests/test_pkg.py create mode 100755 tools/acceptance/tasks/kvstore/blackbox.py create mode 100644 tools/acceptance/tasks/kvstore/prompt.md create mode 100644 tools/acceptance/tasks/md-toc/hidden/test_hidden.py create mode 100644 tools/acceptance/tasks/md-toc/prompt.md create mode 100644 tools/acceptance/tasks/minesweeper/prompt.md diff --git a/frontend/strata_context.cpp b/frontend/strata_context.cpp index ab15a19..1320d56 100644 --- a/frontend/strata_context.cpp +++ b/frontend/strata_context.cpp @@ -1065,6 +1065,19 @@ bool strata_context::load(common_params & params, std::string & err) { llama_model_params mparams = llama_model_default_params(); mparams.vocab_only = true; I.model = llama_model_load_from_file(params.model.path.c_str(), mparams); + if (I.model == nullptr) { + // An architecture this llama.cpp does not know (GLM 5.3 Flash's file says "glm5-next", from neurall's fork) + // still has an ordinary vocabulary and chat template; the engine, not llama.cpp, runs the tensors. A + // vocabulary-only load reads nothing architecture-specific, so the name is overridden to one llama.cpp knows. + LOG_WRN("vocabulary load failed; retrying with general.architecture overridden to \"llama\" (vocabulary only)\n"); + llama_model_kv_override ov[2] = {}; + snprintf(ov[0].key, sizeof(ov[0].key), "%s", "general.architecture"); + ov[0].tag = LLAMA_KV_OVERRIDE_TYPE_STR; + snprintf(ov[0].val_str, sizeof(ov[0].val_str), "%s", "llama"); + ov[1].key[0] = 0; + mparams.kv_overrides = ov; + I.model = llama_model_load_from_file(params.model.path.c_str(), mparams); + } if (I.model == nullptr) { err = "could not read the vocabulary from " + params.model.path; return false; diff --git a/frontend/tests/acceptance-real-engine.sh b/frontend/tests/acceptance-real-engine.sh new file mode 100755 index 0000000..2b6cb0f --- /dev/null +++ b/frontend/tests/acceptance-real-engine.sh @@ -0,0 +1,71 @@ +#!/bin/bash +# PLAN.md step 13 (c), the API-only acceptance of a served model: sampled requests as the model card has them, a fixed +# seed, decode and prompt-reading speed against the step-6/9 figures for the same box. +# acceptance-real-engine.sh [expected-decode-tok/s] [expected-pp-tok/s] [band=0.15] +# Exit 0 when every check passes (speed checks only when an expectation is given). Raw responses are kept in . +set -u +URL=$1; MODEL=$2; OUT=$3; EXP_DEC=${4:-}; EXP_PP=${5:-}; BAND=${6:-0.15}; mkdir -p "$OUT" +post() { curl -s -m "${2:-900}" "$URL/v1/chat/completions" -H 'content-type: application/json' -d "$1"; } +SAMP='"temperature":0.6,"top_p":0.95,"top_k":20,"seed":7' +fail=0; note() { echo "$@"; } + +note "== /v1/models"; curl -s -m 10 "$URL/v1/models" > "$OUT/models.json" || { echo "no server at $URL"; exit 2; } +python3 -c 'import json,sys; d=json.load(open(sys.argv[1])); print([m["id"] for m in d["data"]])' "$OUT/models.json" + +note "== 1. sampled chat with thinking: answer present, reasoning separated, finish=stop" +post "{\"model\":\"$MODEL\",\"messages\":[{\"role\":\"user\",\"content\":\"What is 17 * 23? Answer with the number only.\"}],\"max_tokens\":1024,$SAMP}" > "$OUT/think.json" +python3 - "$OUT/think.json" <<'PY' || fail=1 +import json, sys; d = json.load(open(sys.argv[1])); m = d["choices"][0]["message"] +ok = "391" in (m.get("content") or "") and d["choices"][0]["finish_reason"] == "stop" and "" not in (m.get("content") or "") +print(json.dumps({"content": (m.get("content") or "")[:80], "reasoning_chars": len(m.get("reasoning_content") or ""), "finish": d["choices"][0]["finish_reason"], "ok": ok})); sys.exit(0 if ok else 1) +PY + +note "== 2. same request, same seed, twice: identical ids (sampling is seeded)" +post "{\"model\":\"$MODEL\",\"messages\":[{\"role\":\"user\",\"content\":\"Write one sentence about the sea.\"}],\"max_tokens\":120,$SAMP,\"chat_template_kwargs\":{\"enable_thinking\":false,\"thinking\":false}}" > "$OUT/seed-a.json" +post "{\"model\":\"$MODEL\",\"messages\":[{\"role\":\"user\",\"content\":\"Write one sentence about the sea.\"}],\"max_tokens\":120,$SAMP,\"chat_template_kwargs\":{\"enable_thinking\":false,\"thinking\":false}}" > "$OUT/seed-b.json" +python3 - "$OUT/seed-a.json" "$OUT/seed-b.json" <<'PY' || note " (seeded sampling not reproducible: recorded, not failed; drafting changes the path)" +import json, sys; a, b = (json.load(open(p))["choices"][0]["message"].get("content") for p in sys.argv[1:3]) +print(json.dumps({"a": a[:100], "same": a == b})); sys.exit(0 if a == b else 1) +PY + +note "== 3. tool call, pi-shaped: a tool_calls entry with a JSON-parsable argument object" +post "{\"model\":\"$MODEL\",\"messages\":[{\"role\":\"user\",\"content\":\"Read the file /etc/hostname using the read tool.\"}],\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"read\",\"description\":\"Read a file\",\"parameters\":{\"type\":\"object\",\"properties\":{\"path\":{\"type\":\"string\"}},\"required\":[\"path\"]}}}],\"max_tokens\":1024,$SAMP}" > "$OUT/toolcall.json" +python3 - "$OUT/toolcall.json" <<'PY' || fail=1 +import json, sys; d = json.load(open(sys.argv[1])); tc = d["choices"][0]["message"].get("tool_calls") or [] +ok = bool(tc) and tc[0]["function"]["name"] == "read" and "path" in json.loads(tc[0]["function"]["arguments"]) +print(json.dumps({"tool_calls": tc[:1], "ok": ok})); sys.exit(0 if ok else 1) +PY + +note "== 4. decode speed: 3 x 256 tokens of prose, thinking off, median tokens/s from the server's timings" +python3 - "$URL" "$MODEL" "$OUT" "$EXP_DEC" "$BAND" <<'PY' || fail=1 +import json, sys, urllib.request, statistics +url, model, out, exp, band = sys.argv[1:]; rates = [] +for i in range(3): + body = {"model": model, "messages": [{"role": "user", "content": f"Write a 300-word story about a lighthouse keeper, take {i+1}."}], "max_tokens": 256, + "temperature": 0.6, "top_p": 0.95, "top_k": 20, "seed": 7 + i, "chat_template_kwargs": {"enable_thinking": False, "thinking": False}} + r = urllib.request.Request(f"{url}/v1/chat/completions", json.dumps(body).encode(), {"content-type": "application/json"}) + d = json.load(urllib.request.urlopen(r, timeout=900)); json.dump(d, open(f"{out}/decode-{i}.json", "w")) + rates.append(d["timings"]["predicted_per_second"]) +med = statistics.median(rates); res = {"decode_tok_s": [round(x, 1) for x in rates], "median": round(med, 1)} +if exp: + lo = float(exp) * (1 - float(band)); res.update(expected=float(exp), floor=round(lo, 1), ok=med >= lo) +print(json.dumps(res)); sys.exit(0 if res.get("ok", True) else 1) +PY + +note "== 5. prompt reading: one ~6k-token prompt, tokens/s from the server's timings" +python3 - "$URL" "$MODEL" "$OUT" "$EXP_PP" "$BAND" <<'PY' || fail=1 +import json, sys, urllib.request +url, model, out, exp, band = sys.argv[1:] +text = " ".join(f"Line {i}: the quick brown fox number {i} jumps over the lazy dog, as recorded in the ledger on day {i % 365}." for i in range(260)) +body = {"model": model, "messages": [{"role": "user", "content": text + "\n\nHow many lines are above? Answer with the number only."}], "max_tokens": 32, + "temperature": 0.6, "top_p": 0.95, "top_k": 20, "seed": 7, "chat_template_kwargs": {"enable_thinking": False, "thinking": False}} +r = urllib.request.Request(f"{url}/v1/chat/completions", json.dumps(body).encode(), {"content-type": "application/json"}) +d = json.load(urllib.request.urlopen(r, timeout=900)); json.dump(d, open(f"{out}/pp.json", "w")); t = d["timings"] +res = {"prompt_tokens": t["prompt_n"], "pp_tok_s": round(t["prompt_per_second"], 1), "answer": (d["choices"][0]["message"].get("content") or "")[:40]} +if exp: + lo = float(exp) * (1 - float(band)); res.update(expected=float(exp), floor=round(lo, 1), ok=t["prompt_per_second"] >= lo) +print(json.dumps(res)); sys.exit(0 if res.get("ok", True) else 1) +PY + +note "== /health"; curl -s -m 10 "$URL/health"; echo +[ $fail = 0 ] && echo "ACCEPTANCE_OK $MODEL" || echo "ACCEPTANCE_FAIL $MODEL"; exit $fail diff --git a/tools/acceptance/.gitignore b/tools/acceptance/.gitignore new file mode 100644 index 0000000..a1e0396 --- /dev/null +++ b/tools/acceptance/.gitignore @@ -0,0 +1 @@ +runs/ diff --git a/tools/acceptance/Dockerfile b/tools/acceptance/Dockerfile new file mode 100644 index 0000000..2c911aa --- /dev/null +++ b/tools/acceptance/Dockerfile @@ -0,0 +1,12 @@ +# Sandbox for the acceptance runs (PLAN.md step 13): pi, the coding agent, with the tools a work item needs. The +# model server is outside the container (an ssh tunnel on the host), reached as host.docker.internal. +FROM node:22-bookworm-slim +RUN apt-get update && apt-get install -y --no-install-recommends \ + git python3 python3-pip python3-venv python3-pytest curl ca-certificates jq procps make gcc libc6-dev \ + && rm -rf /var/lib/apt/lists/* +RUN npm install -g @earendil-works/pi-coding-agent@0.85.1 && pi --version +# uid 1000 is "node" in the base image; the agent runs as it +USER node +WORKDIR /work +ENV PI_OFFLINE=1 +ENTRYPOINT ["pi"] diff --git a/tools/acceptance/README.md b/tools/acceptance/README.md new file mode 100644 index 0000000..6855321 --- /dev/null +++ b/tools/acceptance/README.md @@ -0,0 +1,34 @@ +# Model acceptance runs (PLAN.md step 13) + +A model family is accepted when a coding agent gets real work done through the fork's server with that model, under +the sampling the model card asks for, and when the API-only checks (`frontend/tests/acceptance-real-engine.sh`) pass +with decode and prompt-reading speed within 15 % of the step-6/9 figures for the same box. + +## What runs + +The agent is [pi](https://pi.dev) 0.85.1 in a Docker container (`Dockerfile`, image `us2-acceptance:0.85.1`: node 22, +pi, python3 + pytest, git, make, gcc; user `node`, no network but the model server). It gets one prompt +(`tasks//prompt.md`), its tools on, a fresh work directory, and no extensions, skills or context files. The +model server is outside the container, reached as `host.docker.internal:`; `models.tsv` maps the model id to +the port on this Mac (an ssh tunnel to the box that serves it). + +| Task | Work | Judge (`judge.sh`) | +| --- | --- | --- | +| `md-toc` | `mdtoc.py`, a Markdown table-of-contents CLI with GitHub anchors, fenced-block skipping, setext headings, depth filters, and its own pytest file | 4 hidden pytest cases (`tasks/md-toc/hidden/`), run in the image | +| `kvstore` | `kvstore.py`, an HTTP key-value store (PUT/GET/DELETE, list, /health, 1 MiB limit, persistence across restart) | `tasks/kvstore/blackbox.py`: starts it, drives every route, restarts it, checks persistence | +| `bugfix` | three planted bugs in a seeded package (`tasks/bugfix/seed/`: interval merge, slugify, duration parsing); tests are the spec | the seed's tests plus hidden ones; `tests/test_pkg.py` must be byte-identical to the seed | +| `minesweeper` | a single-file browser Minesweeper (9x9, 10 mines, flood fill, flags, counter, timer, new game) | headless Chromium (lookingglass): 81 `.cell`s, a click reveals cells, no console error; screenshot kept | + +`run-task.sh [tag]` does one run: writes a pi config dir (provider `UnbiasedStrata 2`, sampling +temperature 0.6, top_k 20, top_p 0.95, seed 7; `TEMP=`, `SEED=`, `THINKING=` override), starts the container, opens +a window in tmux session `us2-acceptance` that tails the agent's turns (`tmux attach -t us2-acceptance`), waits +(`TIMEOUT_S`, default 90 min), judges, and writes `runs/--[-tag]/`: `pi.jsonl` (pi's JSON event +stream), `pi.log`, `work/`, `judge.json`, `meta.json` (exit code, wall time, turns, tool calls, token counts, errors), +`server-before/after.json` (`/props`), and the pi config used. `run-all.sh ` runs the four tasks at the +defaults and minesweeper again at temperature 1.0, then appends to `runs/summary.tsv`. + +## Reading a run + +`meta.json` → `judge.pass` is the verdict. A failed judge with `pi_exit` 0 is the model's work falling short; `pi_exit` +non-zero or `errors` non-empty points at the server (`server-after.json`, the server log on the box). The pretty +tail in the tmux window is `pretty.py` over `pi.jsonl`. diff --git a/tools/acceptance/judge.sh b/tools/acceptance/judge.sh new file mode 100755 index 0000000..19655d4 --- /dev/null +++ b/tools/acceptance/judge.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# judge.sh -> prints judge JSON ({"pass": bool, ...}) and exits 0 on pass. Python tasks are judged +# inside the sandbox image (no host dependencies); the web task through lookingglass on this Mac. +set -u +TASK=$1; WORK=$(cd "$2" && pwd); HERE=$(cd "$(dirname "$0")" && pwd); IMG=us2-acceptance:0.85.1 +pyjudge() { docker run --rm --entrypoint python3 -e WORK=/work -v "$WORK":/work -v "$HERE/tasks/$TASK":/task:ro -w /work $IMG "$@"; } +case $TASK in + md-toc) + [ -f "$WORK/mdtoc.py" ] || { echo '{"pass": false, "why": "no mdtoc.py"}'; exit 1; } + out=$(pyjudge -m pytest -q -p no:cacheprovider /task/hidden/test_hidden.py 2>&1); rc=$? + own=$(pyjudge -m pytest -q -p no:cacheprovider test_mdtoc.py 2>&1 | tail -1) + python3 -c "import json,sys; print(json.dumps({'pass': $rc==0, 'hidden': sys.argv[1].splitlines()[-1], 'own_tests': sys.argv[2]}))" "$out" "$own"; exit $rc ;; + kvstore) + [ -f "$WORK/kvstore.py" ] || { echo '{"pass": false, "why": "no kvstore.py"}'; exit 1; } + out=$(pyjudge /task/blackbox.py /work 2>&1); rc=$?; echo "$out" | tail -1; exit $rc ;; + bugfix) + changed=$(cd "$WORK" && sha256sum tests/test_pkg.py | cut -c1-64); orig=$(sha256sum "$HERE/tasks/bugfix/seed/tests/test_pkg.py" | cut -c1-64) + out=$(pyjudge -m pytest -q -p no:cacheprovider tests /task/hidden/test_hidden.py 2>&1); rc=$? + [ "$changed" = "$orig" ] || rc=2 + python3 -c "import json,sys; print(json.dumps({'pass': $rc==0, 'tests_untouched': sys.argv[1]==sys.argv[2], 'pytest': sys.argv[3].splitlines()[-1]}))" "$changed" "$orig" "$out"; exit $rc ;; + minesweeper) + [ -f "$WORK/index.html" ] || { echo '{"pass": false, "why": "no index.html"}'; exit 1; } + export PATH="$HOME/.bun/bin:$PATH"; B="bun run $HOME/Code/lookingglass/src/cli.ts" + # one browser: campaigns on different servers may judge at the same moment + LOCK=/tmp/us2-judge-browser.lock; n=0; until mkdir "$LOCK" 2>/dev/null; do sleep 2; n=$((n+1)); [ $n -gt 300 ] && { rmdir "$LOCK"; }; done; trap 'rmdir "$LOCK" 2>/dev/null' EXIT + $B console --clear > /dev/null 2>&1; $B goto "file://$WORK/index.html" > /dev/null 2>&1 + cells=$($B js "document.querySelectorAll('.cell').length" 2>/dev/null | tr -dc 0-9) + revealed=$($B js "var c=document.querySelector('.cell[data-row=\"4\"][data-col=\"4\"]'); if(c){c.click();} document.querySelectorAll('.cell.revealed').length" 2>/dev/null | tr -dc 0-9) + errs=$($B console --errors 2>/dev/null | grep -c -i "error") + $B screenshot "$WORK/../judge-screenshot.png" > /dev/null 2>&1 + pass=false; [ "${cells:-0}" -ge 81 ] && [ "${revealed:-0}" -ge 1 ] && [ "${errs:-1}" -eq 0 ] && pass=true + echo "{\"pass\": $pass, \"cells\": ${cells:-0}, \"revealed_after_click\": ${revealed:-0}, \"console_errors\": ${errs:-1}}"; [ $pass = true ] ;; + *) echo '{"pass": false, "why": "unknown task"}'; exit 1 ;; +esac diff --git a/tools/acceptance/models.tsv b/tools/acceptance/models.tsv new file mode 100644 index 0000000..b11e55c --- /dev/null +++ b/tools/acceptance/models.tsv @@ -0,0 +1,7 @@ +# model id (as the fork server announces it) host port on this Mac (ssh tunnel to the box) context box +qwen3.6-35b-a3b-ud-iq4_xs 18091 32768 A6000 VM +qwen3.8-flash-next-iq3_xxs 18090 65536 A6000 VM +qwen3.8-flash-next-iq3_xxs-3090 18092 65536 RTX 3090 pod +qwen3.6-35b-a3b-ud-q3_k_m-3090 18094 32768 RTX 3090 pod +deepseek-v4-flash-ud-iq2_xxs-b200 18095 32768 2x B200 pod +glm-5.3-flash-3.0bit-b200 18096 32768 2x B200 pod diff --git a/tools/acceptance/pretty.py b/tools/acceptance/pretty.py new file mode 100755 index 0000000..0ce2bf4 --- /dev/null +++ b/tools/acceptance/pretty.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python3 +"""Turn pi's --mode json event stream (stdin) into a readable tail for the tmux window.""" +import json, sys +for line in sys.stdin: + try: ev = json.loads(line) + except Exception: sys.stdout.write(line); sys.stdout.flush(); continue + t = ev.get("type", "") + if t == "message_end": + m = ev.get("message", {}) + if m.get("role") == "assistant": + u = m.get("usage") or {} + for c in m.get("content", []): + if c.get("type") == "text" and c.get("text", "").strip(): print(f"\n[assistant] {c['text'].strip()[:1500]}") + elif c.get("type") == "toolCall": print(f"[tool call] {c.get('name')} {json.dumps(c.get('arguments', {}))[:300]}") + print(f" (in {u.get('input')} out {u.get('output')} stop {m.get('stopReason')})") + elif t == "tool_execution_end": + r = ev.get("result", {}); txt = "" + for c in (r.get("content") or []): + if c.get("type") == "text": txt += c.get("text", "") + print(f"[tool result] {txt.strip()[:400]}") + sys.stdout.flush() diff --git a/tools/acceptance/run-all.sh b/tools/acceptance/run-all.sh new file mode 100755 index 0000000..9015883 --- /dev/null +++ b/tools/acceptance/run-all.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# run-all.sh [tag] : the step-13 set for one model, sequentially (the server takes one request at a time): +# md-toc, kvstore, bugfix, minesweeper at the model card's sampling defaults (seed 7), then minesweeper again at +# temperature 1.0. Summary lines go to runs/summary.tsv. +set -u +MODEL=${1:?model id}; TAG=${2:-}; HERE=$(cd "$(dirname "$0")" && pwd) +for t in md-toc kvstore bugfix minesweeper; do + "$HERE/run-task.sh" "$MODEL" "$t" "${TAG:-}" 2>&1 | tail -1 +done +TEMP=1.0 "$HERE/run-task.sh" "$MODEL" minesweeper "${TAG:+$TAG-}t1" 2>&1 | tail -1 +python3 - "$HERE/runs" "$MODEL" <<'PY' +import json, sys, pathlib +runs, model = pathlib.Path(sys.argv[1]), sys.argv[2]; out = runs / "summary.tsv" +if not out.exists(): out.write_text("run\tmodel\ttask\tpass\tpi_exit\twall_s\tturns\ttool_calls\tinput_tokens\toutput_tokens\ttemperature\tjudge\n") +seen = set(out.read_text().splitlines()) +for d in sorted(runs.glob(f"*-{model}-*")): + m = d / "meta.json" + if not m.exists(): continue + j = json.loads(m.read_text()) + line = "\t".join(str(x) for x in (d.name, j["model"], j["task"], j["judge"].get("pass"), j["pi_exit"], j["wall_s"], j["assistant_turns"], j["tool_calls"], j["input_tokens"], j["output_tokens"], j["temperature"], json.dumps(j["judge"]))) + if line not in seen: out.open("a").write(line + "\n") +print(out.read_text()) +PY diff --git a/tools/acceptance/run-task.sh b/tools/acceptance/run-task.sh new file mode 100755 index 0000000..298a737 --- /dev/null +++ b/tools/acceptance/run-task.sh @@ -0,0 +1,77 @@ +#!/bin/bash +# run-task.sh [tag] +# One acceptance run: pi (in the us2-acceptance Docker image, tools on) does in a fresh work dir against the +# fork server that models.tsv maps to, a tmux window tails it, then judge.sh scores the result. +# Output: runs/--[-tag]/ {work/, pi.jsonl, pi.log, judge.json, meta.json, server-before/after.json} +set -u +MODEL=${1:?model id (models.tsv column 1)}; TASK=${2:?task dir under tasks/}; TAG=${3:-} +HERE=$(cd "$(dirname "$0")" && pwd); IMG=us2-acceptance:0.85.1; TMUX_SESSION=us2-acceptance +PORT=$(awk -F'\t' -v m="$MODEL" '$1==m {print $2}' "$HERE/models.tsv"); [ -n "$PORT" ] || { echo "no port for $MODEL in models.tsv" >&2; exit 2; } +[ -f "$HERE/tasks/$TASK/prompt.md" ] || { echo "no tasks/$TASK/prompt.md" >&2; exit 2; } +TEMP=${TEMP:-0.6}; TOPK=${TOPK:-20}; TOPP=${TOPP:-0.95}; SEED=${SEED:-7}; THINKING=${THINKING:-medium}; TIMEOUT_S=${TIMEOUT_S:-5400} +RUN="$HERE/runs/$(date -u +%Y%m%dT%H%MZ)-$MODEL-$TASK${TAG:+-$TAG}"; mkdir -p "$RUN/work" "$RUN/pi-config/agent" +# Served model id: the alias the server announces (first id in /v1/models). +SERVED=$(curl -s -m 5 "http://127.0.0.1:$PORT/v1/models" | python3 -c 'import json,sys; print(json.load(sys.stdin)["data"][0]["id"])' 2>/dev/null) +[ -n "$SERVED" ] || { echo "no server on 127.0.0.1:$PORT" >&2; exit 3; } +curl -s -m 5 "http://127.0.0.1:$PORT/props" > "$RUN/server-before.json" 2>/dev/null || true +# pi config dir (PI_CODING_AGENT_DIR): provider -> the fork server through Docker's host alias. +python3 - "$RUN/pi-config/agent" "$SERVED" "$PORT" "$TEMP" "$TOPK" "$TOPP" "$SEED" <<'PY' +import json, sys, pathlib +d, served, port, temp, topk, topp, seed = sys.argv[1:]; d = pathlib.Path(d) +(d / "models.json").write_text(json.dumps({"providers": {"UnbiasedStrata 2": { + "baseUrl": f"http://host.docker.internal:{port}/v1", "api": "openai-completions", "apiKey": "local", + "models": [{"id": served, "name": served, "reasoning": True, "input": ["text"], "contextWindow": 32768, "maxTokens": 8192, + "cost": {"input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0}, + "samplingParams": {"temperature": float(temp), "top_k": int(topk), "top_p": float(topp), "min_p": 0, "presence_penalty": 0, "repeat_penalty": 1, "seed": int(seed)}, + "compat": {"supportsStore": False, "supportsDeveloperRole": False, "supportsReasoningEffort": True, "maxTokensField": "max_tokens", "requiresReasoningContentOnAssistantMessages": True}}]}}}, indent=1)) +(d / "settings.json").write_text(json.dumps({"defaultProvider": "UnbiasedStrata 2", "defaultModel": served, "theme": "dark", + "quietStartup": True, "enableSkillCommands": False}, indent=1)) +(d / "auth.json").write_text("{}\n") +PY +# seed files (e.g. the bugfix package) go into the work dir +[ -d "$HERE/tasks/$TASK/seed" ] && cp -R "$HERE/tasks/$TASK/seed/." "$RUN/work/" +NAME="us2-$(echo "$MODEL-$TASK${TAG:+-$TAG}" | tr -c 'a-zA-Z0-9-\n' '-' | cut -c1-50)-$$" +echo "run dir $RUN"; echo "model $SERVED on 127.0.0.1:$PORT, container $NAME, temp $TEMP seed $SEED thinking $THINKING" +START=$(date +%s); date -u +%FT%TZ > "$RUN/started" +cp "$HERE/tasks/$TASK/prompt.md" "$RUN/pi-config/prompt.md" +# the container: pi, print mode, JSON events on stdout, prompt on stdin, tools on, no host extensions/skills/context files +docker run -d --name "$NAME" --add-host=host.docker.internal:host-gateway --network bridge \ + -e PI_CODING_AGENT_DIR=/pi-config/agent -e PI_OFFLINE=1 -e HOME=/home/node -v "$RUN/pi-config":/pi-config -v "$RUN/work":/work -w /work \ + --memory 2g --cpus 2 --entrypoint /bin/bash $IMG -c \ + "pi -p --mode json --no-extensions --no-skills --no-context-files --no-session --provider 'UnbiasedStrata 2' --model '$SERVED' --thinking $THINKING \"\$(cat /pi-config/prompt.md)\"" > "$RUN/container-id" 2> "$RUN/docker-run.err" || { cat "$RUN/docker-run.err" >&2; exit 4; } +# tmux window to watch it (session created on first use) +if command -v tmux > /dev/null; then + tmux has-session -t $TMUX_SESSION 2> /dev/null || tmux new-session -d -s $TMUX_SESSION -n hub "echo 'us2 acceptance runs; one window per run'; bash" + tmux new-window -d -t $TMUX_SESSION -n "$(echo "$MODEL" | cut -c1-14)/$TASK" "docker logs -f $NAME 2>&1 | python3 $HERE/pretty.py; echo; echo '[container exited] run dir $RUN'; bash" +fi +# wait, with a wall-clock cap +rc=$(timeout "$TIMEOUT_S" docker wait "$NAME" 2>/dev/null); [ -n "$rc" ] || { docker kill "$NAME" > /dev/null 2>&1; rc=124; echo "TIMEOUT after ${TIMEOUT_S}s" >&2; } +END=$(date +%s) +docker logs "$NAME" > "$RUN/pi.jsonl" 2> "$RUN/pi.log"; docker rm "$NAME" > /dev/null 2>&1 +curl -s -m 5 "http://127.0.0.1:$PORT/props" > "$RUN/server-after.json" 2>/dev/null || true +# judge +"$HERE/judge.sh" "$TASK" "$RUN/work" > "$RUN/judge.json" 2> "$RUN/judge.err"; jrc=$? +# meta: tokens and turns from the pi event stream +python3 - "$RUN" "$MODEL" "$SERVED" "$TASK" "$PORT" "$rc" "$jrc" "$((END-START))" "$TEMP" "$SEED" "$THINKING" <<'PY' +import json, sys, pathlib +run, model, served, task, port, rc, jrc, secs, temp, seed, thinking = sys.argv[1:]; run = pathlib.Path(run) +inp = out = turns = tools = 0; errs = [] +for line in (run / "pi.jsonl").read_text(errors="replace").splitlines(): + try: ev = json.loads(line) + except Exception: continue + t = ev.get("type", "") + if t == "message_end": + m = ev.get("message", {}); u = m.get("usage") or {} + if m.get("role") == "assistant": + turns += 1; inp += int(u.get("input") or 0); out += int(u.get("output") or 0) + if m.get("stopReason") == "error": errs.append(str(m.get("errorMessage", ""))[:200]) + elif t == "tool_execution_end": tools += 1 +try: judge = json.loads((run / "judge.json").read_text().strip().splitlines()[-1]) +except Exception: judge = {"pass": False, "why": "judge output unreadable"} +meta = dict(model=model, served_id=served, task=task, port=int(port), pi_exit=int(rc), wall_s=int(secs), assistant_turns=turns, + tool_calls=tools, input_tokens=inp, output_tokens=out, errors=errs, temperature=float(temp), seed=int(seed), + thinking=thinking, judge=judge, judge_exit=int(jrc)) +(run / "meta.json").write_text(json.dumps(meta, indent=1)) +print(json.dumps({k: meta[k] for k in ("model", "task", "pi_exit", "wall_s", "assistant_turns", "tool_calls", "input_tokens", "output_tokens")}), "judge:", json.dumps(judge)) +PY +exit $jrc diff --git a/tools/acceptance/tasks/bugfix/hidden/test_hidden.py b/tools/acceptance/tasks/bugfix/hidden/test_hidden.py new file mode 100644 index 0000000..b310ffe --- /dev/null +++ b/tools/acceptance/tasks/bugfix/hidden/test_hidden.py @@ -0,0 +1,16 @@ +import os, sys, pathlib, pytest +sys.path.insert(0, os.environ.get("WORK", str(pathlib.Path(__file__).parent.parent))) +from pkg.intervals import merge +from pkg.slug import slugify +from pkg.duration import parse +def test_merge_more(): + assert merge([[1, 10], [2, 3], [12, 12], [11, 11]]) == [[1, 12]] + assert merge([[1, 1]]) == [[1, 1]] +def test_slug_more(): + assert slugify("Ünïcödé & ASCII") == "n-c-d-ascii" + assert slugify("2024-01-02") == "2024-01-02" +def test_duration_more(): + assert parse("2h") == 7200 + assert parse("0m") == 0 + with pytest.raises(ValueError): + parse("30m1h") diff --git a/tools/acceptance/tasks/bugfix/prompt.md b/tools/acceptance/tasks/bugfix/prompt.md new file mode 100644 index 0000000..0d9c098 --- /dev/null +++ b/tools/acceptance/tasks/bugfix/prompt.md @@ -0,0 +1 @@ +This directory holds a small Python package, `pkg/`, and its tests under `tests/`. Three tests fail. Find the bugs in the package and fix them so that `python3 -m pytest -q` passes. Do not change anything under `tests/`: the tests are the specification. Keep the fixes minimal and in the spirit of each function's docstring; if a docstring and a test disagree, the test wins. Finish with `NOTES.md`: what each bug was, how you found it, and how you confirmed the fix. diff --git a/tools/acceptance/tasks/bugfix/seed/pkg/__init__.py b/tools/acceptance/tasks/bugfix/seed/pkg/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tools/acceptance/tasks/bugfix/seed/pkg/duration.py b/tools/acceptance/tasks/bugfix/seed/pkg/duration.py new file mode 100644 index 0000000..32319c1 --- /dev/null +++ b/tools/acceptance/tasks/bugfix/seed/pkg/duration.py @@ -0,0 +1,15 @@ +import re + +_UNIT = {"h": 3600, "m": 60, "s": 1} + +def parse(text): + """Seconds in a duration written like "1h30m", "45m", "90s", "2h", "1h2m3s" (units in that order, each at + most once, at least one present, no spaces). Raises ValueError on anything else.""" + m = re.fullmatch(r"(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?", text or "") + if not m or not any(m.groups()): + raise ValueError(f"not a duration: {text!r}") + total = 0 + for value, unit in zip(m.groups(), "hms"): + if value is not None: + total += int(value) + _UNIT[unit] + return total diff --git a/tools/acceptance/tasks/bugfix/seed/pkg/intervals.py b/tools/acceptance/tasks/bugfix/seed/pkg/intervals.py new file mode 100644 index 0000000..819c8e9 --- /dev/null +++ b/tools/acceptance/tasks/bugfix/seed/pkg/intervals.py @@ -0,0 +1,13 @@ +def merge(intervals): + """Merge a list of closed integer intervals [a, b] (a <= b). Overlapping or touching intervals + ([1, 3] and [3, 5], or [1, 3] and [4, 5] since every integer is covered) become one. Returns a new + sorted list.""" + if not intervals: + return [] + out = [] + for a, b in sorted(intervals): + if out and a < out[-1][1]: + out[-1][1] = max(out[-1][1], b) + else: + out.append([a, b]) + return out diff --git a/tools/acceptance/tasks/bugfix/seed/pkg/slug.py b/tools/acceptance/tasks/bugfix/seed/pkg/slug.py new file mode 100644 index 0000000..600796b --- /dev/null +++ b/tools/acceptance/tasks/bugfix/seed/pkg/slug.py @@ -0,0 +1,8 @@ +import re + +def slugify(text): + """A URL slug: lowercase ASCII letters, digits and single hyphens; everything else becomes a hyphen; no + leading, trailing or repeated hyphens. The empty string stays empty.""" + text = text.lower() + text = re.sub(r"[^a-z0-9]", "-", text) + return text.strip() diff --git a/tools/acceptance/tasks/bugfix/seed/tests/test_pkg.py b/tools/acceptance/tasks/bugfix/seed/tests/test_pkg.py new file mode 100644 index 0000000..08940ff --- /dev/null +++ b/tools/acceptance/tasks/bugfix/seed/tests/test_pkg.py @@ -0,0 +1,26 @@ +import pytest +from pkg.intervals import merge +from pkg.slug import slugify +from pkg.duration import parse + +def test_merge_touching_and_adjacent(): + assert merge([[1, 3], [3, 5]]) == [[1, 5]] + assert merge([[1, 3], [4, 5]]) == [[1, 5]] + assert merge([[5, 6], [1, 2]]) == [[1, 2], [5, 6]] + assert merge([]) == [] + +def test_slugify_collapses_and_trims(): + assert slugify("Hello, World!") == "hello-world" + assert slugify(" a b ") == "a-b" + assert slugify("--x--") == "x" + assert slugify("") == "" + +def test_parse_duration(): + assert parse("1h30m") == 5400 + assert parse("45m") == 2700 + assert parse("90s") == 90 + assert parse("1h2m3s") == 3723 + with pytest.raises(ValueError): + parse("") + with pytest.raises(ValueError): + parse("3x") diff --git a/tools/acceptance/tasks/kvstore/blackbox.py b/tools/acceptance/tasks/kvstore/blackbox.py new file mode 100755 index 0000000..3e2cf44 --- /dev/null +++ b/tools/acceptance/tasks/kvstore/blackbox.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python3 +"""Black-box check of kvstore.py: start it, drive every route, restart, compare. Exit 0 when it all holds.""" +import json, os, pathlib, socket, subprocess, sys, time, urllib.request, urllib.error +work = pathlib.Path(sys.argv[1]); exe = work / "kvstore.py"; data = work / "_bb.json" +if data.exists(): data.unlink() +def port(): + s = socket.socket(); s.bind(("127.0.0.1", 0)); p = s.getsockname()[1]; s.close(); return p +def start(p): + proc = subprocess.Popen([sys.executable, str(exe), "--port", str(p), "--data", str(data)], cwd=work, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE) + for _ in range(100): + try: urllib.request.urlopen(f"http://127.0.0.1:{p}/health", timeout=1); return proc + except Exception: time.sleep(0.1) + proc.kill(); raise SystemExit("server did not come up: " + proc.stderr.read().decode()[-500:]) +def req(p, method, path, body=None): + r = urllib.request.Request(f"http://127.0.0.1:{p}{path}", data=body, method=method) + try: + with urllib.request.urlopen(r, timeout=5) as resp: return resp.status, resp.read(), resp.headers + except urllib.error.HTTPError as e: return e.code, e.read(), e.headers +fails = [] +def check(cond, what): + if not cond: fails.append(what) +p = port(); proc = start(p) +try: + check(req(p, "GET", "/kv/a")[0] == 404, "GET missing -> 404") + check(req(p, "PUT", "/kv/a", b"one")[0] == 201, "PUT new -> 201") + check(req(p, "PUT", "/kv/a", b"uno")[0] == 204, "PUT existing -> 204") + st, body, hdr = req(p, "GET", "/kv/a"); check(st == 200 and body == b"uno", "GET value"); check(hdr.get("Content-Type", "").startswith("application/octet-stream"), "octet-stream content type") + check(req(p, "PUT", "/kv/sp%20ace", b"x")[0] == 201, "percent-decoded key") + check(req(p, "PUT", "/kv/big", b"z" * (1024 * 1024 + 1))[0] == 413, "1 MiB + 1 -> 413") + check(req(p, "PUT", "/kv/b", b"\x00\xff" * 1000)[0] == 201, "binary value") + st, body, _ = req(p, "GET", "/kv"); check(st == 200 and json.loads(body) == ["a", "b", "sp ace"], f"key list sorted: {body[:80]!r}") + st, body, _ = req(p, "GET", "/health"); check(st == 200 and json.loads(body) == {"ok": True, "keys": 3}, f"health: {body[:80]!r}") + check(req(p, "DELETE", "/kv/b")[0] == 204, "DELETE -> 204"); check(req(p, "DELETE", "/kv/b")[0] == 404, "DELETE missing -> 404") +finally: + proc.terminate(); proc.wait(timeout=5) +p = port(); proc = start(p) +try: + st, body, _ = req(p, "GET", "/kv/a"); check(st == 200 and body == b"uno", "value survives restart") + st, body, _ = req(p, "GET", "/kv"); check(json.loads(body) == ["a", "sp ace"], "keys survive restart") +finally: + proc.terminate(); proc.wait(timeout=5) +print(json.dumps({"pass": not fails, "failures": fails})) +sys.exit(0 if not fails else 1) diff --git a/tools/acceptance/tasks/kvstore/prompt.md b/tools/acceptance/tasks/kvstore/prompt.md new file mode 100644 index 0000000..0014d6f --- /dev/null +++ b/tools/acceptance/tasks/kvstore/prompt.md @@ -0,0 +1,5 @@ +Write a small HTTP key-value store, `kvstore.py`, Python 3 standard library only (http.server is fine), single file. + +`python3 kvstore.py --port P --data FILE` serves: `PUT /kv/` with the raw request body as the value (returns 204; 201 when the key is new); `GET /kv/` returns the value as the body with the content type `application/octet-stream` (404 when absent); `DELETE /kv/` returns 204 (404 when absent); `GET /kv` returns a JSON array of the keys, sorted; `GET /health` returns `{"ok": true, "keys": N}`. Keys are URL path segments (percent-decoded), values are bytes of any size up to 1 MiB (413 above). Every write is persisted to FILE (JSON with base64 values is fine) before the response is sent, so a restart with the same FILE sees the same data. Handle requests one at a time; it does not need to be fast. + +Write `test_kvstore.py` (pytest) that starts the server on a free port in a subprocess, exercises every route including the restart case, and shuts it down; run `python3 -m pytest -q` until it passes. Finish with `NOTES.md`: what you built, how you tested it, anything you left out. diff --git a/tools/acceptance/tasks/md-toc/hidden/test_hidden.py b/tools/acceptance/tasks/md-toc/hidden/test_hidden.py new file mode 100644 index 0000000..93f79ef --- /dev/null +++ b/tools/acceptance/tasks/md-toc/hidden/test_hidden.py @@ -0,0 +1,26 @@ +import os, subprocess, sys, pathlib +HERE = pathlib.Path(__file__).parent +WORK = pathlib.Path(os.environ.get("WORK", HERE.parent)) +def run(md, *args): + f = WORK / "_in.md"; f.write_text(md) + r = subprocess.run([sys.executable, str(WORK / "mdtoc.py"), str(f), *args], capture_output=True, text=True) + return r.returncode, r.stdout +def test_example(): + rc, out = run("# Intro\n## Setup\n### Linux\n## Setup\n") + assert rc == 0 + assert out.rstrip("\n") == "- [Intro](#intro)\n - [Setup](#setup)\n - [Linux](#linux)\n - [Setup](#setup-1)" +def test_fence_and_punctuation(): + md = "## What's new, in 2.0?\n```\n# not a heading\n```\n~~~\n## nor this\n~~~\n## Done\n" + rc, out = run(md) + assert rc == 0 + assert out.rstrip("\n") == "- [What's new, in 2.0?](#whats-new-in-20)\n- [Done](#done)" +def test_setext_and_depth(): + md = "Title\n=====\nPart\n----\n### Deep\n#### Deeper\n" + rc, out = run(md, "--max-depth", "3") + assert rc == 0 + assert out.rstrip("\n") == "- [Title](#title)\n - [Part](#part)\n - [Deep](#deep)" + rc, out = run(md, "--min-depth", "2") + assert out.rstrip("\n") == "- [Part](#part)\n - [Deep](#deep)\n - [Deeper](#deeper)" +def test_missing_file(): + r = subprocess.run([sys.executable, str(WORK / "mdtoc.py"), str(WORK / "nope.md")], capture_output=True, text=True) + assert r.returncode == 1 and r.stderr.strip() diff --git a/tools/acceptance/tasks/md-toc/prompt.md b/tools/acceptance/tasks/md-toc/prompt.md new file mode 100644 index 0000000..0d9cb06 --- /dev/null +++ b/tools/acceptance/tasks/md-toc/prompt.md @@ -0,0 +1,13 @@ +Write a command-line tool `mdtoc.py` (Python 3, standard library only) that prints a table of contents for a Markdown file. + +Usage: `python3 mdtoc.py FILE [--max-depth N] [--min-depth N]`. It reads ATX headings (`#` to `######`), ignores headings inside fenced code blocks (``` or ~~~), and prints one line per heading, indented two spaces per level below the shallowest level that appears, as a Markdown list item linking to the heading's GitHub-style anchor: lowercase, spaces to hyphens, punctuation other than hyphens and underscores removed, and a `-1`, `-2`, ... suffix on repeated anchors. Setext headings (underlined with `===` or `---`) count as levels 1 and 2. `--max-depth` and `--min-depth` filter by heading level. Exit 0 on success, 1 with a message on stderr if the file cannot be read. + +Example: for the lines `# Intro`, `## Setup`, `### Linux`, `## Setup` the output is +``` +- [Intro](#intro) + - [Setup](#setup) + - [Linux](#linux) + - [Setup](#setup-1) +``` + +Write `test_mdtoc.py` with pytest tests covering fenced code blocks, repeated anchors, setext headings, the depth filters and punctuation in headings, and run `python3 -m pytest -q` until it passes. Finish with `NOTES.md`: what you built, how you tested it, and anything you left out. diff --git a/tools/acceptance/tasks/minesweeper/prompt.md b/tools/acceptance/tasks/minesweeper/prompt.md new file mode 100644 index 0000000..4de7e24 --- /dev/null +++ b/tools/acceptance/tasks/minesweeper/prompt.md @@ -0,0 +1,5 @@ +Write a minesweeper clone as a single page: `index.html` in the current directory, with its CSS and JavaScript inline or in `style.css` and `game.js` beside it. No build step, no network, no frameworks. + +Requirements: a 9x9 board with 10 mines placed at random on the first click (so the first click is never a mine); left click reveals a cell, revealing a zero flood-fills its neighbours; right click toggles a flag; a mine counter and a timer; a "New game" button; a clear win state (all safe cells revealed) and a loss state (a mine revealed, all mines shown). Cells must be real DOM elements with the CSS class `cell` and the data attributes `data-row` and `data-col`; a revealed cell also carries the class `revealed`, a flagged one `flagged`. + +Then check your own work: open the page's logic in node if you can (the game logic should be in functions you can call without a browser), or at least run `node --check` on the script, and read the HTML once more for mistakes. When you are done, write `NOTES.md`: what you built, how you tested it, and anything you left out. diff --git a/tools/pod/README.md b/tools/pod/README.md index e77dd16..7acd83f 100644 --- a/tools/pod/README.md +++ b/tools/pod/README.md @@ -1,8 +1,9 @@ # Pod bring-up `bringup.sh ` provisions a fresh RunPod box for this fork: the fork is built from the tree -at `/opt/us2-build` (rsync it there first, submodule checkout included; the pod's own rsync is fine, macOS's -openrsync needs no `--info` flag), llama.cpp at the pin is built as the correctness reference with the dump tool +at `/opt/us2-build` (rsync it there first, submodule checkout included: `rsync -a --exclude='/build' --exclude='/build-frontend' +./ root@pod:/opt/us2-build/`; an unanchored `--exclude='build*'` also drops llama.cpp's `build-info.cmake` and the +configure fails; macOS's openrsync has no `--info` flag), llama.cpp at the pin is built as the correctness reference with the dump tool (`/opt/llamacpp-ref`), and every model file is downloaded fresh from Hugging Face at the pinned revision onto the container disk (`/opt/us2-models`). Never serve from `/workspace`: the RunPod network volume read at 150 MB/s idle and stalled to a few MB/s under the engine's expert-cache fill (2026-10-17). `small` is the two 24 GB-class models @@ -14,3 +15,10 @@ Pod facts that matter: RunPod exposes every host CPU but enforces a cgroup quota on the 3090 pod, 46 on the B200 pod), so `--pool-workers` must be set below it or the engine pins threads it cannot run; `nvcc` lives in `/usr/local/cuda/bin`, not on PATH; `pip` needs `--break-system-packages` on Ubuntu 24.04; `pkill -f` with an unanchored pattern over ssh kills the ssh session itself. + +Copying the tree: from this Mac to a pod, rsync of the 8.8 GB tree (submodule included) took hours on 2026-10-19; between two +pods it took 90 s. With two pods up, rsync the tree once, then from that pod to the next (`ssh-keygen` a key on the +first pod, append its public key to the second's `authorized_keys`, `rsync -a --delete --exclude=/build +--exclude=/build-frontend /opt/us2-build/ root@second:/opt/us2-build/`; `/opt/us2-bringup/push-to-3090.sh` on the +B200 pod is that chain, ending in the second pod's `bringup.sh`). Start `bringup.sh` only after the tree is there: +started early it fails every build step in a second and writes `BRINGUP_DONE` all the same.