Skip to content

docs: document isolated PostgreSQL restore drills - #202704

Merged
VACInc merged 1 commit into
openclaw:mainfrom
VACInc:docs/postgres-restore-drill
Nov 21, 2026
Merged

VACInc merged 1 commit into
openclaw:mainfrom
VACInc:docs/postgres-restore-drill

Conversation

@VACInc

@VACInc VACInc commented Nov 20, 2026

Copy link
Copy Markdown
Member

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-env changes 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 --verify produced 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:

PostgreSQL stores imported through: $STAGING_PG_DSN

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 --check passed.
  • oxfmt --check docs/cli/backup.md docs/gateway/postgresql.md passed.
  • The repository-wide anchor audit reported seven errors on untouched pages. Neither changed page nor either new link appeared in the diagnostics.

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.

@clawsweeper

clawsweeper Bot commented Nov 20, 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 docs Improvements or additions to documentation gateway Gateway runtime labels Nov 20, 2026
@VACInc
VACInc marked this pull request as ready for review November 20, 2026 20:07
@clawsweeper clawsweeper Bot added clawsweeper:intake:docs Preliminary submission classification; full source review pending. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:docs Preliminary submission classification; full source review pending. labels Nov 20, 2026
@clawsweeper

clawsweeper Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

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

  • Before: Using the source CLI profile fails with “requires exclusive offline state ownership,” even with STAGING_PG_DSN.
  • After: The guide selects separate CLI state and config paths, restores into a fresh target, and keeps the restored installation offline.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful, source-verified documentation with a concrete reported PostgreSQL drill and no actionable findings.
Proof confidence 🐚 platinum hermit (4/6) Docs-only changes require no new runtime proof; the supplied source-parser PostgreSQL drill additionally exercises ownership isolation and staging imports, with its full-Gateway limitation stated explicitly.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Docs · Worth it: Yes · Fix scope: Complete
User problem: Operators following the staging-restore guidance can still encounter the running source Gateway's ownership lock.
Reason: The maintainer-authored procedure makes an existing capability usable while preserving offline custody, secret-provider restrictions, and explicit activation.

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
Reviewed head: e0749d5a80246bfb0823acd2098868f8d55ac2cf

Before merge

None.

Findings

None.

Agent review details

How this fits together

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

Technical review

Best 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

  • PostgreSQL staging restore guidance keeps the original intent (96c685b: Allow imports into a separate staging database without rewriting archived configuration or bypassing secret-provider restrictions.)
  • Offline restore and online backup distinction keeps the original intent (f7b61f0: Permit online archive capture while retaining exclusive offline custody for restore operations.)
  • Scheduled Git backup wording keeps the original intent (67796a6: Use online per-store snapshots for scheduled Git capture while retaining offline restore requirements.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit b7bb85a adds docs/gateway/postgresql.md:385 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b7bb85afb9cb; files: docs/gateway/postgresql.md)

PR surface

Docs +29. Total +29 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 2 36 7 +29
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 36 7 +29

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.

Labels

Label changes:

  • add P3: Focused documentation improvement for an advanced operator restore workflow, with no runtime changes.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: Focused documentation improvement for an advanced operator restore workflow, with no runtime changes.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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 20, 2026, 3:22 PM ET / 20:22 UTC.

@VACInc
VACInc merged commit e029e18 into openclaw:main Nov 21, 2026
137 checks passed
@VACInc

VACInc commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Merged via squash.

@VACInc
VACInc deleted the docs/postgres-restore-drill branch November 21, 2026 02:40
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 21, 2026
tideclaw-bot pushed a commit that referenced this pull request Nov 24, 2026
(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)
maplel pushed a commit to maplel/openclaw that referenced this pull request Nov 24, 2026
…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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant