diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 118ee9d7..4a5db400 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -116,6 +116,8 @@ them, run `./ci-local.sh`, read what it names. launcher's comments. - FP8 combined with the 1M context is not memory-measured; the README says to run at native until the curve exists. -- TLS, per-client identity and multi-tenant use do not exist; SECURITY.md - names them as the design's edges, and anything toward them starts as an - issue with a measured motivation. +- Multi-tenant use does not exist. The proxy has optional TLS and optional + per-client identity since v6.16, both off by default and naming clients + rather than limiting them; the cockpit and the relay speak plain HTTP. + SECURITY.md names these as the design's edges, and anything past them starts + as an issue with a measured motivation. diff --git a/README.md b/README.md index 1ec91f64..3f246927 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ The engine answers `/health` even when it is wedged, so the cockpit runs a real ## Quickstart -Requirements: DGX Spark or other GB10 machine (128 GB unified), stock DGX OS (Docker + NVIDIA container toolkit). Free disk: **~84 GB** for a 27B target (~39 under `$HOME` for checkpoints and caches, ~45 on the Docker partition for the 39 GB image; caching the other 27B targets adds ~21 GB per NVFP4 target and ~31 GB per FP8 one), **~225 GB** for a flash target (~175 under `$HOME`: the ~126 GB checkpoint, ~124 for NVIDIA's export, plus the 47.7 GiB sparse file the N-gram table is served from and rewritten into on every boot; ~35 on the Docker partition for the 30 GB image). +Requirements: DGX Spark or other GB10 machine (128 GB unified), stock DGX OS (Docker + NVIDIA container toolkit). Free disk, as the installer checks it before it downloads anything: for a 27B target, **45 GB** on the disk of `HF_CACHE` (`~/.cache/huggingface` by default) for the checkpoints and caches, and **40 GB** on Docker's (`/var/lib/docker`) for its 33 GB image; for a flash target, **230 GB** on the disk of `HF_CACHE` (180 for the checkpoint and its caches, 50 for the 47.7 GiB PLE table the lane rewrites at every boot, counted on the disk of `PLE_DIR` instead when that is another one) and **35 GB** on Docker's for its 30 GB image. The installer checks each disk on its own, so on a stock box, where both are the home disk, plan for the sum: **85 GB** for a 27B target, **265 GB** for a flash one. What the cache already holds of a checkpoint comes off its share (a checkpoint that is all there needs 10 GB of working room instead), and an image already pulled needs 5 GB instead of its own size. Caching the other 27B targets adds ~22 GB per NVFP4 target and ~31 GB per FP8 one. One command, first install and updates alike. It clones or updates `~/dgx-spark-qwen38`, then runs the pinned installer, which installs **the whole box**: engine, keepalive proxy, opencode wiring, the cockpit and its Agent tab. It ends by printing the cockpit URL, and there is nothing left to run by hand. @@ -102,7 +102,7 @@ First boot takes **~7-9 minutes** for a 27B target (CUDA graph capture + kernel - **Any OpenAI client**: `http://:30001/v1/chat/completions`, model `qwen3.8-27b` (flash: `qwen3.8-flash-next`), Bearer key from `~/.config/qwen38/api-key` - **Anthropic protocol**: `http://:30001/v1/messages` (`Authorization: Bearer` only, not `x-api-key`) - Both are the **keepalive proxy**, not the engine: it relays every route the engine serves and adds the guards for the requests SGLang dies on rather than refuses. Since v1.17 the engine itself binds `127.0.0.1` and `:30000` answers on the box only ([docs/clients.md](docs/clients.md), [SECURITY.md](SECURITY.md)) -- **Don't want a systemd service?** `./install.sh --no-service && ./run.sh`: same config, foreground, no sudo, Ctrl+C and it's gone (27B targets; flash is service-only in this release). +- **Don't want a systemd service?** `./install.sh --no-service && ./run.sh`: the native unit's pins and flags, foreground, no sudo, Ctrl+C and it's gone (27B targets; flash is service-only in this release). That path has no proxy: clients talk to the engine on `:30000`, which `run.sh` serves on every interface, without the guards. - Everything is **pinned twice** (base image digest + checkpoint revisions at download, and the same `--revision` passed to the server itself, so an upstream push to a checkpoint repo can never change what you serve; plus sha256-verified overlay files for the flash lane's rollback image, `flash-sglang/ATTRIBUTION.md`). It still works months from now; the installer is idempotent and every failure path says how to fix itself. `MODEL_REV=main ./install.sh` overrides the pins; `git checkout v1.1 && ./install.sh` returns to the DSpark config. - Since 2026-08-21 this same combination (DFLASH2, draft depth 16 since v1.9) is the **official recipe in the [SGLang cookbook](https://docs.sglang.io/cookbook/autoregressive/Qwen/Qwen3.8-27B)**, and since v1.14 both lanes @@ -133,7 +133,7 @@ Combinations that make sense: ```bash # one-liner forms (variables on the bash side, flags after "bash -s --") -curl -fsSL https://raw.githubusercontent.com/hasso5703/dgx-spark-qwen38/main/get.sh | bash # everything: 27B stock, native, service, opencode, cockpit +curl -fsSL https://raw.githubusercontent.com/hasso5703/dgx-spark-qwen38/main/get.sh | bash # everything: 27B stock, 1M context, service, opencode, cockpit curl -fsSL https://raw.githubusercontent.com/hasso5703/dgx-spark-qwen38/main/get.sh | CONTEXT_MODE=native bash # the 262144 window instead curl -fsSL https://raw.githubusercontent.com/hasso5703/dgx-spark-qwen38/main/get.sh | MODEL_CHOICE=uncensored bash # abliterated 27B, 1M context curl -fsSL https://raw.githubusercontent.com/hasso5703/dgx-spark-qwen38/main/get.sh | MODEL_CHOICE=flash bash # Flash-Next lane (service only) @@ -344,7 +344,9 @@ boot 10 min 40 s, KV pool 473,664 tokens, decode 45.4-46.4 tok/s on code, canaries 4/4, needle 1/1 exact at 120K, prefix caching x5.9, and **0 refusals out of 5** deliberately blunt probes, which is the point of the variant. Safety refusals are removed, which moves the guardrails onto you: filtering, human -review and access control are yours to supply, and the lane binds to `0.0.0.0`. +review and access control are yours to supply, and the proxy in front of the +lane listens on every interface by default, with the API key as its only gate +(`PROXY_BIND=127.0.0.1` keeps it on the box). Two alternatives were rejected for stated reasons, both worth knowing if you go looking: `orcarouter/Qwen3.8-Flash-Next-Uncensored-NVFP4` is a different packaging (18 shards, 170.9 GiB, no `hf_quant_config`, a separate @@ -543,6 +545,7 @@ journalctl -u qwen38-keepalive -f # one line per proxied request (bytes, f ./uninstall.sh # removes services + config; prints reclaim commands for data it found ./uninstall.sh --yes # same, and deletes ~/.config/qwen38 (API key) without asking; opencode's config loses this box's providers # the images the installer pulls by digest are tagged qwen38-pinned:-, so a docker image prune leaves them alone +``` Killing an abandoned generation, reading a dead decode from both sides of the wire, the opt-in extras, and what an upgrade from an earlier version actually does: @@ -575,7 +578,7 @@ question you had when you opened the page. | Tab | What it answers | What you can do there | |---|---|---| -| **Overview** | Is the box serving, and on what? KV pool held right now, serving lane, unified memory, the last events | Start, stop, restart, switch lane, flush the prefix cache, abort all, smoke probe | +| **Overview** | Is the box serving, and on what? KV pool held right now, serving lane, unified memory, the last events | Start or stop the lane, switch target, flush the prefix cache, abort all, smoke probe, diagnostics bundle (the bar at the top, on every tab) | | **Agent** | opencode's own web interface, framed behind this login | Run a session on the box from a laptop or a phone, no terminal | | **Engines** | Which units exist, which one is served, what the probes and containers say | Act on any unit this repo installed | | **Requests** | What the engine and the proxy each did with the same traffic: live feed, zombie guard, pool and decode | Read a dead decode from both sides of the wire | @@ -584,8 +587,8 @@ question you had when you opened the page. | **System One** | The typed-decisions endpoint, from a browser: is it served, and what does it answer? | Ask the lane with prefilled examples, copy the matching curl, read the probabilities | | **Image** | Qwen-Image 2.1, when it is the serving lane: generation, editing with up to ten references, native RGBA | Generate and edit at the model's defaults (**Reset settings**), start from the sample prompts, follow each stage of a request, copy the matching curl | | **Video** | Nothing yet, and it says so | | -| **Logs** | Live logs, the last 30 events, recent jobs | Run a bench, the 4-canary quality battery, a diagnostics bundle | -| **Setup** | The repo itself, opencode integration, serving-stack updates, the cockpit's own settings | Regenerate the API key, update the stack, change what the page binds to | +| **Logs** | Live logs, the last 30 events, recent jobs | Tail or follow a service's log, read what each recent job printed | +| **Setup** | The repo itself, opencode integration, whether a newer release is out, the cockpit's own settings | Fit opencode's limits to the engine that serves; copy the command that updates the stack, which runs in a terminal because the installer needs an interactive sudo | The three other screenshots, what each panel does that a terminal does not, how it behaves on a phone, and the Agent tab that runs opencode in the browser behind this same login: diff --git a/SECURITY.md b/SECURITY.md index b8debeca..c437cb79 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -6,8 +6,9 @@ What this box trusts, what it does not, and how to report a hole in that line. A serving stack one operator installs on a machine they own and administer: a Docker engine behind a Python proxy, a cockpit web UI that reaches systemd -through an exact-argv sudo allowlist, and an opt-in relay that puts opencode's -web interface behind the cockpit login. There is no telemetry and no +through an exact-argv sudo allowlist, and a relay, installed with the cockpit +when opencode is there, that puts opencode's web interface behind the cockpit +login. There is no telemetry and no phone-home: every byte that leaves the box is a download the installer names (Hugging Face, the image registry) or a request you sent. One exception, added in v1.15.2 and named here because it is one: the cockpit asks GitHub's public releases @@ -66,13 +67,16 @@ unconstrained in the served release, checked in the image, and all of them are reachable from an ordinary chat request. The proxy refuses all of them with a 400. **That protects the clients that go -through it, and nothing else.** On this box the engine binds `0.0.0.0:30000` -with no firewall in front of it, so anything on the LAN or the tailnet that -holds the serving API key can reach the engine directly and end it, exactly -as it could before these guards existed. The key is the boundary there, not -the proxy. **Since v1.17 the engine binds `127.0.0.1` by default**, so on a fresh -install the proxy's guards are the only door and the engine is not on the -network at all. Nothing is lost by it: the proxy is a full pass-through of +through it, and nothing else.** Whatever reaches the engine's own port with the +serving API key reaches the scheduler with none of these guards. **Since v1.17 +the engine binds `127.0.0.1` by default**, so on a box installed that way its +port answers on the box only and the proxy is the one door from the network. +Two paths still put the engine itself on the network: `ENGINE_BIND=0.0.0.0 +./install.sh`, and `./run.sh`, the foreground path of `--no-service`, which +serves it on `0.0.0.0:30000` with no proxy at all. On either, anything on the +LAN or the tailnet that holds the key can reach the engine directly and end it, +exactly as it could before these guards existed: the key is the boundary there, +not the proxy. Nothing is lost by the default: the proxy is a full pass-through of every route the engine serves, so a client that used `:30000` from another machine uses `:30001` and gets the guards with it. `ENGINE_BIND=0.0.0.0` restores the old behaviour, `PROXY_BIND` does the same for the proxy, and an @@ -110,14 +114,19 @@ repo on every install. Read these before reporting; a report against one of them is a design discussion, not a disclosure. -- **Plain HTTP.** The proxy, cockpit and relay serve HTTP because they are - meant for loopback or a tailnet, and the cockpit warns when a non-loopback - bind has no key. TLS in front is the operator's reverse proxy. If you need - to expose any of it to a LAN you do not control, that is the design's - stated edge, not a hole. -- **One API key, one trust realm.** Every client that holds the key is the - same principal: same quota, same ceiling, same lane. Per-client identity - does not exist yet. +- **Plain HTTP by default.** The cockpit and the relay serve HTTP only, and so + does the proxy until it is given a certificate (`QWEN38_TLS_CERT`, proxy + v6.16, see docs/clients.md): all three are meant for loopback or a tailnet. + The cockpit says in its journal when it binds anything but loopback, and with + no key file no login succeeds. TLS in front of the cockpit and the relay is + the operator's reverse proxy. If you need to expose any of it to a LAN you do + not control, that is the design's stated edge, not a hole. +- **One API key, one trust realm, by default.** Every client that holds the key + is the same principal: same quota, same ceiling, same lane. The proxy can + name clients instead (`QWEN38_CLIENT_KEYS_FILE`, proxy v6.16: one bearer per + client, a 401 for an unlisted one on every route but `/health`, the label on + every journal line of its requests), and naming is all it does: there are no + per-client quotas or ceilings, and the engine behind it still has one key. - **`AGENT_AUTO=1` is deliberate escalation.** It sets opencode to allow every tool call in the Agent tab, behind the cockpit login, on this machine, by the operator's own choice. The explicit deny rules of your @@ -126,11 +135,17 @@ discussion, not a disclosure. `uncensored-fp8` and `flash-uncensored` exist as pinned checkpoints because the operator asked for them; nothing in the serving stack filters or vets what they answer. -- **`/metrics` is open on the engine port.** Since the Prometheus flag ships on - every lane, request rates and queue depths are readable by anything that can - reach the engine port. That is the port's existing trust model (a trusted - network by design, see the plain HTTP edge above); the metrics endpoint adds - counters to it, not a new surface to authenticate against. +- **`/metrics` needs no key.** Every text lane passes the Prometheus flag, and + the engine serves `/metrics` without the API key (checked on the reference + box: 200 with no key, where `/v1/models` answers 401). Since v1.17 the engine + port is on loopback, so from another machine the counters are read through + the proxy on `:30001`, which relays that route like any other, with no key + either; with the per-client identity file set, it needs a listed key like + every route but `/health`. Request rates and queue depths are therefore + readable by anything that can reach the proxy port. That is the port's + existing trust model (a trusted network by design, see the plain HTTP edge + above); the metrics endpoint adds counters to it, not a new surface to + authenticate against. The image lane exports no metrics. - **The cockpit assumes one admin user.** The sudo allowlist covers this repo's argv, but a hostile local user with your shell can do what you can do: this box is yours, and it is not a multi-tenant host. diff --git a/dashboard/DESIGN.md b/dashboard/DESIGN.md index 05bb7fcd..4bab64f8 100644 --- a/dashboard/DESIGN.md +++ b/dashboard/DESIGN.md @@ -1,8 +1,9 @@ # Spark Cockpit: design foundations One web app that does everything this repo does from the shell, by clicks, with -everything visible in real time. Ships as `qwen38-dashboard.service`, -opt-in, since v1.6. +everything visible in real time. Ships as `qwen38-dashboard.service` since v1.6, +and since v1.12 `install.sh` installs it by default as its last step +(`--no-cockpit` opts out, and the choice sticks). ## Non-negotiables (from the owner) @@ -34,9 +35,12 @@ GET for the fallback path. Actions are POST with JSON, CSRF-protected.** ## Security model (NASA mode) -- Binds 127.0.0.1 by default; reaching it from another machine is an explicit - choice (`DASH_BIND` at install, `COCKPIT_BIND` on the unit), announced in the - journal at startup, and still gated by the API key. +- A first `install.sh` binds the box's tailnet address when it has one, so the + page opens from a laptop or a phone over a private network, and 127.0.0.1 + otherwise; `dashboard/install-dashboard.sh` run alone binds 127.0.0.1. Any other + address is an explicit choice (`DASH_BIND` at install, `COCKPIT_BIND` on the + unit), and a re-run keeps the installed one. A bind other than loopback is + announced in the journal at startup, and the API key is its only gate. - Session auth: the app reuses the repo's api-key file as its bearer secret (cookie session after a login page; the key never appears in URLs). - CSRF token on every mutating POST; same-origin checked. diff --git a/docs/clients.md b/docs/clients.md index 0a21ce9c..989c2f62 100644 --- a/docs/clients.md +++ b/docs/clients.md @@ -73,19 +73,28 @@ enforces the key; the proxy forwards it verbatim. Served model names: `qwen3.8-27b` (27B lane, both context modes) and `qwen3.8-flash-next` (flash lane). Send the name, not the checkpoint path. -Reasoning effort is a first-class field in both dialects (`low`, `medium`, -`xhigh`; the template maps `max`/`high` to `xhigh` and `minimal` to `low`, -see README "Reasoning-effort variants"). Long turns cost time at the +Reasoning effort is a first-class field in both dialects: `lean`, which a +request that names no level gets, and Qwen's own `low`, `medium` and `xhigh` +(the template maps `max`/`high` to `xhigh` and `minimal` to `low`; the levels +and what each costs are in [LEAN.md](../LEAN.md), and a box installed with +`LEAN_DEFAULT=0` keeps Qwen's `xhigh` as the default). Long turns cost time at the engine's speed, not yours: an `xhigh` turn can stream for minutes on a correct answer, and several clients have wall-clock watchdogs that read that as a hang. Prefer `medium` for interactive editing, `low` for mechanical edits, and keep `xhigh` for the hard turn. -Oversize behavior differs by lane, deliberately: the 27B units pass -`--allow-auto-truncate` (an oversized prompt is truncated, which is often -what an agent wanted), the flash lane does not (it refuses instead), and -the flash proxy carries a 250,000-token ceiling that answers 413 with a -message naming the ceiling and the retry shape. +Oversize behavior is the same on every lane: nothing is truncated. No unit or +launcher passes `--allow-auto-truncate` (a CI gate refuses it), so a prompt a +lane cannot serve comes back refused rather than silently cut. The proxy +refuses a prompt past 92% of the lane's KV pool (`OVERSIZE_MARGIN_FRAC`, 0.08) +with a 400 `context_too_long` (`code: context_length_exceeded`, the code +opencode compacts on), whose message names the count, the limit and the pool; +while the flash lane serves, the limit is also held under its one-prompt +ceiling (`FLASH_PROMPT_CEILING_TOKENS`, 250,000 by default), which keeps a long +flash prefill off the memory edge. The engine itself refuses a request whose +prompt plus `max_tokens` passes its window (262,144 tokens, 1,010,000 in 1M +mode). A 413 means a body over `MAX_BODY_BYTES` (256 MiB), refused before a +byte of it is read. ## Measured on the reference box diff --git a/docs/cockpit.md b/docs/cockpit.md index a997b725..054a7cde 100644 --- a/docs/cockpit.md +++ b/docs/cockpit.md @@ -89,17 +89,20 @@ sudo systemctl restart qwen38-dashboard of the **running** proxy from its startup banner; and whether the engine accepts the proxy's request id at all, because without that an abandoned answer can only be drained. See the v1.8.4 and v1.8.5 changelog entries. -- **Jobs.** Bench runs, the 4-canary quality battery, diagnostics bundles and cache - operations run as supervised one-at-a-time jobs with live output, instead of - commands you type blind into a terminal. +- **Jobs.** Every action above, the opencode fit and the diagnostics bundle run + as supervised one-at-a-time jobs with live output, instead of commands you + type blind into a terminal. Benchmarks are not among them: `./bench.sh` and + `./bench-matrix.sh` run in a terminal (BENCHMARKS.md). - **Housekeeping.** Inventory of everything the repo ever put on the box and - what each item costs in bytes (read-only: the reclaim commands are printed by - `./uninstall.sh --list` and by the installer, never run from the page), the - opencode integration state (limits per lane, default model, output cap) with - the one action that writes there, fitting those limits to the pool the engine - actually booted with, the patched chat templates, the API key (masked, - regenerable), and the repo itself (version, upstream tag, changelog, update - badge). + what each item costs in bytes (read-only, from `./uninstall.sh --list`; the + reclaim commands are printed by `./uninstall.sh` once it has removed the + services, and by the installer for images an earlier version left, never run + from the page), the opencode integration state (limits per lane, default + model, launcher) with the one action that writes there, fitting those limits + to the pool the engine actually booted with, and the repo itself (version, + branch, head, a dirty working tree, and whether a newer release is out). There + is no panel for the API key, which is what you log in with; the diagnostics + bundle masks it. On a phone the chrome collapses to one identity row plus a swipeable section rail, controls are 44 px targets, and the Agent tab opens fullscreen (see "On a diff --git a/docs/context-1m.md b/docs/context-1m.md index 20d29e93..5e309e7f 100644 --- a/docs/context-1m.md +++ b/docs/context-1m.md @@ -29,18 +29,23 @@ daily since 2026-08-22: boots in the v1.3 era reported **917K-1019K** tokens; three around 2026-08-30 reported **863,398, 893,479 and 913,334** for the same checkpoint; four on the official image at 0.76, on 2026-09-17 and 18, reported **902,398, 889,131, - 889,722 and 887,797**. The ranges do not overlap, so treat **863K as the floor - to plan against** until a fresh campaign settles it. DFlash2 acceptance is unchanged either way, and a real 690K-token + 889,722 and 887,797**. Over sixteen 27B boots here the pool ranged from + **832,993 to 922,094 tokens**, so no campaign's floor is the floor: plan against + the pool your own boot reports, which is what the fit below does. DFlash2 + acceptance is unchanged either way, and a real 690K-token request has been served (cold prefill 40 min, then cached). - **The limits are fitted to your own boot, automatically.** The generated - opencode limits below are static, and their 1m worst case (compaction at ~680K - plus 200K of output) sits **above the 863,398 floor**: on an unlucky boot a long - session can meet a proxy refusal mid-conversation, which is the field case that - produced this tool. Since v1.12.1, `install.sh` runs `oc-fit-limits.py` itself at + opencode limits below are static, and their 1m worst case (compaction at 680K, + one agent step of up to 43,863 tokens after it, and 200K of output: 923,863) + sits **above every pool measured here**, so left as is a long session can + outgrow the pool mid-conversation, which is the field case that produced this + tool. Since v1.12.1, `install.sh` runs `oc-fit-limits.py` itself at the end of every 1m install, once the engine is up: it reads the pool your boot actually got and rewrites the limits to fit it, up or down. Run it by hand (or - press the cockpit's button) after any later reboot you want re-fitted. The FP8 targets ship lower static limits already, because their pool is - about 92,000 tokens smaller. + press the cockpit's button) after any later reboot you want re-fitted. The FP8 targets ship lower static limits (480,000/160,000), + set when their pool measured about 92,000 tokens smaller; on the official image + the gap all but closed (881,895 against 887,797 on 2026-09-18), so theirs are + conservative now. - **The keepalive proxy becomes load-bearing.** Every service install ships it (see "opencode integration"), but at 1M it is not optional: a cold 690K-token prefill can keep the wire silent for tens of minutes. The proxy injects the official Anthropic @@ -85,8 +90,10 @@ daily since 2026-08-22: **every** request of the session (measured 2026-09-09 against Claude Code 2.1.266 and its `Artifact` tool). The proxy removes only the patterns Python cannot compile, only inside tool parameter schemas, and forwards every other body untouched and unparsed. -- The generated opencode config switches to `context/input 700000, output 200000` - (compaction fires at 680000; worst case 880000, under the worst measured pool). +- The generated opencode config starts from `context/input 700000, output 200000` + (compaction fires at 680000; with one worst agent step and the answer on top, + 923,863, above every pool measured here), and the fit at the end of the install + lowers it to the pool the boot got. Quality past the native 262144 window is not formally evaluated here: treat it as an experimental preset. Proof it holds up operationally, one continuous **opencode** session @@ -97,8 +104,8 @@ prompt by YouTuber Bijan Bowen: - **~360K tokens generated**, 239 agent steps, 274 tool calls, no retry, no manual rescue - Result, single HTML file: **https://subway-fps.vercel.app** -Back to native: `CONTEXT_MODE=native ./install.sh` (removes the proxy service and -restores the pre-YaRN `config.json.pre-yarn` originals over the patched +Back to native: `CONTEXT_MODE=native ./install.sh` (keeps the proxy, which every +service install ships, and restores the pre-YaRN `config.json.pre-yarn` originals over the patched target and draft configs; a native server crashes at load on a patched config, so `run.sh` refuses a patched cache early instead of ten minutes into the boot, and the installer refuses with a re-download fix-it when a backup is diff --git a/docs/opencode.md b/docs/opencode.md index 8e423027..761057a0 100644 --- a/docs/opencode.md +++ b/docs/opencode.md @@ -2,7 +2,7 @@ What the installer writes for [opencode](https://opencode.ai), why each piece is there, and how to opt out. Moved out of the README in v1.14.2. -The installer writes a complete, ready-to-use [opencode](https://opencode.ai) config at `~/.config/qwen38/opencode.json` (the API key is referenced via `{file:...}`, no secret inside). It contains one provider per installed engine (`qwen38` for the 27B pair, `flashnext` for flash), each with `low` / `medium` / `xhigh` reasoning-effort variants (no variant = the template's own default, xhigh), and its default model follows the installed target (`./switch-model.sh` re-points it on every switch): +The installer writes a complete, ready-to-use [opencode](https://opencode.ai) config at `~/.config/qwen38/opencode.json` (the API key is referenced via `{file:...}`, no secret inside). It contains one provider per installed engine (`qwen38` for the 27B pair, `flashnext` for flash), each with `lean` / `low` / `medium` / `xhigh` reasoning-effort variants (no variant = the patched template's default, `lean`, or Qwen's `xhigh` on a box installed with `LEAN_DEFAULT=0`), and its default model follows the installed target (`./switch-model.sh` re-points it on every switch): A box with no opencode config of its own gets this one as `~/.config/opencode/opencode.json` (since v1.18.4: before, it was printed as a `cp` command, and a first install left opencode, @@ -69,7 +69,7 @@ What the shipped config gets right for you: 1. **The hidden 32K output cap**: opencode sends `max_tokens = min(limit.output, OPENCODE_EXPERIMENTAL_OUTPUT_TOKEN_MAX or 32000)`. Without that env var, a long thinking phase hits 32000 tokens, the turn ends silently (`finish_reason: length`, no text, no tool call) and you have to re-prompt. The installer ships an **`oc` launcher** (`~/.local/bin/oc`, skipped if an unrelated `oc` binary exists) that exports the right value and execs `opencode --yolo`: launch with `oc` instead of `opencode` and the cap sits above every output limit this repo declares, on every target and in either context mode. It is deliberately a ceiling rather than the installed target's own number, because `limit.output` is what follows a model switch: a ceiling copied from the installed target survives the switch and cuts the next lane's turn in the same silence (`./oc-limits.sh --max-out` is where both installers read it). Note that `--yolo` auto-approves every tool action (how the reference box runs); remove it from the launcher file if you prefer per-action prompts. 2. **Limits that can never 400**: the server rejects any request where `input + max_tokens` exceeds the window (no clamping), and the prompt opencode sends can reach its compaction point (`limit.input` minus 20,000) plus one agent step (up to 43,863 tokens measured on this box). So the config ships `context/input 173000, output 64000` in native mode (173,000 - 20,000 + 43,863 + 64,000 = 260,863, under 262,144, whether the 32K cap is lifted or not), `205000/32000` on the flash lane, and `700000/200000` in 1m mode as a starting pair. Until v1.18.7 the native pair was 194048/64000 and the flash one 225000/32000: both fitted a prompt of exactly `context`, not the one a large step brings past compaction, so a request in that band got a 400 that opencode then compacted on. The 1m pair is a starting pair, which the installer then fits to the pool the boot actually got (`oc-fit-limits.py`, after step 9): the pool changes from boot to boot (832,993 to 922,094 tokens over sixteen 27B boots on the reference box), and that pair does not fit the smaller ones. Since v1.18.2 the cockpit does the same fit by itself after a switch and a Start. Both fits hold the same window rule, and on a 262,144 window they never go above the lane's pair above (v1.18.7). -3. **Reasoning-effort variants**: the generated config declares `medium` and `low` variants (ctrl+t in the TUI); the default is the model's `xhigh`. This works because the patched template accepts and maps effort tiers (`max`/`high` → `xhigh`, `minimal` → `low`, [contributed by helge](https://forums.developer.nvidia.com/t/380257/10)); any client sending an unmapped tier would get a 500 on the stock template. +3. **Reasoning-effort variants**: the generated config declares `lean`, `low`, `medium` and `xhigh` variants (ctrl+t in the TUI), `lean` first because it is what a turn that picks none gets: the patched template's default since v1.13, measured in [LEAN.md](../LEAN.md) (`LEAN_DEFAULT=0 ./install.sh` keeps Qwen's `xhigh` as the default and still offers `lean`). This works because the patched template accepts `lean` and maps other clients' effort tiers (`max`/`high` → `xhigh`, `minimal` → `low`, [contributed by helge](https://forums.developer.nvidia.com/t/380257/10)); any client sending an unmapped tier would get a 500 on the stock template. 4. **Mid-conversation system messages**: some agent clients inject system messages after turn 1; the stock template raises `System message must be at the beginning`. Patched to render them as `` blocks. 5. **Vision declared**: `attachment` + `modalities` are set, so image attachments and on-disk image reads work end to end (the model is natively multimodal). diff --git a/docs/operations.md b/docs/operations.md index 9350b410..212a7abf 100644 --- a/docs/operations.md +++ b/docs/operations.md @@ -33,12 +33,16 @@ Notes: the server's own `watchdog_timeout=300` is a *hang* detector (kills a gen **Idle power**: without `--sleep-on-idle`, SGLang's scheduler busy-spins a full CPU core while doing nothing (reported as +10-12 W at the wall by [alef204 and emX0r](https://forums.developer.nvidia.com/t/380257/56), diagnosed in [MiaAI-Lab issue #4](https://github.com/MiaAI-Lab/Qwen3.8-27B-SGLang-DGX-Spark/issues/4)). Every serving lane ships the flag, and a CI gate requires it: the 27B units and `run.sh` since v1.2.6, the flash launcher since v1.8.5, where the lane was measured holding a core at 101 % for 12 h 21 min of idle because the launcher had been written without it. A/B on the reference box: scheduler CPU 101 % -> 1.7 % at idle, module power 12.1 -> 10.5 W, and wake-up TTFT unchanged (0.234-0.240 s before, 0.234-0.239 s after, measured after 60 s and 300 s of idle), throughput in family (41.5 tok/s code, 52.8 math). -**Metrics**: every serving lane passes `--enable-metrics`, so Prometheus scrapes -`http://:/metrics` (request rates, KV usage, acceptance -lengths under speculative decoding, queue depth). The endpoint is unauthenticated -on the engine port, the same trust model that port's whole surface already -assumes (trusted network: loopback, tailnet; see SECURITY.md), and it arrives at -your next `./install.sh` re-run and engine start. +**Metrics**: every text lane passes `--enable-metrics` (the image lane exports +none), so Prometheus scrapes `/metrics` (request rates, KV usage, acceptance +lengths under speculative decoding, queue depth). Since v1.17 the engine port is +on loopback, so a scraper on another machine reads `http://:30001/metrics`, +which the proxy relays like every route; one on the box can read +`http://127.0.0.1:30000/metrics` directly. The endpoint needs no key on either +port (with the proxy's per-client identity file set, it needs a listed key like +every route but `/health`), the same trust model the proxy port's whole surface +already assumes (trusted network: loopback, tailnet; see SECURITY.md), and it +arrives at your next `./install.sh` re-run and engine start. ## Extras (opt-in) diff --git a/install.sh b/install.sh index b59c69ab..f30e3339 100755 --- a/install.sh +++ b/install.sh @@ -922,10 +922,10 @@ TOTAL_GB=$(awk '/^MemTotal/{print int($2/1048576)}' /proc/meminfo) mkdir -p "$HF_CACHE" 2>/dev/null || true FREE_DISK_GB=$(df -BG --output=avail "$HF_CACHE" 2>/dev/null | tail -1 | tr -dc '0-9') # Fresh installs need ~45 GB for the 27B stack (checkpoints + caches) and -# ~145 GB for Flash-Next (the NVFP4 checkpoint alone is ~136 GB and doubles as -# the mmap-served PLE table). Upgrades with the big checkpoint already cached -# only need working room. -NEED_GB=45; DOCKER_NEED_GB=40; IMG_LABEL="39 GB Docker image" +# ~180 GB for Flash-Next (its NVFP4 checkpoint alone is ~135 GB), plus the 50 GB +# its PLE table takes below. Upgrades with the checkpoint already cached only need +# working room. README "Quickstart" states these numbers: keep the two together. +NEED_GB=45; DOCKER_NEED_GB=40; IMG_LABEL="33 GB Docker image" if [ "$LANE" = "flash" ]; then NEED_GB=180; DOCKER_NEED_GB=35; IMG_LABEL="30 GB Docker image" fi @@ -2254,7 +2254,7 @@ except Exception as e: elif [ "${IMAGE_ON:-0}" -eq 0 ]; then echo " Images : not installed; ./install.sh --with-image adds the Qwen-Image 2.1 lane (38 GB)" fi - [ "$LANE" = "27b" ] && echo " Benchmark : ./bench.sh (or the Benchmarks tab of the cockpit)" + [ "$LANE" = "27b" ] && echo " Benchmark : ./bench.sh" exit 0 fi ST="$(systemctl is-active "$UNIT_NAME" || true)"