fix(cron): handle naive legacy timestamps in due-job checks#1308
Closed
0xNyk wants to merge 1 commit into
Closed
Conversation
Cherry-picked from PR NousResearch#807 by 0xNyk, rebased onto current main. When HERMES_TIMEZONE differs from system local timezone, naive (legacy) timestamps were misinterpreted by _ensure_aware() — it stamped them with the Hermes timezone via replace(tzinfo=...), but they were created using datetime.now() (system local time). This could shift the absolute time and cause overdue jobs to appear not-due. Fix: interpret naive datetimes as system-local wall time first, then convert to Hermes timezone. Already-aware datetimes are normalized to Hermes timezone for consistent comparisons. Added 3 tests: - _ensure_aware preserves absolute time for naive datetimes - _ensure_aware normalizes aware datetimes to Hermes tz - get_due_jobs detects naive past timestamps as due even when Hermes tz is far behind system local tz (the scenario from NousResearch#806) Fixes NousResearch#806 Co-authored-by: Nyk <0xnykcd@googlemail.com>
teknium1
pushed a commit
that referenced
this pull request
Mar 14, 2026
Cherry-picked from PR #1308 by 0xNyk. Adds an end-to-end regression test covering a Hermes timezone far behind system local time (Pacific/Midway, UTC-11) to ensure legacy naive cron timestamps are still recognized as due under large timezone mismatches.
Contributor
angelburgosrosado
pushed a commit
to angelburgosrosado/hermes-agent
that referenced
this pull request
Apr 27, 2026
Cherry-picked from PR NousResearch#1308 by 0xNyk. Adds an end-to-end regression test covering a Hermes timezone far behind system local time (Pacific/Midway, UTC-11) to ensure legacy naive cron timestamps are still recognized as due under large timezone mismatches.
angelburgosrosado
pushed a commit
to angelburgosrosado/hermes-agent
that referenced
this pull request
Apr 27, 2026
…048e6599 Merging the remaining useful regression coverage from NousResearch#1308 on top of the already-merged cron fix in NousResearch#949.
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
Cherry-picked from PR NousResearch#1308 by 0xNyk. Adds an end-to-end regression test covering a Hermes timezone far behind system local time (Pacific/Midway, UTC-11) to ensure legacy naive cron timestamps are still recognized as due under large timezone mismatches.
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
…048e6599 Merging the remaining useful regression coverage from NousResearch#1308 on top of the already-merged cron fix in NousResearch#949.
olympus-terminal
pushed a commit
to olympus-terminal/hermes-agent
that referenced
this pull request
May 16, 2026
Cherry-picked from PR NousResearch#1308 by 0xNyk. Adds an end-to-end regression test covering a Hermes timezone far behind system local time (Pacific/Midway, UTC-11) to ensure legacy naive cron timestamps are still recognized as due under large timezone mismatches.
olympus-terminal
pushed a commit
to olympus-terminal/hermes-agent
that referenced
this pull request
May 16, 2026
…048e6599 Merging the remaining useful regression coverage from NousResearch#1308 on top of the already-merged cron fix in NousResearch#949.
Egavasyug
pushed a commit
to Egavasyug/hermes-agent
that referenced
this pull request
Jun 10, 2026
Cherry-picked from PR NousResearch#1308 by 0xNyk. Adds an end-to-end regression test covering a Hermes timezone far behind system local time (Pacific/Midway, UTC-11) to ensure legacy naive cron timestamps are still recognized as due under large timezone mismatches.
Egavasyug
pushed a commit
to Egavasyug/hermes-agent
that referenced
this pull request
Jun 10, 2026
…048e6599 Merging the remaining useful regression coverage from NousResearch#1308 on top of the already-merged cron fix in NousResearch#949.
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.
Replaces #929 (rebased to resolve merge conflicts with upstream main).
Summary
_ensure_aware()to interpret naive datetimes as system-local wall time (viadatetime.now().astimezone().tzinfo), then convert to Hermes timezone — instead of blindly stamping withreplace(tzinfo=hermes_tz)which shifted the absolute time.astimezone(target_tz)for consistent comparisons inget_due_jobs()Test plan
pytest tests/test_timezone.py— all 22 tests pass (including 4 new ones)