Three defects found by Macroscope and Cursor Bugbot:
- The restart window was armed only at click time, but an npm install can
consume most of the 10-minute request window, so a slow-but-successful
update restarted after the window had lapsed and was presented as an
outage. Re-arm from the acknowledgement and from the interrupt path,
matching what keepPendingForRestart already does for the button expiry.
- Effect.catch on the detached restart fiber only sees typed failures, so
an unexpected defect skipped the inFlight reset and left a live process
refusing every further update until restarted by other means. Release
the guard from Effect.onExit, outside the typed handler. Success still
deliberately keeps it set: systemd is about to stop the process and a
second update would race the handoff.
- "A server update is already in progress" is a typed failure, so it
cleared a restart overlay that the earlier still-pending update needed,
restoring the harsh reconnect UI mid-restart. That reason now lives in
contracts as SERVER_SELF_UPDATE_ALREADY_RUNNING_REASON with an
isAlreadyRunning helper, so the client can distinguish it structurally
instead of matching prose.
Each fix has a regression test; the defect-path test was confirmed to
fail without the onExit change.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>