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

A paid checkout deploys the buyer's forge on its own machine, and an at-cost… #16205

shipped production is serving it opened this has it

Landed in pull #16559 · 3 runs · run

opened this

A paid checkout deploys the buyer's forge on its own machine, and an at-cost code sells it for what it costs

Today a completed Stripe checkout ends in a forge hosted inside the owner's forge. The owner wants a sale to produce a standalone forge on a cloud machine, and to be able to hand someone a code that gives them a forge at cost.

What done looks like:

  1. Purchase → deploy. A completed checkout (webhook, and the confirm-on-return path) starts a pinned deploy at the place the buyer chose, or the default place for the plan. The buyer gets the claim link by email and on the return page once the forge answers on HTTPS. The steps are recorded so a retry finishes a half-done sale and never makes two machines for one payment; a deploy that cannot finish in a stated time tells the buyer and the owner plainly and holds the money question for the owner (refunds are his).
  2. Lapse and cancel. A cancelled or unpaid subscription stops the machine after the stated grace, keeps the volume and the last backup for a stated period, and says so to the buyer beforehand; paying again brings it back with its data. Retiring for good deletes the machine and volume once, and the bill stops.
  3. Price follows the place. The plan's price is the default; if the buyer picks a place whose cost is higher than the plan's default place, the difference is added and shown before they pay. Checkout keeps using inline price data so the owner pastes only a key.
  4. At-cost codes. Codes today grant a plan free (forges codes). Add a kind: at cost. A buyer with an at-cost code pays the place's monthly cost plus the payment fee, rounded up to the next dollar, for as long as the subscription runs; the page shows the normal price struck through and "at cost" with the amount. When a place's cost changes, an at-cost subscription follows at its next renewal after notice. The owner makes, lists and revokes at-cost codes where he makes free ones, with uses and expiry as now.
  5. The owner's billing view shows, per sold forge: plan, place, what it costs, what it pays, and the margin; at-cost forges read as zero margin, not as a loss.

Proof: in the Stripe sandbox, a purchase with no code, one with a chosen dearer place, and one with an at-cost code each end with a claimed forge on its own machine and the right amount charged; a cancelled one stops and comes back with its data.

Depends on the places catalog and on a pinned forge having its own name, HTTPS and backups.

2 earlier comments
commented

Direction from the owner, 2026-11-24: buyers will come through the New forge button, so the cloud machine goes BEHIND that door, not beside it. A map of the code (origin/main at 0486fe445) shows the purchase path already does most of this issue: placeOrder → Stripe session → webhook or confirm-on-return → spawnOrder → spawnDoor({plan}, {paid: true}) (src/actions/order.ts:176), with order states, a failed state, claim mail and resend, entitlement and lapse. What is missing is narrow: make() (src/actions/spawn.ts:443) only knows placementFor = cell or hosted (src/spawn/door.ts:153), and CLOUD_BODY_CONFIGURED is false (src/spawn/placement.ts:20).

So this issue becomes: a third Placement, cloud, that the same door uses.

  1. cloudPlacement.place(plan) calls the pinned deploy at the plan's default place (chooseDefault, src/cloud/places.ts:170) or the place the buyer chose, on the cloud account the owner named for sales, under that account's ceiling. retire(bodyId) calls pinned retire. room() says why not when the ceiling, the catalog or the account would refuse, before anyone pays.
  2. Which placement: one forge setting, "paid forges run on" = hosted (today, the default) or a named cloud account. Free forges stay hosted. A paid order on a cloud setting never falls back to hosted silently: it fails into the order's existing failed state with the reason.
  3. deployPinned requires an admin actor (src/actions/pinned.ts:173). A purchase is not an admin: add a system actor for an order's deploy, recorded on the pinned row and the event as "order <id>", not a borrowed admin.
  4. make() skips copyInto for a cloud body. The claim is the pinned claim (hash on the machine, 7 days), not mintClaim; spawnOrder returns that link, and /pricing/done and the order mail carry it. A machine takes minutes: the order gets a making state the done page polls, and the claim link is shown and mailed only once the forge answers on HTTPS. Never two machines for one order (spawningNow already guards a slow spawn; keep that guarantee across restarts).
  5. What a cloud forge does NOT get, because each needs the parent in the same process or on loopback: the parent proxying <name>--<parentHost>, sleep and wake, lent crew credit over FORGE_PARENT_LOCAL (src/apps/egress.ts:126), heartbeat / reach / child_db, following the parent's updates. A cloud forge has its own name, takes its own updates and backups (#16204), and its owner brings their own AI key. The plan's included crew credit cannot be lent to it this way: do not promise it on a cloud plan until there is another way to give it; say so on the page.
  6. Lapse and cancel for a cloud forge: after grace, power the machine off (keep the volume, say what happens when); after retention, retire with the buyer warned first. sleepLapsed (src/spawn/host.ts:527) only knows hosted children.
  7. Words that are wrong for a standalone forge and must branch on placement: AFTER_PAYMENT_STEPS (plan_words.ts:79), lapseRuleWords (lapse_rule.ts:17), KEY_BUDGET_NOTE (plan.ts:32), and the <name>--<parent> address on pricing.ts:199. Fix the stale comment at placement.ts:5 while there.
  8. At-cost codes and "price follows the place" stay as written above, on this same door.

Depends on, all in flight: deploy at a catalog place, DNS written by the forge with a base domain (no hostname asked of the buyer), and retire.

Files: src/spawn/placement.ts, src/spawn/door.ts, src/actions/spawn.ts, src/actions/order.ts, src/actions/pinned.ts, src/spawn/host.ts, src/billing/lapse.ts, src/web/pages/pricing.ts

commented

Taken over by @trevato; stopped @scout.

commented

Parked by the crew: the run ended without a pull: declined: the owner (@trevato) took this issue over and stopped @scout on 2026-11-24, so I'm not working it. The last comment on the issue reads "Taken over by @trevato; stopped @scout." Nothing is pushed.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs