Skip to content

fix(kanban): close decompose sqlite connections#29550

Closed
namrop wants to merge 1 commit into
NousResearch:mainfrom
namrop:fix/kanban-decompose-close-connections
Closed

fix(kanban): close decompose sqlite connections#29550
namrop wants to merge 1 commit into
NousResearch:mainfrom
namrop:fix/kanban-decompose-close-connections

Conversation

@namrop

@namrop namrop commented May 21, 2026

Copy link
Copy Markdown

Summary

  • Close SQLite connections opened by hermes_cli.kanban_decompose after preserving sqlite3 transaction context-manager semantics
  • Add regression coverage proving decomposer/list-triage paths close connections instead of relying on sqlite3.Connection.__exit__

Why

sqlite3.Connection context managers commit/rollback but do not close the underlying connection. In a long-lived gateway process, the kanban auto-decompose loop can repeatedly open kanban DB handles and leak file descriptors until unrelated session/state writes fail with OSError: [Errno 24] Too many open files.

Test Plan

  • Verified new regression tests fail against the previous with kb.connect() as conn: implementation
  • PYTHONPATH=/tmp/hermes-kanban-fd-pr /Users/luisramirez/Code/hermes-agent-upstream-staged-2026-05-19/.venv/bin/python -m pytest tests/hermes_cli/test_kanban_decompose.py tests/hermes_cli/test_kanban_decompose_db.py -q -o addopts= --tb=short — 19 passed
  • PYTHONPATH=/tmp/hermes-kanban-fd-pr /Users/luisramirez/Code/hermes-agent-upstream-staged-2026-05-19/.venv/bin/python -m py_compile hermes_cli/kanban_decompose.py

Ensure kanban_decompose closes SQLite connections after preserving sqlite3 transaction context-manager semantics. This prevents the gateway auto-decompose loop from leaking kanban DB file descriptors in long-lived processes.
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard labels May 21, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #29525 — same fix using contextlib.closing() on kb.connect() in kanban_decompose.py to prevent fd leaks. Same root cause as #28802 (specify helpers) but distinct code path. See also #28803 (companion fix for specify helpers).

@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), which converted all kanban_decompose.py connection sites to kb.connect_closing(). Thanks!

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 P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants