Repository navigation
fix: harden SQLite lock handling and WAL retention - #335
Merged
Merged
Conversation
edheltzel
approved these changes
Oct 17, 2026
edheltzel
left a comment
Owner
There was a problem hiding this comment.
64MiB should be large enough but we might consider bumping this to 128 or 256MiB per session run.
edheltzel
force-pushed
the
harden/sqlite-pragmas
branch
from
October 17, 2026 14:12
711054e to
c82471e
Compare
edheltzel
pushed a commit
that referenced
this pull request
Oct 17, 2026
* fix(db): busy_timeout before WAL and cap journal size on every writer (#212, #192) * docs(db): journal_size_limit truncates after checkpoint, not a hard WAL cap (#192) * no-mistakes(test): Prevent concurrent SQLite schema failures during crash recovery * no-mistakes(document): Clarify SQLite locking and WAL retention documentation --------- Co-authored-by: Atlas-Key <296298943+Atlas-Key@users.noreply.github.com>
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.
What Changed
Risk Assessment
Testing
Installed locked dependencies, built CLI/MCP runtime, ran focused SQLite checks, and drove eight isolated product scenarios successfully, including 20 crash-recovery rounds. Saved transcripts and database-state evidence, then cleaned disposable data and build output. Extraction used a local protocol fixture; the WAL comparison used an unlimited-policy control on the same product.
Evidence: Product transcript
Evidence: MCP WAL comparison
Evidence: Persisted state
Evidence: Runtime SQLite settings
Pipeline
Updates from git push no-mistakes
⏭️ **intent** - skipped
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
src/db/connection.ts:30- Simplification: harden: bound WAL growth — centralize journal_size_limit across all Recall DB writers #192 explicitly requests a shared pragma helper, but the new journal-limit policy has ten separate hook copies alongside this constant. No requirement needs these parallel definitions. Remove the copies by defining the common setup under hooks/lib and consuming it from both CLI and hooks. Other sites: hooks/RecallExtract.ts:862, hooks/RecallPreCompact.ts:346, hooks/lib/consolidate-core.ts:108, hooks/lib/extraction-lock.ts:18, hooks/lib/extraction-migration.ts:12, hooks/lib/extraction-semaphore.ts:15, hooks/lib/extraction-tracker.ts:11, hooks/lib/session-progress.ts:18, hooks/lib/session-start-context.ts:93, hooks/lib/sqlite-writers.ts:59.tests/hooks/extract-core.test.ts:488- The edited suite retains two source-content-only tests: these assertions inspect RecallExtract.ts text, and tests/hooks/extract-core.test.ts:499 inspects extract-core.ts text. Neither executes the claimed behavior; commented or unreachable calls can satisfy the positive assertions. Under the explicit test-quality rule for directly encountered tests, remove both tests or replace them with isolated execution that asserts actual files and side effects.src/lib/memory.ts:295- Concurrent crash recovery intermittently rejects a realrecall add breadcrumbcommand withSQLITE_SCHEMA: vtable constructor failed: breadcrumbs_fts. One of seven attempts without instrumentation persisted only five of six requested breadcrumbs. Concurrent recovery remains unreliable; whether this predates the change was not established.bun install --frozen-lockfile./node_modules/.bin/tsup src/index.ts --format esm --external bun:sqlite./node_modules/.bin/tsup src/mcp-server.ts --format esm --external bun:sqlitebun test tests/db/pragmas.test.ts tests/hooks/sqlite-writers-concurrency.test.tswith isolated HOME and Recall pathsbun test tests/hooks/extract-core.test.ts --test-name-pattern 'exclusively locked'with isolated HOME and Recall pathsbun ~/.no-mistakes/evidence/01M52TP6ZQ2ARNP0T3RN3BBG9G/validate-sqlite.tsbun ~/.no-mistakes/evidence/01M52TP6ZQ2ARNP0T3RN3BBG9G/validate-sqlite.ts --hooks-onlyafter correcting fixture setupbun ~/.no-mistakes/evidence/01M52TP6ZQ2ARNP0T3RN3BBG9G/validate-sqlite.ts --only='Concurrent CLI'for seven uninstrumented recovery attemptsbun ~/.no-mistakes/evidence/01M52TP6ZQ2ARNP0T3RN3BBG9G/validate-mcp-wal.tsSQLite persisted-state and integrity readbacks; removed disposable databases, build output, and locally installed test dependencies🔧 Fix applied.
1 info still open:
tests/db/recovery-concurrency.test.ts- new test file written by agent: tests/db/recovery-concurrency.test.tsbun install --frozen-lockfile --ignore-scriptsbun run --bun tsup src/index.ts src/mcp-server.ts --format esm --clean --external bun:sqlitebun test tests/db/pragmas.test.ts tests/db/recovery-concurrency.test.ts tests/hooks/sqlite-writers-concurrency.test.tswith isolated HOME, runtime paths, and databasebun test tests/hooks/extract-core.test.ts --test-name-pattern 'exclusively locked'bun ~/.no-mistakes/evidence/01M52TP6ZQ2ARNP0T3RN3BBG9G/round-2/validate-sqlite.tsbun ~/.no-mistakes/evidence/01M52TP6ZQ2ARNP0T3RN3BBG9G/round-2/validate-mcp-wal.tsChecked live connection PRAGMAs and queried persisted SQLite state; saved evidence before removing disposable databases and build output✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.