The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): warn when config still declares a retired idle/daily session_reset
kshitijk4poor0d5aae5e245e
diff --git a/gateway/run_startup.py b/gateway/run_startup.pyindex 03f113734ee..eb31922455c 100644--- a/gateway/run_startup.py+++ b/gateway/run_startup.py@@ -886,6 +886,7 @@ class GatewayStartupMixin:disarm_startup_watchdog()logger.info("Session storage: %s", self.config.sessions_dir)self._start_log_systemd_timing_alignment()+ self._start_log_retired_session_reset()self._log_agent_budget()# Warn prominently when redaction is opted out; the redactor snapshots its state at import time,# so this line is the source of truth for the process lifetime.@@ -936,6 +937,19 @@ class GatewayStartupMixin:logger.warning("%s", _adv_msg)logger.warning("Run `hermes doctor` on the gateway host for full remediation steps.")+ def _start_log_retired_session_reset(self) -> None:+ """Warn per served profile whose config still declares an idle/daily ``session_reset``,+ unless the plugin that honours it is enabled. Never raises."""+ with _log_suppressed(logging.DEBUG, "retired session_reset check failed", exc_info=True):+ from gateway.config_loader import read_yaml_layers+ from hermes_cli.profiles import profiles_to_serve+ from hermes_cli.session_reset_retirement import format_notice, reset_plugin_enabled, retired_reset_policy+ hits = [(name, found) for name, home in profiles_to_serve(bool(self.config.multiplex_profiles))+ if (found := retired_reset_policy(read_yaml_layers(home)))]+ if hits and not reset_plugin_enabled():+ for name, (path, mode) in hits:+ logger.warning("Profile %s: %s", name, format_notice(path, mode))+def _start_log_systemd_timing_alignment(self) -> None:"""Warn when systemd's TimeoutStopSec does not cover the drain window (a unit file from beforean upgrade may encode the old default, so SIGKILL hits mid-drain). Never raises."""diff --git a/hermes_cli/doctor.py b/hermes_cli/doctor.pyindex cb382fef75e..07e51f36d96 100644--- a/hermes_cli/doctor.py+++ b/hermes_cli/doctor.py@@ -30,6 +30,7 @@ from hermes_cli.doctor_config import (_check_env_file,_check_mcp_security,_check_xai_retirement,+ _check_retired_session_reset,_check_plugin_compat,)from hermes_cli.doctor_platform import (@@ -112,6 +113,7 @@ DOCTOR_CHECKS = (('Required Packages', _check_required_packages), ('Configuration Files', _check_env_file),(None, _check_config_file), (None, _check_config_drift),('xAI Model Retirement (May 15, 2026)', _check_xai_retirement),+ ('Session Reset (timers removed Sep 7, 2026)', _check_retired_session_reset),('Plugin import paths (removed Sep 14, 2026)', _check_plugin_compat), ('Auth Providers', _check_auth_providers),('Directory Structure', _check_directory_structure), (None, _check_state_db), (None, _check_checkpoint_store),(None, _check_gateway_supervision), (None, _check_command_installation),diff --git a/hermes_cli/doctor_config.py b/hermes_cli/doctor_config.pyindex 785907acc4f..3ff0d597ee5 100644--- a/hermes_cli/doctor_config.py+++ b/hermes_cli/doctor_config.py@@ -516,6 +516,20 @@ def _check_xai_retirement(should_fix: bool, f: Finding) -> None:f.manual_issues.append(f"Update {len(retired_refs)} retired xAI model reference(s) in config.yaml — see {MIGRATION_GUIDE_URL}")+@doctor_check("Session reset check skipped", "({e})")+def _check_retired_session_reset(should_fix: bool, f: Finding) -> None:+ from hermes_cli.config_effective import load_user_config_effective+ from hermes_cli.session_reset_retirement import format_notice, reset_plugin_enabled, retired_reset_policy+ found = retired_reset_policy(load_user_config_effective())+ if found is None:+ check_ok("No idle/daily session_reset policy configured")+ elif reset_plugin_enabled():+ check_ok(f"{found[0]}.mode: {found[1]} is applied by the session reset plugin")+ else:+ check_warn(format_notice(*found))+ f.manual_issues.append(format_notice(*found))++@doctor_check("Plugin compat check skipped", "({e})")def _check_plugin_compat(should_fix: bool, f: Finding) -> None:from hermes_cli.plugin_compat import ALLOW_KEY, COMPAT_REMOVAL, compat_report, removal_in_effectdiff --git a/hermes_cli/session_reset_retirement.py b/hermes_cli/session_reset_retirement.pynew file mode 100644index 00000000000..67d99ce87b9--- /dev/null+++ b/hermes_cli/session_reset_retirement.py@@ -0,0 +1,48 @@+"""Point configs that still declare an idle/daily ``session_reset`` at the plugin that restores it.++Core stopped rotating gateway conversations on timers (1d5d059410) and reads nothing under+``session_reset``. A household that relied on it silently gets conversations that never end and+a bill that grows with them, so gateway startup and ``hermes doctor`` say so. The+``hermes-session-reset-policy`` catalog plugin reads the top-level block unchanged, which is why+this module reports and never rewrites or drops the key.+"""+from __future__ import annotations++from typing import Any, Optional, Tuple++PLUGIN_NAME = "hermes-session-reset-policy"+_TIMED_MODES = frozenset({"idle", "daily", "both"})+++def retired_reset_policy(config: Any) -> Optional[Tuple[str, str]]:+ """``(config_path, mode)`` for a timed ``session_reset`` the config still declares, else None.++ Looks at the top-level block and the ``gateway:`` form the pre-removal loader also accepted.+ """+ if not isinstance(config, dict):+ return None+ gateway = config.get("gateway")+ for path, block in (+ ("session_reset", config.get("session_reset")),+ ("gateway.session_reset", gateway.get("session_reset") if isinstance(gateway, dict) else None),+ ):+ if isinstance(block, dict):+ mode = str(block.get("mode") or "").strip().lower()+ if mode in _TIMED_MODES:+ return path, mode+ return None+++def reset_plugin_enabled() -> bool:+ """Whether the restoring plugin is installed and enabled in this process's plugin set."""+ from hermes_cli.plugins import discover_plugins, get_plugin_manager+ discover_plugins()+ return any(p["name"] == PLUGIN_NAME and p["enabled"] for p in get_plugin_manager().list_plugins())+++def format_notice(path: str, mode: str) -> str:+ move = "" if path == "session_reset" else " (move the block to top-level session_reset first)"+ return (+ f"{path}.mode: {mode} is no longer applied: gateway conversations reset only on /new or "+ f"/reset. To keep idle/daily resets, run `hermes plugins install {PLUGIN_NAME}`{move}."+ )diff --git a/tests/gateway/test_retired_session_reset_notice.py b/tests/gateway/test_retired_session_reset_notice.pynew file mode 100644index 00000000000..8c1f7a11bdd--- /dev/null+++ b/tests/gateway/test_retired_session_reset_notice.py@@ -0,0 +1,36 @@+"""Gateway startup names every served profile whose config still declares a retired timed reset."""+import logging+from types import SimpleNamespace++import pytest++from gateway.run_startup import GatewayStartupMixin+from hermes_cli import session_reset_retirement++[email protected]("plugin_enabled", [False, True])+def test_startup_warns_on_timed_session_reset_unless_plugin_enabled(tmp_path, monkeypatch, caplog, plugin_enabled):+ home = tmp_path / "home"+ home.mkdir()+ (home / "config.yaml").write_text("session_reset:\n mode: idle\n idle_minutes: 60\n", encoding="utf-8")+ monkeypatch.setattr("hermes_cli.profiles.profiles_to_serve", lambda multiplex: [("default", home)])+ monkeypatch.setattr(session_reset_retirement, "reset_plugin_enabled", lambda: plugin_enabled)+ runner = object.__new__(GatewayStartupMixin)+ runner.config = SimpleNamespace(multiplex_profiles=False)++ with caplog.at_level(logging.WARNING, logger="gateway.run"):+ runner._start_log_retired_session_reset()++ warned = [r.getMessage() for r in caplog.records if "session_reset.mode: idle" in r.getMessage()]+ assert (warned == []) is plugin_enabled+ if not plugin_enabled:+ assert session_reset_retirement.PLUGIN_NAME in warned[0]+++def test_only_timed_modes_count_as_retired_policy():+ find = session_reset_retirement.retired_reset_policy+ assert find({"session_reset": {"mode": "both"}}) == ("session_reset", "both")+ assert find({"gateway": {"session_reset": {"mode": "Daily"}}}) == ("gateway.session_reset", "daily")+ assert find({"session_reset": {"mode": "none"}}) is None+ assert find({"session_reset": {"idle_minutes": 60}}) is None+ assert find({}) is Nonediff --git a/website/docs/user-guide/messaging/index.md b/website/docs/user-guide/messaging/index.mdindex 047bc448104..dd1126bb2b3 100644--- a/website/docs/user-guide/messaging/index.md+++ b/website/docs/user-guide/messaging/index.md@@ -314,8 +314,11 @@ old behavior: in-flight responses are lost on crash).Gateway conversations do not reset after inactivity or at a daily boundary. Use `/new`or `/reset` for an explicit new conversation; context compression remains automatic.-Legacy `session_reset` settings, reset-policy overrides and reset-timer environment-variables are ignored. Cached agents may be released to reclaim resources without+Core ignores legacy `session_reset` settings, reset-policy overrides and reset-timer+environment variables. If your config still sets `session_reset.mode` to `idle`, `daily`+or `both`, gateway startup and `hermes doctor` warn about it. To keep time-based resets,+install the catalog plugin that reads the same block unchanged:+`hermes plugins install hermes-session-reset-policy`. Cached agents may be released to reclaim resources withoutreplacing the durable conversation. Restart-recovery freshness limits automaticcontinuation, not the history loaded when you send a message.diff --git a/website/docs/user-guide/sessions.md b/website/docs/user-guide/sessions.mdindex 4403ac6bf27..e8c6756279a 100644--- a/website/docs/user-guide/sessions.md+++ b/website/docs/user-guide/sessions.md@@ -954,8 +954,11 @@ That reverts groups/channels to a single shared session per room, which preserveGateway conversations do not reset after inactivity or at a daily boundary. Use `/new`or `/reset` for an explicit new conversation; context compression remains automatic.-Legacy `session_reset` settings, reset-policy overrides and reset-timer environment-variables are ignored. Cached agents may be released to reclaim resources without+Core ignores legacy `session_reset` settings, reset-policy overrides and reset-timer+environment variables. If your config still sets `session_reset.mode` to `idle`, `daily`+or `both`, gateway startup and `hermes doctor` warn about it. To keep time-based resets,+install the catalog plugin that reads the same block unchanged:+`hermes plugins install hermes-session-reset-policy`. Cached agents may be released to reclaim resources withoutreplacing the durable conversation. Restart-recovery freshness limits automaticcontinuation, not the history loaded when you send a message.