The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(dashboard): use a fixed sidebar cache TTL (no HERMES_* env var for non-secret config)
Teknium67a1c1ed1adc
diff --git a/hermes_cli/web_routers/profiles.py b/hermes_cli/web_routers/profiles.pyindex b99bbcabe34..4d44e9e366b 100644--- a/hermes_cli/web_routers/profiles.py+++ b/hermes_cli/web_routers/profiles.py@@ -84,23 +84,10 @@ _write_profile_mcp_servers = late("_write_profile_mcp_servers")_write_profile_model = late("_write_profile_model")-def _read_sidebar_cache_ttl() -> float:- """Return the bounded cache lifetime for the expensive sidebar scan."""- raw = os.environ.get("HERMES_DASHBOARD_SIDEBAR_CACHE_TTL", "5")- try:- value = float(raw)- if not math.isfinite(value):- raise ValueError("non-finite TTL")- except (TypeError, ValueError):- _log.warning(- "invalid HERMES_DASHBOARD_SIDEBAR_CACHE_TTL=%r; using 5s",- raw,- )- value = 5.0- return min(max(value, 0.0), 30.0)---_SIDEBAR_CACHE_TTL_SECONDS = _read_sidebar_cache_ttl()+# Bounded cache lifetime for the expensive sidebar scan. Short enough that the+# UI never shows meaningfully stale data, long enough to coalesce the desktop's+# reconnect/focus/change poll bursts into one scan.+_SIDEBAR_CACHE_TTL_SECONDS = 5.0_SIDEBAR_CACHE_MAX_ENTRIES = 32_SIDEBAR_PROFILE_CACHE_MAX_ENTRIES = 256_SIDEBAR_PROFILE_CACHE = OrderedDict()diff --git a/tests/hermes_cli/test_profiles_sidebar_cache.py b/tests/hermes_cli/test_profiles_sidebar_cache.pyindex 76d96b418fc..5bb113a028a 100644--- a/tests/hermes_cli/test_profiles_sidebar_cache.py+++ b/tests/hermes_cli/test_profiles_sidebar_cache.py@@ -20,12 +20,6 @@ class SidebarCacheTests(unittest.TestCase):profiles._sidebar_profile_cache_clear()self.addCleanup(profiles._sidebar_profile_cache_clear)- def test_invalid_or_non_finite_ttl_falls_back_to_default(self):- for raw in ("invalid", "nan", "inf", "-inf"):- with self.subTest(raw=raw):- with mock.patch.dict(profiles.os.environ, {"HERMES_DASHBOARD_SIDEBAR_CACHE_TTL": raw}):- self.assertEqual(profiles._read_sidebar_cache_ttl(), 5.0)-def test_profile_cache_uses_db_and_wal_fingerprint_and_defensive_copies(self):with tempfile.TemporaryDirectory() as root:db_path = Path(root) / "state.db"