In production at RetroSpeedLab¶
RetroSpeedLab is a game studio run by AI agents: they build original 8-bit games, speedrun them live and run the website, the stream and the data platform around them. Its maintainer agent keeps the two servers behind all that healthy, and ops-gate is the only way it reaches them.
The challenge¶
Both servers, Main and the Home Lab, a GPU server that also runs the lakehouse, deploy their apps with Dokku. Disks fill with build cache and old images, a container hangs, a Kafka topic goes missing. The maintainer should fix that at night without waiting for the owner, but a root shell would let one bad prompt delete a database. RetroSpeedLab needed the agent to do the routine repairs alone and the risky ones only with the owner's say, on each server separately.
What the gate allows¶
| Class | Verbs | Limit per server |
|---|---|---|
| Read | disk, docker-usage, containers, gate-table, app-status, app-logs, journal |
60 an hour |
| Repair | prune-builder, prune-images, prune-containers, restart, kafka-topics |
3 an hour |
| Needs approval | retire, vacuum-journal, restart-guarded |
6 an hour |
restart refuses the maintainer itself, Bugsink and the databases; Bugsink and the databases go through restart-guarded, which needs approval. The pruning verbs refuse ages under a day (three days for images), so the agent cannot wipe the cache a running build needs. The whole table is examples/retrospeedlab/verbs.toml.
How it is wired¶
- The agent's side. The maintainer runs in a container with an SSH key and an SSH config for
mainandhome-lab, logging in asmaintainer-ops. Its servers skill tells it which verb answers which alert. - Run approvals. The maintainer, repo-steward 0.2.0, proposes an approval verb to the backend, and the owner sees it as a card with Approve and Deny in the steward's web console. Approve opens the backend's own decision page, which signs the owner in with Discord, checks the user id and signs that exact command for that server with
sign_run, valid for 14 minutes; the steward fetches the signature and sends the command once. Deny means the backend never signs it. The steward never holds the key, so it cannot approve its own commands. - Table changes. A new verb is a pull request to the suite's
deploy/ops/verbs.toml. Once it is merged, the owner approves an "enable" card for that commit through the same decision page. The backend checks that the commit is onmain, fetches the table at that commit and signs it withsign_tablefor every host in itshosts. A timer on each server runsops-gate updateevery two minutes and installs it. - Install. A setup script installs ops-gate from PyPI into a root-owned virtual environment on both servers, writes the table, host name, public key and approvals URL to
/etc/ops-gate, installs the generated sudoers rules aftervisudoaccepts them, and forcesops-gate serveon the maintainer's key.
See it live¶
The code that drives the gate is open source in the RetroSpeedLab suite: the backend's signing in src/retrospeedlab/backend/maintainer/ops.py, the table and the setup in deploy/ops/. The maintainer itself runs on repo-steward.