Skip to content

fix(sqlite): prevent snapshot WAL growth under writes - #113385

Merged
vincentkoc merged 1 commit into
mainfrom
fix/sqlite-destructive-reliability-20260724
Jul 24, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/sqlite-destructive-reliability-20260724

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

Related: #113306

What Problem This Solves

Fixes an issue where creating SQLite snapshots while OpenClaw was actively writing could hold a long-lived read snapshot, preventing WAL reuse and allowing disk usage to grow for the duration of compaction.

Why This Change Was Made

Snapshot creation now verifies the live database, captures it with SQLite's incremental online backup API, closes the live connection, then normalizes and compacts the private copy before publication. The staged copy is explicitly switched to rollback journaling so the portable artifact remains one sidecar-free file.

User Impact

Operators can snapshot and archive busy OpenClaw databases with shorter live read-lock windows while retaining committed WAL state, deleted-page scrubbing, full integrity checks, atomic publication, and portable single-file restore artifacts.

Evidence

  • Blacksmith Testbox tbx_01kyaphwmjxdhezkyrp9cy49jb: src/infra/sqlite-snapshot.test.ts and src/infra/backup-create.test.ts, 93 passed and 2 Windows-only tests skipped on Linux.
  • Path-scoped pnpm check:changed: core and core-test typecheck, lint, database-first guards, import-cycle checks, and docs formatting passed.
  • Regression proof covers committed WAL capture, journal_mode=delete, absent -wal/-shm sidecars, deleted-byte removal, unsafe-index rejection, and archive sanitization.
  • Fresh structured autoreview: clean, no accepted or actionable findings, confidence 0.88.
  • Testbox workflow: https://github.com/openclaw/openclaw/actions/runs/30117502977

@vincentkoc vincentkoc self-assigned this Jul 24, 2026
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: XS maintainer Maintainer-authored PR labels Jul 24, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review July 24, 2026 18:52
@vincentkoc
vincentkoc merged commit f1afaa3 into main Jul 24, 2026
198 of 201 checks passed
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

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 maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant