30-Apr-2026 — make Fly post-deploy scaling self-healing

build 632commit acc3049


Two of sixteen environments (medway, sevenoaks) failed in the all-environments deploy of 4cae672e with:

Error: could not update machine ...: failed to update VM ...: aborted: machine is replacing: concurrent update in progress

After flyctl deploy --strategy rolling returned success, the script fired flyctl scale memory immediately. Fly's machine-replacement state machine was still finalising the rolling swap behind the scenes - the scale call collided with that, and the existing 3-attempt 2s/4s retry backoff was too short to outlast the replacement window. By the second retry the old machine was gone and the new one had not yet appeared in the 'app' process group, producing the secondary "No active machines" error.

Two changes in server/lib/fly/fly-commands.ts that the deploy loop now relies on instead of issuing flyctl scale unconditionally:

deploy-to-environments.ts now calls ensureScale once per environment in place of the back-to-back flyctl scale count and flyctl scale memory calls.