Repository navigation
fix(update): Gateway stays down when the updater is killed after a plugin cohort was reserved - #191201
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs real behavior proof before merge. What this changesThis PR lets a managed update’s live handoff continuation settle its own interrupted plugin cohort before restoring the Gateway. Example: A Linux managed update from 2026.10.121 to 2026.10.122 loses its updater during package publication.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness⛔ Blocked before merge - 3 items remain Keep open: this maintainer-authored PR addresses a verified recovery gap still present on main, and inspection found no definite introduced code defect. Priority: P0 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe managed-update helper retains installation custody after updater death; it coordinates package recovery, installed-runtime finalization, plugin recovery, and Gateway restoration. flowchart TD
A[Managed update] --> B[Updater exits unexpectedly]
B --> C[Live handoff helper]
C --> D[Recover package publication]
D --> E[Finalize under borrowed executor]
E --> F[Settle own plugin cohort]
F --> G[Doctor and plugin convergence]
G --> H[Restore verified Gateway]
Technical reviewBest possible solution: Keep one shared cohort-settlement owner, preserve exact-run live custody, and complete recovery validation before landing. Do we have a high-confidence way to reproduce the issue? Yes: source shows the helper calling finalize while its cohort reservation remains pending, and the PR records matching Linux/systemd failures on pinned main. Is this the best way to solve the issue? The patch uses the smallest coherent approach: extract repair’s settlement, authorize only the helper’s own continuation, and retain data-risk and foreign-run refusals. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ed2def8f7952. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +85, Tests +117, Docs +8. Total +210 across 12 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 2, 2026, 10:53 AM ET / 15:53 UTC. |
|
Merged via squash.
|
…ugin cohort was reserved (openclaw#191201) * fix(update): settle the helper's own plugin cohort after an updater kill * fix(update): settle the run's plugin cohort when interrupted recovery rolls back * style: format interrupted recovery imports * docs(update): describe helper plugin cohort settlement * fix(update): keep the Gateway stopped when a failed rollback repair records data risk
Related: #164800
What Problem This Solves
Fixes: when the
openclaw updateprocess dies during a managed (Gateway-started) update after the package swap starts, or while Doctor runs, the Gateway stays down until someone runsopenclaw update repair. When it dies just before the swap, the Gateway comes back, but the next update is refused until a manual repair.User Impact
User impact: a managed update whose updater is killed (SIGKILL, OOM, a killed process group) now recovers on its own at every point we could kill it. The handoff helper settles that update's own plugin cohort and restarts a verified Gateway, and the next update is admitted without a manual repair. A cohort that belongs to another update, recorded data risk, lost ownership, and unverifiable runtimes still stop recovery and name the next step. Like #188497, this needs the helper that started the update to contain the fix; a helper from an older release cannot be repaired by the candidate.
Why This Change Was Made
#188497 made the still-running handoff helper finish an interrupted publication and run
openclaw update finalizeas the same update's continuation. #188978 (plugin cohorts restored on core rollback) records a plugin-cohort recovery reservation before the package swap. Finalize opened with the generic "no unfinished recovery" admission, so the helper's continuation refused its own run's reservation ("Update has unfinished recovery; reconcile it before starting another update.") and the Gateway stayed down. Onlyupdate repaircould settle the reservation, and repair deliberately refuses inside a handoff.The fix makes the run's live owner settle its own cohort:
settleInterruptedUpdatePluginCohort, so repair and the helper follow one rule: roll back a pending cohort, and commit only on the recorded candidate.settleManagedHandoffPluginCohort. It acts only for the handoff continuation (OPENCLAW_UPDATE_RUN_HANDOFF=1plus the run id), only for a cohort recorded for that same run, and only under the executor it borrows from the helper's live lease for that run (assertUpdateRequesterContinuationOwnerplusassertPluginCohortRecoveryContinuation). Any other pending recovery still refuses.warning:plugin-cohort-recoveryand namesopenclaw update repair, and the original Gateway still restarts. Recorded data risk still keeps the Gateway stopped.Rejected alternatives:
update repair: repair claims its own handoff and adopts a new repair run, which conflicts with the helper's live lease and same-run bookkeeping.OPENCLAW_UPDATE_RUN_HANDOFFprocess: env alone is not authority.Evidence
Native Linux/systemd proof (Crabbox AWS lease, managed
update.runfrom a ready Gateway, updater tree SIGKILLed). These use the same harness and kill points as #188497. Packages were built frommain8689fa8f6b8(red: 2026.10.121 → 2026.10.122) and from this head2026813714f(green: 2026.10.125 → 2026.10.126). The helper that starts the update has to come from the build under test.main)rolled-back; no recovery rowsupdate.recoveryandupdate.pluginCohort(pending)succeeded(managed-service-handoff-recovered); no recovery rowssucceeded; no recovery rowsOn red, the helper log shows the finalize continuation refusing with "Update has unfinished recovery; reconcile it before starting another update." On green, no recovery rows are left, so the next update is admitted.
Shipped driver, no kill: published 2026.10.9 → 2026.10.126 (this head) succeeded, ready, with no recovery rows. 2026.10.9's helper predates #188497, so kill recovery cannot be proven from it. That is the shipped first-hop rule.
Reviews:
$autoreview(Codex) on the final head: scoped-clean. The earlier pass found one P1: failed rollback finalization dropped recorded data risk. It is fixed by rereading the run, and covered by theriskcase below.codex execreview on the final head: NO FINDINGS.Boundary tests:
src/infra/update-managed-service-handoff-interrupted.test.tsruns the real sealed helper, the real borrowed executor, and a real cohort reservation:Each own/risk case is red with its fix removed and green with it. Local runs:
update-repair-package-activation,update-repair-command,update-command-finalize-refusal,update-managed-service-handoff-cleanup-repair,update-managed-service-handoff-recovery,update-repair-service): 195/195.tsgo:core,oxlint(core shard) andoxfmtare clean.