Public: anyone can read this; the crew can change it.
On /infra a machine opens to its projects and containers, and a container opens to live logs, stats, restart and stop #18537
Merged 13m ago, goes live with the next release
This is a partial slice of #18487. A machine now opens by name on /infra, and a container's Restart and Stop post to /infra. Moving src/games into the general layer is not done, so don't close the issue on this pull.
-
Reviews
Changes requested — before the latest pushChanges needed, in one round:
- Box 1 is only half done. /infra/<machine> redirects to the tree node and lists containers, but the issue asks for compose projects too, and for a container page that streams logs AND stats. Group containers under their compose project, or split the issue so this pull's claim matches what it does. Show stats on the container page, or say plainly where they already are. The pull is a slice and says so; the issue should not be ticked on it.
- One way to do the thing: the same power action now has two routes, /games/<box>/<service>/power (still drawn by the games page) and /infra/container/<box>/<service>/<act>. Both call askPower, so it is not a security gap, but the pull does not say what retires the old one or why both stay. Name the plan in the pull, or have the games page post to the new route.
- Test gaps: nothing covers the Start act, a held box (refusesNow renders a disabled button), or GET /infra/<machine> for a machine the cloud has not been read for (it silently redirects to /infra). Add one test each.
- docs/features/infra.md: the Logs bullet is now one long run-on with a misplaced parenthetical '(that route is still served)'. Split it into plain sentences (docs/WRITING.md). Also state that Stop no longer sits under More.
Checked and fine: same-origin via readForm, operator check via mayOnGame before the write, back limited to /infra/-/ paths, act whitelisted, non-admins refused on GET /infra/<name>. No new dependency. Terminal side is covered by the existing s/x/r keys, so the No door line is accurate.
ApprovedSince 8f1f96ad: Stop now sits under More, backOf rejects
..segments, and the tests and docs match. Nothing high remains. Restart, Stop and Start are same-origin through readForm, gated by mayOnGame operator after the admin guard, and queued through askPower. The return address is limited to /infra/-/ and is escaped in the hidden input. A held box gets disabled buttons. Earlier asks are met.Non-blocking: backOf does not decode, so a
backof/infra/-/%2e%2e/%2e%2e/gamespasses the check and a browser would normalise it. It stays on the same origin and the person posted it themselves, so it is low severity. Decoding before the segment test would close it.Boxes: 1 is partly met. Compose projects are not listed and stats are not streamed on the container page. 2 is not met, because src/games has not moved and there is no grep test. 3 is met, because a Minecraft server is a container of its box and opens from the same page.
-
Checks
waiting merged; waiting for the forge to restart on it
-
History
- Container power: Stop sits under More, a back with .. is refused, Start, held and unread-machine are tested, the Logs bullet is plain sentences e22b137
- No look: /infra is not a page of app.looks, and the pane is admin-only and needs a synced machine to draw 8f1f96a
- Rewrap long comment lines 8ddba97
- Try: as an admin open /infra/<a machine's name>, then a container in its table, and press Restart or Stop under its Logs tab 36c2b3c
- A machine opens by name on /infra, and a container's Restart and Stop post to /infra b337a15
- Opening an invite link signs the person in, proves the account and applies the bundle, in every sign-up mode including closed (#18520) f42bd09
- forge.json declares jobs: steps, needs (macos, xcode, docker), on (pull, land) and secrets, read and validated at the boundary (#18512) 85e7b4f
- Lending speaks the versioned agent protocol, and each machine's page shows when it last used the old sync route (#18521) 7db7ea2
- A pull that changes an MCP tool's schema runs mcp-size.test.ts in its fast check (#18529) 9b4b38b
- may() is the only permission check: every remaining helper beside it is deleted, and a test fails if one returns (#18498) ad5d09a
- A test fails a new terminal screen for a thing that already has a web page, and today's screens are the only ones allowed (#18527) a068c28
- No new terminal screen for a thing that has a web page: a rule test lists today's screens and the list can only shrink (#18519) 8a9f7de
- Automate a review finding as a lint or test: Small: `src/http/git_access.ts` ends with a stray blank line. (#18511) 6b5946b
- Neutral public names, step 1 of 2 (expand): the new name beside the old for the game_* tables, the games MCP tool, connection.kind and the game and design: minecraft plan options (#18513) 6368d15
- The runners page is live: connected, busy, the run it holds, its log and last seen, updated as they change (#18497) 24da6e3
- A rule test fails any page whose form answers with a full page, and the list of today's pages can only shrink (#18495) c10b305
- A new account's home offers three things it can do, each one click away, and an empty page says what goes there and how (#18496) bf74994
- An invite carries a bundle: the owner picks Use, Host or Build, each with a line saying what it allows (#18473) d231856
- A machine agent that does not check in after its update goes back to the version before, and the forge says so (#18483) 49c1b5a
- A machine stays trustworthy under load: power cycle, live status, a memory check, a patient healer (#18472) a7825b4
5 earlier comments
This is a partial slice of #18487. A machine now opens by name on /infra, and a container's Restart and Stop post to /infra. Moving src/games into the general layer is not done, so don't close the issue on this pull.
I ran tsc, the gate (its comment-width rule passes), test/cloud-containers.test.ts and the budget, route-mark, doorless and dup-import tests. One test failed in a combined run of about 56 files, and I could not tell which, because I had piped the output to tail. Rerunning the same files in smaller groups gave 0 failures. The forge's full check will settle it.
What changed
GET /infra/<machine>: it redirects to the machine's place in the resource tree, where its containers are listed as a table. An unknown machine gives 404, and a non-admin is refused.POST /infra/container/<box>/<container>/<restart|stop|start>:- It requires the same origin through
readForm. mayOnGame(…, "operator")decides who may use it.- It queues the command with the same
askPowerthat/games/<box>/<service>/poweruses. - It returns to the container page. The
backfield only accepts paths under/infra/-/, so it can't send anyone elsewhere. - The old
/games/.../powerroute is untouched and still served.
- It requires the same origin through
- Container page buttons: the container's Logs tab used to carry the games-page power menu. It now shows Restart (Start when not running) and Stop, posting to the new route. The buttons are in
src/web/pages/container_power.ts, andcontainerConsoleinsrc/web/pages/games.tstakes thebackaddress. - Registration: the two routes are listed in
src/http/lazy_lists.ts. - Docs and tests:
docs/features/infra.mdis updated.test/cloud-containers.test.tsgains tests for the machine redirect and for the power route: cross-origin refused, a badbackignored, an act it doesn't take returns 404, and a non-operator is refused. - Terminal door: the commit says
No door:. The terminal already starts, stops and restarts a container withs,xandrin the games screen, and thegamesMCP tool'spowerdoes the same.
What I chose not to do
- No move out of
src/games. The container list and logs still read the game tables throughcontainerConsole. - No grep test. The
test/kind-boundary.test.tsthe issue refers to isn't in the repo. #18456 closed as "split" after pull #18482 failed its check three times, so the grep test can't pass yet. Moving the games code would be a separate series of pulls. - No compose-project grouping. Nothing in the tree models compose projects yet, so
/infra/<machine>lists containers only. - Minecraft: a Minecraft server opens from the same page, because it is a container of its game box. I added nothing specific to it.
Try it: as an admin, open /infra/<a machine's name>, open a container in its table, go to the Logs tab and press Restart or Stop. The page then shows "asked" and the command is queued for the box.
Reused: askPower, mayOnGame, mainPower, refusesNow, readForm, flashTo, cloudHref, resourcesOf and logReader.
<!-- look-pages 36c2b3c58982 --> Look pages for 36c2b3c, from the gate:
look pages (none): this pull changes src/web/pages/container_power.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
I pushed a commit that adds the three lines the gate asked for: Direction: … (#18487), Replaces: nothing, … and Looks: /infra. I did not rerun the gate after the push, so I haven't seen it pass. The forge's check on #18537 will say.
I also ran bun scripts/gate.ts --fix first, which rewrapped the long comment lines in src/http/infra_routes.ts, src/web/pages/games.ts and test/cloud-containers.test.ts. The gate printed the two naming rules as failing during that run, because the new message wasn't committed yet.
This is still a partial slice of #18487, as the earlier pull description said: a machine opens by name on /infra, and a container's Restart and Stop post to /infra. The move of src/games into the general layer and the grep test (test/kind-boundary.test.ts, which doesn't exist) are not done. Compose-project grouping is not done either.
I pushed a commit with the line No look: /infra is not a page of app.looks, and the pane is admin-only and needs a synced machine to draw. After it, the local gate run reports only the long-comment-lines note, which says no action is needed.
The look-pages comment was written for 36c2b3c, before my last two commits. I had added Looks: /infra, but the gate rejected it because /infra isn't listed in app.looks in forge.json. A page I changed can't be looked at there: the container pane is admin-only and needs a synced machine to draw, so the No look: line is the accurate answer. I did not add /infra to app.looks.
The note about comment lines over 100 columns is still there. bun scripts/gate.ts --fix did not clear it, and the gate says the nightly rewrap handles those files on main.
I didn't rerun the tests this turn, since only commit messages changed.
This pull is a slice of #18487 and shouldn't tick it. A machine now opens by name to its containers, and a container's Restart, Start and Stop post to /infra. Compose projects and a stats stream on the container page are not done.
What changed this round
- Stop moved. Stop now sits under More on the container page, as it does on the games page. Restart (Start while the container is not running) stays as the main button.
backis stricter.backOfinsrc/web/pages/container_power.tsrejects any return path with a..segment and falls back to/infra.- New tests.
test/cloud-containers.test.tsnow covers:- Start on a stopped container.
- A held box, where the start button is disabled.
- A
backof/infra/-/../x, which falls back to/infra. GET /infra/<machine>for a machine the cloud has not been read for, which redirects to/infra.- Stop appearing after More in the markup.
- Docs. The Logs bullet in
docs/features/infra.mdis split into plain sentences. It now says that Stop sits under More, where the games page's route fits, and that stats are on the Facts tab. The machine-by-name behaviour has its own bullet.
What I chose not to do
- Compose projects. Containers are not grouped under their compose project yet. That needs its own issue, to be linked as a child of #18487.
- Stats. The container's CPU, memory and uptime are on its Facts tab. They are not streamed on the Logs tab.
- The old games route.
/games/<box>/<service>/powerstays. The games page draws it and returns to the games page, while/infra/container/<box>/<service>/<act>returns to the container. Both callaskPower, so the checks are the same. Retiring the old route would mean moving the games page onto the new one, which I left out of this slice.
Checks run
bun test test/cloud-containers.test.ts: 20 pass, 0 fail.bun x tsc --noEmitandbun scripts/design-lint.tsare clean.scripts/gate.ts --fixrewrapped comments, which I committed.- It still lists three files with long comment lines (
src/http/infra_routes.ts,src/web/pages/games.ts,test/cloud-containers.test.ts) and says the nightly rewrap handles them. - I did not run the first-view budget or duplicate-import tests. This change adds no imports.
To try it: as an admin, open /infra/<machine name>, then a container, then its Logs tab. Restart is there, and Stop is under More.
No door: the terminal already has s, x and r for these acts, and the page only moves Stop under More.
This is a partial slice of #18487. A machine now opens by name on
/infra, and a container's Restart and Stop post to/infra. Movingsrc/gamesinto the general layer is not done, so don't close the issue on this pull.I ran
tsc, the gate (its comment-width rule passes),test/cloud-containers.test.tsand the budget, route-mark, doorless and dup-import tests. One test failed in a combined run of about 56 files, and I could not tell which, because I had piped the output totail. Rerunning the same files in smaller groups gave 0 failures. The forge's full check will settle it.What changed
GET /infra/<machine>: it redirects to the machine's place in the resource tree, where its containers are listed as a table. An unknown machine gives 404, and a non-admin is refused.POST /infra/container/<box>/<container>/<restart|stop|start>:readForm.mayOnGame(…, "operator")decides who may use it.askPowerthat/games/<box>/<service>/poweruses.backfield only accepts paths under/infra/-/, so it can't send anyone elsewhere./games/.../powerroute is untouched and still served.src/web/pages/container_power.ts, andcontainerConsoleinsrc/web/pages/games.tstakes thebackaddress.src/http/lazy_lists.ts.docs/features/infra.mdis updated.test/cloud-containers.test.tsgains tests for the machine redirect and for the power route: cross-origin refused, a badbackignored, an act it doesn't take returns 404, and a non-operator is refused.No door:. The terminal already starts, stops and restarts a container withs,xandrin the games screen, and thegamesMCP tool'spowerdoes the same.What I chose not to do
src/games. The container list and logs still read the game tables throughcontainerConsole.test/kind-boundary.test.tsthe issue refers to isn't in the repo. #18456 closed as "split" after pull #18482 failed its check three times, so the grep test can't pass yet. Moving the games code would be a separate series of pulls./infra/<machine>lists containers only.Try it: as an admin, open
/infra/<a machine's name>, open a container in its table, go to the Logs tab and press Restart or Stop. The page then shows "asked" and the command is queued for the box.Reused:
askPower,mayOnGame,mainPower,refusesNow,readForm,flashTo,cloudHref,resourcesOfandlogReader.Closes #18487