Problem
memctrl/store.py sets busy_timeout=30s but has no exponential backoff retry. If two agents (CLI + MCP server) write simultaneously, the second gets database is locked and fails permanently.
Fix
Add a _retry_write() helper with 3 attempts (50ms / 200ms / 500ms). Wrap all write operations:
insert_memory
delete_memory
update_memory
clear_memories
insert_tree_node
save_provenance
Acceptance
Add test_concurrent_writes_dont_crash using threading to verify no unhandled OperationalError.
Problem
memctrl/store.pysetsbusy_timeout=30sbut has no exponential backoff retry. If two agents (CLI + MCP server) write simultaneously, the second getsdatabase is lockedand fails permanently.Fix
Add a
_retry_write()helper with 3 attempts (50ms / 200ms / 500ms). Wrap all write operations:insert_memorydelete_memoryupdate_memoryclear_memoriesinsert_tree_nodesave_provenanceAcceptance
Add
test_concurrent_writes_dont_crashusing threading to verify no unhandled OperationalError.