Skip to content

fix(sqlite): recover snapshots after killed rollback writers - #113580

Merged
vincentkoc merged 1 commit into
mainfrom
fix/sqlite-state-durability-20260725
Jul 25, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/sqlite-state-durability-20260725

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

Related: #113306

What Problem This Solves

Fixes an issue where operators creating a SQLite backup after an abrupt process kill could see snapshot creation fail when the source retained a hot rollback journal, even though SQLite could safely recover the committed state.

Why This Change Was Made

Snapshot reads continue to prefer SQLite's online backup protocol. When SQLite specifically rejects a read-only open and a rollback journal is still present, OpenClaw now copies a stable database/journal pair into a private directory and lets SQLite recover only that copy. The source database family remains byte-for-byte untouched, races retry once, and multi-database super-journal residue fails closed instead of risking incomplete cross-database recovery.

User Impact

Backups can capture the last committed state after a killed rollback-journal writer without requiring a writable recovery open or modifying the live database files. Unsafe multi-database crash residue returns an explicit error.

Evidence

  • Blacksmith Testbox tbx_01kyc5s73srg4vk49f4ec2ramh, Actions run 30150931566:
    • 141 focused tests passed; 2 Windows-only tests skipped on Linux.
    • Real SIGKILL hot-journal snapshot recovery passed.
    • Super-journal private-recovery refusal passed.
    • Stale-journal and journal-appearance race coverage passed.
    • SQLite reliability smoke passed: crash recovery, snapshot publication interruption, restore interruption, repository interruption, WAL sentinel/bounds, interrupted VACUUM, compaction, and post-compaction restore.
    • pnpm check:changed passed for core, coreTests, and docs, including formatting, typechecks, lint, and database-first guards.
  • Fresh Codex autoreview: clean, no accepted/actionable findings.
  • git diff --check passed.

@vincentkoc vincentkoc self-assigned this Jul 25, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels Jul 25, 2026
@vincentkoc
vincentkoc force-pushed the fix/sqlite-state-durability-20260725 branch from f57a68b to 39c15a1 Compare July 25, 2026 08:29
@vincentkoc
vincentkoc marked this pull request as ready for review July 25, 2026 08:34
@vincentkoc
vincentkoc force-pushed the fix/sqlite-state-durability-20260725 branch from 39c15a1 to bae3a77 Compare July 25, 2026 08:36
@vincentkoc vincentkoc closed this Jul 25, 2026
@vincentkoc vincentkoc reopened this Jul 25, 2026
@vincentkoc
vincentkoc merged commit e43d688 into main Jul 25, 2026
147 of 165 checks passed
@vincentkoc
vincentkoc deleted the fix/sqlite-state-durability-20260725 branch July 25, 2026 08:47
@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

maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant