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

Upgrade a shared forge to a dedicated one, keeping its data #17167

opened this

Check · Review · Land · Live — Its check is queued. Next: reviewer, no review yet.

Ready to land

An admin can now upgrade a shared forge to a dedicated plan, and its data moves with it. bun x tsc --noEmit is clean. The new test/upgrade-shared.test.ts, the MCP, page and terminal move-door tests, and the route-mark, hollow-code and unused-export checks pass.

Notes · 10 files · +444 −8

Look

9 pages beside main · 0 new to this pull

/apps

main

at c1c75da ·

this pull

In the dark

main

at c1c75da ·

this pull

at ba9a8e0 ·

/changelog

main

at c1c75da ·

this pull

In the dark

main

at c1c75da ·

this pull

at ba9a8e0 ·

/docs

main

at c1c75da ·

this pull

In the dark

main

at c1c75da ·

this pull

at ba9a8e0 ·

/explore

main

at c1c75da ·

this pull

In the dark

main

at c1c75da ·

this pull

at ba9a8e0 ·

/looks/failed

main

at c1c75da ·

this pull

In the dark

main

at c1c75da ·

this pull

at ba9a8e0 ·

/looks/missing

main

at c1c75da ·

this pull

In the dark

main

at c1c75da ·

this pull

at ba9a8e0 ·

/notes

main

at c1c75da ·

this pull

In the dark

main

at c1c75da ·

this pull

at ba9a8e0 ·

/review

main

at c1c75da ·

this pull

In the dark

main

at c1c75da ·

this pull

at ba9a8e0 ·

/security

main

at c1c75da ·

this pull

In the dark

main

at c1c75da ·

this pull

at ba9a8e0 ·

opened this

An admin can now upgrade a shared forge to a dedicated plan, and its data moves with it. bun x tsc --noEmit is clean. The new test/upgrade-shared.test.ts, the MCP, page and terminal move-door tests, and the route-mark, hollow-code and unused-export checks pass. I didn't run the full suite, and I didn't write the keep_plan or estimate entries.

What changed

  • The action. src/actions/upgrade_shared.ts has planUpgrade, which only previews, and upgradeShared, which does the move and then the plan change. The preview shows the machine, the move steps, and the price before and after (shared → small: $19.00 / month). The move is moveToMachine from src/spawn/move_machine.ts: copy through the backup destination, start, switch the router. The plan changes only once the forge answers on the machine. A failed move leaves it shared and billed as shared.
  • Billing. On success it writes the entitlement (kept in entitlement_change, source upgrade), tells the forge its new plan, and emits a billing.plan event. The earlier price falls back to the shared density price when a stored plans list lacks the shared plan.
  • Web. An "Upgrade to a dedicated forge" button on /forges, shown only for shared forges in their own cell when a machine is declared. It opens /forges/<name>/upgrade, where ?plan=&to= previews and the POST does it, with a route mark and the lazy list updated.
  • Terminal. Key e on the Forges screen asks which forge, plan and machine, shows the same plan, then confirms.
  • MCP. The forges tool takes action: "upgrade" with forge, plan and to. It previews by default and dryRun: false does it.
  • Docs. The "Not done" line in docs/features/shared-tier.md is now an "Upgrading" section.
  • Reused. I reused planMove, moveToMachine, previewChange, changeLine, centsFor, putEntitlement and tellPlan rather than writing new ones.

Left out

  • A forge whose subscription is at a payment provider is refused with words saying to change it there. This forge can't change what Stripe bills, and I didn't want to move the price here behind its back.
  • Only an admin who is a person can do it, and agents are refused. An owner upgrading their own forge is not built.
  • It needs a declared machine (FORGE_MACHINES) and a forge in its own cell. A forge hosted inside this process is told to sandbox first.

Gate notes

  • The both-doors rule would not accept the terminal key and the how-to edit as doors for a new page, so the commit says No door: with the reason. A No look: line says why there is no look page: the look fixture has no declared machine.
  • The gate's "one implementation?" similarity notes remain on upgradeOne, forgeUpgradeForm, forgeUpgradeSubmit and a test helper. Each follows the shape of its machine-move sibling, and I left them.

Try it Declare a machine, put a forge on the shared plan, then open /forges/<name>/upgrade on the preview. You can also call MCP forges with { action: "upgrade", forge, plan: "small", to: "<machine>" }.

🤖 Generated with Claude Code

Closes #17024

commented

An admin can now upgrade a shared forge to a dedicated plan, and its data moves with it. bun x tsc --noEmit is clean. The new test/upgrade-shared.test.ts, the MCP, page and terminal move-door tests, and the route-mark, hollow-code and unused-export checks pass. I didn't run the full suite, and I didn't write the keep_plan or estimate entries.

What changed

  • The action. src/actions/upgrade_shared.ts has planUpgrade, which only previews, and upgradeShared, which does the move and then the plan change. The preview shows the machine, the move steps, and the price before and after (shared → small: $19.00 / month). The move is moveToMachine from src/spawn/move_machine.ts: copy through the backup destination, start, switch the router. The plan changes only once the forge answers on the machine. A failed move leaves it shared and billed as shared.
  • Billing. On success it writes the entitlement (kept in entitlement_change, source upgrade), tells the forge its new plan, and emits a billing.plan event. The earlier price falls back to the shared density price when a stored plans list lacks the shared plan.
  • Web. An "Upgrade to a dedicated forge" button on /forges, shown only for shared forges in their own cell when a machine is declared. It opens /forges/<name>/upgrade, where ?plan=&to= previews and the POST does it, with a route mark and the lazy list updated.
  • Terminal. Key e on the Forges screen asks which forge, plan and machine, shows the same plan, then confirms.
  • MCP. The forges tool takes action: "upgrade" with forge, plan and to. It previews by default and dryRun: false does it.
  • Docs. The "Not done" line in docs/features/shared-tier.md is now an "Upgrading" section.
  • Reused. I reused planMove, moveToMachine, previewChange, changeLine, centsFor, putEntitlement and tellPlan rather than writing new ones.

Left out

  • A forge whose subscription is at a payment provider is refused with words saying to change it there. This forge can't change what Stripe bills, and I didn't want to move the price here behind its back.
  • Only an admin who is a person can do it, and agents are refused. An owner upgrading their own forge is not built.
  • It needs a declared machine (FORGE_MACHINES) and a forge in its own cell. A forge hosted inside this process is told to sandbox first.

Gate notes

  • The both-doors rule would not accept the terminal key and the how-to edit as doors for a new page, so the commit says No door: with the reason. A No look: line says why there is no look page: the look fixture has no declared machine.
  • The gate's "one implementation?" similarity notes remain on upgradeOne, forgeUpgradeForm, forgeUpgradeSubmit and a test helper. Each follows the shape of its machine-move sibling, and I left them.

Try it Declare a machine, put a forge on the shared plan, then open /forges/<name>/upgrade on the preview. You can also call MCP forges with { action: "upgrade", forge, plan: "small", to: "<machine>" }.

🤖 Generated with Claude Code

commented

The two MCP size tests that were red only on this pull now pass, and I pushed the fix. The gate printed four "one implementation?" similarity notes on the upgrade code, and I did not act on them.

Cause. The forges tool grew by about 8 bytes because upgrade was added to its action enum. That pushed two lists over their ceilings:

  • tools/list was 6008 bytes against a limit of 6000 (test/mcp-size.test.ts).
  • The Talk list was 18506 bytes against a limit of 18500 (test/mcp-talk-tools.test.ts).

Fix. I shortened the tool's listed description from "Forges sent from here (admin)." to "Forges sent from here." That saves exactly the 8 bytes needed, so tools/list is now at 6000, right on the limit. The tool is still admin-only through listedTo. test/mcp-size.test.ts and test/mcp-talk-tools.test.ts now pass.

Not fixed. The other red tests (guest-pull, talk-phone, phone-targets, talk-page, talk-pane-bar, runner-adopt, mcp-flow-drift-update) fail on main at cec8b4d too, and the check did not count them against this pull. I re-ran "a writer's update names the agent and queues its run" from test/mcp-flow-drift-update.test.ts without my change, and it fails the same way. I did not run the other red files. bun x tsc --noEmit printed nothing.

How to try. Run bun test test/mcp-size.test.ts test/mcp-talk-tools.test.ts.

Sign in to join this conversation.

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

Keyboard shortcuts

Docs