Repository navigation
fix(update): recover interrupted managed updates on 2026.11.3 - #193884
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: needs real behavior proof before merge. What this changesThis PR backports managed Gateway recovery after interrupted updates and recoverable finalization failures to release/2026.11.3. Example: The updater is killed after publishing a candidate labelled 2.0.0.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness⛔ Blocked before merge - 6 items remain Keep this maintainer-authored release backport open: it addresses a valuable recovery defect, but its helper can still undo a later recorded operator stop. Priority: P1 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe update CLI and detached handoff helper coordinate package publication, Doctor maintenance, update history, and native service managers to restore a verified Gateway after failure. flowchart TD
A[Update request] --> B[Update CLI]
B --> C[Detached handoff helper]
C --> D[Package publication owner]
C --> E[Installed finalizer]
C --> F[Native service manager]
E --> G[Update ledger]
F --> H[Gateway readiness]
Technical reviewBest possible solution: Port main’s pending-stop callback into the existing helper and check it immediately before each native startup effect. Do we have a high-confidence way to reproduce the issue? The release-base source and supplied pre-fix failures establish the interrupted-update recovery defect; this review ran no target code. Is this the best way to solve the issue? Reusing the existing publication, finalization, and service owners is appropriate, but the backport needs main’s final-effect stop-intent guard. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a7ba22b91b85. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: Recovery authority crosses into publication and startup, while lease replacement and service reassignment rejection remain unproven. EvidenceWhat I checked:
PR surfaceSource +800, Tests +1550, Docs +29. Total +2379 across 70 files. Added test files: 5. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
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 HistoryReview history (1 earlier review cycle)
Reviewed November 10, 2026, 1:08 AM ET / 06:08 UTC (Revision 2). |
Adapt #172784, #175890, and #188497 to release/2026.11.2 while retaining the current-core recovery owner and release-line custody grace. Preserve operator stops, named data-risk refusals, and same-run interrupted helper bookkeeping. Co-authored-by: RomneyDa <[email protected]>
Complete safe post-core repair with a warning when service inspection returns a nonowned verdict. Keep automatic startup disabled and retain live-authority and data-risk checks. Exercise unavailable and absent services through the repair command; align retained-handoff fixtures with the preserved release-line grace period. Co-authored-by: RomneyDa <[email protected]>
Select the verified installed ledger and terminal writer before post-core repair can migrate state. Retain staged fallback before candidate verification and cover finalizer failure and post-finalize data-risk refusal. Co-authored-by: RomneyDa <[email protected]>
…igration reason The release-line run reader maps a legacy "state-migration-started" reason to legacy-state-migration data risk, so the saved fixture correctly kept the Gateway stopped. Use a non-migration reason so the test still proves stale history does not leak into immediate guidance.
23823af to
0c3954f
Compare
… advance The staged managed-update helper is a copy of the old updater's build. When the candidate's Doctor advances the shared state schema and the updater is then killed, the helper's first history reads (the Gateway stop and this run) hit the newer-schema refusal, so recovery never starts and the Gateway stays stopped. On a newer-schema refusal, read and record through the installed runtime, which already owns post-core repair. Other read errors still fail recovery. The boundary test advances the schema past the staged helper before SIGKILL and fails without this change.
…kport The backport took #172784's restart-after-failure behavior without its test updates, and the release line still expected verified readiness where recovery now only observes an untouched service. Apply #172784's already-current, candidate-activation and node-runtime changes, port main's observation expectations for the Windows triage and foreground-failure cases, and give the package-swap risk fixture the dataAtRisk field release writers set.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Repair maintenance has already finished when the Gateway fails to start or verify, so report that as a warning naming `openclaw gateway start` and `openclaw gateway status --deep` instead of failing the repair. Named data risk and process-cleanup failures still fail. Inspect the service and check recovery admission once, right before the start, instead of repeating the full inspection inside the start callback. An unreadable update history no longer skips the helper's existing failure handling when the updater exits without a result.
Require the current helper lease and unretired stop intent after native inspection and before recovery start, launchd bootstrap retries, and kickstart. Keep publication recovery on its existing lease-only authority check. Exercise late stop retirement, replaced helper leases, and reassigned native service identity through the generated helper boundary. Co-authored-by: RomneyDa <[email protected]>
Check the pending recovery stop at native dispatch without revoking post-start authority. Carry the existing effect-only callback through launchd activation retries and Windows task startup, preserving repair warning semantics. Prove late stop retirement through the repair CLI and native preparation boundaries, including successful-start self-retirement. Co-authored-by: RomneyDa <[email protected]>
Keep the real launchd-system and exec-file export surfaces while overriding only native ownership and command effects in the stop-authority regressions. Co-authored-by: RomneyDa <[email protected]>
Related: #188303. Backports #172784, #175890 and #188497.
What Problem This Solves
Fixes recovery paths that leave an update-owned Gateway stop unresolved after an interrupted update, recoverable finalization failure, or completed repair on release/2026.11.3.
User Impact
Restore an owned Gateway only after recovery verifies service ownership, runtime identity, and safe state. Operator stops, named data risks, custody grace, process census, and unknown-owner refusals remain intact. Unowned services receive manual-start guidance rather than failing completed maintenance.
This does not establish that every incident in #188303 is resolved. An already-running old updater cannot acquire these fixes retroactively.
Why This Change Was Made
Adapt the three existing fixes to the release’s current-core and inline helper owners. Preserve compatible failure history, accept the release’s actual finalizer response, and select the verified installed ledger/terminal writer before post-core repair can migrate state and fail. No plugin-cohort subsystem, recovery-owner restructuring, release metadata, versions, or production schema change is included.
Preparation base:
1bec8184bcd9849061bedf7f4e5cc9405039801a. The seven commits since original proof basefc9b9635e6d4142ff42d0409f41d7e306f14c5d0do not overlap the backport. Original author and human coauthor credit are preserved.Evidence
6189a2636644a0777df90e8ef26a94b738cb66b0was scoped-clean. Final correction commit:0e783c4874dd14aff32561b81b96370a521ac8a7.Rebased onto release/2026.11.3
2026.11.2 shipped on 2026-11-08 without this PR, so it now targets
release/2026.11.3(base40223c5cc262). Changes from the rebase:docs/install/updating.md, resolved by keeping 11.3's SQLite-probe and Doctor-ownership paragraph alongside this PR's recovery paragraph.23823aff802abecame empty on 11.3 and was dropped.0c3954f8f9c0.update-recovery-guidance.test.ts› "uses raw recovery facts for immediate guidance without replacing history" failed on both the original 11.2 head and the rebase. Its saved fixture usedreason: "state-migration-started", which this PR'supdate-run-read.kernel.tsdeliberately maps tolegacy-state-migrationdata risk, so the guidance correctly said to keep the Gateway stopped. The fixture now uses a non-migration reason, so the test still proves stale history stays out of immediate guidance. No production code changed.Proof on the rebased head:
pnpm tsgo:corepasses.oxfmt --check,oxlintandgit diff --checkpass on all 63 changed files.ClawSweeper P1 and CI repairs
c8b6453dabe6fixes the schema-crossing read (ClawSweeper P1). The staged helper is a copy of the old updater's build (stageManagedHandoffRuntime). If the candidate's Doctor advanced the shared schema before the updater was killed, the helper's first reads, the Gateway stop and this run, failed withSqliteSchemaVersionErrorand recovery never started. On that error, and only that error, the helper now reads and records through the installed runtime, which already owns post-core repair. The newschema-advanceboundary case advances the schema past the staged helper before SIGKILL. Without the fix it fails withhandoff failed: SqliteSchemaVersionError: This OpenClaw build cannot open your existing data.; with it, the Gateway is restored on 2.0.0 and the run finishessucceeded. The fixture's candidate stands in for a newer build by reading the migrated schema, and this is not a real cross-version package migration.mainhas the same staged-reader structure and needs this fix too.d173d3392d04ports the test updates the backport dropped. fix(update): recover stopped gateways after unverified service activation #172784 changedalready-current,candidate-activationandnode-runtimetests together with the restart-after-failure behavior, and those changes are now applied. The Windows triage and foreground-failure cases now expect the observationmainrecords when recovery leaves an untouched service alone. The package-swap risk fixture now carries thedataAtRiskthat release writers set.d173d3392d04:fresh-doctor15/15,windows-lifecycle27/27,failure-recovery25/25,candidate-activation13/13,node-runtime8/8,recovery-guidance28/28, interrupted handoff 14/14,tsgo:core:testclean.update-cli.already-current› "handles changed service owner before already-current convergence" still fails, identically to the 11.3 base40223c5cc262. It's inherited and not caused by this PR.Remaining gates: Exact-head PR CI and packaged actual-candidate upgrade/data-preservation proof remain pending. Native macOS/Windows execution is not established by synthetic manager tests; release validation remains required.
Worked on by
Fewer hard failures (
4d16bb6964b9)openclaw update repair/finalize: when the Gateway does not start or verify after maintenance, repair now completes with a warning namingopenclaw gateway startandopenclaw gateway status --deep, instead of failing the repair. Named data risk and process-cleanup failures still fail.update-repair-service23/23 (expectations updated for warning instead of failure),update-managed-service-handoff-interrupted14/14,cleanup-repair37/37,post-update-recovery34/34,post-update-repair43/43,fresh-doctor15/15,tsgo:core:test, oxlint and oxfmt clean.Live stop authority (
fb6a0b7b01e4)4d16bb6964b9repair-warning semantics and single ownership inspection. Recheck the current helper lease and same-run pending stop after awaited inspection and before recovery startup, including launchd retries. Carry the existing effect-only check through repair CLI, launchd activation, and Windows scheduled-task/fallback startup, without revoking authority after successful startup.