updates (#1562-13): a swapped control plane that cannot BOOT is never rolled back — a restore guard outside the process (ADR 0259's open half) #1639

Closed
opened 2026-09-19 22:57:40 +00:00 by ben · 2 comments
Owner

The hazard

ADR 0259 (#1636) makes the gateway restart its own control plane to finish an update, and the restarted process gives the post-swap health verdict and rolls back if it is unhealthy. That covers a new binary that runs but is unhealthy. It does not cover a new binary that cannot boot at all (a panic at start, a missing library, a bad flag): it never reaches Orchestrator.Resume, so nothing alive can call Lander.Restore. Restart=on-failure / RestartSec=5s (internal/clan/vmguest.go) just loops it, and the community's one door stays shut until someone gets a shell on the gateway. GOTCHAS #241 names this: a swap with no rollback bricks the operator's only door.

What to build

A guard outside the control-plane process that puts the previous fleet software back when a swapped binary will not start:

  • It acts only when a rollout checkpoint is dangling in the durable update store (#1633) and the *.previous copies the lander retained exist (internal/fleetland, previousSuffix). A control plane that fails to start for any other reason is left alone — the guard must never "restore" over a healthy install.
  • Trigger: the unit hits a start limit after the swap (e.g. StartLimitBurst + an OnFailure= oneshot), or an ExecStartPre check that counts failed starts since the checkpoint was marked "restart pending". Pick one and say why in the commit.
  • Act: rename *.previous back over the binary, the agent and the control panel (the same scope Lander.Restore restores), record in the durable store that the attempt failed at boot so the started process counts it against the ADR 0067 budget and shows U4x (rolled back) with an honest reason, then start the unit.
  • Say so loudly in the journal (ADR 0100).

Acceptance

  • A render test shows the guard unit/hook in the gateway's config and that it is inert without a dangling checkpoint.
  • A shell or Go test drives the restore script against a temp dir: checkpoint + *.previous → restored and marked; no checkpoint → untouched; checkpoint but no *.previous → refuses loudly, touches nothing.
  • After a boot-failure restore, the Updates surface shows the release rolled back with the attempt counted; a second boot failure of the same release quarantines it.
  • GOTCHAS entry + STATUS in the same commit.

Live proof can ride a later fire of the #1614 drive (a release C′ whose binary exits 1 at start) — file that leg as a follow-up rather than widening this ticket.

Why it matters when

Not needed for #1614's applied leg. Needed before any kept community pins a release channel (#1569, and founding's held testing pin) — so it blocks #1562.

## The hazard ADR 0259 (#1636) makes the gateway restart its own control plane to finish an update, and the restarted process gives the post-swap health verdict and rolls back if it is unhealthy. That covers a new binary that **runs but is unhealthy**. It does not cover a new binary that **cannot boot at all** (a panic at start, a missing library, a bad flag): it never reaches `Orchestrator.Resume`, so nothing alive can call `Lander.Restore`. `Restart=on-failure` / `RestartSec=5s` (`internal/clan/vmguest.go`) just loops it, and the community's one door stays shut until someone gets a shell on the gateway. GOTCHAS #241 names this: a swap with no rollback bricks the operator's only door. ## What to build A guard **outside** the control-plane process that puts the previous fleet software back when a swapped binary will not start: - It acts only when a rollout checkpoint is dangling in the durable update store (#1633) **and** the `*.previous` copies the lander retained exist (`internal/fleetland`, `previousSuffix`). A control plane that fails to start for any other reason is left alone — the guard must never "restore" over a healthy install. - Trigger: the unit hits a start limit after the swap (e.g. `StartLimitBurst` + an `OnFailure=` oneshot), or an `ExecStartPre` check that counts failed starts since the checkpoint was marked "restart pending". Pick one and say why in the commit. - Act: rename `*.previous` back over the binary, the agent and the control panel (the same scope `Lander.Restore` restores), record in the durable store that the attempt failed **at boot** so the started process counts it against the ADR 0067 budget and shows U4x (rolled back) with an honest reason, then start the unit. - Say so loudly in the journal (ADR 0100). ## Acceptance - [ ] A render test shows the guard unit/hook in the gateway's config and that it is inert without a dangling checkpoint. - [ ] A shell or Go test drives the restore script against a temp dir: checkpoint + `*.previous` → restored and marked; no checkpoint → untouched; checkpoint but no `*.previous` → refuses loudly, touches nothing. - [ ] After a boot-failure restore, the Updates surface shows the release rolled back with the attempt counted; a second boot failure of the same release quarantines it. - [ ] GOTCHAS entry + STATUS in the same commit. Live proof can ride a later fire of the #1614 drive (a release C′ whose binary exits 1 at start) — file that leg as a follow-up rather than widening this ticket. ## Why it matters when Not needed for #1614's `applied` leg. **Needed before any kept community pins a release channel** (#1569, and founding's held `testing` pin) — so it blocks #1562.

swarm-claim host=bens-mac-04 run=27974
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=27974 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #1639 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 1639,
  "status": "success",
  "commits": [
    "da89695e2afcdfdecbea243d71bed75e78187e45"
  ],
  "changed_files": [
    "STATUS.md",
    "control-plane/cmd/control-plane/updates_scheduler.go",
    "control-plane/cmd/control-plane/updates_scheduler_test.go",
    "control-plane/cmd/control-plane/whole_composition.go",
    "docs/GOTCHAS.md",
    "internal/clan/restore_guard.sh",
    "internal/clan/restore_guard_test.go",
    "internal/clan/vmguest.go",
    "internal/clan/vmguest_test.go",
    "internal/update/bootfailure.go",
    "internal/update/bootfailure_test.go",
    "internal/update/export_test.go",
    "internal/update/rollout.go",
    "internal/update/rolloutview.go"
  ],
  "tests": [
    {
      "command": "go test ./internal/update/...",
      "exit_code": 0
    },
    {
      "command": "go test ./internal/clan/",
      "exit_code": 0
    },
    {
      "command": "go test ./control-plane/cmd/control-plane/",
      "exit_code": 0
    }
  ],
  "criteria": {
    "A render test shows the guard unit/hook in the gateway's config and that it is inert without a dangling checkpoint": "internal/clan/vmguest_test.go TestRenderGatewayGuest_RestoreGuard asserts the ExecStartPre + writeShellScriptBin guard are in renderGatewayGuest's output, that it gates on the durable store's `restart_pending` mark and only acts when `.previous` copies exist (so inert without a dangling checkpoint), and that the rendered guard is restore_guard.sh byte-for-byte; the guard is rendered by controlPlaneRestoreGuard in internal/clan/vmguest.go",
    "A shell or Go test drives the restore script against a temp dir: checkpoint + *.previous -> restored and marked; no checkpoint -> untouched; checkpoint but no *.previous -> refuses loudly, touches nothing": "internal/clan/restore_guard_test.go runs the embedded restore_guard.sh via bash against t.TempDir(): TestRestoreGuard_DanglingCheckpointRestoresAndMarks (restored + marker dropped + loud journal line), TestRestoreGuard_NoCheckpointTouchesNothing (no store and non-restart-pending store both leave everything untouched, no marker), TestRestoreGuard_CheckpointButNothingRetainedRefusesLoudly (refuses loudly, touches nothing, no marker), plus TestRestoreGuard_CountsBelowThresholdBeforeActing for the failed-start counting",
    "After a boot-failure restore, the Updates surface shows the release rolled back with the attempt counted; a second boot failure of the same release quarantines it": "internal/update/bootfailure.go Orchestrator.RecordBootFailure counts the attempt against the ADR 0067 budget via recordFailure and retains a U4x view; internal/update/bootfailure_test.go TestRecordBootFailure_CountsTheAttemptAndShowsU4x (surface Automatic still tracks it, RolloutState U4x attempt 1 of 2 with an honest non-health-check reason) and TestRecordBootFailure_SecondFailureQuarantines (surface Quarantined, attempts 2); TestUpdateScheduler_FoldsBootFailureMarkerOnBoot proves the driver folds the marker and shows U4x on boot",
    "GOTCHAS entry + STATUS in the same commit": "docs/GOTCHAS.md #277 and STATUS.md milestone-log entry both in commit da89695e"
  },
  "summary": "A swapped control-plane binary that cannot boot is now rolled back by an out-of-process ExecStartPre guard (restore_guard.sh) that restores the previous fleet software and marks a boot failure the started process counts against the ADR 0067 budget (RecordBootFailure), showing U4x.",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #1639 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1639, "status": "success", "commits": [ "da89695e2afcdfdecbea243d71bed75e78187e45" ], "changed_files": [ "STATUS.md", "control-plane/cmd/control-plane/updates_scheduler.go", "control-plane/cmd/control-plane/updates_scheduler_test.go", "control-plane/cmd/control-plane/whole_composition.go", "docs/GOTCHAS.md", "internal/clan/restore_guard.sh", "internal/clan/restore_guard_test.go", "internal/clan/vmguest.go", "internal/clan/vmguest_test.go", "internal/update/bootfailure.go", "internal/update/bootfailure_test.go", "internal/update/export_test.go", "internal/update/rollout.go", "internal/update/rolloutview.go" ], "tests": [ { "command": "go test ./internal/update/...", "exit_code": 0 }, { "command": "go test ./internal/clan/", "exit_code": 0 }, { "command": "go test ./control-plane/cmd/control-plane/", "exit_code": 0 } ], "criteria": { "A render test shows the guard unit/hook in the gateway's config and that it is inert without a dangling checkpoint": "internal/clan/vmguest_test.go TestRenderGatewayGuest_RestoreGuard asserts the ExecStartPre + writeShellScriptBin guard are in renderGatewayGuest's output, that it gates on the durable store's `restart_pending` mark and only acts when `.previous` copies exist (so inert without a dangling checkpoint), and that the rendered guard is restore_guard.sh byte-for-byte; the guard is rendered by controlPlaneRestoreGuard in internal/clan/vmguest.go", "A shell or Go test drives the restore script against a temp dir: checkpoint + *.previous -> restored and marked; no checkpoint -> untouched; checkpoint but no *.previous -> refuses loudly, touches nothing": "internal/clan/restore_guard_test.go runs the embedded restore_guard.sh via bash against t.TempDir(): TestRestoreGuard_DanglingCheckpointRestoresAndMarks (restored + marker dropped + loud journal line), TestRestoreGuard_NoCheckpointTouchesNothing (no store and non-restart-pending store both leave everything untouched, no marker), TestRestoreGuard_CheckpointButNothingRetainedRefusesLoudly (refuses loudly, touches nothing, no marker), plus TestRestoreGuard_CountsBelowThresholdBeforeActing for the failed-start counting", "After a boot-failure restore, the Updates surface shows the release rolled back with the attempt counted; a second boot failure of the same release quarantines it": "internal/update/bootfailure.go Orchestrator.RecordBootFailure counts the attempt against the ADR 0067 budget via recordFailure and retains a U4x view; internal/update/bootfailure_test.go TestRecordBootFailure_CountsTheAttemptAndShowsU4x (surface Automatic still tracks it, RolloutState U4x attempt 1 of 2 with an honest non-health-check reason) and TestRecordBootFailure_SecondFailureQuarantines (surface Quarantined, attempts 2); TestUpdateScheduler_FoldsBootFailureMarkerOnBoot proves the driver folds the marker and shows U4x on boot", "GOTCHAS entry + STATUS in the same commit": "docs/GOTCHAS.md #277 and STATUS.md milestone-log entry both in commit da89695e" }, "summary": "A swapped control-plane binary that cannot boot is now rolled back by an out-of-process ExecStartPre guard (restore_guard.sh) that restores the previous fleet software and marks a boot failure the started process counts against the ADR 0067 budget (RecordBootFailure), showing U4x.", "reason": "", "blockers": [], "no_code_change": "" } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/idss#1639
No description provided.