fix(cron): fall back gracefully when HERMES_CRON_TIMEOUT is invalid - #17515
Merged
Merged
Conversation
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>
This was referenced Apr 29, 2026
This was referenced Jul 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Salvages #11365 from @yeyitech onto current main. Fixes #11319.
Summary
Cron jobs no longer crash when
HERMES_CRON_TIMEOUTis set to a non-numeric string. Previously the barefloat(os.getenv(...))call inrun_job()raisedValueErrorbefore the agent started; now it logs a warning and falls back to the 600s default, mirroring the pattern already used forHERMES_CRON_SCRIPT_TIMEOUT.Changes
cron/scheduler.py— defensive try/except aroundHERMES_CRON_TIMEOUTparsetests/cron/test_cron_inactivity_timeout.py— two new regression tests (invalid value, empty string), existing env-var tests updatedscripts/release.py— AUTHOR_MAP entry for @yeyitechValidation
tests/cron/test_cron_inactivity_timeout.py— 11/11 pass (both new tests)tests/cron/— 260/260 pass (no regressions)HERMES_CRON_TIMEOUT=abc→ 600s + warning,""→ 600s,"120"→ 120s,"0"→ unlimited sentinel preservedOriginal PR: #11365