Files
hermes-agent/tui_gateway
Tikkanaditya Siddartha Jyothi 539b82698e fix: bound the LSP document cache, delta baselines, TUI fuzzy cache and the tool-call logger (#62950)
Long-running gateway/TUI processes grew four in-memory structures for their
whole lifetime:

- agent/lsp/client.py: `_docs` pinned every opened file's full text (and the
  server's mirror) until the idle reaper killed the client. Now an
  insertion-ordered LRU capped at MAX_TRACKED_FILES=64; evicted files are
  didClose'd and re-didOpen'ed on their next touch.
- agent/lsp/manager.py: `_delta_baseline` kept a pre-write snapshot for every
  path ever written; capped at 256 with write-recency eviction.
- tui_gateway/methods_complete_helpers.py: `_fuzzy_cache` only checked its TTL
  on read, so a root queried once (one .worktrees/<id> per worktree flow) was
  pinned forever; the write path now sweeps expired roots under the lock.
- gateway/run_turn.py: `logging.getLogger(f"hermes.tool_calls.{id(log_queue)}")`
  registered one permanent Logger per logged turn; a single fixed-name Logger
  with one RotatingFileHandler is shared by all turns.

Salvaged from #62934 by @Vissirexa, re-targeted onto the decomposed modules.
The per-task file-tool tracker hunks were dropped: f7a422ee4a already pops
them in AIAgent.close()/cleanup_vm via clear_file_ops_cache.

(cherry picked from commit 668f43b2ea9)
2026-09-19 01:55:38 -07:00
..
…
…