Public: anyone can read this; the crew can change it.

See and manage everything on any cloud: provider ▸ account ▸ project ▸ resources, the cloud's own view, a console that always works #17253

opened this in answer to

Merged 29h ago, live in production

This pull delivers V2 of #17151 for DigitalOcean and Hetzner only: the cloud's own view of each machine, read from the provider's API when someone opens it, so it works with the agent dead. Nothing else in the issue is done here.

Notes

opened this

This pull delivers V2 of #17151 for DigitalOcean and Hetzner only: the cloud's own view of each machine, read from the provider's API when someone opens it, so it works with the agent dead. Nothing else in the issue is done here.

What changed

  • What it shows: power state, size, image, region, public and private IP, created time, attached volume ids, and the provider's recent actions, newest first and capped at 8 (e.g. power_on · completed · 2026-12-01 17:44). Fields the provider returns malformed are dropped, not guessed.
  • Reads: DigitalOcean reads the droplet and its actions. Hetzner reads the server and its actions. The read is admin-only and opens the account's token for a read, never a write.
  • Doors:
    • Page: GET /infra/:name/cloud, reached from an "At the cloud" button on each machine row on /infra.
    • Terminal: v on a machine row in the infra screen.
    • MCP: infra with action: "cloud" and id: <machine name>. This is a new action on the existing tool, not a new tool.
    • How-to: a section in docs/features/infra.md.
  • Reused: withCloud for the token and gated fetch, and the Driver pattern (viewMachine sits beside readMachine).
  • Tests: test/machine-view.test.ts covers the two parsers and bounds, both drivers' calls, the action (admin only, unknown forge), the page (escaped, anonymous refused), the tool, and the v key. It passes, along with tsc, design-lint, the infra page tests, test/route-marks.test.ts and test/mcp-size.test.ts. The gate has no failing rules after the last commit; the commit lines carry No door, No look and Try for the gate. I did not run the full suite.

Left out

  • Volume mount state: neither API reports it, so volumes show as "attached" with their ids.
  • Refresh on a schedule while something is in flight: the view is read each time it is opened, with no cache.
  • Hetzner's view is covered by a driver test with a fake call, not an end-to-end test; DigitalOcean has the end-to-end one.
  • V3 (the provider ▸ account ▸ project tree, placement, and moves as plan steps) and V4 (the agent shell, provider consoles, and a time-limited SSH step). V1 is already in flight elsewhere.
  • OVH has no view yet. Its machine says "not read here yet".
  • No forge.json egress change: the calls go to the provider hosts that the existing cloud code already uses.

Try it Open /infra as an admin and press "At the cloud" on a machine. Or press v in the terminal infra screen. Or call the infra tool with {action: "cloud", id: "<machine name>"}.

Closes #17151

Show 6 earlier items

7 earlier comments
commented

This adds a read-only cloud action that shows what a provider says about a machine: power state, size, IPs and recent actions. It's in the web /infra page, the terminal infra screen and the MCP infra tool, and the docs/features/infra.md how-to covers it. This push fixes the check failure on the cloud action's addition to the Talk list.

What failed and what I did

  • Talk list ceiling: adding cloud to the infra tool's action enum brought the Talk tool list to exactly 18,500 bytes, and the test fails at or above that. I shortened the tool's description from "Cloud machines and spend." to "Cloud machines, spend." It now passes, with only a couple of bytes to spare. I did not raise the ceiling.
  • "sweeping a checkout hands the loop back" (checks-home-sweep): it passed when I ran the file alone. One earlier local run of the three failing files did show it failing, so it looks timing-sensitive under load. I changed nothing for it.
  • "the last ten follows, newest first" (fork-follow-history): it passed locally, so I changed nothing for it.

If either of those two fails again on the next check, it needs its own look.

What I ran: mcp-talk-tools, machine-view and pinned-ceiling all pass, tsc is clean, and I ran gate --fix. The gate printed two notes and asked for nothing: seven files have comment lines over 100 columns (the nightly rewrap handles them on main), and it asks whether viewOf and read in src/cloud/machine.ts are one implementation. I left that second one alone.

To try it: open /infra as an admin and look at a machine, or call the MCP infra tool with {action: "cloud", id: "<machine name>"}.

Not done: the cloud view is read-only, so there are no power or resize controls.

🤖 Generated with Claude Code

commented

I merged main into this branch, resolved the two conflicts and pushed. bun x tsc --noEmit is clean. I ran about 94 tests across the files this change touches and they pass. I did not run the full suite; the forge's check runs that on the push.

  • docs/features/infra.md: I kept both sections. The Minecraft and Projects sections from main stay, followed by this pull's "What the cloud says of a machine".
  • src/http/mcp/tools/infra.ts: the doc now carries main's Minecraft design wording and this pull's cloud action. I kept the short description, which is now "Machines, spend.".
  • Route fix: main now registers routes from a boot-time list in src/http/lazy_lists.ts. GET /infra/:name/cloud wasn't in it, so the machine page answered 405. I added it, and machine-view.test.ts passes again.
  • Talk list ceiling: the merge pushed the Talk tool list one byte over its 18,500-byte ceiling. The shorter description above brings it back under, and mcp-talk-tools.test.ts passes.

The gate (bun scripts/gate.ts --fix) changed nothing. It flagged viewOf and read in src/cloud/machine.ts as possibly duplicate, which I left alone.

I did not touch the web page, so there is no new review block.

commented

Every point in the review is addressed on the branch (9501705fe). tsc is clean. The 50 tests I ran in these files pass: machine-view, pinned-ceiling, unused-exports, the Talk list ceiling, cloud-doors, lazy-first-use and llms-budget. I did not run the full suite; the forge's check does that on push.

What changed

  • viewer() is gone. machineView now calls viewOf(driverOf(…)). The ceiling test whitelists viewOf, a real read-only call, in place of viewer. The count stays at 16 because main added a call site.
  • Typed refusals. machineView returns {reason, message}, where reason is one of denied, missing, retired, no_machine, unread or refused. The page returns 404 for missing and 422 for the rest, with no string matching. The page, the infra tool and the terminal all read .message.
  • One guard in src/cloud/machine.ts. viewOf and read both go through a single onMachine check of the machine id. viewOf returns undefined when a cloud has no view yet, which becomes the "not read here yet" answer.
  • New tests in test/machine-view.test.ts:
    • a retired forge, with a 422 on the page;
    • a forge with no machine;
    • a cloud with no viewMachine, with a 422 on the page;
    • an unknown forge, with a 404;
    • a provider answer with <script>alert(1)</script> as an action name, which the page escapes;
    • a non-admin refused on both the page and the tool.
  • Talk description. It stays "Machines, spend." to fit the Talk list's 18,500-byte ceiling. That is the trade, and it cost clarity in a one-line description. The full wording is still in the tool's doc.
  • Earlier fix, carried over. GET /infra/:name/cloud is registered in src/http/lazy_lists.ts, so the machine page no longer answers 405.

Disagreement. Item 5 is only partly resolved. The gate may still flag viewOf and read as similar, because the shared guard is the part they have in common and their bodies differ.

Left out: writes of any kind; the cloud view stays read-only and admin-only.

How to try it: open /infra as an admin and use "At the cloud" on a machine row, or press v on the row in the terminal. In the MCP, call infra with {action: "cloud", id: "<name>"}.

[
  {"go": "/infra", "look": "a machine row that exists at its provider", "expect": "an \"At the cloud\" button beside it, and a Projects section listing each project with its resources and monthly cost"},
  {"go": "/infra/<machine>/cloud", "look": "the facts list and the recent provider actions", "expect": "power, size, image, region, public and private IP, volumes, and actions such as \"power_on · completed · 2026-12-01 17:44\"; provider text appears escaped"},
  {"go": "/infra/nope/cloud", "look": "the status and message", "expect": "404 for a name no forge has; 422 with a sentence for a retired forge, one with no machine, or a cloud whose view is not read yet"}
]
commented

I merged main into the branch, resolved the three conflicts, and pushed (46d15c992).

In every conflict I kept both sides:

  • docs/features/infra.md: both sections stay: "What the cloud says of a machine" and "Provider console (Hetzner)".
  • src/http/infra_routes.ts: the imports now bring in both cloudPage (this pull) and consolePage (from main).
  • src/tui/screens/infra.ts: v still opens "At the cloud" and o still asks for the Hetzner console.

I ran the infra, machine-view, console, lazy-boot, doors and MCP tests, and all 108 pass. I did not run the whole suite: scripts/fast.ts named 2,848 files, about 233 minutes, so I picked the covering tests myself.

tsc --noEmit reports one error, in src/web/tabforge/opfs.ts: it can't find the @sqlite.org/sqlite-wasm types. I didn't touch that file or investigate whether the error was already there.

I started scripts/gate.ts --fix but killed it with the test run before it reported, so the gate hasn't run on this merge. The forge's check on this push will run it.

commented

Merged main into the branch and pushed. The type check is clean, and the five test files that cover this feature pass (55 tests). I didn't run the full suite; the forge runs the check on the push.

The conflict. main had landed #17156 ("Cloud says"), which independently added src/cloud/provider_view.ts. The file has a different job there: a cached one-line "what your provider says" for each machine, used by the web page, terminal, MCP and games. Our branch's file of the same name was the full detail view: power, size, image, region, addresses, volumes and the last actions.

Resolution.

  • main's src/cloud/provider_view.ts is kept as is, along with actions/cloud_says.ts and their tests.
  • Our pure parsing and wording module moved to src/cloud/provider_detail.ts, and its imports now point there: actions/machine_view.ts, the web and terminal infra pages, droplet.ts, hetzner.ts, machine.ts and test/machine-view.test.ts.
  • The two features now sit side by side. The machine row carries main's one-line fact, and the detail view carries ours.

Noticed.

  • The merge commit also holds the rewrap that gate.ts --fix made to long comments in 19 files.
  • The gate still flags fromDigitalOcean and fromHetzner in main's provider_view.ts as 0.57 similar ("one implementation?"). That code came from main, and I left it.
commented

Every machine in /infra now has a page for what its cloud provider's API says of it (GET /infra/:name/cloud), read when you open it. The terminal and the infra tool show the same view. A refusal comes back typed: 404 for a machine that isn't there, 422 for one the forge can't ask about.

The last red check was the "the diff is the change" gate rule. An earlier gate.ts --fix had rewrapped comments this pull didn't write, in 13 files such as test/game-volume.test.ts, src/games/sleep.ts, src/apps/dev_hot.ts and src/actions/cloud_says.ts. I restored all of those to main's text. The diff is now 13 files, all cloud-view work.

bun scripts/gate.ts --explain reads 0 failing and 1 note, a comment-width note on 7 files that the nightly rewrap fixes on main. bun x tsc --noEmit printed nothing, and 65 tests across test/machine-view.test.ts, pinned-ceiling, cloud-says-doors and hollow pass. I also ran doorless and feature-doors. I didn't run the whole suite. The dead-code test was not run by name: I couldn't find a file called that, so I ran the nearby ones.

To try it: on /infra, open a machine's "at its cloud" page. In the terminal, select a machine on the infra screen and press v. The infra tool exposes the same view. The how-to is in docs/features/infra.md.

Left out: managing resources from the provider's console, and anything above a single machine (account, project, listing every resource). Those need their own issues.

commented

Still red on current main: pinned forge address > only a well-formed public IPv4 is taken. Fix it and push.

commented

The pinned-forge-address failure was caused by this branch, and I fixed it and pushed; I couldn't reproduce the migrate failure.

Cause: my refactor of src/cloud/machine.ts turned read from an async function into a plain one that calls the shared onMachine guard. A malformed machine id therefore made read throw synchronously instead of rejecting. The test "only a well-formed public IPv4 is taken" expects a rejection. read and viewOf are async again, so both reject on a bad id.

Checked: bun x tsc --noEmit is clean, and test/pinned-forge-address.test.ts and test/tui-migrate.test.ts pass locally (22 tests).

Not reproduced: the "migrate from the terminal" test passes here. It failed in the check after 20 seconds, which looks like a timeout on a loaded runner, and nothing on this branch touches migration. The forge's check on this push will show whether it fails again.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs