Repository navigation
fix(sqlite): retry the WAL switch when another opener holds a lock (#22865) - #23920
Conversation
…22865) When several connections opened the same new memory file at once, some failed with "database is locked" at PRAGMA journal_mode=WAL. Leaving a rollback journal for WAL takes an exclusive lock by upgrading a read lock, and SQLite reports a conflict on that upgrade at once without calling the busy handler, so busy_timeout did not cover it. The new kiro_crew.sqlite_wal.enable_wal reads the journal mode first and returns when the file is already in WAL, which takes no write lock. Otherwise it retries the switch on a lock conflict with a short doubling wait, until the store's own busy timeout, and raises anything else at once. The memory store open now sets busy_timeout first and calls it; the member database, history index, knowledge store, skill search index and research campaign opens use it too. The knowledge store waits at most its own 10 s busy window, since some of its callers still open it on the event loop. Closes #22865
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The retry addresses the actual cause: Notes
[DESIGN-REVIEWED] 9a380c8 Description read[DESCRIPTION-READ] ceac7311935994bf47d3b4150ec32fe2c9644416f73953dc0c6c083aea239586 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing to check. Inventory (6 items) — 6 justifiedIntent: let several connections open the same new memory file at once without some of them failing with "database is locked". This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 9a380c8 Description read[DESCRIPTION-READ] c270246a41242fc7e283079237694b88e164b435eac79217f2498208cf57bda3 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]: disposition of the Design Review note on Acknowledged, no change in this PR. The wait can only happen on a file that is not in WAL yet while another connection holds its write lock: WAL is persistent in the file header, so after a store's first open the helper returns from its read pragma without waiting. The on-loop callers of this store are already a tracked backlog, recorded in |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: fix (8 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: bug fix that routes every store's WAL switch through one helper that retries a lock conflict, which busy_timeout does not cover, with tests for concurrent first opens.
Cherry-picks these main commits onto release/0.11.0, in merge order: - fix(schedule): return focus to the cron folder toggle after rename (#23907) (cherry picked from commit a5b78da) - fix(probes): declare an undated duplicate check's conservative bucket on the reading (#23912) (cherry picked from commit 95640ac) - fix(skill-projection): coalesce end prunes so a fan-out cannot hold the start queue (#23913) (cherry picked from commit 47e0b8f) - fix(optimizer): keep the user's ask and add no requirements or solutions (#23915) (cherry picked from commit 1f0e872) - fix(sqlite): retry the WAL switch when another opener holds a lock (#22865) (#23920) (cherry picked from commit 03f3b2a) - fix(slack): post a quiet nudge cycle's outcome to the linked thread (#23911) (cherry picked from commit 32faa11) - feat(crew): run each crewmate's worker in its own git worktree (#23563) (cherry picked from commit 6b21419) - fix(members): finish the phone crewmates single top bar (#19629) (cherry picked from commit a6150d5) - fix(channels): stop Discord, Teams and Webex re-announcing while held (#23916) (cherry picked from commit 1f3210d) - fix(subagent): macOS spawn floor reads host_available_mib (#23914) (cherry picked from commit ed83ad2) - feat(crew): run a crewmate's worker on claude as well as KAS (#23538) (cherry picked from commit 32362f8) - fix(dashboard): read every body integer through body_int (#22502) (#23921) (cherry picked from commit dad46e9)
Cherry-picks these main commits onto release/0.11.0, in merge order: - fix(schedule): return focus to the cron folder toggle after rename (#23907) (cherry picked from commit a5b78da) - fix(probes): declare an undated duplicate check's conservative bucket on the reading (#23912) (cherry picked from commit 95640ac) - fix(skill-projection): coalesce end prunes so a fan-out cannot hold the start queue (#23913) (cherry picked from commit 47e0b8f) - fix(optimizer): keep the user's ask and add no requirements or solutions (#23915) (cherry picked from commit 1f0e872) - fix(sqlite): retry the WAL switch when another opener holds a lock (#22865) (#23920) (cherry picked from commit 03f3b2a) - fix(slack): post a quiet nudge cycle's outcome to the linked thread (#23911) (cherry picked from commit 32faa11) - feat(crew): run each crewmate's worker in its own git worktree (#23563) (cherry picked from commit 6b21419) - fix(members): finish the phone crewmates single top bar (#19629) (cherry picked from commit a6150d5) - fix(channels): stop Discord, Teams and Webex re-announcing while held (#23916) (cherry picked from commit 1f3210d) - fix(subagent): macOS spawn floor reads host_available_mib (#23914) (cherry picked from commit ed83ad2) - feat(crew): run a crewmate's worker on claude as well as KAS (#23538) (cherry picked from commit 32362f8) - fix(dashboard): read every body integer through body_int (#22502) (#23921) (cherry picked from commit dad46e9)
Backports these main PRs to release/0.11.0, in pick order. Each was a `git cherry-pick -x` of its squash commit on main: - fix(memory): read memory.db off the writer lock, split background pool (#24290) (cherry picked from commit fed830c) - fix(dashboard): bound the pre-prompt build's wait to enter the memory pool (#24414) (cherry picked from commit 520cf2c) - fix(memory): keep the shared -wal when another process closes the memory store (#25852) (cherry picked from commit dc63bb6) - fix: read the page-cache prefetch in a child to keep sqlite locks (#26302) (cherry picked from commit 81dde23) - perf(memory): score facts from a term index and prebuild after restart (#25328) (cherry picked from commit 6824348) - fix(desktop): retry a failed netstat before Windows recovery gives up (#25792) (cherry picked from commit 043dd9f) - fix(cli): say a gateway still serves the port when restart's replacement is refused (#25366) (cherry picked from commit 2e13127) - fix(cli): refuse to stop or restart a gateway the desktop app supervises (#25705) (cherry picked from commit bbf0910) - fix(hooks): approve kiro-cli read-only file searches after the deny tiers (#25150) (cherry picked from commit a0c0bd4) - fix(settings): refuse a config save that config.local.json overrides (#26216) (cherry picked from commit 7f8688e) - fix(workflows): write non-finite floats as null so runs open (#26085) (cherry picked from commit 3591282) - fix(approvals): give each background tool approval its own id (#25905) (cherry picked from commit 51ef3bb) - fix(chat): record file changes for kiro-cli v3 write tools (#25650) (cherry picked from commit 5369270) - fix(sandbox): stop blaming a host-wide OOM kill on a per-tree limit (#25647) (cherry picked from commit 791d2a2) - fix(acp): replay history when a KAS resume restores no turns (#25521) (cherry picked from commit 47c71cb) Conflicts resolved by hand: - #26302: test/spawn_audit_helpers.py adds only the page_cache.py entry (the embeddings_child.py entry names a module 0.11.0 lacks); test/test_page_cache_prefetch.py takes main's file. - #25328: test/test_dashboard_server_composition_contract.py lazy-import count 93 -> 96 (the three names it adds). - #25705: test/test_cli_restart_refused_message.py takes main's file. - #26085: dashboard/handlers/workflows.py adds import math, keeps the release typing import. Left out: #23920 (already on release/0.11.0), #26144 (needs sandbox_launch_mark from #24709), #26088 (fences a main-only port).
Backports these main PRs to release/0.11.0, in pick order. Each was a `git cherry-pick -x` of its squash commit on main: - fix(memory): read memory.db off the writer lock, split background pool (#24290) (cherry picked from commit fed830c) - fix(dashboard): bound the pre-prompt build's wait to enter the memory pool (#24414) (cherry picked from commit 520cf2c) - fix(memory): keep the shared -wal when another process closes the memory store (#25852) (cherry picked from commit dc63bb6) - fix: read the page-cache prefetch in a child to keep sqlite locks (#26302) (cherry picked from commit 81dde23) - perf(memory): score facts from a term index and prebuild after restart (#25328) (cherry picked from commit 6824348) - fix(desktop): retry a failed netstat before Windows recovery gives up (#25792) (cherry picked from commit 043dd9f) - fix(cli): say a gateway still serves the port when restart's replacement is refused (#25366) (cherry picked from commit 2e13127) - fix(cli): refuse to stop or restart a gateway the desktop app supervises (#25705) (cherry picked from commit bbf0910) - fix(hooks): approve kiro-cli read-only file searches after the deny tiers (#25150) (cherry picked from commit a0c0bd4) - fix(settings): refuse a config save that config.local.json overrides (#26216) (cherry picked from commit 7f8688e) - fix(workflows): write non-finite floats as null so runs open (#26085) (cherry picked from commit 3591282) - fix(approvals): give each background tool approval its own id (#25905) (cherry picked from commit 51ef3bb) - fix(chat): record file changes for kiro-cli v3 write tools (#25650) (cherry picked from commit 5369270) - fix(sandbox): stop blaming a host-wide OOM kill on a per-tree limit (#25647) (cherry picked from commit 791d2a2) - fix(acp): replay history when a KAS resume restores no turns (#25521) (cherry picked from commit 47c71cb) - fix(kas): auto-approve granted built-ins after Crew's own checks (#25339) (cherry picked from commit dba4de5) - fix(kas): mount web_search as the engine's remote_web_search (#26435) (cherry picked from commit 65c21b5) - fix(kas): answer a spec's shell.allowedCommands at the gate, after Crew's checks (#25539) (cherry picked from commit 39d07d9) - fix(kas): relay an MCP server's boolean env flags, never its secrets (#25331) (cherry picked from commit b734a68) - fix(security): read the -c script past options and redirections (#26087) (cherry picked from commit fea0920) - fix(kas): refuse a shell command a denyByDefault spec does not allow (#26501) (cherry picked from commit 9f0d02f) - fix(kas): name a deniedCommands deny aimed at a redirect as not carried (#26489) (cherry picked from commit 4951c0c) - fix(security): delete the curl-upload deny rule (#26469) (cherry picked from commit 70e206e) Conflicts resolved by hand: - #26302: test/spawn_audit_helpers.py adds only the page_cache.py entry (the embeddings_child.py entry names a module 0.11.0 lacks); test/test_page_cache_prefetch.py takes main's file. - #25328: test/test_dashboard_server_composition_contract.py lazy-import count 93 -> 96 (the three names it adds). - #25705: test/test_cli_restart_refused_message.py takes main's file. - #26085: dashboard/handlers/workflows.py adds import math, keeps the release typing import. - #25339: platform/governance.py keeps the release rule for a missing ceiling (main's enterprise-baseline clause is not on 0.11.0). - #26435: harness-parity.md H6 row edited in place on the release text. - #25539: its acp-client.md and agent-spec-fields.md lines are left out; the paragraphs they edit are not on 0.11.0 (security.md carries it). - #25331: the test and two doc mentions use hoist_managed_servers / resume=, the 0.11.0 names of main's renamed hoist_servers_for_session. - #26087: security package line budget 32,552 -> 32,714 (re-measured). - #26501: kas_permissions.py comment keeps 0.11.0's shapes (main's subagent rules are absent); its acp-client.md line is left out, and the agent-spec-fields.md toolsSettings row says denyByDefault is gate-enforced. - #26489: its agent-spec-fields.md sentence is added to the 0.11.0 row. - #26469: test_denied_commands_security.py keeps 0.11.0's comment; count 113 -> 112. Test fixes (host-dependent tests made hermetic; none loosens an assertion): - tmpdir_helpers.short_tmp_path: a tmp_path override for modules whose code judges a path by its components (a .kiro/crew data-home part); an agent session's TMPDIR under ~/.kiro/crew made every test path the data home. Used by the file-explorer, design-tweak (both), spawn-offload, launch-copy, home-pin, native-skill and auto-improvement-members tests; the sage ancestor-chain test creates its dir under /tmp for the same reason. - pi-gate tests and the remote-session Python 3.9 test take the first real binary on PATH (playwright_cli_installer_helpers._native_tool_on_path): a mise shim under a scratch HOME hangs or writes to stdout. - snapshot-merge ACL test names its own uid; nobody (65534) is the overflow uid inside a user namespace and cannot be named in an ACL. - installer-step and push_guard interrupt tests spawn with SIGINT at its default; a background pytest run starts with SIGINT ignored, which a shell trap and Python both keep. Left out: #23920 (already on release/0.11.0), #26144 (needs sandbox_launch_mark from #24709), #26088 (fences a main-only port), #25346 (11 of its tests fail on 0.11.0: the kiro-cli skill scope it compares against differs there), #26397 (needs #26152's new download route, not on 0.11.0), #26428 (not merged).
…26487) Backports these main PRs to release/0.11.0, in pick order. Each was a `git cherry-pick -x` of its squash commit on main: - fix(memory): read memory.db off the writer lock, split background pool (#24290) (cherry picked from commit fed830c) - fix(dashboard): bound the pre-prompt build's wait to enter the memory pool (#24414) (cherry picked from commit 520cf2c) - fix(memory): keep the shared -wal when another process closes the memory store (#25852) (cherry picked from commit dc63bb6) - fix: read the page-cache prefetch in a child to keep sqlite locks (#26302) (cherry picked from commit 81dde23) - perf(memory): score facts from a term index and prebuild after restart (#25328) (cherry picked from commit 6824348) - fix(desktop): retry a failed netstat before Windows recovery gives up (#25792) (cherry picked from commit 043dd9f) - fix(cli): say a gateway still serves the port when restart's replacement is refused (#25366) (cherry picked from commit 2e13127) - fix(cli): refuse to stop or restart a gateway the desktop app supervises (#25705) (cherry picked from commit bbf0910) - fix(hooks): approve kiro-cli read-only file searches after the deny tiers (#25150) (cherry picked from commit a0c0bd4) - fix(settings): refuse a config save that config.local.json overrides (#26216) (cherry picked from commit 7f8688e) - fix(workflows): write non-finite floats as null so runs open (#26085) (cherry picked from commit 3591282) - fix(approvals): give each background tool approval its own id (#25905) (cherry picked from commit 51ef3bb) - fix(chat): record file changes for kiro-cli v3 write tools (#25650) (cherry picked from commit 5369270) - fix(sandbox): stop blaming a host-wide OOM kill on a per-tree limit (#25647) (cherry picked from commit 791d2a2) - fix(acp): replay history when a KAS resume restores no turns (#25521) (cherry picked from commit 47c71cb) - fix(kas): auto-approve granted built-ins after Crew's own checks (#25339) (cherry picked from commit dba4de5) - fix(kas): mount web_search as the engine's remote_web_search (#26435) (cherry picked from commit 65c21b5) - fix(kas): answer a spec's shell.allowedCommands at the gate, after Crew's checks (#25539) (cherry picked from commit 39d07d9) - fix(kas): relay an MCP server's boolean env flags, never its secrets (#25331) (cherry picked from commit b734a68) - fix(security): read the -c script past options and redirections (#26087) (cherry picked from commit fea0920) - fix(kas): refuse a shell command a denyByDefault spec does not allow (#26501) (cherry picked from commit 9f0d02f) - fix(kas): name a deniedCommands deny aimed at a redirect as not carried (#26489) (cherry picked from commit 4951c0c) - fix(security): delete the curl-upload deny rule (#26469) (cherry picked from commit 70e206e) Conflicts resolved by hand: - #26302: test/spawn_audit_helpers.py adds only the page_cache.py entry (the embeddings_child.py entry names a module 0.11.0 lacks); test/test_page_cache_prefetch.py takes main's file. - #25328: test/test_dashboard_server_composition_contract.py lazy-import count 93 -> 96 (the three names it adds). - #25705: test/test_cli_restart_refused_message.py takes main's file. - #26085: dashboard/handlers/workflows.py adds import math, keeps the release typing import. - #25339: platform/governance.py keeps the release rule for a missing ceiling (main's enterprise-baseline clause is not on 0.11.0). - #26435: harness-parity.md H6 row edited in place on the release text. - #25539: its acp-client.md and agent-spec-fields.md lines are left out; the paragraphs they edit are not on 0.11.0 (security.md carries it). - #25331: the test and two doc mentions use hoist_managed_servers / resume=, the 0.11.0 names of main's renamed hoist_servers_for_session. - #26087: security package line budget 32,552 -> 32,714 (re-measured). - #26501: kas_permissions.py comment keeps 0.11.0's shapes (main's subagent rules are absent); its acp-client.md line is left out, and the agent-spec-fields.md toolsSettings row says denyByDefault is gate-enforced. - #26489: its agent-spec-fields.md sentence is added to the 0.11.0 row. - #26469: test_denied_commands_security.py keeps 0.11.0's comment; count 113 -> 112. Test fixes (host-dependent tests made hermetic; none loosens an assertion): - tmpdir_helpers.short_tmp_path: a tmp_path override for modules whose code judges a path by its components (a .kiro/crew data-home part); an agent session's TMPDIR under ~/.kiro/crew made every test path the data home. Used by the file-explorer, design-tweak (both), spawn-offload, launch-copy, home-pin, native-skill and auto-improvement-members tests; the sage ancestor-chain test creates its dir under /tmp for the same reason. - pi-gate tests and the remote-session Python 3.9 test take the first real binary on PATH (playwright_cli_installer_helpers._native_tool_on_path): a mise shim under a scratch HOME hangs or writes to stdout. - snapshot-merge ACL test names its own uid; nobody (65534) is the overflow uid inside a user namespace and cannot be named in an ACL. - installer-step and push_guard interrupt tests spawn with SIGINT at its default; a background pytest run starts with SIGINT ignored, which a shell trap and Python both keep. Left out: #23920 (already on release/0.11.0), #26144 (needs sandbox_launch_mark from #24709), #26088 (fences a main-only port), #25346 (11 of its tests fail on 0.11.0: the kiro-cli skill scope it compares against differs there), #26397 (needs #26152's new download route, not on 0.11.0), #26428 (not merged). Co-authored-by: w <w@k.local>
Problem / Motivation
Goal: Several connections opening the same new memory file at once all succeed, instead of some failing with "database is locked".
When four openers call
VectorMemoryStore.init()on one fresh v1 file at the same moment, some raisesqlite3.OperationalError: database is lockedatPRAGMA journal_mode=WALin_init_database. Measured on main (8fdb1bb), 4 threads released by a barrier: 7 of 100 rounds had a failed open, every one at that pragma.Why it matters
A store open that fails this way surfaces as a broken memory read or write for whichever crewmate, subagent or gateway path lost the race, and nothing retries it. The same bare pragma sits on the open path of the member database, history index, knowledge store, skill search index and research campaign store.
Not a goal
What changed (motivation → approach → change)
Symptom: a second concurrent opener of a new file fails at once at
PRAGMA journal_mode=WAL.Root cause: leaving a rollback journal for WAL takes an exclusive lock by upgrading the read lock the pragma already holds. SQLite reports a conflict on that upgrade straight away without calling the busy handler, so
busy_timeoutdoes not cover it. Measured here: with another connection holding a write lock (BEGIN IMMEDIATE), the switch fails after 0.0 s even withbusy_timeout=2000. A file already in WAL needs no lock to report its mode.Change: a new module
src/kiro_crew/sqlite_wal.pywithenable_wal(conn, *, timeout_secs, clock, sleep). It readsPRAGMA journal_modefirst and returns when it is alreadywal, so an up-to-date file takes no write lock. Otherwise it runs the switch and retries anOperationalErrorwhose message holds "locked" (SQLITE_BUSY or SQLITE_LOCKED) with a doubling wait from 5 ms capped at 100 ms, until the deadline, then re-raises. Any other error is raised at once, so a damaged file still fails the open the same way (file is not a databasecomes from the read pragma now, andis_damaged_database_errorstill matches it). It accepts both the compat and the stdlib SQLite error classes, because the campaign store uses the stdlib module.Call sites, each with the window its store already uses:
vector_memory_lifecycle._init_database:busy_timeoutnow set before the switch; 5 s.vector_memory_member.create_member_database: 5 s (the connect default on the line above).history_index:busy_timeoutset before the switch; 10 s.knowledge/store.py: 10 s, its own busy window rather than the 30 s connect timeout, because some callers still open it on the event loop and a wait past the loop-stall exit budget (25 s) would kill the gateway.skill_search_index: 2 s.auto_research/campaign/storage.py: 30 s. Its process-wide init lock stays; it cannot see another process, so the switch retries too.Backwards compatibility
Compatible: every open that succeeded before still succeeds with the same journal mode; an open that hit the lock race now waits for at most the store's existing busy window instead of failing.
Removes nothing: the diff adds a retry around an existing statement and takes no path, record or key away.
Tests
test/test_sqlite_wal.py(new):TestEnableWal::test_a_held_write_lock_is_waited_out[compat|stdlib]: another connection holds a write lock on a rollback-journal file; the test first shows a bare switch fails at once despitebusy_timeout, thenenable_walwith a fake clock waits, the holder commits on the second wait, and the file ends in WAL. No real sleep.test_a_lock_that_outlasts_the_deadline_is_raised: the error is re-raised once the fake clock passes the deadline; waits never exceed the cap.test_a_file_already_in_wal_is_not_switched_again: a trace callback shows onlyPRAGMA journal_moderuns on a WAL file.test_an_error_that_is_not_a_lock_is_raised_at_once: a non-lockOperationalErroris not retried.TestMemoryStoreOpen::test_concurrent_first_opens_of_a_fresh_file_all_succeed: fourVectorMemoryStore.init()calls on one fresh v1 file, released by athreading.Barrier, for 20 rounds; zero failed opens.TestMemoryStoreOpen::test_an_open_waits_out_a_held_write_lock_then_switches: a store open against a held write lock waits (fake clock) and ends in WAL.Proof: not provable -- other: prove.py reverts every production hunk, which deletes the new sqlite_wal module, so the test file only errors at import; the hand reverts below show the reds.
Hand reverts, each run alone on a clean tree:
vector_memory_lifecycle.pyrestored to main: the held-lock store test failed 10 of 10 runs; the 4×20 concurrency test failed 8 of 10 runs.enable_wal: 4 tests fail. Already-WAL check removed: the trace test fails. Retry on any error: the non-lock test fails. Only the compat error class caught: the[stdlib]case fails.-n0, no sleeps, barrier-released threads).Also run, all passing:
test_vector_memory.py,test_vector_memory_schema_transaction.py,test_member_memory_upgrade.py,test_member_memory_database.py,test_history_index.py,test_skill_search_index.py,test_knowledge_store_{damaged_file,onloop_db,sources}.py,test_auto_research_campaign_{contract,store}.py,test_flake_pattern_ratchet.py; pluscheck_file_line_cap.py,check_comment_history.py, mypy, flake8 and isort on the changed files.Manual verification
A standalone script (4 and 8 threads, a barrier,
init()on a fresh file) failed 7 of 100 rounds on main and 0 of 200 with the fix, on Linux with Python 3.12 and the bundled pysqlite3. Windows and macOS were not run: the lock-upgrade behaviour is SQLite's own and not platform code, but it is unverified on those hosts.Related Issues
Closes #22865. Refs #13732, #21034, #22866.
Sibling sweep
Swept: git grep -n "journal_mode=WAL" -- src/
Sibling: src/kiro_crew/vector_memory_member.py:124 -- changed here
Sibling: src/kiro_crew/history_index.py:329 -- changed here
Sibling: src/kiro_crew/knowledge/store.py:482 -- changed here
Sibling: src/kiro_crew/skill_search_index.py:369 -- changed here
Sibling: src/kiro_crew/apps/builtins/auto_research/campaign/storage.py:160 -- changed here
Sibling: src/kiro_crew/apps/builtins/personal_shopper/backend/store.py:148 -- not affected -- one connection per app process, opened once at startup
Sibling: src/kiro_crew/builtin_skills/security-conductor/scripts/ledger.py:382 -- not affected -- standalone skill script that cannot import the package helper; one opener per run
Sibling: src/kiro_crew/taskq/store.py:681 -- not affected -- not a bare WAL switch: it picks WAL or DELETE per filesystem and reports what SQLite kept; left for its own change
Pattern harvest
Rule candidate: review-prompt
Pattern: a bare
PRAGMA journal_mode=WALon a connection open path; busy_timeout does not cover the switch, so route it throughsqlite_wal.enable_wal.Decision for the owner
The decision is whether the WAL switch race on concurrent first opens is fixed with a shared retry helper applied to every open path that runs a bare WAL switch. This draft adds
sqlite_wal.enable_wal(skip when already WAL, retry a lock conflict until each store's existing busy window) and uses it at six open sites, rather than serializing openers with a lock, which cannot cover other processes.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.