HERMES-GIELIE/api
happy5318 65e5690772 fix: add LRU limit to SESSION_AGENT_CACHE to prevent memory bloat
The agent cache stores full AIAgent instances (each holding complete
conversation history) without size limit. Long-running servers with
many sessions can accumulate unbounded memory usage.

Changes:
- Replace dict with OrderedDict for LRU tracking
- Add SESSION_AGENT_CACHE_MAX = 50 limit
- Evict least-recently-used entries when cache exceeds limit
- Call move_to_end() on cache hits to maintain LRU order

This prevents memory exhaustion on servers with many active sessions.
2026-04-29 17:35:12 +08: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 fix: batch triage — 12 contributor PRs (v0.50.227) (#1168) 2026-04-27 13:34:59 -07:00
auth.py fix(auth): persist sessions across restarts via STATE_DIR/.sessions.json (#962) 2026-04-24 11:21:41 -07:00
background.py feat(commands): /background, /btw slash commands + undo button + reasoning chip 2026-04-24 01:24:51 +00:00
clarify.py fix: preserve clarify drafts on timeout 2026-04-29 04:32:40 +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: add LRU limit to SESSION_AGENT_CACHE to prevent memory bloat 2026-04-29 17:35:12 +08:00
gateway_watcher.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
helpers.py v0.50.223: model picker, idle retry, drag-drop, CSP, clipboard copy (#1127) 2026-04-26 15:29:02 -07: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 fix: retry stale repair after lock contention 2026-04-29 04:31:37 +00:00
onboarding.py absorb: address Opus review findings (security + correctness) 2026-04-29 05:06:34 +00:00
profiles.py fix: batch v0.50.234-235 — XSS hardening, workspace validation, profile switch fixes (#1206) 2026-04-27 21:39:30 -07:00
providers.py absorb: address Opus review findings (security + correctness) 2026-04-29 05:06:34 +00:00
routes.py absorb: address Opus review findings (security + correctness) 2026-04-29 05:06:34 +00:00
session_ops.py fix: batch triage — 12 contributor PRs (v0.50.227) (#1168) 2026-04-27 13:34:59 -07:00
startup.py fix(security): gate auto-install behind HERMES_WEBUI_AUTO_INSTALL=1 — v0.50.156 2026-04-22 20:49:28 +00:00
state_sync.py security: bandit fixes B310/B324/B110 + QuietHTTPServer (#354) 2026-04-13 11:11:56 -07:00
streaming.py fix: add LRU limit to SESSION_AGENT_CACHE to prevent memory bloat 2026-04-29 17:35:12 +08: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 absorb: address Opus review findings (security + correctness) 2026-04-29 05:06:34 +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