Skip to content

Fix concurrency issues across storage layer#67

Merged
cdnsteve merged 4 commits intodevelopfrom
feature/concurrency-fixes
Mar 20, 2026
Merged

Fix concurrency issues across storage layer#67
cdnsteve merged 4 commits intodevelopfrom
feature/concurrency-fixes

Conversation

@cdnsteve
Copy link
Copy Markdown
Member

Summary

  • Fix dictionary mutation RuntimeError in subagent cancel_all during shutdown
  • Replace connection caching with per-operation connections in memory store for thread safety
  • Add row-level locking, retry logic, WAL mode, and busy timeouts across work_queue, issue_response_manager, and task_type_manager
  • Add proper shutdown event handling with fallback force exit in main loop
  • Add 16 concurrency tests and benchmark suite

Test plan

  • All 16 concurrency tests pass (tests/test_concurrency.py)
  • No engram/legacy references in any changed files
  • Run full test suite: pytest tests/ -x
  • Verify graceful shutdown under load

- Snapshot active_subagents dict before iteration in cancel_all to prevent RuntimeError
- Add proper shutdown event handling with fallback force exit in main loop
- Replace connection caching with per-operation connections in memory store for thread safety
- Add row-level locking and retry logic to issue_response_manager and task_type_manager
- Rewrite work_queue with WAL mode, busy timeout, and immediate transactions
- Add comprehensive concurrency test suite (16 tests) and benchmarks
- Update pytest markers with clearer descriptions
@cdnsteve cdnsteve changed the base branch from main to develop March 19, 2026 18:36
Windows CI runners hit 45 ops/sec which is fine but tripped the 50
ops/sec floor. 30 ops/sec still catches real regressions without
flaking on slower CI hardware.
Throughput benchmarks are too variable on shared CI runners (10-45
ops/sec on Windows). Mark them with @pytest.mark.benchmark and
exclude from CI. Run locally with: pytest -m benchmark
@cdnsteve cdnsteve merged commit a853845 into develop Mar 20, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant