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

Replacing a DigitalOcean forge's machine waits for its volume to be free befo… #16342

shipped production is serving it opened this has it

Landed in pull #16346

opened this

Replacing a DigitalOcean forge's machine waits for its volume to be free before creating the new droplet

Seen on production 0.7.645, 2026-11-24 20:55Z, on the first real pinned forge (test1): pinned_forge claim (a fresh link, which replaces the machine on the same volume) deleted the old droplet and then had the new droplet create refused: "The cloud refused: api.digitalocean.com answered 422". The row was left failed with no machine. The same call a minute later succeeded. So the new droplet is created with the volume while DigitalOcean is still detaching it from the deleted one. The same path serves update and rollback, so every replace on DigitalOcean can fail this way, and a sold forge sits dark until someone retries.

What done looks like:

  1. After deleting the old droplet, the driver waits until the volume reports no droplet attached (GET /v2/volumes/{id}, droplet_ids empty) or the delete action completes, polling with a bound (say 2 minutes), before creating the new droplet. Each poll is recorded like the other cloud calls.
  2. A 422 on create that names the volume as in use is retried a few times with backoff, not returned as failure on the first answer.
  3. If the bound passes, the refusal says the volume is still attached and to try again, and the row is not marked failed while nothing at the provider was created (the existing "failed only when untrue" rule).
  4. The same check for Hetzner, whose volume detach is also asynchronous.
  5. Record the provider's error body's message (not the whole body) in the refusal, so the next 422 says what was refused.

Proof: recorded-fetch tests where the volume stays attached for two polls then frees (one droplet made), and where it never frees (refused, nothing made, row not failed).

Files: src/cloud/droplet.ts, src/cloud/hetzner.ts, src/cloud/machine.ts

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs