Repository navigation
docs: document isolated PostgreSQL restore drills - #202704
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 maintainer review before merge. What this changesDocuments an isolated PostgreSQL archive restore drill and links it from the backup CLI reference. Example: Restore backup.tar.gz into staging while the source Gateway retains its ownership lock.
Review scores
ProductKind: Docs · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open for merge: it documents a useful, existing restore path accurately, and no actionable defects were found. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe backup CLI verifies an archive, acquires ownership of its selected state directory, and imports captured PostgreSQL stores into fresh namespaces using the staging connection. flowchart TD
A[Trusted backup archive] --> B[Restore CLI]
C[Isolated CLI state and config] --> B
D[Staging connection environment variable] --> B
B --> E[Fresh filesystem target]
B --> F[Dedicated staging database]
G[Source Gateway retains its own state] --> H[Source installation continues running]
Technical reviewBest possible solution: Merge the single canonical drill procedure and its CLI-reference link. Do we have a high-confidence way to reproduce the issue? Source inspection confirms the ownership failure described in the PR and why the documented environment overrides avoid it; no target code was executed during this read-only review. Is this the best way to solve the issue? The guide is the smallest complete correction: it explains existing selectors and restore behavior without adding runtime machinery or changing ownership policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4b74fd5a979d. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceDocs +29. Total +29 across 2 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. 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 20, 2026, 3:22 PM ET / 20:22 UTC. |
|
Merged via squash.
|
Co-authored-by: VACInc <[email protected]>
(cherry picked from commit 3d91af2) Release adaptation: regenerate config docs hashes for this stable tree using config:docs:gen; config:docs:check passed. No config migration or anchor rename. Companions: no later PR or SHA mentions. Later same-path overlaps are unrelated config baseline regeneration, PostgreSQL operations/docs, or qualification tooling; #202109 is independent upgrade coverage, #202704 is a restore guide, and #202654 is a Session Share feature. Existing anchor selection and numeric aggregate fix #202629 are unchanged. Co-authored-by: VACInc <[email protected]> Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit abc82993e59c1632ddfcaece8a02ce15c432e990)
…law#194384) * docs: clarify PostgreSQL conformance coverage * fix(cron): keep one-shot finalization working on PostgreSQL 16 * test(database): reuse cron conformance for JSON conversion regression * test(postgres): accept fractional explain row counts (cherry picked from commit 7ab0143) Release adaptation: Only engine-owned jsonValue and retained cron enabled JSON replacement; preserve native boolean type with PG16 explicit ::json and SQLite json(). Omit unrelated PG docs/EXPLAIN test edits; retained one-shot enabled-transition caller present on baseline. Follow-up dispositions: e029e18 docs: document isolated PostgreSQL restore drills (openclaw#202704); 49f0740 fix(database): report disabled memory after a port (openclaw#202630); a80b564 fix: keep database workers healthy after silent connection loss (openclaw#201856); 3d91af2 fix(config): reject reserved PostgreSQL schema prefixes (openclaw#202097); 835d722 fix: catch incompatible ownership before porting to SQLite (openclaw#202101); 67796a6 fix: keep scheduled Git backups current on PostgreSQL (openclaw#201870); cc849dd fix: recover lease heartbeats after a PostgreSQL connection loss (openclaw#201858); 6594caf fix: prepare macOS runtime pins without the PostgreSQL secret (openclaw#202102); 6ca56cd docs: clarify PostgreSQL storage and backup coverage (openclaw#202086); a079190 fix(postgres): chat history slows under concurrent reads (openclaw#190129); 2ff4256 feat(database): keep PostgreSQL rollback captures in PostgreSQL (openclaw#196236); 96c685b feat(backup): restore PostgreSQL stores into a staging database for restore drills (openclaw#194808); fb83d65 fix: reduce transcript allocation when preparing native context seeds; 71ec4d2 fix(config): keep Workboard PostgreSQL upgrades readable (openclaw#194648); b6ed907 perf(sessions): persist active transcript facts for hydration (openclaw#193682) Validation: Baseline cron generated json(bound text) on PostgreSQL where json(text) is unavailable; helper and focused boolean regression retained. Exact PostgreSQL16 server proof unavailable; focused SQLite/helper tests queued. diff check passed. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 38fdd9b52704d588d9ca24ef8e391d644961c985) (cherry picked from commit fb935e6912388314851b05cb698ef038b83bbd07)
Summary
High Level TLDR
The PostgreSQL restore guide now shows how to rehearse a full archive restore while the source Gateway keeps running. Use separate CLI state and config paths, a fresh filesystem target, and a dedicated staging database. The backup CLI reference links to the procedure.
Root Cause
Archive restore takes offline ownership of the state directory selected by the CLI.
--postgres-connection-envchanges the PostgreSQL import connection, so running with the source profile still encounters the running Gateway's ownership lock. On the base commit, the CLI returned “requires exclusive offline state ownership” even with a separate restore target and staging database.Real behavior proof
On disposable PostgreSQL 18,
openclaw backup create --no-include-workspace --verifyproduced the archive. A second process held the source Gateway ownership lock throughout both attempts. The restore from the source profile exited 1, cleaned its incomplete target, and preserved the archive.I ran the new guide's shell example against the same archive. The backup parser and command handlers ran from source. The output included:
The restore exited 0. Readback found the restored file and row, the new anchor's namespace only in the staging database, and the archived connection reference in the restored config. The source process still held its lock.
What was not tested
Gateway boot, restored installation activation, and paid model calls were outside the drill. The fixture held the real Gateway ownership lock without starting the full Gateway. The backup outcome ledger emitted a best-effort warning in the fixture.
Verification
git diff --checkpassed.oxfmt --check docs/cli/backup.md docs/gateway/postgresql.mdpassed.Evidence
The simplification pass retained one restore drill procedure and linked it from the CLI reference. The local autoreview helper prepared the complete docs diff at P0–P3 but its isolated Codex launcher could not start. Hosted ClawSweeper review is the fallback.