# NousResearch/hermes-agent · SQLite SessionDB connection leak on exception paths

## Open now

- Nothing open on GitHub.

These members concern a file descriptor leak where SessionDB SQLite connections are not closed when exceptions occur, potentially causing EMFILE crashes. The group includes a bug report and related fix attempts addressing the same exception-path cleanup issue.

## TL;DR

- 6 member(s): 0 open issue(s), 1 closed issue(s), 0 open PR(s), 2 merged PR(s), 3 PR(s) closed without merging.
- A fix was merged to main in PR #86667. Verify it addresses your case.
- **Recommended:** read PR #86667 (and any competing PRs below) before filing. Confirm the merged change covers your symptom.

## Maintainer resolution verdict

- Internal-tracker verdict over this cluster's issue members: `resolved` · deciding PR(s): `pr-86667`. This is distinct from the fix status above. Weigh it yourself.

## How this cluster was grouped

- Link evidence (`STRUCTURAL_SPANNING`): every member is connected by structural evidence: shared changed files, or a closing/superseded reference.
- Pairwise link density `0.53`: the share of member pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36. `1.00` means every pair is linked.

## Closed / duplicate issues

- #83226: SQLite file descriptor leak — SessionDB connections not closed on exception paths (EMFILE crash)

## Prior & competing PRs

- **#86667: fix(state): close leaked SessionDB connections on exception paths (salvage #83237 + #83620 + #72822)**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`; implication `superseded`
  - files: `agent/auxiliary_client.py`, `agent/trace_upload.py`, `cli.py`, `cron/scheduler.py`, `gateway/platforms/api_server.py`, `gateway/shutdown_flush.py`, `gateway/slash_commands.py`, `hermes_cli/main.py`, `hermes_cli/sessions_cmd.py`, `hermes_state.py`, `mcp_serve.py`, `plugins/memory/retaindb/__init__.py`, `run_agent.py`, `tests/agent/test_trace_upload.py`, `tests/cli/test_cli_insights_command.py`, `tests/cron/test_sessiondb_init_hang.py`, `tests/gateway/test_platform_reconnect_fd_leak.py`, `tests/gateway/test_shutdown_flush.py`, `tests/plugins/memory/test_retaindb_provider.py`, `tests/run_agent/test_async_httpx_del_neuter.py` (+9 more)
- **#86691: fix: close leaked SessionDB connections on exception paths (#83226)**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`; implication `superseded`
  - files: `gateway/slash_commands.py`, `hermes_cli/sessions_cmd.py`, `hermes_state.py`
- **#83237: fix: close leaked SessionDB connections on exception paths (#83226)**. closed without merge
  - maintainer direction: category `merged_via`; implication `superseded`; refs `#86691`, `#83226`
- **#83397: \[Bug\] SQLite file descriptor leak: close SessionDB connections on exception paths**. closed without merge
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#83226`, `#83237`, `#83620`, `#83226`
- **#83620: fix(state): close leaked SessionDB connections on exception paths**. closed without merge
  - maintainer direction: category `merged_via`; implication `superseded`; refs `#86667`, `#72822`, `#72782`

## Fix status

- Merged to main in PR #86667 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-08-15`.
- Subsystem: `agent`
