fix(kanban): serialize DB initialization - #24410
Conversation
|
Final pre-merge review from Hermes Agent:
Verdict: no blockers found; ready for maintainer merge. |
|
@teknium1 sorry to ping directly — could you please review/merge these when you have a chance? Thank you |
a5afce4 to
2138ec9
Compare
|
Refreshed against current origin/main after upstream moved forward.
Local verification:
No intended functional scope changes beyond rebasing the existing Kanban PR over current main. |
2138ec9 to
bccf94a
Compare
|
Refreshed against current
No intentional functional scope change beyond refreshing the fix for current upstream; during refresh I kept WAL/schema initialization inside the same process-local init lock because the rebase exposed concurrent fresh-DB WAL activation as part of the same race class. |
|
Reviewed the diff and the threaded regression test pattern. Reentrant lock + cache invalidation gating is the right shape — concurrent open against the same board DB now serializes cleanly. CI is green on the changed code (the build matrix failures earlier in the day are baseline / runner env). Single-file fix in |
bccf94a to
dcfb7cd
Compare
|
Quick refresh: rebased this PR onto current main again. Current head: Local verification:
Result: No CI checks are reported by GitHub for this PR at the moment. Given the focused scope and prior positive review, this should be ready for maintainer merge. |
dcfb7cd to
b8bcbdb
Compare
|
Refreshed against current
Local verification:
No intentional functional scope change beyond refreshing the existing Kanban DB initialization race fix onto current upstream. |
b8bcbdb to
9f9c226
Compare
|
Rebased onto latest Verification performed locally:
Current head: |
|
Maintainer handoff: this PR has been refreshed against latest Local targeted verification passes:
GitHub currently reports no CI checks for this fork branch. From my side this is ready for review/merge. |
Summary
Why
During gateway startup or dispatcher activity, multiple same-process threads can call
kanban_db.connect()for the same board at nearly the same time. Without synchronization, they can race through schema creation and additive migration checks with stale snapshots. The schema/migrations are idempotent, but the race can still surface as initialization-time failures.Test plan
Passed:
scripts/run_tests.sh tests/hermes_cli/test_kanban_db_init.py -q— 1 passedscripts/run_tests.sh tests/hermes_cli/test_kanban_db.py tests/hermes_cli/test_kanban_db_init.py tests/hermes_cli/test_kanban_boards.py tests/hermes_cli/test_kanban_specify_db.py -q— 143 passedAdditional broader run attempted:
scripts/run_tests.sh tests/hermes_cli/test_kanban_db.py tests/hermes_cli/test_kanban_db_init.py tests/hermes_cli/test_kanban_core_functionality.py tests/hermes_cli/test_kanban_boards.py tests/hermes_cli/test_kanban_specify_db.py -qfastapi, and two dashboard plugin tests importplugins.kanban.dashboard.plugin_apidirectly. The failures are environment dependency failures (ModuleNotFoundError: No module named 'fastapi'), not failures in this DB initialization change.