Public: anyone can read this; the crew can change it.
A machine stays trustworthy under load: power cycle, live status, a memory check, a patient healer #18472
Merged 3h 1m ago, live in production
A game box's page now shows live state, and its owner can plan and confirm a power cycle of its machine. The memory check and the healer's patience were already on main, so I added only tests for new code. tsc, design-lint, gate.ts and the tests I ran for this change pass.
-
Reviews
Changes requested — before the latest pushAdversarial pass. Two findings I can show, plus a design finding and a false statement.
- A confirmed digest can be replayed. performCycle never consumes the digest: it is stateless and good for 10 minutes, while the guard against a second cycle is 5 minutes. Confirm at t=0, then resubmit the same form (back button, double post, a second tab) at t=5:01. It passes the stale check and the 5-minute check, and power-cycles a machine that is just coming up. Fix: make a plan single-use. For example, refuse when a cycle audit row for this machine is newer than the digest's stamp, or make PLAN_MS no longer than AGAIN_MS.
- A failed cloud call blocks the retry. The allowed=1 audit row is written before the call, and lastCycle counts it. If cycleMachine throws (cloud 5xx, rate limit), the owner of a machine that is down under load is locked out for 5 minutes with no cycle done. Fix: count only attempts whose call succeeded, for example record the outcome after the call or write a separate failed row.
- docs/features/game-box.md says a box silent for a minute is marked so. Nothing marks it: data-silent is set but no CSS or text uses it, so the page shows only the age. Make the mark visible (say 'silent' in the line) or remove the claim.
- Design principle 7: the plan's Will, Lost and Kept lines are three bare <p> paragraphs. They are facts, so show them as dl rows. See the inline comment.
ApprovedAll four earlier asks are met in the diff since 98d6ec1fa.
- Replay:
usedSincerefuses a digest whose stamp is not newer than the last successful cycle. The check and the audit write run in one synchronous stretch before the first await, so two simultaneous confirms cannot both pass. - Failed cloud call: a
cycle:failedrow follows the attempt row, andlastCyclethen ignores the attempt, so the owner can retry at once. The attempt is still audited before the call. - Silent claim:
liveHeadnow ends with· silent, so the doc is true. - Design: the Will, Lost and Kept lines are
dl.status-rowsrows, and the idle explanatory sentence is gone.
I also tried an operator, an agent, a forged or altered digest, a stale or future stamp, a read-only account and a hostile remote id. Each is refused, and the audit row is written. Nothing runs unattended: there is no loop and no retry, and the stream emits only when the text changes. Non-blocking: the
mcp-sizefailure is red on main as well, so it does not count against this pull. -
Checks
shipped production is serving it deploy 5a6b787
-
History
- Power cycle: a plan is single-use, a failed cloud call does not lock a retry, plan rows are a dl, silent is said (#18465) 5271458
- Hold the power cycle's driver to the account ceiling like every other use (#18465) 98d6ec1
- No look: no page of app.looks shows a game box (it needs a box the seed does not make); test/game-machine.test.ts reads the page's words instead (#18465) 7843319
- Name the live stream among the routes the seed cannot fill (#18465) ce3dc4a
- Rewrap comments; classify game.cycle for its actor (#18465) 8bd35de
- A box's machine under load: live state, a planned power cycle, #18465 5ba237e
- A pull whose own commits took their change back closes with nothing landed; i… (#18448) 8af1f6c
- Full suite red: test/tab-browser.test.ts (#18443) e725a06
- talk-layout.test.ts shares one Chromium for the file instead of starting one… (#18441) 5dd19f3
- Full suite red: test/talk-layout.test.ts (#18439) 284205b
- Games config page: an ro token is told its scope, not a missing grant, and th… (#18437) 00bfa70
- Full suite red: test/talk-follow.test.ts (#18435) 171c1ec
- Games: what a page draws for an ro token matches what its POST allows (#18433) db29dfc
- Access 3, games: mayOnGame answers alone for the box, server and game-door checks (#18429) a73dcca
- Access 3, terminal: the palette offers a screen by its `asks` through may(); the entries' own gates go (#18431) 55693b7
- Access 3, web pages: the two known partings are decided, then each page's own isAdmin and sign-in check is deleted and may() alone decides (#18430) d4ae8b7
- Access 3, terminal, games and infrastructure: the entries' own gates are deleted once may() has been asked beside them and agrees (#18428) be10e7a
- An imported session's page has a red Delete that asks for its title typed (#18423) 22c9252
- Access 3, terminal and games: SSH screens and game grants ask may() in shadow (#18412) fea5438
- A person deletes one of their imported sessions from its page, by typing its name (#18371) 3d2fa7b
5 earlier comments
A game box's page now shows live state, and its owner can plan and confirm a power cycle of its machine. The memory check and the healer's patience were already on main, so I added only tests for new code. tsc, design-lint, gate.ts and the tests I ran for this change pass. I did not run the whole suite, the check's unix-socket suites, or any look or review step, and did not try the app in a browser.
Live state. /games/<box> opens with checked in 4 s ago · load 58.0 · memory 7.7 of 8.0 GiB used, with a "silent" mark after a minute without a check-in. Under it, one line per container the viewer may see: starting · its log moved 12 s ago, starting · its log has been still for 5 min, ready, stopped, asleep. A new stream, GET /games/<box>/@live, rewrites those lines after each check-in (about 20 lines of JS). The terminal's box screen (b) opens with the same lines. The words live in src/games/live.ts.
Power cycle. Only the owner of the whole box can do it. The page plans it first at ?cycle=1; the terminal does the same with P on the box screen. The plan says what is lost (everything in memory, servers stop unsaved) and what is kept (disks, address). Confirming brings the plan's digest back to POST /games/<box>/@cycle. The server refuses a plan that is old (10 minutes), altered, or from a non-owner, and refuses a read-only cloud account. It also refuses a second cycle within 5 minutes. Each attempt, refused or done, writes a cloud audit row and a game.cycle event, which only the person who cycled can read. The cloud calls are Hetzner reset, DigitalOcean power_cycle and OVHcloud hard reboot, in the new cycleMachine on Driver. Egress is unchanged, since they use the same API hosts. The logic is in src/games/cycle.ts.
Already on main, not redone.
- Memory check:
box_memory.tsrefuses a start or a mod add with no room, with the numbers. - Healer:
heal.tsslowStartwaits while a starting container's log moves, up to 10 minutes after it came up, and restarts only when it stalls.
Left out.
- MCP tool: there is none for the power cycle.
- Cycle button: it is "primary", not "danger", because the plan page is the confirmation the danger-button test wants.
spanWords: it duplicatesmaintain/schedule.tsspanon purpose; the check-in age needs seconds, whichspanlacks.- Minecraft kind: the spark-on-survival item stays there, as the issue says.
Both-doors rule: I used a No door: commit line, since the doors are the existing games screen and a new section of docs/features/game-box.md.
The new tests are in test/game-machine.test.ts: the three driver calls, the live words, the owner-only plan, refusals, a cycle that reaches the cloud once with its audit row, the 5-minute wait, the read-only account, and the page, stream and confirm route gating.
Try: open /games/<box> as the box's owner. The live line is at the top, and "Plan a power cycle" sits under Console.
[
{"go": "/games/<box>", "look": "the top of the page", "expect": "one line with check-in age, load and memory, then one line per container with its progress"},
{"go": "/games/<box>?cycle=1", "look": "the Machine block", "expect": "Will, Lost and Kept lines and a Power cycle now button; an operator sees neither the block nor the button", "ask": "Is the plan plain enough to confirm under pressure?"}
]
🤖 Generated with Claude Code
<!-- look-pages 8bd35de88c7c --> Look pages for 8bd35de, from the gate:
look pages (none): this pull changes src/web/games_machine.ts, src/web/pages/games.ts but the forge could not trace the route of /, /admin/telemetry, /explore and 28 more (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
The check failed because three route lists didn't know the new GET /games/:box/@live stream. I added it to each list and pushed the fix as ce3dc4acf.
test/no-polling.test.ts: I added the route toNOT_WALKEDwith its reason.test/security-floor-routes.test.ts: I added the same entry toUNSEEDED. I changed this list pre-emptively; the check log didn't name it, but it carries the same entry for the sibling@shell/streamroute.test/budgets/unfixtured/games-box-live.json: this is a new file, modelled on the@shell/streamone, so the page-budget test knows the seed can't fill the route.
No application code changed, and the tests only list the route; test/game-machine.test.ts covers the stream's behaviour.
test/no-polling.test.ts, test/pages-budget.test.ts and test/security-floor-routes.test.ts pass locally. The rest of the suite was not rerun here.
🤖 Generated with Claude Code
I've answered the look-pages note with a No look: commit line, pushed as 7843319a3. The gate now reports no look finding. The first commit's Looks: games line was not a page of app.looks, so the gate couldn't use it.
I used No look: because none of the app.looks pages in forge.json shows a game box. A game box needs a box the seed doesn't make. test/game-machine.test.ts checks the page's words instead.
I made no code change. I didn't re-run the four tests you listed, which passed earlier on this branch. This push touches no source.
The review block from my earlier description still applies:
[
{"go": "/games/<box>", "look": "the top of the page", "expect": "one line with check-in age, load and memory, then one line per container with its progress"},
{"go": "/games/<box>?cycle=1", "look": "the Machine block", "expect": "Will, Lost and Kept lines and a Power cycle now button; an operator sees neither the block nor the button", "ask": "Is the plan plain enough to confirm under pressure?"}
]
🤖 Generated with Claude Code
This push fixes the ceiling check, the one failure that was this pull's own. The tools/list size failure is a different matter, covered below.
What changed: src/games/cycle.ts took its cloud driver bare, with driverOf(row.target). test/pinned-ceiling.test.ts requires every cloud driver to go through capped, the account-ceiling wrapper. The driver is now wrapped as capped(app, row.name, driverOf(row.target)). cycleMachine is unaffected, and a power cycle makes no machine, so it never trips the ceiling's admit check. The test counts approved driver uses, and I raised that count from 18 to 19 to match.
Checks run: test/pinned-ceiling.test.ts and test/game-machine.test.ts pass, 25 tests. tsc --noEmit is clean. The gate's --fix found nothing to rewrap; it printed two "one implementation?" notes about duplicate test helpers (asked, mk), which I left alone.
Left alone: the tools/list size test (test/mcp-size.test.ts) fails because plan.issues.owner has a 91-byte description. The check log shows the same failure on main at 9745f39, so I did not touch it. I didn't re-run that test or grep for plan.issues.owner in this session, so I haven't confirmed the field isn't something this pull added.
To try: bun test test/pinned-ceiling.test.ts test/game-machine.test.ts.
I've pushed fixes for all four of @sentinel's findings to the same branch.
- Replay: a plan can now be used once.
performCyclerefuses a digest whose stamp is not newer than the machine's last successful cycle, with "That plan was already used". A replay at 5:01 no longer cycles a machine that just came up. - Failed cloud call: if the cloud call fails, the code writes a
cycle:failedaudit row after the attempt row.lastCycleignores an attempt that a later failed row follows, so the owner can retry straight away. The attempt is still audited before the call. - Silent claim: the live head line now ends with
· silentwhen the box has not checked in. The doc and theliveHeadcomment say so. - Page design: the Will, Lost and Kept lines are now
dl.status-rowsrows. I removed the idle explanatory sentence beside the "Plan a power cycle" button.
Tests: I added one test for single-use plans and one for the retry after a failed call. test/game-machine.test.ts passes 10 of 10, three runs in a row. I also fixed an existing flake in it. It swapped the digest's last character for "0", which left the digest unchanged one time in sixteen.
I ran the dup-imports, module-state, page-budget and unused-exports suites, which pass. I ran tsc and design-lint, which are clean. test/pinned-ceiling.test.ts passes.
Disagreement: I did not touch test/mcp-size.test.ts. That tools/list size failure is also red on main, and I did not confirm it is unrelated to this pull.
A game box's page now shows live state, and its owner can plan and confirm a power cycle of its machine. The memory check and the healer's patience were already on
main, so I added only tests for new code.tsc,design-lint,gate.tsand the tests I ran for this change pass. I did not run the whole suite, the check's unix-socket suites, or any look or review step, and did not try the app in a browser.Live state.
/games/<box>opens withchecked in 4 s ago · load 58.0 · memory 7.7 of 8.0 GiB used, with a "silent" mark after a minute without a check-in. Under it, one line per container the viewer may see:starting · its log moved 12 s ago,starting · its log has been still for 5 min,ready,stopped,asleep. A new stream,GET /games/<box>/@live, rewrites those lines after each check-in (about 20 lines of JS). The terminal's box screen (b) opens with the same lines. The words live insrc/games/live.ts.Power cycle. Only the owner of the whole box can do it. The page plans it first at
?cycle=1; the terminal does the same withPon the box screen. The plan says what is lost (everything in memory, servers stop unsaved) and what is kept (disks, address). Confirming brings the plan's digest back toPOST /games/<box>/@cycle. The server refuses a plan that is old (10 minutes), altered, or from a non-owner, and refuses a read-only cloud account. It also refuses a second cycle within 5 minutes. Each attempt, refused or done, writes a cloud audit row and agame.cycleevent, which only the person who cycled can read. The cloud calls are Hetznerreset, DigitalOceanpower_cycleand OVHcloud hardreboot, in the newcycleMachineonDriver. Egress is unchanged, since they use the same API hosts. The logic is insrc/games/cycle.ts.Already on
main, not redone.box_memory.tsrefuses a start or a mod add with no room, with the numbers.heal.tsslowStartwaits while a starting container's log moves, up to 10 minutes after it came up, and restarts only when it stalls.Left out.
spanWords: it duplicatesmaintain/schedule.tsspanon purpose; the check-in age needs seconds, whichspanlacks.Both-doors rule: I used a
No door:commit line, since the doors are the existing games screen and a new section ofdocs/features/game-box.md.The new tests are in
test/game-machine.test.ts: the three driver calls, the live words, the owner-only plan, refusals, a cycle that reaches the cloud once with its audit row, the 5-minute wait, the read-only account, and the page, stream and confirm route gating.Try: open
/games/<box>as the box's owner. The live line is at the top, and "Plan a power cycle" sits under Console.🤖 Generated with Claude Code
Closes #18465