hermes-agent/tests/cron
Teknium d6ef7fdf92
fix(cron): replace wall-clock timeout with inactivity-based timeout (#5440)
Port the gateway's inactivity-based timeout pattern (PR #5389) to the
cron scheduler. The agent can now run for hours if it's actively calling
tools or receiving stream tokens — only genuine inactivity (no activity
for HERMES_CRON_TIMEOUT seconds, default 600s) triggers a timeout.

This fixes the Sunday PR scouts (openclaw, nanoclaw, ironclaw) which
all hit the hard 600s wall-clock limit while actively working.

Changes:
- Replace flat future.result(timeout=N) with a polling loop that checks
  agent.get_activity_summary() every 5s (same pattern as gateway)
- Timeout error now includes diagnostic info: last activity description,
  idle duration, current tool, iteration count
- HERMES_CRON_TIMEOUT=0 means unlimited (no timeout)
- Move sys.path.insert before repo-level imports to fix
  ModuleNotFoundError for hermes_time on stale gateway processes
- Add time import needed by the polling loop
- Add 9 tests covering active/idle/unlimited/env-var/diagnostic scenarios
2026-04-05 23:49:42 -07:00
..
__init__.py test: add unit tests for 8 modules (batch 2) 2026-02-26 13:54:20 +03:00
test_cron_inactivity_timeout.py fix(cron): replace wall-clock timeout with inactivity-based timeout (#5440) 2026-04-05 23:49:42 -07:00
test_cron_script.py feat(cron): add script field for pre-run data collection (#5082) 2026-04-04 10:43:39 -07:00
test_jobs.py fix(cron): prevent recurring job re-fire on gateway crash/restart loop (#3396) 2026-03-27 08:02:58 -07:00
test_scheduler.py fix: resolve listed messaging targets consistently 2026-04-05 11:59:28 -07:00