HERMES-GIELIE/api
nesquena-hermes c75ce33280 v0.50.259: Opus pre-release follow-up — close _session_db on LRU eviction + CHANGELOG + 5 regression tests
PR #1421 (SessionDB WAL handle leak fix on cached-agent reuse path) had a
sibling leak at the LRU eviction site that I caught during pre-review:

api/streaming.py SESSION_AGENT_CACHE.popitem(last=False) was discarding
the evicted entry with `evicted_sid, _ = ...`. The agent's _session_db
was dropped on the floor and only released when GC eventually finalized
the agent — which on a long-running server may be never (cyclic refs,
extension types holding C handles, etc.).

Same fix shape as #1421: capture the evicted entry, call
_evicted_agent._session_db.close() explicitly. SessionDB.close() is
idempotent + thread-safe (with self._lock: if self._conn:), so the
double-close-is-benign property still holds.

5 regression tests in test_v050259_sessiondb_fd_leak.py:
- Source-level: cached-agent reuse path closes before replace
- Source-level: LRU eviction path captures + closes evicted agent
- Behavioral: SessionDB.close() is idempotent (3 calls safe)
- Behavioral: cached-agent reuse with mock — close called exactly once
- Behavioral: LRU eviction with mock — only evicted agent's DB closes

Full suite: 3615 passed, 0 failed.

Nathan explicitly authorized 'just go ahead and merge it as a small release'
since the PR is 9 LOC, focused, has Opus pre-release follow-up + tests, and
matches the empirically-confirmed leak shape (73-handle leak at EMFILE).
2026-05-01 22:42:53 +00:00
..
__init__.py Hermes Web UI — Sprints 11-14: multi-provider models, settings, session QoL, alerts, polish 2026-03-31 07:02:47 +00:00
agent_sessions.py release: apply Opus SHOULD-FIX 1+2 + add #1372 manual-cron persistence 2026-04-30 23:17:54 +00:00
auth.py v0.50.258: Opus follow-up — fix multi-param redirect-encoding bug + CHANGELOG 2026-05-01 21:30:10 +00:00
background.py feat(commands): /background, /btw slash commands + undo button + reasoning chip 2026-04-24 01:24:51 +00:00
clarify.py feat(clarify): SSE long-connection for real-time clarify notifications (#1355) 2026-04-30 21:32:51 +00:00
commands.py feat: slash command parity + skill autocomplete — v0.50.91 (PR #711) 2026-04-19 05:37:44 +00:00
config.py Fix WebUI custom provider routing 2026-05-02 02:11:41 +08:00
gateway_watcher.py release: v0.50.241 (#1293) 2026-04-29 19:54:07 -07:00
helpers.py v0.50.255: Opus follow-ups (4 fixes) + CHANGELOG 2026-05-01 17:19:53 +00:00
metering.py v0.50.207: batch of 10 PRs — TPS stat, SSE guard, session polish, cron UX, folder create, model errors, session speed, title gen (#1031) 2026-04-25 13:07:35 -07:00
models.py Merge PR #1402 from bergeouss: P2 improvements — cron history, toolsets per session, Codex OAuth 2026-05-01 18:20:05 +00:00
oauth.py v0.50.257: 4 Opus pre-release follow-ups + CHANGELOG + test fixes for #1415 2026-05-01 18:30:41 +00:00
onboarding.py absorb: address Opus review findings (security + correctness) 2026-04-29 05:06:34 +00:00
profiles.py fix(cancel-stream): rename tool_calls to _partial_tool_calls (Opus MUST-FIX) 2026-04-30 23:43:23 +00:00
providers.py fix: TTS toggle CSS specificity collision (#1409) + Ollama env var bleed (#1410) 2026-05-01 17:14:51 +00:00
rollback.py v0.50.255: Opus follow-ups (4 fixes) + CHANGELOG 2026-05-01 17:19:53 +00:00
routes.py v0.50.257: 4 Opus pre-release follow-ups + CHANGELOG + test fixes for #1415 2026-05-01 18:30:41 +00:00
session_ops.py Show profile home in /status command (refs #463) (#1380) 2026-05-01 04:46:37 +00:00
startup.py fix: P0 hotfixes — API regression, code block parser, chmod override 2026-05-01 12:10:48 +00:00
state_sync.py security: bandit fixes B310/B324/B110 + QuietHTTPServer (#354) 2026-04-13 11:11:56 -07:00
streaming.py v0.50.259: Opus pre-release follow-up — close _session_db on LRU eviction + CHANGELOG + 5 regression tests 2026-05-01 22:42:53 +00:00
terminal.py absorb: address Opus review findings (security + correctness) 2026-04-29 05:06:34 +00:00
updates.py fix: update banner — conflict recovery path + server self-restart after update (#816) 2026-04-21 17:10:41 -07:00
upload.py Merge remote-tracking branch 'refs/remotes/pr/1229' into stage/batch-v0.50.238 2026-04-29 15:17:57 +00:00
workspace.py fix: batch v0.50.234-235 — XSS hardening, workspace validation, profile switch fixes (#1206) 2026-04-27 21:39:30 -07:00