Public: anyone can read this; the crew can change it.
Stop and Delete a cloud machine or volume from the cost row, each confirmed only by typing its name #18187
Merged 15h 58m ago, live in production
A machine or volume on a write-allowed DigitalOcean or Hetzner account now has Stop and Delete on its cost row, and nothing runs until the person types its name, for Stop as for Delete.
-
Reviews
Changes requested — before the latest pushThe name-typed Stop works on the server, the web confirm and the terminal prompt, and it is tested. But the issue asked for more than this head does. Fix first: put Stop and Delete on
/infra's costliest table rows (box 1). The builder's own note says they are only on a resource's page. Also still missing: the MCPapplywith no name (box 2) is neither covered nor changed, and either the tool needs the same typed-name check and a test or the issue must be narrowed by a person; plans do not expire after 30 minutes (box 1), so state that decision or add the expiry as a stamp inside the digest instead of a new store; and the pull description must end with areviewblock for the page change. Also check thatcloud.endis written for refused attempts too, or say that only completed calls get an event.Changes requested — before the latest pushName-typed Stop, the 30-minute stamp, the cost-row links and the refusal events work and are tested. Three things to fix in this round.
Fix first: the MCP half of box 2 is not met. The issue asks for a test of the MCP tool's
applywith no name. The pull says no such tool exists. Either add the tool as a thin caller ofperformEndwith that test, or have a person narrow the issue. Do not leave the box silently open.Also: (1)
row-endsis a new component class with no CSS and no entry indocs/design/areas/, so the Stop · Delete pair is unstyled and undocumented. (2) The expiry stamp is client-supplied and the hash is unkeyed, so anyone can mint a fresh digest. That is harmless for the typed-name gate, but say so, or HMAC the digest with a server secret. (3) The read-only refusal is written at confirm time, not plan time, and no test shows an audit row for a read-only plan. See the line comments.ApprovedEvery earlier ask is met on this head. The MCP
cloud_endtool refuses apply without the typed name and is tested. A read-only plan is audited at plan time, once. The digest is an HMAC keyed with the per-boot secret and carries the stamp, and a test shows a re-minted unkeyed stamp is refused..row-endsis documented indocs/design/areas/infra.mdand styled with tokens only. Stop and Delete are plain links on the cost table, so they work without JavaScript. The how-to is indocs/features/cloud-end.md, not the README.Non-blocking:
infraend(from main) andcloud_endare now two MCP ways to stop or delete one resource, and they differ in whether the forge's own agent can apply (held for a yes versus never). Fold one into the other in a follow-up.Non-blocking: the digest is compared with
!==. It is keyed and the typed name is the real gate, so this is not exploitable, but a constant-time compare would be tidier. -
Checks
shipped production is serving it deploy f698c54
-
History
- Rewrap a comment the gate flagged (#18182) 38ffcbd
- Merge main: keep infra's end beside cloud_end, both to the name-typed stop and the stamped digest 8f7b6f1
- Ask before cloud_end's apply, as infra's apply asks; list it among the MCP tools (#18182) 230b018
- Spend 3: the same cost reads and planned stop/delete as MCP tools and a terminal screen (#18206) c30e6bb
- Games: host the spark profiler viewer and its uploads in the forge (#18096) beabbda
- Games: a day after a mod set is installed, the games page says whether it helped, with take-back one tap away (#18201) 2243020
- Hold cloud_end's apply as the destroying call in the delete-tier roster (#18182) c64f978
- Audit a read-only plan as the admin who asked, typed as the rest (#18182) bd8eb33
- Name the unaudited plan for what it is; rewrap comments the gate flagged (#18182) 96d49b5
- Stop and Delete through MCP's cloud_end, a read-only plan audited when planned, the plan stamp keyed, row-ends styled and documented (#18182) 4b7d60d
- Read each account's write flag once per /infra page, not per row (#18182) 7d634ce
- Games: installing the quality set ships Essential Commands' config with only /home, /spawn and /tpa on (#18199) 7b84b2c
- Stop and Delete on /infra's costliest rows; a plan expires after 30 minutes inside its digest; cloud.end for refused attempts too (#18182) 0678778
- Connections on an account: verified identities the person controls, each with its own uses, and a lookup that answers only on opt-in (#18120) 314f4eb
- A granted app's two-page print comes out as one sheet, printed on both sides (#18194) e2e7eb4
- Merge the pull's head; keep the cloud.end event on its Stop and Delete 7eba3cb
- Traces 5c: the trace list and one trace read through MCP tools and a terminal screen compare (#18183) cc38920
- Merge main: keep its Stop and Delete, hold a Stop to the name typed too, record cloud.end ac2110d
- Access 5a: a visitor principal is minted only when a visitor creates something, signed, with a role in may() and per-visitor limits (#18174) e261ee9
- Rewrap a comment the gate flagged (#18182) bf6f9b3
8 earlier comments
A machine or volume on a write-allowed DigitalOcean or Hetzner account now has Stop and Delete on its cost row, and nothing runs until the person types its name, for Stop as for Delete. The nine tests in test/spend-end.test.ts, the gate (0 failing), tsc, bun scripts/design-lint.ts and a spot-check of the rules named in the issue (including mcp-size and unused-exports) pass. I did not run the whole suite.
What changed
- Branch: the #18067 branch was not on the forge, so I wrote this fresh from main. The budget half was never carried over.
- Plan:
src/actions/spend_end.tsbuilds the plan. It says what is deleted, what it costs now with its source and read time, what is lost and what keeps billing. It lives in a newcloud_end_plantable for 30 minutes and runs once. It does not touch the cloud. - Name check:
confirmEndrefuses unlesstyped === plan.confirmWord. A refused attempt reaches no vendor and leaves the plan open. - Refusals: a read-only account is refused at plan time with an audit row. Each end writes the gated fetch's audit row and a
cloud.endevent. Calls go throughwithCloud,driverOfandgone. - Page: forms for Stop and Delete sit on the
/infracostliest table rows and on a resource's own pane, posting to/infra/end/planand/infra/end/confirm. The confirm page shows the name field and the danger button for both actions. I added one allow-list entry intest/danger-buttons.test.tsfor that button, because it is behind a plan and a typed name rather thanconfirmAction. - Terminal:
X(stop) andD(delete) on a row incloudtree.tsopen the plan, then a prompt for the name. What is typed is passed on as typed;plan.confirmWordis never passed. - MCP:
infraplanwithwant: {end, action}returns a plan id, andapplytakesnames: ["<name>"]. It adds no new tool and no schema property, andmcp-sizeis unchanged. - Docs: a section in
docs/features/infra.md.
Choices to check
- Stop vs Delete: Stop deletes the machine and its own disk; attached volumes stay and the plan says they keep billing. Delete also deletes the attached volumes after the machine. A volume that is attached to something is refused.
- Pinned forges: a machine or volume that a pinned forge's row owns is not offered; that is End on its page.
- Bad dependent volume: if a dependent volume will not detach within the wait, the answer lists it as left behind.
- Terminal keys:
Swas already the sort key, so Stop isX.
Left out
- Other clouds (AWS, Cloudflare, Azure, OVH) and Hetzner/DigitalOcean resource kinds other than machine and volume.
- Waiting on the vendor to confirm a machine is gone.
Reused: withCloud, caller, gone, driverOf, recordAudit, confirmScreen and promptScreen. The gate noted endForms against fileTab and keys against cloud-tree.test.ts's press as near-duplicates; I left both.
Try it: with a write-allowed DigitalOcean or Hetzner account, open /infra, press Stop beside a machine, read the plan, then type a wrong name, then the right one. In the terminal, open Cloud resources, move to a machine, and press X.
[
{"go": "/infra", "look": "A machine on a write-allowed DigitalOcean or Hetzner account, in the costliest table", "expect": "Stop and Delete buttons beside its name; a volume has only Delete; read-only and AWS rows have none"},
{"go": "/infra", "look": "Press Stop on a machine", "expect": "A plan page lists what is deleted, the cost with its source and read time, what is lost, what keeps billing, and the expiry; no vendor call has happened"},
{"go": "/infra", "look": "On the plan, submit the name field empty, then with a wrong name", "expect": "The plan page returns with a refusal; nothing is deleted. The field and the red button are there for Stop as for Delete", "ask": "Is the confirm wording clear enough for a Stop that deletes a disk?"},
{"go": "/infra", "look": "Open a machine's own page", "expect": "Stop and Delete beside Ask about this"}
]
🤖 Generated with Claude Code
Admins can now stop or delete a cloud machine or volume from its cost row, and each action needs the resource's name typed first. This push fixes the failing check, which came from the new cloud.end event having no audience classification.
src/actions/spend_end.ts records a cloud.end event for each stop or delete, and src/core/event_audience.ts didn't classify that kind. The event names the owner's cloud account, so I classified it for admins only, alongside the other cloud spend and configuration events. I did not add a reader-visible variant.
test/event-audience-coverage.test.ts passes locally (5 tests), and bun x tsc --noEmit is clean. I did not rerun the full suite, so the forge's check on this push is the next confirmation.
bun scripts/gate.ts --fix changed nothing. It reported only advisory notes about long comments in other files and similar-looking helpers in the new tests, so I left those alone.
To try it, open the cloud cost tree as an admin and use Stop or Delete on a machine or volume row. A non-admin should not see the buttons, and the action refuses a mistyped name.
The pushed commit carries No door: an audience classification, no page, action, route or tool changes.
Stop and Delete for a cloud machine or volume are done. Each is held to the resource's name typed first, and only admins can plan or confirm one. This push fixes one of the two failures in the last check; the other I could not reproduce.
- Fixed (account-purge test):
cloud_end_plan.user_idnamed a user without a cascade, so deleting an account would have left plan rows behind. It now hasREFERENCES user(id) ON DELETE CASCADE. The migration isn't on main yet, so I edited it in place and regenerated its pin. - Not fixed (survival performance test in
test/game-mods.test.ts): this failure is unrelated to the change, which touches nothing under game mods. It passes alone (36 of 36) and failed in the check after waiting 20 s for text on screen, which looks like a timeout under a loaded runner. If it fails again on the next check, it needs a look separately. - Checks run here:
test/account-purge.test.tsandtest/spend-end.test.tspass (24 tests), andbun x tsc --noEmitis clean. I did not run the full suite, so the forge's check on this push is the next confirmation. - Left out:
cloud.endstays admin-only in the event audience, with no reader-visible variant. - To try it: open the cloud cost tree as an admin and use Stop or Delete on a machine or volume row. A non-admin sees no buttons, and a mistyped name runs nothing.
This pull now takes main's Stop and Delete (#18170) and adds one thing: a Stop also asks for the resource's name typed back. The merge conflicts are gone.
Main had already landed its own Stop and Delete in src/actions/cloud_end.ts, and the old version of this branch conflicted with it. The merge commit takes main's tree outright and drops this branch's spend_end.ts version. Main's version had Stop as a single confirm, with only Delete asking for the name, which is what this issue changes.
- Server:
performEndnow refuses a missing or wrong name for Stop as well as Delete. A refused Stop reaches no vendor call. - Web: the plan page shows the name field and the danger button for Stop too.
- Terminal:
src/tui/screens/cloud_end.tsalways asks for the name, for Stop as well as Delete. It passes only what was typed. - Docs:
docs/features/cloud-end.mdsays both ask for the name. - Tests: the Stop test in
test/cloud-end.test.tsnow covers Stop with no name, Stop with a wrong name, and Stop with the right one. A page test checks that Stop's form has the name field. I did not run the full suite. - Checks:
test/cloud-end.test.ts(11 pass),tsc --noEmit,design-lintandgate.tsare clean.
Not done:
- MCP tool: main has no MCP tool for ending a resource, so the issue's "MCP
applywith no name" test has no tool to test. - Cloud audit: I did not look at whether main's
cloud.endevent handling covers what the issue lists, so the earliercloud.endcommits on this branch are not carried over. - Plan lifetime: plans don't expire after 30 minutes. Main's plans are stateless and carry a digest of what the cloud was last read as, so there's no process-wide plan store.
To try: as an admin, open a machine under /infra, press Stop…, and the confirm needs the machine's name. In the terminal's Cloud resources screen, x plans a stop and X a delete.
[{"go":"/infra","look":"open a machine on a write-allowed DigitalOcean or Hetzner account and press Stop…","expect":"the plan page has a 'Type <name> to stop it' field and a danger Stop button; submitting it empty or with a wrong name is refused and nothing stops"},{"go":"/infra","look":"press Delete… on a volume","expect":"the same name field, 'Type <name> to delete it'"}]
🤖 Generated with Claude Code
The branch now merges with main and is pushed. The change is smaller than before: it adds the name-typed Stop and a cloud.end event on top of main's Stop and Delete (#18170).
Main had landed its own plan-and-confirm Stop and Delete while this branch built a parallel one. The remote branch also already carried a resolution that took main's version and made Stop ask for the name. I merged that in and kept the one thing it lacked.
- What changed:
- Name typed for Stop: a Stop needs the resource's name typed back, as a Delete does, because it deletes the machine's own disk. This holds on the server (
src/actions/cloud_end.ts), on the web confirm page and in the terminal prompt. The web page shows the name field and a danger button for both. cloud.endevent: each Stop or Delete writes acloud.endevent, classified admin-only insrc/core/event_audience.ts.
- Name typed for Stop: a Stop needs the resource's name typed back, as a Delete does, because it deletes the machine's own disk. This holds on the server (
- Tests: a Stop with no name or the wrong name is refused and nothing reaches the vendor; with the right name it runs and writes one
cloud.endevent. The cloud-end, audience-coverage and account-purge tests pass (82),tscis clean and the gate is clean. I did not run the full suite, so the forge's check on this push is the next confirmation. - Dropped: my parallel implementation, the
cloud_end_plantable and its migration, andtest/spend-end.test.ts. Main's plan is stateless and carries a digest instead. Theaccount-purgecascade fix from earlier went with that table. - Not done: the issue also asked for Stop and Delete on
/infra's costliest table. Main offers them only on a resource's own page, and I did not add them to the table. The MCP tool'sapplywas also not changed or tested for the missing-name case. - To try it: as an admin, open a machine under
/infraon a write-allowed account and press Stop…. The confirm asks for the machine's name, and a wrong name is refused. In the terminal,xandXon a resource ask the same.
This pull adds Stop and Delete to /infra's costliest table, adds a 30-minute plan expiry, and writes a cloud.end event for refused attempts too. It does not touch the MCP apply, for the reason below. bun x tsc --noEmit, design-lint and the cloud-end and cloud-tree tests pass. I did not run the full suite. The /infra row links were not tried against the running preview.
What changed
- Cost rows: each row on the costliest table now has a "Stop · Delete" pair beside its name. Each link opens the same name-typed plan as the resource page, and nothing runs from the table. Rows on read-only accounts, unsupported clouds or non-machine/volume kinds get no links. The write flag is read once per account per page, so the 2,000-resource query-count test still holds.
- Expiry: the plan's digest is now
<time shown>.<hash>, with the time inside the hash. A confirm after 30 minutes, or with a digest the forge didn't issue, is refused before the typed name is checked and before any vendor call. No new store. - Events for refusals:
cloud.endis now written for every attempt. That covers a read-only or unsupported account, a stale or changed plan, and a missing or wrong name. A refused one carriesok: falseand arefusedreason, and each also writes its audit row. Tests check this and the expiry. - Docs:
docs/features/cloud-end.mdis updated.
Not done
- MCP
apply: there is no MCP tool that stops or deletes a cloud resource on this head. Theinfratool'sapplyonly builds a plan the forge showed, andperformEnd, which holds the typed-name check, is reached only by the web route and the terminal. I did not invent a tool just to put a check on it. If an MCP end is wanted, it should be a separate change that callsperformEnd. The check and its refusal-event path would then apply to it without change. - Terminal: unchanged.
xandXon a selected cost row already plan and ask for the typed name. - Gate note: it says
costliestTableresemblesworkSectioninorg.ts(0.63 similarity). It is a note, not a failure, and I left the two separate.
I could not name the dead-code and module-state tests from your list on the touched modules. This change adds no new export and no module-level Map, Set or array that a function writes to. The per-request map is local to a closure.
[
{"go": "/infra", "look": "Beside each machine or volume name in the table, on a write-allowed DigitalOcean or Hetzner account: 'Stop · Delete' (volumes: Delete only)", "expect": "Links present; none on read-only accounts or on rows that are not machines or volumes"},
{"go": "/infra, then press Stop on a machine row", "look": "The plan: Will, Cost now, Lost, Kept, a field 'Type <name> to stop it', a danger button", "expect": "Submitting with no name or a wrong name shows the refusal and nothing stops"},
{"go": "The same plan page, left open for over 30 minutes, then submit the right name", "look": "The flash message", "expect": "'That plan is more than 30 minutes old…: review the plan again.' and nothing reaches the cloud"}
]
🤖 Generated with Claude Code
On /infra's costliest table, a machine or volume on a write-allowed account gets Stop · Delete beside its name. Each link opens a plan, and nothing runs until the resource's name is typed back, for a Stop as well as a Delete. This round fixes the four review findings.
- MCP tool (box 2): a new
cloud_endtool insrc/http/mcp/tools/cloud_end.ts. It is a thin caller ofplanEndandperformEnd:planwith anact(stop or delete) and anid(asinfra listgives it) returns the plan and itsdigest.applyneeds thatdigestand thenametyped back.applyneeds an admin-scope token. It is markedtier: "delete", so the forge's own agent can never apply one, and it is added totest/delete-tier.test.ts.- A new test plans through MCP, then shows that
applywith no name, with a wrong name, or with a read-only token is refused and nothing reaches the vendor.
- Read-only refused at plan time (box 5):
planEndnow writes the refused audit row and a refusedcloud.endevent as soon as a read-only account's plan is asked for.performEndreads the plan through an internal step that writes nothing, so a confirm does not write the plan-time row a second time. A new test asks for a read-only plan and checks that exactly one audit row and one refused event are written, with no vendor call. - Plan expiry: the digest is now an HMAC keyed with the forge's per-boot secret (
app.hookSecret). A client can no longer mint a fresh time stamp for an old plan, and a restart expires every plan shown before it. A new test recomputes the old unkeyed sha256 over a fresh stamp and is refused; it would pass the check without the key.docs/features/cloud-end.mdsays the typed name is still the real gate. row-ends: styled insrc/web/style/components.tswith tokens only: muted text,--accenton the links only. Where a mouse can hover, the pair stays transparent until its row is hovered or holds keyboard focus. On touch it always shows, and the links stay in the tab order and work without JavaScript. Because only opacity changes, the row never moves. The class is documented in the newdocs/design/areas/infra.md.
The how-to docs/features/cloud-end.md now names the MCP door and the plan-time refusal.
Left out: planEnd audits only the read-only refusal at plan time. Other plan-time refusals (an attached volume, a pinned forge's own machine) are audited only when someone tries to confirm them, so opening a plan page doesn't fill the audit log.
Checks run: bun x tsc --noEmit passes, bun scripts/design-lint.ts passes, and bun scripts/gate.ts --explain has 0 failing rules (2 notes). test/delete-tier.test.ts failed until cloud_end was added to its roster, as above. bun scripts/fast.ts named 2,872 test files, too many to run here, so I ran the 21 suites closest to this change and all pass. They include test/cloud-end.test.ts (16), cloud-tree, delete-tier, the mcp- and llms-tools suites, design-, both-doors, unused-exports and module-state.
To try it: on the preview, open /infra as an admin and hover a costly machine's row. Stop opens the plan with the name field and the danger button. Over MCP:
cloud_end {action:"plan", act:"stop", id:"<id from infra list>"}- then
cloud_end {action:"apply", act:"stop", id:…, digest:…}with noname. It is refused with "Type <name> to stop it".
[
{"go": "/infra", "look": "a machine's row in the costliest table, hovered then tabbed to", "expect": "Stop · Delete appears muted beside the name with accent links; the row does not shift"},
{"go": "/infra/end/stop/<cloud>/<account>/<project>/<machine id>", "look": "the plan", "expect": "Will, Cost now, Lost and Kept rows, a name field and a danger Stop button"},
{"go": "/settings/cloud/audit", "look": "after opening a plan on a read-only account", "expect": "a refused row whose plan starts with the read-only refusal", "ask": "Is auditing at plan time noisy enough to matter?"}
]
🤖 Generated with Claude Code
Stop and Delete for a cloud machine or volume (#18182), now merged with current main. A stop also asks for the resource's name typed back, because it deletes the machine's own disk. A plan can be confirmed for 30 minutes: its digest carries the time it was shown, keyed with the forge's per-boot secret. Every attempt is audited and records a cloud.end event, whether it was refused or done. The costliest table on /infra gets a Stop · Delete pair on each row. Over MCP, the cloud_end tool does the same: plan reads, apply acts.
What fixed the red check:
cloud_endasks first: it is now on the list of tools that ask first (crew/conversation_confirm.ts), asking onapplythe wayinfra's apply does. It also has its sentence increw/conversation_ask.ts, though its apply is in the delete tier and a chat is refused it before anything is asked. It is now in the MCP tool list intest/mcp-forge-protocol.test.ts.- Merge with
main: theapps-feedbackfailure was a test that exists only onmain. Merging brought in #18206, which addedinfraend, a second MCP way to stop or delete. It ran into this pull's rules in two places:- It cut the digest at 32 characters; it now takes 80.
- It applied a stop without the name typed; it now asks for
want.typedon a stop as on a delete, and its plan returnsname. Its doc string anddocs/features/cloud-end.mdsay so.
Test changed on purpose: test/mcp-cloud-cost.test.ts expected the old 16-hex digest and a stop without a typed name. It was right for main's rules, which this pull changes, so it now expects the stamped digest and a refused untyped stop.
Left as is:
cloud_endandinfraendare two MCP ways to do the same thing. Folding one into the other is a separate decision.- From the forge's own agent,
infraend's stop is still held for the person's yes, as onmain.cloud_end's apply is never run from a chat at all.
Checks: the gate and bun x tsc --noEmit pass. The 9 test files covering this change pass (148 tests), and the 41 cloud, infra and MCP tool files pass apart from one: cloud-inventory's redirect test failed once when run alongside the others, then passed on its own here and on main. It is not changed here. The fast script named 2,930 files because of the merge, so I didn't run the whole list; the forge's check runs the full suite.
To try it: on the preview, open /infra and pick Stop… on a costliest row; the plan asks for the name typed back. Over MCP: infra {action:"end", id, want:{act:"stop"}}, then the same call with want.digest and want.typed.
🤖 Generated with Claude Code
Left #18182 open: 1 unticked item remain (On /infra's costliest table and on a resource's own page, a machine or volume on a write-allowed DigitalOcean or Hetzner account has Stop and Delete. Pressing either one shows a plan (src/actions/spend_end.ts). The plan says what is deleted, what it costs now with its source and read time, what is lost, and what keeps billing. It expires after 30 minutes.).
A machine or volume on a write-allowed DigitalOcean or Hetzner account now has Stop and Delete on its cost row, and nothing runs until the person types its name, for Stop as for Delete. The nine tests in
test/spend-end.test.ts, the gate (0 failing),tsc,bun scripts/design-lint.tsand a spot-check of the rules named in the issue (includingmcp-sizeandunused-exports) pass. I did not run the whole suite.What changed
src/actions/spend_end.tsbuilds the plan. It says what is deleted, what it costs now with its source and read time, what is lost and what keeps billing. It lives in a newcloud_end_plantable for 30 minutes and runs once. It does not touch the cloud.confirmEndrefuses unlesstyped === plan.confirmWord. A refused attempt reaches no vendor and leaves the plan open.cloud.endevent. Calls go throughwithCloud,driverOfandgone./infracostliest table rows and on a resource's own pane, posting to/infra/end/planand/infra/end/confirm. The confirm page shows the name field and the danger button for both actions. I added one allow-list entry intest/danger-buttons.test.tsfor that button, because it is behind a plan and a typed name rather thanconfirmAction.X(stop) andD(delete) on a row incloudtree.tsopen the plan, then a prompt for the name. What is typed is passed on as typed;plan.confirmWordis never passed.infraplanwithwant: {end, action}returns a plan id, andapplytakesnames: ["<name>"]. It adds no new tool and no schema property, andmcp-sizeis unchanged.docs/features/infra.md.Choices to check
Swas already the sort key, so Stop isX.Left out
Reused:
withCloud,caller,gone,driverOf,recordAudit,confirmScreenandpromptScreen. The gate notedendFormsagainstfileTabandkeysagainstcloud-tree.test.ts'spressas near-duplicates; I left both.Try it: with a write-allowed DigitalOcean or Hetzner account, open
/infra, press Stop beside a machine, read the plan, then type a wrong name, then the right one. In the terminal, open Cloud resources, move to a machine, and pressX.🤖 Generated with Claude Code
Closes #18182