Files
alzeo/docs/cockpit.md
T
Hasan BasbunarandClaude Opus 5.5 5a37ed2c43 docs: the cockpit at the top of the README, and every capture retaken at v1.27.0
The README shows the cockpit before "In detail": its Now view, taken from
this box's own page at v1.27.0 with the 27B serving. The cockpit section
shows Lanes in its place, where every version of a lane is now in sight.
Now, Lanes, Traffic and Video on a desktop and the phone's drawer are
retaken in deep indigo, and their alt texts say what each image shows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 21:40:55 +02:00

21 KiB

The cockpit

The full tour. The README carries the short version: what the cockpit is, how it is installed, what it binds to, and the table of its views. This is everything else, starting with what it looks like.

Installing it, and what it binds to

A local dashboard for this stack: what is served right now, whether it is healthy for real, and the handful of actions you would otherwise type by hand. Single-file stdlib backend, no pip and no venv. Since v1.12 install.sh installs it as step 10/10, once the engine has answered a real generation, and prints its URL as the last thing it says. You do not run anything else:

curl -fsSL https://raw.githubusercontent.com/hasso5703/dgx-spark-qwen38/main/get.sh | bash
# ... ends with:  ▶ OPEN THE COCKPIT:  http://<address>:30090
# the login is the API key from ~/.config/qwen38/api-key

On a first install it binds the box's tailnet address when there is one, so the page opens from your laptop or your phone over a private network, and 127.0.0.1 otherwise. A re-run never changes that: install-dashboard.sh converges on the installed unit, so an upgrade cannot flip a reachable cockpit back to loopback. Install it alone, or change the bind, with the same script:

dashboard/install-dashboard.sh          # DASH_PORT=30090 by default

To open a loopback-bound cockpit from another machine, set DASH_BIND and re-run it:

DASH_BIND=0.0.0.0 dashboard/install-dashboard.sh        # every interface
DASH_BIND=$(tailscale ip -4) dashboard/install-dashboard.sh   # that interface only

Then browse http://<the box's tailnet or LAN address>:30090. The login is the same API key, over plain HTTP: the session cookie is HttpOnly and SameSite=Strict and every mutating POST carries a CSRF token, but there is no TLS, so this belongs on a tailnet or a LAN you trust and never on the open internet. On an already installed cockpit, change it in place:

sudo systemctl edit qwen38-dashboard    # [Service] Environment=COCKPIT_BIND=0.0.0.0
sudo systemctl restart qwen38-dashboard

That moves the page only. The Agent view's relay keeps its own address, COCKPIT_AGENT_BIND, which a re-run of dashboard/install-agent.sh keeps too: set it in the same drop-in (Environment=COCKPIT_AGENT_BIND=tailscale, or an address), or re-run that script with AGENT_BIND=.

What it looks like

The cockpit's Now view: one pool of unified memory and what holds it, the four lanes in their rack with their makers' marks and the serving one edged in green, and below them the requests and the timeline

Now: one pool of unified memory, four lanes that take turns in it, and which one holds the box. The timeline is the engines' own state transitions, including the kernel's GPU-allocation refusals that precede the memory edge on this hardware.

The Lanes view: each lane with its maker's mark, every version it can load in one row of buttons with the one serving marked in green, its Load or Stop button, its facts and its last five boots

Lanes: each lane with what it serves, what its boots took on this box and the KV pool each one won, and one button that loads it: switch, stop, start, each step asking first and showing its command.

The Traffic view: the running, waiting and KV counters, the requests the keepalive proxy relayed with client, route, size, duration and outcome, and the abandoned-request guard

Traffic: both sides of the wire. The feed is what the proxy relayed; the guard is whether any client walked away from an answer the engine is still generating.

The Video view with the 27B lane holding the box: the button that loads MiniMax-H3, then the mode, examples, prompt, length, size and speed of a call, beside where the video appears

Video: MiniMax-H3 on this box. While another lane holds the box, the view says which one and loads the video lane with one button; what a call costs here shows before it is made.

Deep indigo, two halos of light drifting slowly behind translucent panels, and colour kept for meaning: green is ready and serving, amber on its way, red broken, grey idle, blue memory and information, violet the controls. Each lane carries its maker's mark on its bay and its card in Lanes, and its own hue on its share of the pool and the gauge in the head, and a lane's versions are all in sight, one button each. The backdrop is decoration and behaves like it: the browser draws it at a quarter of its width and height and 8 frames a second at most, pauses it in a hidden tab and under the Agent's fullscreen frame, keeps it still for a system that asks for reduced motion, leaves it out under forced colours, and shows the same light in CSS where WebGL is missing. Every text measured on every view meets WCAG AA contrast (4.5:1, 3:1 for large text), on a desktop and a phone over the backdrop's whole drift (v1.27.0). Fonts, marks and scripts are all served by the box: the page fetches nothing from elsewhere.

What it does that a terminal does not

  • Lane state that is not a lie. A wedged SGLang still answers /health, so the cockpit runs a real generation canary and reports ready, loading, wedged or stopped from that, with the served checkpoint named from the unit rather than guessed.
  • Belts. A host MemAvailable floor that aborts generations before the box reaches the memory edge, and a counter of the kernel's NVRM allocation refusals, which is how the memory-edge behaviour in the flash section was found in the first place.
  • Actions, one at a time. Unit start/stop/restart, lane switch (the same switch-model.sh you would run), cache flush, abort-all, smoke probe. Every action is audited to ~/.config/qwen38/cockpit-audit.log with its exact argv.
  • Recipes and drift. Every target as data, derived from install.sh and the lane templates so a recipe cannot drift from what the installer renders, compared flag by flag against the invocation actually running on the box. Since v1.8.5 that comparison covers value-less flags too (switch.--sleep-on-idle: recipe true, installed false is what the panel said the morning the flash lane was caught spinning a core).
  • Zombie guard. A client that gives up leaves the engine decoding unless something stops it, so the Traffic view reads both sides of the wire: the engine's own flood lines grouped by request, worst first, with the span between a request's first and last line, which is the dead decode; what the proxy did about it over the same window (aborted, drained, the longest drain, aborts the engine never answered); the version 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. 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, 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 rail is a drawer behind the menu button, controls are 44 px targets, and the Agent view opens fullscreen (see "On a phone" below): the whole box is operable from a hand.

The privileged surface, stated plainly. The unit actions need root, so the installer writes /etc/sudoers.d/qwen38-cockpit: an exact argv allowlist, nothing wildcarded except the rendered unit path, validated with visudo -c from a temp file before it lands so a bad render can never brick sudo. It covers start/stop/restart and enable/disable of this repo's units, daemon-reload, the writes switch-model.sh performs, one read-only forensics wrapper and kernel journal reads. ./uninstall.sh removes it along with the unit and the wrapper. If that surface is more than you want, do not install the cockpit: nothing else in this repo depends on it.

Self-restart is off by default (COCKPIT_AUTOHEAL=0 in the unit). This repo spends a whole section on how a GB10 box freezes, so an engine that restarts itself is not something an install should decide for you. Arm it once you know what a wedge looks like on your box:

sudo systemctl edit qwen38-dashboard    # [Service] Environment=COCKPIT_AUTOHEAL=1
                                        # and Environment=COCKPIT_AUTOHEAL_GRACE=600
                                        # to keep a wedge up for forensics first

Remove it with ./uninstall.sh (which takes the whole stack) or on its own:

sudo systemctl disable --now qwen38-dashboard
sudo rm -f /etc/systemd/system/qwen38-dashboard.service \
           /etc/sudoers.d/qwen38-cockpit /usr/local/bin/qwen38-pyspy-scheduler
sudo systemctl daemon-reload

The Decide view: the typed-decisions endpoint, from a browser

POST /v1/systemone answers probabilities instead of text, and until this view the only way to see one was curl. The view is the console for it, and it exercises the whole contract:

  • five prefilled examples, one per shape the endpoint is actually used for: routing a support ticket, choosing an agent's next tool, moderating a comment, extracting a field, and an eight-option choice, the likely cause of an engine crash (labelled A to H: the labels only turn to two letters past 26 options)
  • an editor for all three question types, with options and levels you can add and remove, so a question you are about to put in production can be tried before it is
  • the answer drawn as the distribution it is: a bar per option, the pick and its confidence, and for a score the level the number lands on
  • the headers the contract has no room for: how many branches the call fanned out to, how much of the model's first-token probability landed on a label, and how many tokens the radix cache served
  • the same call as a curl that updates as you type and copies in one click, because the point of the view is the request, not the view
  • the measured comparison against the hosted Jev, task by task, from BENCHMARKS.md

The serving key never reaches the page. The browser sends the state and the questions to the cockpit, and the cockpit calls the proxy with the key it already holds; a test asserts that a body naming its own path or upstream changes neither. Availability is probed rather than assumed, so a box whose proxy predates v6.19 is told why instead of looking broken.

Image is next to it: since v1.18.0 it drives Qwen-Image 2.1, the third lane, when that lane serves (generation, editing with up to ten references, native RGBA; see docs/image-lane.md). Video drives MiniMax-H3, the fourth lane, when that lane serves (text to video with joint video-and-audio, first/last-frame conditioning; see docs/video-lane.md).

Being told there is a newer version

A box that runs an old release does not know it. The answer existed from v1.6 in the Library view, printed after a button press, which means it reached whoever already suspected there was news. Since v1.15.2 the cockpit volunteers it: every six hours it asks GitHub whether a newer release is published, and if there is one the banner strip says so with the command that installs it. The Settings view carries the same line permanently, next to the repo's own version.

Two details decide whether this is useful or irritating. It compares version numbers, not strings, so v1.15.0 is correctly newer than v1.9.0, and it only speaks when the published version is strictly newer than the installed one, because a box that develops this repo is regularly ahead of the newest tag and would otherwise be nagged forever. The installed release is the one the checkout's own CHANGELOG.md names, not what its git tags say: the one-liner fetched main and no tag until v1.20.2, so a box it updated described itself as the release it was first cloned at and was told the release it ran was out. A box with no network says "latest release unknown" rather than raising an alarm, and stops asking for a while instead of spending a request every collection.

The same strip carries the other staleness a running cockpit can have: a git pull under a live process leaves it serving new HTML against the Python it imported at start, so its controls and its checks disagree. The banner names the files that changed and the one command that fixes it.

COCKPIT_UPDATE_CHECK=0 turns the outbound check off. SECURITY.md names it as the one request this stack makes that the operator did not type.

On a phone

The cockpit is built for a hand as well as for a desk, and that is checked with a finger rather than assumed. Below 980 px the rail is a drawer behind the menu button at the top left: a tap opens it, a tap on a view shows that view and closes it, and a tap beside it or Escape closes it. The head keeps what is serving and the engine actions, and the cards stack. On a phone the request log shows one card per request, outcome beside time, and the Library's wide tables stack into cards whose lines carry their column's name. Controls are at least 44x44 CSS px, every form control is 16 px or larger (iOS Safari zooms the whole page when a smaller one takes focus and never zooms back), heights use dvh, and the page keeps clear of what an iPhone reserves: the notch or island in landscape, the home indicator at the foot.

The cockpit on a phone, with the drawer open over the Now view: the rail's eleven views in three groups, Operate, Create and Maintain

The Agent view opens fullscreen on a phone, because there the view is the frame: opencode gets the whole screen, held to the safe area, and Back to the cockpit brings the rest back. That choice is remembered per device, so leaving fullscreen once makes the embedded frame the default from then on; embedded, the frame fills what is left under the view's buttons, or takes a screen and scrolls under the head when too little is. It never opens fullscreen when the panel cannot load (a relay bound to another address, a stopped server): covering the explanation with a blank frame would leave nothing to act on.

Two browser checks hold this. dashboard/tests/touch-check.mjs runs in CI against a cockpit of its own: real touch events on five touch screens (four iPhone sizes and an iPad) and a laptop, every rail item tapped where a finger lands, every control of every view audited for anything covering it, and the safe areas emulated. It exists because every earlier check switched views with click() from script, which ignores what covers an element: on a phone the drawer's veil covered every rail item while every check stayed green (found on the reference box's phone, 2026-09-30). dashboard/tests/mobile-check.mjs runs against a live box, taps the same way, and measures the layout on four iPhone geometries, the Agent view in both of its modes included. Run it against the address the phone uses, so the Agent view behaves the way it does in a hand:

node dashboard/tests/touch-check.mjs                                          # a cockpit of its own
node dashboard/tests/mobile-check.mjs http://<the box's tailnet address>:30090

The Agent view: opencode in the browser, behind the cockpit login

Since v1.7.0 the cockpit can hold opencode's own web interface, so a session on the box runs from the laptop without a terminal: sessions, the project picker, file diffs, the terminal panel, the same config, plugins, skills and MCP servers as the oc command. Since v1.12 install.sh installs it with the cockpit whenever opencode is on your PATH, and since v1.18.3 the installer puts the pinned opencode there when there is none (docs/opencode.md); when it still is not, the installer says so and skips that one view rather than failing an install that is otherwise up. Run it by hand after installing opencode, or to retune it:

dashboard/install-agent.sh

Two pieces land, and the shape is the security model:

  • opencode-web.service runs opencode serve as you on 127.0.0.1:4096 (OPENCODE_PORT=), with Basic credentials generated once into ~/.config/qwen38/opencode-web.env (mode 0600). Nothing else ever reaches it, and the password never leaves the box. The unit carries your PATH and the same output-token cap as the oc launcher, so long thinking is not cut at 32,000.
  • The relay inside the cockpit process listens on ONE address (port AGENT_PORT=30091). Installed without AGENT_BIND=, that is the tailnet address when the cockpit binds every interface or the tailnet, loopback when the cockpit is on loopback, and the cockpit's own address otherwise, so a cockpit bound to a LAN address puts the relay on the LAN too; AGENT_BIND= sets any other. It answers a request only with a valid cockpit session cookie, refuses any foreign Origin and shows opencode its own in place of the browser's (opencode gives its terminal only to a page of its own host or of loopback), strips the cookie before forwarding, adds the credentials, and streams everything back: plain answers, the event stream, the WebSocket of the terminal panel. Its responses carry frame-ancestors naming the cockpit, so no other page can frame the interface.

The browser therefore sees one host for the cockpit and the relay (cookies ignore ports): the Agent view frames the interface with no second login and no Basic-auth prompt, which Chrome would block inside a cross-origin frame anyway. That is also the one rule: open the cockpit through the address the relay binds. With the cockpit on 0.0.0.0 or on the tailnet address, that is http://<tailnet address>:30090/#agent; the view says so when you arrive by another name. A cockpit bound to 127.0.0.1 gets a loopback relay, usable on the box itself.

What the view shows: the state of the server and the relay, the served opencode version and, after opencode upgrade, that a newer binary is installed with a Restart server button (systemd restart, through the same exact-argv sudoers allowlist as the other units, three more lines). Fullscreen makes the interface cover the whole browser window; Back to the cockpit (drag it wherever it is least in the way) or Escape brings the cockpit back, and a reload comes back the way it was left. Prefer it to opening more browser tabs: every browser tab of the interface holds one permanent event stream, browsers allow six connections per origin, and a sixth tab freezes them all (the interface handles any number of sessions in one tab). Open in a new tab still exists for a second screen. The Logs view reads the server's journal.

Permissions are opencode's own. Its defaults (opencode 1.18) allow most tool calls and ask before a tool touches a path outside the session's project and when the same call repeats three times; the interface shows those prompts. For the autonomy of the oc launcher's --yolo (a flag opencode serve rejects), install with AGENT_AUTO=1: the unit then carries OPENCODE_PERMISSION set to allow everything, which opencode honours (verified: the served config reads {"*": "allow"}), explicit deny rules of your config still apply, and your opencode.json is not touched. The view says which mode the running server applies. Re-runs remember the choice; AGENT_AUTO=0 turns it back off.

AGENT_AUTO=1 dashboard/install-agent.sh

Variables: OPENCODE_PORT (4096), AGENT_PORT (30091), AGENT_BIND (an address, or tailscale), AGENT_AUTO (0 or 1), AGENT_OUTPUT_TOKEN_MAX (the output ceiling; by default ./oc-limits.sh --max-out, the largest limit any target asks for), AGENT_PATH (the PATH the service gets; yours by default, plus the directories of the installed one, less what an editor's session puts on its terminal's PATH, such as VS Code's remote CLI, since v1.22.7; an AGENT_PATH you set is taken as given on that run). A re-run of either script keeps what it finds installed unless a variable says otherwise: install-agent.sh both ports, the relay's address, AGENT_AUTO and the service's PATH (since v1.18.7; before, every ./install.sh put them back on the defaults), and dashboard/install-dashboard.sh the relay settings, the bind and the port. Remove with:

sudo systemctl disable --now opencode-web.service
sudo rm -f /etc/systemd/system/opencode-web.service
DASH_AGENT_PORT=0 dashboard/install-dashboard.sh       # the cockpit without the relay

Back to the README