fix(config): read browser inactivity timeout from config

This commit is contained in:
Amy Ravenwolf
2026-06-15 07:46:34 -07:00
committed by Teknium
parent bee13817f0
commit 2f2e3616b4
2 changed files with 40 additions and 4 deletions
+17 -4
View File
@@ -1177,10 +1177,23 @@ _cleanup_done = False
# Inactivity Timeout Configuration
# =============================================================================
# Session inactivity timeout (seconds) - cleanup if no activity for this long
# Default: 5 minutes. Needs headroom for LLM reasoning between browser commands,
# especially when subagents are doing multi-step browser tasks.
BROWSER_SESSION_INACTIVITY_TIMEOUT = env_int("BROWSER_INACTIVITY_TIMEOUT", 300)
# Session inactivity timeout (seconds) - cleanup if no activity for this long.
# config.yaml is authoritative; BROWSER_INACTIVITY_TIMEOUT remains a legacy
# fallback so old deployments keep working if they have not migrated yet.
def _get_session_inactivity_timeout() -> int:
result = env_int("BROWSER_INACTIVITY_TIMEOUT", 300)
try:
from hermes_cli.config import read_raw_config
cfg = read_raw_config()
val = cfg_get(cfg, "browser", "inactivity_timeout")
if val is not None:
result = max(int(val), 30) # Floor at 30s to avoid instant reaping
except Exception as e:
logger.debug("Could not read inactivity_timeout from config: %s", e)
return result
BROWSER_SESSION_INACTIVITY_TIMEOUT = _get_session_inactivity_timeout()
# Track last activity time per session
_session_last_activity: Dict[str, float] = {}