Skip to content

fix(kanban): close board count connections in boards list - #30031

Closed
worlldz wants to merge 1 commit into
NousResearch:mainfrom
worlldz:fix-kanban-boards-fd-leak
Closed

fix(kanban): close board count connections in boards list#30031
worlldz wants to merge 1 commit into
NousResearch:mainfrom
worlldz:fix-kanban-boards-fd-leak

Conversation

@worlldz

@worlldz worlldz commented May 21, 2026

Copy link
Copy Markdown
Contributor

Fixes #30027

hermes kanban boards list currently leaks sqlite file descriptors across boards in long-lived processes.

The root cause is _board_task_counts() in hermes_cli.kanban, which uses with kb.connect(board=slug) as conn:. For sqlite3.Connection, that pattern manages transaction scope but does not close the handle.

Since boards list calls that helper once per board, per-board kanban.db, kanban.db-wal, and kanban.db-shm handles can accumulate in a single process.

This patch switches that read path to explicit closing and adds regression coverage for sqlite-like connections whose context manager does not call close().

Validation:
uv run --extra dev pytest tests/hermes_cli/test_kanban_boards.py -q -k 'board_task_counts_closes_sqlite_like_connection or boards_list_default_only or boards_create_and_switch'

Result:
3 passed in 10.36s

Live repro before fix:
{'base': 5, 'after': 68, 'delta': 63, 'boards': 21}

Live repro after fix:
{'base': 5, 'after': 5, 'delta': 0, 'boards': 21}

@worlldz
worlldz force-pushed the fix-kanban-boards-fd-leak branch from 4593504 to 32167f6 Compare May 21, 2026 21:01
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard labels May 21, 2026
@worlldz
worlldz force-pushed the fix-kanban-boards-fd-leak branch from 32167f6 to a075646 Compare May 22, 2026 03:45
@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Closing as already fixed on main — landed via commit ebe04c66c (fix(kanban): close kanban.db FD after every connect() in long-lived processes). All kanban.py board-list/count connection sites now use kb.connect_closing(). Same diagnosis, same outcome. Thanks!

@GottZ GottZ mentioned this pull request Jul 22, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: kanban boards list leaks sqlite connections across boards in long-lived processes

3 participants