-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
[Bug]: macOS SQLite WAL checkpoints skip fullfsync barriers #99066
Copy link
Copy link
Closed
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:data-lossCan lose, corrupt, or silently drop user/session/config data.Can lose, corrupt, or silently drop user/session/config data.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:data-lossCan lose, corrupt, or silently drop user/session/config data.Can lose, corrupt, or silently drop user/session/config data.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.
Type
Fields
Priority
None yet
Summary
OpenClaw configures SQLite databases for WAL mode and periodic checkpoints, but macOS connections do not enable SQLite's checkpoint fullfsync barrier. On macOS, that leaves WAL checkpoint durability weaker than it needs to be during local store checkpointing.
Real environment observed
openclaw/openclawmainat5bcd25f0fbsrc/infra/sqlite-wal.tsprocess.platformbranches in VitestUser-visible symptom
Users are unlikely to see a normal runtime error. The impact is durability: on macOS, SQLite WAL checkpoints can run without the platform-specific fullfsync barrier, increasing the risk that recently checkpointed local state is less durable across abrupt power loss or OS crashes.
Source-level repro on current main
configureSqliteWalMaintenance.PRAGMA journal_mode = WAL;andPRAGMA wal_autocheckpoint = ...;.PRAGMA checkpoint_fullfsync = 1;before automatic or explicit WAL checkpoints are configured.Expected behavior
On macOS, WAL setup should enable SQLite checkpoint fullfsync so checkpoints use the stronger macOS flush barrier when SQLite supports it.
Actual behavior
WAL setup configures journal mode and checkpoint cadence, but skips the macOS checkpoint fullfsync PRAGMA.
Scope / non-goals
This is scoped to SQLite WAL maintenance setup. It does not change transaction retry logic, checkpoint cadence, rollback mode on unsupported filesystems, or non-macOS behavior.
Proposed fix
After enabling WAL mode, set
PRAGMA checkpoint_fullfsync = 1;only on macOS. Treat unsupported PRAGMA errors as non-fatal so older SQLite builds or unusual environments still proceed with normal WAL setup.