Skip to content

fix(update): supervised PostgreSQL updates ignore server recovery captures and orphan them on finish - #198469

Merged
VACInc merged 2 commits into
mainfrom
roboclaw/fix-198401-server-captures
Nov 18, 2026
Merged

VACInc merged 2 commits into
mainfrom
roboclaw/fix-198401-server-captures

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #198401
Supersedes #198435

What Problem This Solves

Fixes: with database.postgres.recoveryCaptures: "server", supervised openclaw update migrate exported every PostgreSQL store to local files while the Gateway was stopped, extending downtime, and update finish would 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 retry update 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 finish deletes those manifests without dropping the schemas. Finish now retires them through the existing discardPostgresSchemaCaptures owner (the same one the native updater uses) before removing the backup directory; a failure keeps the manifests so a retry can finish, and DROP SCHEMA IF EXISTS keeps 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

  • New finish regression in 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.ts 22 passed (including fix(update): honor server recovery captures in supervised migrations #198435's tests); update-command-database-retention.test.ts 15 passed.
  • The PostgreSQL migrate→finish lifecycle case ran and passed against a real PostgreSQL service in CI, not skipped: PostgreSQL conformance (1/3), run 43512134482, 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.
  • All 52 PR checks passed on 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.
  • Type-aware oxlint and format check of touched files, git diff --check pass.

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.

qingminglong and others added 2 commits November 13, 2026 21:19
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]>
@clawsweeper

clawsweeper Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: M labels Nov 13, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 13, 2026
@clawsweeper

clawsweeper Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This 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.

  • Before: The rollback capture exports Workboard rows to a local database.sqlite file.
  • After: Rows stay in a server-side restore_<uuid> schema, which finish drops before removing its local manifests.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The production repair is focused and has no identified correctness defect, but the supplied evidence does not establish the changed supervised PostgreSQL behavior or upgrade compatibility.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Supervised PostgreSQL updates ignore the selected server-capture policy, extending downtime and consuming local disk.
Reason: The existing documented option establishes the expected behavior, and the maintainer-authored change completes its supervised lifecycle without adding configuration or changing retention policy.

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
Reviewed head: 95500ea9c4c879cb4f302cb6e8e3f09615da982a

Before merge

  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Low-value test src/cli/update-cli/update-command-migrate.test.ts: Remove the argument-forwarding group at lines 691–721: it replaces backup creation with a throwing mock and asserts internal fields, while the added PostgreSQL lifecycle test verifies observable server-carrier selection.
  • Missing end-to-end proof: Supply redacted supervised PostgreSQL CLI evidence for capture creation, restore, finish, cleanup-failure retry, and an upgrade from v2026.11.3 with settings, rows, and existing portable captures intact.
Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Mitchell Etzel: Raw commit 2ff4256 adds src/snapshot/database-backup.ts:269 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2ff4256ae377; files: src/snapshot/database-backup.ts)
  • Peter Steinberger: Raw commit 61bfde1 adds src/cli/update-cli/update-command-migrate.ts:206 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 61bfde18d87b; files: src/cli/update-cli/update-command-migrate.ts)

PR surface

Source +20, Tests +166. Total +186 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 27 7 +20
Tests 2 166 0 +166
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 193 7 +186

Preflight source

Source 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 cluster

Relationship: fixed_by_candidate
Canonical: #198401
Summary: This PR addresses the canonical supervised capture-policy bug and completes the lifecycle missing from the earlier candidate.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add P2: The bug adds update downtime and local disk usage in an advanced supervised PostgreSQL workflow, without demonstrated data corruption.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.

Label justifications:

  • P2: The bug adds update downtime and local disk usage in an advanced supervised PostgreSQL workflow, without demonstrated data corruption.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 13, 2026, 4:51 PM ET / 21:51 UTC.

@VACInc VACInc self-assigned this Nov 18, 2026
@VACInc
VACInc merged commit 6fc8970 into main Nov 18, 2026
142 checks passed
@VACInc
VACInc deleted the roboclaw/fix-198401-server-captures branch November 18, 2026 20:45
@VACInc

VACInc commented Nov 18, 2026

Copy link
Copy Markdown
Member

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 19, 2026
…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]>
RomneyDa added a commit that referenced this pull request Nov 19, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: update migrate ignores database.postgres.recoveryCaptures "server" and exports every PostgreSQL store locally

3 participants