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

Spend 3: the same cost reads and planned stop/delete as MCP tools and a terminal screen #18206

opened this

Merged 12h 39m ago, live in production

The infra MCP tool now reads the cost table and plans or does a stop or delete, and a terminal screen shows the same table. I ran tsc, the new test, the MCP and confirm tests, and the palette and door tests. I did not run the full suite, so the forge's check is the first full run.

Notes

opened this

The infra MCP tool now reads the cost table and plans or does a stop or delete, and a terminal screen shows the same table. I ran tsc, the new test, the MCP and confirm tests, and the palette and door tests. I did not run the full suite, so the forge's check is the first full run. The test/mcp-size.test.ts run passed.

What changed

  • cost: a new action on infra (no new tool) returns each cloud account against its ceiling and budget, plus the ten resources that cost most. Each resource carries the id that cloud and end take. The words come from src/actions/cloud_cost.ts, which the terminal screen also reads. A read-only account with no budget still appears, as "no budget set".
  • end: an id plus want: {act: stop|delete} returns the plan and its digest and calls no cloud. The same call with want.digest (and want.typed for a delete) does it, through the existing performEnd. That keeps the read-only refusal, stale-digest refusal, typed-name check and audit row. Only that second call is held for the owner's yes when the forge's own agent makes it (ASKING.infra in conversation_confirm.ts, plus a sentence in conversation_ask.ts).
  • Terminal: the "What the clouds cost" palette entry (src/tui/screens/cloudcost.ts) shows the account lines and the costliest resources. It is read-only and admin-only.
  • Docs and generated files: docs/features/cloud-end.md has the MCP and terminal lines, and src/generated/screens.ts is regenerated.
  • Tests: test/mcp-cloud-cost.test.ts runs against the stand-in vendor and covers all of this.
    • cost shows the budget and the costliest resource.
    • end without a digest is a plan with no vendor call.
    • The agent's confirm comes back needs_confirm with no vendor call.
    • A person's token does it, and a stale digest is refused.
    • A read-only account is refused.
    • A delete with the wrong typed name is refused.
    • The terminal lines equal the tool's says, and a non-admin gets none.
  • One existing test edited: test/palette-roster.test.ts lists the new entry.

Not done

  • The terminal screen does not plan a stop or delete itself. That stays on Cloud resources (x/X), which already did.
  • The web page's account lines are unchanged; the new words match them, but the page does not call the shared function.
  • test/delete-tier.test.ts is not affected. The infra description is unchanged, so the tool is not marked tier: "delete". The held-until-confirmed behaviour is what the issue asked for.
  • bun scripts/gate.ts still prints a note that cloudCostScreen looks 0.93 like weekScreen. I kept the screen as is, because it follows the same pattern as the other read-only screens (footingScreen).

Reused: planEnd, performEnd, costliestOf, standingWords, and the heldNotWhen and ASKING confirm path.

To try

  • Call infra with {action: "cost"}.
  • Call infra with {action: "end", id: <id from cost>, want: {act: "stop"}} for the plan.
  • Open "What the clouds cost" in the terminal.
[{"go":"MCP infra {action:\"cost\"}","look":"accounts[] says","expect":"each account with its ceiling and budget, then costliest[] with ids"},{"go":"MCP infra {action:\"end\", id, want:{act:\"stop\"}}","look":"digest and says","expect":"the plan, no cloud call"},{"go":"Terminal palette: What the clouds cost","look":"account lines","expect":"the same sentences as cost's says"}]

Closes #18103

2 earlier comments · 1 event
commented

The infra MCP tool now reads the cost table and plans or does a stop or delete, and a terminal screen shows the same table. I ran tsc, the new test, the MCP and confirm tests, and the palette and door tests. I did not run the full suite, so the forge's check is the first full run. The test/mcp-size.test.ts run passed.

What changed

  • cost: a new action on infra (no new tool) returns each cloud account against its ceiling and budget, plus the ten resources that cost most. Each resource carries the id that cloud and end take. The words come from src/actions/cloud_cost.ts, which the terminal screen also reads. A read-only account with no budget still appears, as "no budget set".
  • end: an id plus want: {act: stop|delete} returns the plan and its digest and calls no cloud. The same call with want.digest (and want.typed for a delete) does it, through the existing performEnd. That keeps the read-only refusal, stale-digest refusal, typed-name check and audit row. Only that second call is held for the owner's yes when the forge's own agent makes it (ASKING.infra in conversation_confirm.ts, plus a sentence in conversation_ask.ts).
  • Terminal: the "What the clouds cost" palette entry (src/tui/screens/cloudcost.ts) shows the account lines and the costliest resources. It is read-only and admin-only.
  • Docs and generated files: docs/features/cloud-end.md has the MCP and terminal lines, and src/generated/screens.ts is regenerated.
  • Tests: test/mcp-cloud-cost.test.ts runs against the stand-in vendor and covers all of this.
    • cost shows the budget and the costliest resource.
    • end without a digest is a plan with no vendor call.
    • The agent's confirm comes back needs_confirm with no vendor call.
    • A person's token does it, and a stale digest is refused.
    • A read-only account is refused.
    • A delete with the wrong typed name is refused.
    • The terminal lines equal the tool's says, and a non-admin gets none.
  • One existing test edited: test/palette-roster.test.ts lists the new entry.

Not done

  • The terminal screen does not plan a stop or delete itself. That stays on Cloud resources (x/X), which already did.
  • The web page's account lines are unchanged; the new words match them, but the page does not call the shared function.
  • test/delete-tier.test.ts is not affected. The infra description is unchanged, so the tool is not marked tier: "delete". The held-until-confirmed behaviour is what the issue asked for.
  • bun scripts/gate.ts still prints a note that cloudCostScreen looks 0.93 like weekScreen. I kept the screen as is, because it follows the same pattern as the other read-only screens (footingScreen).

Reused: planEnd, performEnd, costliestOf, standingWords, and the heldNotWhen and ASKING confirm path.

To try

  • Call infra with {action: "cost"}.
  • Call infra with {action: "end", id: <id from cost>, want: {act: "stop"}} for the plan.
  • Open "What the clouds cost" in the terminal.
[{"go":"MCP infra {action:\"cost\"}","look":"accounts[] says","expect":"each account with its ceiling and budget, then costliest[] with ids"},{"go":"MCP infra {action:\"end\", id, want:{act:\"stop\"}}","look":"digest and says","expect":"the plan, no cloud call"},{"go":"Terminal palette: What the clouds cost","look":"account lines","expect":"the same sentences as cost's says"}]
the crew's run was interrupted: restart, resumes on the next pass — cancelled
commented

This pull puts the cost table and a planned stop or delete on the infra tool (cost and end actions) and on a terminal screen.

The check failed because the new cost and end actions pushed the Talk tool list to 18,512 bytes, against a ceiling of 18,500. I did not raise the ceiling. I shortened the descriptions of propose_upstream, bring and new_app instead, with no change in meaning, and the list is now back under the ceiling. The Talk-list test and the cloud-cost tests pass, as do the propose-upstream and bring tests, and bun x tsc --noEmit is clean. The gate's --fix changed nothing. The pushed commit is 032192d1a.

I did not run the full 604-file impact set that scripts/fast.ts names, because it is estimated at over 40 minutes. The forge's check runs it on this push.

The gate also prints two advisory notes:

  • Long comment lines: two files have comment lines over 100 columns (src/crew/conversation_ask.ts, src/http/mcp/tools/infra.ts). The nightly rewrap handles them on main.
  • Similar screens: cloudCostScreen (src/tui/screens/cloudcost.ts) is 0.93 similar to weekScreen (src/tui/screens/maintenanceweek.ts); I did not merge them.

To try it, as a forge admin ask an infra tool call for {action: "cost"}. Then {action: "end", id, want: {act: "stop"}} returns a plan with a digest, and repeating it with that digest does the stop or delete once you confirm. A delete also needs typed set to the resource's name.

commented

I pushed c6b1d729d to the branch. It covers all three of sentinel's points. tsc is clean and the infra-page, infra-plan, cloud-cost and delete-tier tests pass. I did not run the wider suite; I ran bun scripts/gate.ts --fix once on the earlier commit, and its only output was advisory notes, which I did not re-check.

  • HIGH — delete from chat: infra is now marked tier: "delete". A call with action: "end", want.act: "delete" and a digest is refused at once to the forge's own agent, with the sentence naming the Cloud resources page (/infra/end/delete/<resource>). It is never held as a confirm. A stop is still held for the person's yes, and apply is unchanged.
    • ASKING.infra and the confirm sentence now cover a stop only.
    • test/delete-tier.test.ts has an infra sample. Its test.each refuses the call from a conversation before the tool runs, so no cloud is called and nothing is held. I added no separate agent-delete test, since that loop already covers it.
  • MEDIUM — words said twice: meterFigure in src/actions/cloud_cost.ts now builds the amount and the "of $X a month on …" part. meterWords and the web page's meter line (src/web/pages/infra.ts) both use it, so the page and the other doors can't drift. costTable is not used by the page; it already shared the meter data.
  • Minor — held-stop sentence: test/conversation-ask.test.ts now checks that a held end stop reads "Stop the cloud resource", not "Build the infrastructure plan".

The two gate notes are unchanged: some comment lines are over 100 columns, which the nightly rewrap handles, and cloudCostScreen is 0.93 similar to weekScreen, which I left as is.

Sign in to join this conversation.

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

Keyboard shortcuts

Docs