You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(storage): concurrent CLI and daemon writes cause silent data divergence #741
The daemon and the CLI can write to the same SQLite database simultaneously. WAL mode prevents corruption, but the daemon's cursor state and the CLI's parse state diverge silently. The CLI inserts raw records for conversations that the daemon already processed. When the daemon's watcher next inspects those files, the content fingerprint no longer matches the cursor — causing the watcher to skip unchanged files and silently miss new data.
No process-level advisory lock exists. No detection of external writes.
Acceptance criteria
Add file-based advisory lock (e.g. portalocker on the DB file) to prevent concurrent write access
OR have the daemon detect external writes by checking PRAGMA data_version on wakeup
OR route all CLI writes through the daemon (when running) and fall back to direct writes only when the daemon is down
Test: run daemon and CLI write simultaneously, verify no data loss or divergence
Found by
2026-05-03 pre-mortem analysis (wave 7). Related to discussion of daemon-only-writes model vs. library-first architecture.
Activity
Sinity commentedon May 3, 2026
Scope absorbed into #717 (daemon architecture). Concurrent writer coordination is a daemon-vs-CLI architecture concern.