Skip to content

fix(cron): fall back gracefully when HERMES_CRON_TIMEOUT is invalid - #17515

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-49aabb57
Apr 29, 2026
Merged

teknium1 merged 2 commits into
mainfrom
hermes/hermes-49aabb57

Conversation

@teknium1

Copy link
Copy Markdown
Collaborator

Salvages #11365 from @yeyitech onto current main. Fixes #11319.

Summary

Cron jobs no longer crash when HERMES_CRON_TIMEOUT is set to a non-numeric string. Previously the bare float(os.getenv(...)) call in run_job() raised ValueError before the agent started; now it logs a warning and falls back to the 600s default, mirroring the pattern already used for HERMES_CRON_SCRIPT_TIMEOUT.

Changes

  • cron/scheduler.py — defensive try/except around HERMES_CRON_TIMEOUT parse
  • tests/cron/test_cron_inactivity_timeout.py — two new regression tests (invalid value, empty string), existing env-var tests updated
  • scripts/release.py — AUTHOR_MAP entry for @yeyitech

Validation

  • tests/cron/test_cron_inactivity_timeout.py — 11/11 pass (both new tests)
  • tests/cron/ — 260/260 pass (no regressions)
  • E2E: verified HERMES_CRON_TIMEOUT=abc → 600s + warning, "" → 600s, "120" → 120s, "0" → unlimited sentinel preserved

Original PR: #11365

yeyitech and others added 2 commits April 29, 2026 08:16
Bare `float(os.getenv("HERMES_CRON_TIMEOUT", 600))` in `run_job()` raises
a `ValueError` when the env var is set to a non-numeric string (e.g. "abc").
Replace it with the same defensive try/except pattern already used by
`_get_script_timeout()` for `HERMES_CRON_SCRIPT_TIMEOUT`: log a warning
and fall back to the 600 s default instead of crashing.

Also update the existing env-var tests to exercise the new code path and
add two new tests — one for an invalid value, one for an empty string.

Fixes #11319

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@teknium1
teknium1 merged commit 6d84237 into main Apr 29, 2026
11 of 12 checks passed
@teknium1
teknium1 deleted the hermes/hermes-49aabb57 branch April 29, 2026 15:21
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cron Cron scheduler and job management labels Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cron Cron scheduler and job management P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: invalid HERMES_CRON_TIMEOUT makes run_job fail with ValueError instead of falling back

3 participants