Skip to content

fix(backup): runtime pin store is archived as opaque bytes with a warning on every backup - #197809

Merged
steipete merged 1 commit into
mainfrom
codex/backup-services-store
Nov 12, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/backup-services-store

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: every openclaw backup create (and backups taken around updates) warns SQLite file archived as opaque bytes without a live snapshot or integrity checks: <state>/control/services.sqlite once the Gateway has a runtime pin store.

User Impact

User impact: the managed-service runtime pin store is now backed up like the other OpenClaw-owned SQLite stores: as a verified snapshot with integrity checks, restored with its private control/ directory mode, and without the warning. No configuration change or user action is needed. Released versions are not affected; the store was introduced on main after 2026.11.3 was cut.

Why This Change Was Made

The runtime pin store (control/services.sqlite, added in #172703) is an OpenClaw-owned database, but backup only registers the global, client credential, quarantine and agent databases as core SQLite sources. Every other .sqlite file under the state directory falls through to the opaque path, so this store was copied as raw bytes without a snapshot. This registers it as a core database with its own services role, the same way the client credential store is handled, including emitting its private parent directory before snapshot entries create implicit tar parents. Update capture already covered this store; only backup missed it.

Evidence

  • New src/infra/backup-create.runtime-pins.test.ts: writes a pin through the real withDaemonRuntimePinStore writer, backs up, restores, and checks no opaque warning, restored rows, integrity_check = ok, and a 0700 control/ directory. Red on the base (Received: ["SQLite file archived as opaque bytes ... state/control/services.sqlite"]), green with the fix.
  • Backup, backup command and update-database-restore suites pass locally; tsgo:core clean; test-lines ratchet OK (+43 of 400 allowance).
  • $autoreview (P2) scoped-clean; independent read-only Codex review: no findings.

Found by the daily update-reliability sweep while reviewing backup output on main.

@clawsweeper

clawsweeper Bot commented Nov 12, 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.

@steipete
steipete marked this pull request as ready for review November 12, 2026 15:49
@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: S labels Nov 12, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T15:51:43.335328Z 5177c21 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@steipete
steipete enabled auto-merge (squash) November 12, 2026 15:54
@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. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 12, 2026
@clawsweeper

clawsweeper Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Register the runtime pin database for verified SQLite snapshots and preserve its private parent directory during backup.

Example: Back up control/services.sqlite containing gateway runtimePath /synthetic/node.

  • Before: The database is copied as opaque bytes with a warning and no live snapshot guarantee.
  • After: The existing snapshot pipeline captures the database without that warning and preserves control directory permissions.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused implementation and meaningful integration regression support correctness; the required real-behavior evidence gate remains unmet.
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: Backups warn about the runtime pin database and copy it without the consistency guarantees applied to other owned SQLite stores.
Reason: The maintainer-authored direction restores the existing managed-backup contract with a focused change and no new user setting.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: current main still misses this owned database, and the focused fix introduces no identified correctness defect.

Priority: P2
Reviewed head: 5177c21da79e9be02218fc3320085b4b65148db9

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Provide redacted shipped-CLI create --verify and restore output for a populated runtime pin store, showing no opaque warning, retained rows, integrity success, and private control directory permissions.
Agent review details

How this fits together

The backup inventory classifies state files before SQLite capture and archive traversal; registered databases become verified snapshots that the existing restore command extracts.

flowchart LR
  A[Runtime pin store] --> B[Backup resource inventory]
  B --> C[Verified SQLite snapshot]
  C --> D[Backup archive]
  E[Private directory metadata] --> D
  D --> F[Backup restore]
Loading

Technical review

Best possible solution:

Use the existing managed SQLite snapshot pipeline for runtime pins while retaining opaque handling for unrelated databases.

Do we have a high-confidence way to reproduce the issue?

Current-main ownership discovery deterministically classifies this unregistered SQLite path as opaque; the submitted test reports the matching base failure, but this review executed no reproduction.

Is this the best way to solve the issue?

This is the smallest complete fix: register the existing owner, propagate its internal role, and reuse private-directory ordering without adding another capture path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 7b75336b789c.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 4706053 adds src/infra/backup-create.ts:504 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4706053bc398; files: src/infra/backup-create.ts)
  • Ayaan Zaidi: Raw commit b10035f adds src/infra/backup-sqlite-snapshot.ts:338 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: b10035faa9d3; files: src/infra/backup-sqlite-snapshot.ts)

PR surface

Source +16, Tests +43. Total +59 across 5 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 4 20 4 +16
Tests 1 43 0 +43
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 63 4 +59

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 P2: An owned database on main lacks managed snapshot guarantees during ordinary backup; the fix is narrow and the supplied stable release lacks this store.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab 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:

  • P2: An owned database on main lacks managed snapshot guarantees during ordinary backup; the fix is narrow and the supplied stable release lacks this store.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab 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 12, 2026, 11:05 AM ET / 16:05 UTC.

@steipete
steipete merged commit c827f97 into main Nov 12, 2026
216 of 219 checks passed
@steipete
steipete deleted the codex/backup-services-store branch November 12, 2026 16:20
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash auto-merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S 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