hermes - 💡(How to fix) Fix [Bug]: kanban boards list leaks sqlite connections across boards in long-lived processes [2 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Operating System

Ubuntu on WSL2 (Windows 11)

Python Version

Python 3.12.3

Hermes Version

Hermes Agent v0.14.0 (2026.5.16)

Additional Logs / Traceback (optional)

Root Cause

This gets worse as the number of boards grows, because the command touches each board DB to collect task counts.

Fix Action

Fixed

Code Example

import os, tempfile
os.environ["HERMES_HOME"] = tempfile.mkdtemp(prefix="hermes_boards_leak_")

from hermes_cli import kanban_db as kb
from hermes_cli.kanban import run_slash

conn = kb.connect()
conn.close()

for i in range(20):
    kb.create_board(f"b{i}")

base = len(os.listdir("/proc/self/fd"))
run_slash("boards list")
after = len(os.listdir("/proc/self/fd"))

print({"base": base, "after": after, "delta": after - base})


### Expected Behavior

Running `boards list` should not leave per-board sqlite handles open or grow the process fd count.

### Actual Behavior

A single `boards list` call can leave many sqlite file descriptors open.

In my repro on current main with 21 boards total, one `run_slash("boards list")` call changed the fd count from:

`{'base': 5, 'after': 68, 'delta': 63}`

The leaked descriptors were the per-board `kanban.db`, `kanban.db-wal`, and `kanban.db-shm` handles.

### Affected Component

CLI (interactive chat)

### Messaging Platform (if gateway-related)

N/A (CLI only)

### Debug Report

---

### Operating System

Ubuntu on WSL2 (Windows 11)

### Python Version

Python 3.12.3

### Hermes Version

Hermes Agent v0.14.0 (2026.5.16)

### Additional Logs / Traceback (optional)
RAW_BUFFERClick to expand / collapse

Bug Description

I found a real sqlite fd leak in the kanban boards listing path.

hermes kanban boards list calls _board_task_counts() for each board, and that helper currently uses with kb.connect(board=slug) as conn:.

For sqlite3.Connection, that context-manager pattern does not close the connection. It only manages transaction scope. As a result, listing boards in a long-lived process can leave per-board sqlite handles open.

This gets worse as the number of boards grows, because the command touches each board DB to collect task counts.

What I expected instead was for the board-count helper to close each sqlite connection explicitly after reading the counts.

Steps to Reproduce

  1. Start from current main
  2. Use a single long-lived Python process with a temporary HERMES_HOME
  3. Create a number of kanban boards
  4. Call hermes_cli.kanban.run_slash("boards list")
  5. Observe the process fd count before and after

Minimal repro I used:

import os, tempfile
os.environ["HERMES_HOME"] = tempfile.mkdtemp(prefix="hermes_boards_leak_")

from hermes_cli import kanban_db as kb
from hermes_cli.kanban import run_slash

conn = kb.connect()
conn.close()

for i in range(20):
    kb.create_board(f"b{i}")

base = len(os.listdir("/proc/self/fd"))
run_slash("boards list")
after = len(os.listdir("/proc/self/fd"))

print({"base": base, "after": after, "delta": after - base})


### Expected Behavior

Running `boards list` should not leave per-board sqlite handles open or grow the process fd count.

### Actual Behavior

A single `boards list` call can leave many sqlite file descriptors open.

In my repro on current main with 21 boards total, one `run_slash("boards list")` call changed the fd count from:

`{'base': 5, 'after': 68, 'delta': 63}`

The leaked descriptors were the per-board `kanban.db`, `kanban.db-wal`, and `kanban.db-shm` handles.

### Affected Component

CLI (interactive chat)

### Messaging Platform (if gateway-related)

N/A (CLI only)

### Debug Report

```shell
Report     https://paste.rs/dw6Bj
agent.log  https://paste.rs/DZQZ4

Operating System

Ubuntu on WSL2 (Windows 11)

Python Version

Python 3.12.3

Hermes Version

Hermes Agent v0.14.0 (2026.5.16)

Additional Logs / Traceback (optional)

This is a steady-state resource leak rather than an immediate traceback.

The impact grows with the number of boards because `boards list` opens each board DB to collect task counts. In a long-lived process, repeated use can push the process toward fd exhaustion.

Root Cause Analysis (optional)

The leak is in hermes_cli/kanban.py, inside _board_task_counts().

That helper uses with kb.connect(board=slug) as conn:. For sqlite connections, with conn: does not close the connection when the block exits; it only commits or rolls back the transaction.

Since boards list calls that helper once per board, sqlite handles accumulate across boards in long-lived processes.

Proposed Fix (optional)

Wrap the board-count read path in contextlib.closing(kb.connect(board=slug)) so each sqlite handle is closed explicitly after reading counts.

I also prepared regression coverage to make sure _board_task_counts() closes sqlite-like connections whose context manager does not call close().

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix [Bug]: kanban boards list leaks sqlite connections across boards in long-lived processes [2 pull requests]