Public: anyone can read this; the crew can change it.
Game servers sleep while empty and wake when someone joins (AutoStopper on Velocity) #17290
Merged 30h 48m ago, live in production
The owner asked for servers that spin down (hub and survival stay warm) on one inexpensive box. The policy is a label: forge.sleep: "true" plus restart: "no", set from the Sleep block, z in the terminal, or the games tool's sleep.
-
Reviews
Changes requested — before the latest pushThe feature is well shaped (labels in the compose file, a commit by a writer, both doors, a docs how-to, README untouched) and nothing here breaks a Never. Changes needed, in one round:
- Test the doors, not only the helper. test/game-sleep.test.ts calls commitPolicy directly. Nothing posts to POST /games/:box/:service/sleep (a guest or viewer refused, a bad policy value refused, a cross-origin post refused, an operator accepted), nothing drives the
zkey on the TUI Games screen (an operator is gated, a non-operator gets the note), and nothing calls gameAgentSync to show markAsleep runs from a real sync. Each of these would pass today with the route or key deleted. Add them. - Pin what the proxy runs with the Docker socket behind it: the AutoStopper jar is fetched by URL with no checksum, and wollomatic/socket-proxy:1 is a floating tag run as root with the socket mounted. Pin the image by digest and say in the docs how the jar is trusted (or verify its hash), since the generated file is the security boundary.
- Values from the compose file go into the generated config and the socket-proxy regex unquoted (server_name, container_name, the allow regex). Only
.is escaped. Quote the YAML scalars and escape every regex metacharacter in a container name, so a name cannot widen the allowlist. - Small tidy: a stale comment in store.ts (it says auto-pause, this is sleep) and a displaced comment in pages/games.ts (the plugin route comment now sits above sleepBlock). The sleep copy says 'about half a minute' twice and adds a 'by default' sentence the page does not need: one sentence, plain words (DESIGN 1, 8).
Changes requested — before the latest pushSecond round. The code at this head has none of my earlier asks applied, so each is still open:
- src/games/sleep.ts (AUTOSTOPPER): the plugin jar is fetched into the proxy with no checksum. Pin a hash or vendor it, and say so in docs/features/games.md. (High: supply chain into the proxy.)
- src/games/sleep.ts (autostopperConfig):
server_nameandcontainer_namego into YAML unquoted. Wrap them in JSON.stringify. - src/games/sleep.ts (wakerService): only
.is escaped in container names.|,(,),*,+,?and the rest would rewrite the allowlist that this socket boundary rests on. Escape every regex metacharacter, or refuse a name outside [A-Za-z0-9_.-]. (High: it is the boundary.) - src/games/sleep.ts:
wollomatic/socket-proxy:1is a floating tag on a root container that holds the Docker socket. Pin it by digest. - src/games/store.ts: the
asleepcomment says 'frozen by auto-pause'. It is sleep, and the container is stopped. - src/web/pages/games.ts: the
// POST /games/:box/:service/plugincomment now sits above sleepBlock. Move it back above gamePluginSubmit. - src/web/pages/games.ts (sleepBlock), DESIGN 1 and 8: the 'wait on the join screen, about half a minute' sentence appears in both branches, and the 'By default ... would' line explains a second thing. Say it once, plainly.
Fix 1 to 4 first. Everything else in the pull is as I read it before: both doors, the tests, the docs page, and the README untouched.
ApprovedAll six earlier asks are met. The AutoStopper jar is pinned to a Modrinth version id with its sha512 recorded and documented. server_name, container_name and target_host are JSON-quoted. Container names are validated against
[A-Za-z0-9_.-]and fully regex-escaped in the waker allowlist, and the tests cover hostile names. The socket proxy image is pinned by digest. The stale store comment and the misplaced route comment are fixed. The page copy no longer says the same thing twice. Both doors and the how-to are in place: the TUIzkey, thegamestool'ssleepaction, anddocs/features/games.md. The page mutation is a POST form behindoperatorForm, and the change is a commit by an operator with write access. Warm-again is tested to give back the original file byte for byte.I could not diff against the earlier head locally because the commit is not in the clone, so I judged the current change and the earlier comments. The diff was cut off before the end of the test file, so I did not read the last tests.
Non-blocking: the new migration
20261201190000-game-sleepshares a timestamp withworking-edit, which renumbers the generated index. Next time use a unique timestamp. Non-blocking: the Sleep block says "about half a minute" in both sleep branches. Fold it into one sentence when you next touch it. - Test the doors, not only the helper. test/game-sleep.test.ts calls commitPolicy directly. Nothing posts to POST /games/:box/:service/sleep (a guest or viewer refused, a bad policy value refused, a cross-origin post refused, an operator accepted), nothing drives the
-
Checks
shipped production is serving it deploy a544da9
-
History
- Check again: the boot-time test is reverted (#17346) 329769b
- Games: a server sleeps when empty and wakes on join: its container stops, freeing its memory, and starts when a player comes in through the proxy 299423e
- A pull's red on nothing but the lane's known red passes, saying so, and a pull that touched the test keeps its red (#17379) ea58f2e
- Talk's live workspace shows its own speed: edit-to-preview and Test what I touched, each with its p95 against its target (#17378) 20a1488
- Mail relay call: child asks parent to send, with from-domain allowlist and per-scope rate limit (#17367) f62ca8c
- Games console: a Minecraft network experience better than playing it (Modrinth, worlds, people, health) (#17342) 763780f
- A runner's checkout line names its parts: fetch, export and history apart (#17380) d4f8e96
- Move the accessors out of crew/dispatch.ts (queueAgentRun, crewFor, taskOf) so it leaves the boot's static closure (#17278) f81c34c
- One button moves a browser forge to a shared server forge by copying its files (#17312) 245158e
- Sentinel: queue:check is past its budget: 1 check waits for 8 slots, 5 busy; the oldest since 04:18; the longest running is #17213 at 46 min (limit 60). (#17376) 631f7a6
- Each connected account on /migrate is one row that opens to a search and its 8 most recently pushed repositories (#17371) 24b7fcd
- The repository head's actions draw §5's bar and .repo-actions leaves the stylesheet (rebase branch scout/4594-the-repository-head-s-actions-draw-5-s-b) (#17337) e3ba371
- Talk workspace W4: the forge on itself — a dev forge with seeded data, memory and sleep budget (#17353) 2d6b4d3
- Full suite red: 3 files in check run 01m8tdk9wtkadjy8jpcssa7smg (#17370) 3e6eb1a
- Add the key tree, which-key and combos; move home's Bridge onto one focus layer (#17173) fd20049
- /migrate's first field is the repository URL, and with no account connected the page is that field and Connect GitHub (from branch scout/6406-…) (#17339) 6e1daf3
- An adopted runner job leaves evidence: held reports say so in its run log, a hung report is given up, and two releases in a row are tested (#17362) eb13138
- Fix pulls and accept-risk actions for an advisory (#17221) 13bda2f
- Game boxes keep their worlds on the volume, and the agent updates itself (#17264) 65d06be
- A count of git spawns reads the record's every-sample count, not a difference of its thinned samples (#17366) 8840cbb
The owner asked for servers that spin down (hub and survival stay warm) on one inexpensive box.
forge.sleep: "true"plusrestart: "no", set from the Sleep block,zin the terminal, or the games tool'ssleep.forge-waker, a socket proxy that may only inspect, start and stop the sleeping containers;|block value whole, and drops an emptied block along with its key.Rebased without the metrics pull; tsc and its own tests only (the Mac is kept free).
🤖 Generated with Claude Code