Repository navigation
fix(update): recover migrated Gateways after verification failure - #175890
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 maintainer review before merge. What this changesAllow schema-checked Gateway recovery after normal Doctor completion and preserve filesystem causes in backup-cleanup warnings. Example: Doctor completes normally, databases migrate, and subsequent Gateway verification fails.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it narrowly repairs a current recovery-admission defect, preserves existing safety restrictions, and introduces no identified correctness bug. Priority: P1 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe update finalizer consumes package, migration, and stopped-service observations, then coordinates safe recovery and publishes durable update outcomes. flowchart TD
A[Update finalizer] --> B[Recovery admission]
B --> C[Candidate schema inspection]
C --> D[Owned service restart]
D --> E[Readiness verification]
A --> F[Package backup cleanup]
E --> G[Update report]
F --> G
Technical reviewBest possible solution: Retain this focused recovery fix and diagnostic improvement, with acceptance through the existing published-driver update boundary. Do we have a high-confidence way to reproduce the issue? Source establishes that normal Doctor completion without settlement or rollback steps rejects recovery despite available candidate schemas; the author reports a failing-before/passing-after composed regression, which was inspected but not executed. Is this the best way to solve the issue? The patch is the smallest complete repair for the demonstrated admission defect: it reaches existing schema and service owners while preserving their restrictions, and uses the existing error formatter for cleanup diagnostics. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7badd73ed357. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +2, Tests +30, Docs +7. Total +39 across 5 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 October 17, 2026, 6:59 PM ET / 22:59 UTC. |
…enclaw#175890) After an update migrated state and activated the new package (state-migrated-no-rollback), a later failure such as package-backup-retention left the Gateway stopped (stopped-free): final recovery required a Doctor settlement receipt, which a normal Doctor completion may omit, so it never reached the candidate schema check. Recovery now admits that case through the existing candidate schema inspection, restarts the owned Gateway on the migrated candidate and verifies it. Backup-retention warnings now include the underlying filesystem cause (e.g. EPERM/EBUSY). Fixes openclaw#175865
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]>
* fix(update): backport managed recovery to 2026.11.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]> * fix(update): retain manual guidance for nonowned services 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]> * fix(update): retain terminal outcomes after post-core failure 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]> * test(update): keep the raw-recovery guidance fixture off the legacy migration 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. * fix(update): read interrupted-update history after a candidate schema 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. * test(update): port recovery expectations for the managed recovery backport 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. * fix(update): report unrestored Gateways as repair warnings 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. * fix(update): recheck stop authority before recovery startup 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]> * fix(update): retain repair stop authority through native startup 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]> * test(update): preserve native authority mock exports 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]> --------- Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: RomneyDa <[email protected]> Co-authored-by: Dallin Romney <[email protected]>
Fixes #175865
What Problem This Solves
After state migration, an unverified activation could leave the installed Gateway stopped and report
verifying: exit unknown,package-backup-retention: exit 1, andstate-migrated-no-rollback.User Impact
Recovery can start and verify the installed candidate after normal Doctor completion. Verified activation still succeeds when obsolete backup removal is blocked; its warning now preserves the filesystem cause and retained path. The original verification failure remains visible when recovery cannot establish that the whole update completed successfully.
Why This Change Was Made
A normal, fully settled Doctor often emits no process-settlement step. Forward recovery incorrectly required that step or a database-rollback attempt before it would inspect the candidate schemas. The existing recovery owner now admits that inspection when candidate schema metadata is available, then uses its existing migration check, owned-service restart, and health verification. Failed writer settlement, other named data risks, foreign services, and restored databases retain their existing restrictions.
The package cleanup owner already bounds obsolete backup work and classifies ordinary filesystem errors as maintenance warnings. Its fallback discarded the deletion and rename causes. Both are now included, including
EPERMandEBUSY, without adding retries or changing backup custody.Evidence
stopped-free. Afterward, the same real retained package transaction and finalization path recover and verify the candidate. The focused new case takes 827 ms of test time; the complete invocation took 90.26 s including a 63.1 s runtime build.EPERMduring removal andEBUSYduring fallback rename. It checks that the candidate and launcher remain active, the old backup remains retained, the persisted run succeeds, and the report includes both causes. The pre-fix run failed because those causes were missing.v2026.10.3driver already recordscandidateSchemaVersionsinupdate-command-execution.tsand carries it through the existing migrated-worker handoff. No new driver marker or input field is required. This is source compatibility evidence, not a claimed live Windows upgrade.node scripts/run-vitest.mjs <38 importer files in original discovery order> --maxWorkers=2: 858 passed, 37 files passed, one existing file / six tests skipped; exit 0 in 747.52 s. The three runtime groups reported 436 + 260 + 162 passing tests. Exact imports were discovered from the two changed production owners plus theirupdate-command-service/package-update-swapbarrels.tsgo, type-aware Oxlint on all four TypeScript files, Oxfmt,git diff --check, the line-cap ratchet, MDX validation, and Madge (zero cycles) passed.check:changedwas replaced with the campaign-authorized targeted checks; its SQLite inventory was skipped for time. PR CI supplies broad proof.Production: +6/-4 (net +2). Tests: +41/-11 (net +30). Documentation: +7/-0. The test growth extends two existing scenario tables to cover the missing recovery and error-reporting contracts.
Existing slow files (summed test time):
src/cli/update-cli/update-command-original-service.test.ts: 182.674 s.src/cli/update-cli/update-command-database-rollback.test.ts: 164.438 s.src/cli/update-cli.windows-lifecycle.test.ts: 153.314 s.src/cli/update-cli/update-command-lease.test.ts: 138.372 s.src/cli/update-cli.service-authority.test.ts: 123.326 s.These unchanged scenarios repeatedly exercise real package/database copies and native-process lifecycle fixtures. The campaign's pre-existing slow-suite exception applies; no timeout, retry, skip, or baseline was changed. CI timings are not yet available.