Repository navigation
fix(update): supervised PostgreSQL updates ignore server recovery captures and orphan them on finish - #198469
Conversation
Retire PostgreSQL schema captures through the existing snapshot owner before removing supervised update backup manifests. Keep cleanup best effort: preserve the directory on discard failure, warn, and allow update finish to retry. Cover ordered retirement, failure and retry through the real finish command, plus a skip-gated PostgreSQL migrate-to-finish lifecycle case. Rolled-back receipts retain their captures under the existing recovery policy. Co-authored-by: steipete <[email protected]> Co-authored-by: qingminglong <[email protected]>
|
🦞👀 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: blocked before merge. What this changesThis PR makes supervised PostgreSQL migrations honor server recovery captures and retire them safely when the update finishes. Example: Run supervised migration with database.postgres.recoveryCaptures set to "server" and a PostgreSQL Workboard store.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this maintainer-authored PR addresses a verified current-main bug and completes supervised server-capture retirement through the existing cleanup owner. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe supervised update CLI receives configuration and a backup root, captures databases before Doctor migration, and records a receipt used by restore or finish. flowchart TD
A[Configured recovery policy] --> B[Supervised migrate]
B --> C[Existing database backup owner]
C --> D[Portable shared state capture]
C --> E[PostgreSQL server capture]
D --> F[Recovery receipt]
E --> F
F --> G[Restore or accepted update finish]
G --> H[Existing schema retirement owner]
Technical reviewBest possible solution: Use the existing capture and retirement owners throughout supervised updates while preserving portable defaults, portable exceptions, and rollback retention. Do we have a high-confidence way to reproduce the issue? Current main omits the option that selects server captures, and #198401 supplies matching real-run observations; no target code was executed during this review. Is this the best way to solve the issue? The invariant is that server captures retain their manifests until rollback retention or accepted-update retirement settles; forwarding the existing option and invoking the existing cleanup owner is the smallest complete production fix. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f3957e8653e5. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +20, Tests +166. Total +186 across 3 files. Added test files: 0. 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. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. 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 Reviewed November 13, 2026, 4:51 PM ET / 21:51 UTC. |
|
Merged via squash.
|
…tures and orphan them on finish (openclaw#198469) * fix(update): honor server recovery captures in supervised migrations * fix(update): retire supervised PostgreSQL recovery captures Retire PostgreSQL schema captures through the existing snapshot owner before removing supervised update backup manifests. Keep cleanup best effort: preserve the directory on discard failure, warn, and allow update finish to retry. Cover ordered retirement, failure and retry through the real finish command, plus a skip-gated PostgreSQL migrate-to-finish lifecycle case. Rolled-back receipts retain their captures under the existing recovery policy. Co-authored-by: steipete <[email protected]> Co-authored-by: qingminglong <[email protected]> --------- Co-authored-by: qingminglong <[email protected]> Co-authored-by: steipete <[email protected]>
…tures and orphan them on finish (#198469) * fix(update): honor server recovery captures in supervised migrations * fix(update): retire supervised PostgreSQL recovery captures Retire PostgreSQL schema captures through the existing snapshot owner before removing supervised update backup manifests. Keep cleanup best effort: preserve the directory on discard failure, warn, and allow update finish to retry. Cover ordered retirement, failure and retry through the real finish command, plus a skip-gated PostgreSQL migrate-to-finish lifecycle case. Rolled-back receipts retain their captures under the existing recovery policy. Co-authored-by: steipete <[email protected]> Co-authored-by: qingminglong <[email protected]> --------- Co-authored-by: qingminglong <[email protected]> Co-authored-by: steipete <[email protected]> (cherry picked from commit 6fc8970) Co-authored-by: RomneyDa <[email protected]>
Closes #198401
Supersedes #198435
What Problem This Solves
Fixes: with
database.postgres.recoveryCaptures: "server", supervisedopenclaw update migrateexported every PostgreSQL store to local files while the Gateway was stopped, extending downtime, andupdate finishwould orphan server-side captures if they were made.User Impact
User impact: supervised PostgreSQL updates honor the configured server recovery captures (shorter stopped window, no local export copies), and finishing the update retires those server captures instead of leaving
restore_<uuid>schemas behind. Cleanup stays best effort: if retirement fails, the update still succeeds, the backup is kept, and a warning says to retryupdate finish.Why This Change Was Made
Builds on @qingminglong's #198435, which forwards the existing setting to the supervised migrate backup, matching the native updater. That alone would keep rows in server schemas whose only references are the local backup manifests, and
update finishdeletes those manifests without dropping the schemas. Finish now retires them through the existingdiscardPostgresSchemaCapturesowner (the same one the native updater uses) before removing the backup directory; a failure keeps the manifests so a retry can finish, andDROP SCHEMA IF EXISTSkeeps retries idempotent. Doctor's capture pruning cannot reclaim these because supervised captures lack its prefix marker.Rolled-back (restored) receipts keep their captures under the existing rollback retention contract; no retention policy change.
Evidence
update-command-migrate.test.ts(real finish command, discard owner mocked at its module boundary): red on fix(update): honor server recovery captures in supervised migrations #198435's head (discard never called), green with the fix; covers ordering before directory removal, discard failure keeping the directory with a warning, and retry.update-command-migrate.test.ts22 passed (including fix(update): honor server recovery captures in supervised migrations #198435's tests);update-command-database-retention.test.ts15 passed.retires server captures through supervised migrate and finish(13.124 s). The adjacent existing exact-capture→rollback→retirement test also passed (6.696 s), preserving the frozen capture and row verification. This remains in-process boundary proof (Doctor is stubbed), not an installed CLI upgrade.95500ea9c4c879cb4f302cb6e8e3f09615da982a. Remaining gap: no installed v2026.11.3→candidate supervised CLI upgrade with existing portable captures. No schema, receipt format, or default-policy change is introduced; portable defaults and shared-state exceptions remain unchanged.git diff --checkpass.Thanks @qingminglong for spotting the missing option and the parity test; your commit is kept as-is with authorship.
Work sessions
Linked for team reference; these sessions aren’t public.