PlatformMachines: expose provider lifecycle calls

TE
8d ago
+957-17

HOLD: remote backend typecheck and workerd validation are queued. Final independent Astra review is SHIP.

PlatformMachines currently exposes only the environment runner's narrow interface. The Freestyle MachineProvider in manaflow-ai/cmux-platform#20 needs atomic machine metadata, memory pause/resume, fork, and shape selection. This adds versioned provider discovery and additive create/get/shape/pause/resume/fork RPCs while preserving boot/find/exec/snapshot/destroy.

Create and fork intents are journaled in CloudDO before provider work. The existing operation ledger, plan checks, quotas and provider driver execute every step. Creation grows a snapshot-sized machine to the requested shape after binding and exposes it as starting until complete. Fork captures memory+disk, restores a child, and retires its intermediate snapshot only after capture/create settle. Alarms recover interrupted work and clean failed or expired allocations without another client request. Lease labels stay in the durable intent and participate in idempotency conflicts.

Ownership and team membership stay enforced. The new calls accept only direct Freestyle transport. A disabled surface or unavailable provider refuses new allocation. Matching existing create/fork intents can be recovered without provider calls, even after membership loss, so lost replies do not strand cleanup. Pending create and resize ledgers are cancelled before ordinary alarm retries. Development cleanup survives disable; staging and production refuse every call. No public HTTP route, new secret, or deployment setting is introduced. Existing development configuration requires CLOUD_FREESTYLE_API_KEY, CLOUD_FREESTYLE_SNAPSHOT, the matching CLOUD_NAME_PREFIX, and PLATFORM_MACHINES=on in cmux-api. The platform service binding remains development only.

Dependency: #26939 is already on feat-cmux-next. This PR is rebased directly onto feat-cmux-next at a25aeb1d5d94e44bf8fe994d158a535a0b1f6ad1; its diff contains only the extension. Consumer: cmux-platform#20.

Size: 896 changed lines. The RPC extension, durable continuation and crash/cost regressions form one correctness change; splitting would expose incomplete fork or shape behavior.

Observed / Not run

  • Observed: git diff --check and prepush-gate pass (no new violations).
  • Remote validation in progress at e769ceede855a25682da90d24aae9331d70ac8e3: fast checks. Command: cd backend && bun install --frozen-lockfile && cd apps/api && bun run typecheck && bun run test -- test/platform-machines.test.ts.
  • No real cloud machines created. Workerd tests use the existing fake driver.
  • Final Astra high/fast review: SHIP at e769ceede855a25682da90d24aae9331d70ac8e3; exact-head receipt posted.
  • App builds are not applicable to this API-only change.

Changelog

none

Leo, 2026-10-28:

"We need to auto scale. We need to be like Versa. Is to AWS. Like we need to be that to Freestyle, to like whatever fucking cloud provider, whatever machines that we have. We need to just get after it."

Agent session: agent session