From Mainbrella · · 2m
When machine boots but reply disappears
How Mainbrella saves machine starts without losing work.
In brief
How Mainbrella saves machine starts without losing work. Mainbrella's system saves receipts before booting machines so retries find previous attempts without starting new ones. Originally reported by Mainbrella.
The problem
When a machine boots but the reply never reaches you, do you retry and risk starting a second machine?
We save a receipt
Mainbrella saves a receipt before booting so a retry can find the first attempt.
The slot reservation

Each account gets a Cloudflare Durable Object to decide which requests get a slot and compute allowance.
Reservation before boot
The coordinator saves the reservation before asking the runtime to boot so the next request sees the slot as taken.
Idempotency key
A new key on every retry starts a new machine; keeping the key reuses the original attempt.
Atomic write

The reservation and receipt land in one atomic write to prevent charging without a retry to find.
Receipts last 24 hours
Receipts last twenty-four hours; if the machine stops or slot reuses, the key returns creation_no_longer_running.
Running definition
The runtime boots the selected image with sleep infinity and gives uname -a sixty seconds to succeed.
Old request meets new machine
An old request arrives with the right slot name but wrong lifetime after cancellation.
Compute reservation
A free slot doesn’t mean unlimited runtime; we reserve compute allowance up front.
Compute units
One hour reserved for a Medium machine costs ten units; five minutes used costs 0.833 units.
Hard deadlines
The machine’s hard deadline is the earliest of its plan’s session limit, paid access expiration, next month boundary, or reserved compute.
Managed execution
For longer work, create a managed execution with its own idempotency key and machine identity.
File requests
The job writes /workspace/metrics.csv; we download it through a generation-bound file request.
Save the disk
Saving a disk involves three parties: the account, runtime, and provider; none can atomically commit the other two.
The consequence
Retries find previous attempts without starting new ones; the system prevents lost work.
The key point
Mainbrella's system saves receipts before booting machines so retries find previous attempts without starting new ones.

