diff --git a/gateway/run.py b/gateway/run.py index 207ae120ba..94f1dde532 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -186,6 +186,8 @@ if _config_path.exists(): os.environ["HERMES_AGENT_TIMEOUT"] = str(_agent_cfg["gateway_timeout"]) if "gateway_timeout_warning" in _agent_cfg and "HERMES_AGENT_TIMEOUT_WARNING" not in os.environ: os.environ["HERMES_AGENT_TIMEOUT_WARNING"] = str(_agent_cfg["gateway_timeout_warning"]) + if "gateway_notify_interval" in _agent_cfg and "HERMES_AGENT_NOTIFY_INTERVAL" not in os.environ: + os.environ["HERMES_AGENT_NOTIFY_INTERVAL"] = str(_agent_cfg["gateway_notify_interval"]) if "restart_drain_timeout" in _agent_cfg and "HERMES_RESTART_DRAIN_TIMEOUT" not in os.environ: os.environ["HERMES_RESTART_DRAIN_TIMEOUT"] = str(_agent_cfg["restart_drain_timeout"]) _display_cfg = _cfg.get("display", {}) @@ -8146,11 +8148,17 @@ class GatewayRunner: interrupt_monitor = asyncio.create_task(monitor_for_interrupt()) # Periodic "still working" notifications for long-running tasks. - # Fires every 10 minutes so the user knows the agent hasn't died. - _NOTIFY_INTERVAL = 600 # 10 minutes + # Fires every N seconds so the user knows the agent hasn't died. + # Config: agent.gateway_notify_interval in config.yaml, or + # HERMES_AGENT_NOTIFY_INTERVAL env var. Default 600s (10 min). + # 0 = disable notifications. + _NOTIFY_INTERVAL_RAW = float(os.getenv("HERMES_AGENT_NOTIFY_INTERVAL", 600)) + _NOTIFY_INTERVAL = _NOTIFY_INTERVAL_RAW if _NOTIFY_INTERVAL_RAW > 0 else None _notify_start = time.time() async def _notify_long_running(): + if _NOTIFY_INTERVAL is None: + return # Notifications disabled (gateway_notify_interval: 0) _notify_adapter = self.adapters.get(source.platform) if not _notify_adapter: return diff --git a/hermes_cli/config.py b/hermes_cli/config.py index 8c46f8bba1..011c9bca9b 100644 --- a/hermes_cli/config.py +++ b/hermes_cli/config.py @@ -355,6 +355,10 @@ DEFAULT_CONFIG = { # threshold before escalating to a full timeout. The warning fires # once per run and does not interrupt the agent. 0 = disable warning. "gateway_timeout_warning": 900, + # Periodic "still working" notification interval (seconds). + # Sends a status message every N seconds so the user knows the + # agent hasn't died during long tasks. 0 = disable notifications. + "gateway_notify_interval": 600, }, "terminal": {