Repository navigation
fix(sqlite): prevent snapshot WAL growth under writes - #113385
Merged
Merged
Conversation
vincentkoc
marked this pull request as ready for review
July 24, 2026 18:52
Member
Author
|
Merged via squash.
|
This was referenced Jul 24, 2026
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Jul 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
tbx_01kyaphwmjxdhezkyrp9cy49jb:src/infra/sqlite-snapshot.test.tsandsrc/infra/backup-create.test.ts, 93 passed and 2 Windows-only tests skipped on Linux.pnpm check:changed: core and core-test typecheck, lint, database-first guards, import-cycle checks, and docs formatting passed.journal_mode=delete, absent-wal/-shmsidecars, deleted-byte removal, unsafe-index rejection, and archive sanitization.