Files
Profa 9df4dd2758 fix: prevent SQLite corruption from concurrent writers — centralized safe-db opener
Root cause: 40+ places opened memory.db with `new Database()` without WAL mode
or busy_timeout. When 10 Claude Code hooks spawn separate processes that
concurrently write to the DB, rollback journal mode causes page-level corruption.

Fix: Created v3/src/shared/safe-db.ts with openDatabase() that enforces
WAL + busy_timeout=5000 on every open. Replaced all 28 direct new Database()
calls across v3/src (22 files), hooks (1 file), helpers (2 files), and
scripts (2 files). Only remaining direct call is the UnifiedMemoryManager
singleton which already sets WAL + busy_timeout itself.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 10:35:05 +00:00
..