fix(cron): handle naive legacy timestamps in due-job checks#807
Closed
0xNyk wants to merge 1 commit into
Closed
Conversation
Contributor
Author
|
Maintainer ping for triage: this is a narrow bugfix for legacy cron timestamps. What it changes:
Why:
Validation:
|
teknium1
pushed a commit
that referenced
this pull request
Mar 11, 2026
Cherry-picked from PR #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 #806) Fixes #806 Co-authored-by: Nyk <0xnykcd@googlemail.com>
teknium1
pushed a commit
that referenced
this pull request
Mar 11, 2026
Legacy cron job rows may store next_run_at without timezone info. _ensure_aware() previously stamped the Hermes-configured tz directly via replace(tzinfo=...), which shifts absolute time when system-local tz differs from Hermes tz — causing overdue jobs to appear not due. Now: naive datetimes are interpreted as system-local wall time first, then converted to Hermes tz. Aware datetimes are normalized to Hermes tz for consistency. Cherry-picked from PR #807, rebased onto current main. Fixes #806 Co-authored-by: 0xNyk <0xNyk@users.noreply.github.com>
teknium1
added a commit
that referenced
this pull request
Mar 11, 2026
Three new tests for the naive timestamp fix (PR #807): - test_ensure_aware_naive_preserves_absolute_time: verifies UTC equivalent is preserved when interpreting naive datetimes as system-local time - test_ensure_aware_normalizes_aware_to_hermes_tz: verifies already-aware datetimes are normalized to Hermes tz without shifting the instant - test_ensure_aware_due_job_not_skipped_when_system_ahead: end-to-end regression test for the original bug scenario
0xNyk
added a commit
to 0xNyk/hermes-agent
that referenced
this pull request
Mar 14, 2026
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>
angelburgosrosado
pushed a commit
to angelburgosrosado/hermes-agent
that referenced
this pull request
Apr 27, 2026
Legacy cron job rows may store next_run_at without timezone info. _ensure_aware() previously stamped the Hermes-configured tz directly via replace(tzinfo=...), which shifts absolute time when system-local tz differs from Hermes tz — causing overdue jobs to appear not due. Now: naive datetimes are interpreted as system-local wall time first, then converted to Hermes tz. Aware datetimes are normalized to Hermes tz for consistency. Cherry-picked from PR NousResearch#807, rebased onto current main. Fixes NousResearch#806 Co-authored-by: 0xNyk <0xNyk@users.noreply.github.com>
angelburgosrosado
pushed a commit
to angelburgosrosado/hermes-agent
that referenced
this pull request
Apr 27, 2026
Three new tests for the naive timestamp fix (PR NousResearch#807): - test_ensure_aware_naive_preserves_absolute_time: verifies UTC equivalent is preserved when interpreting naive datetimes as system-local time - test_ensure_aware_normalizes_aware_to_hermes_tz: verifies already-aware datetimes are normalized to Hermes tz without shifting the instant - test_ensure_aware_due_job_not_skipped_when_system_ahead: end-to-end regression test for the original bug scenario
angelburgosrosado
pushed a commit
to angelburgosrosado/hermes-agent
that referenced
this pull request
Apr 28, 2026
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>
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
Legacy cron job rows may store next_run_at without timezone info. _ensure_aware() previously stamped the Hermes-configured tz directly via replace(tzinfo=...), which shifts absolute time when system-local tz differs from Hermes tz — causing overdue jobs to appear not due. Now: naive datetimes are interpreted as system-local wall time first, then converted to Hermes tz. Aware datetimes are normalized to Hermes tz for consistency. Cherry-picked from PR NousResearch#807, rebased onto current main. Fixes NousResearch#806 Co-authored-by: 0xNyk <0xNyk@users.noreply.github.com>
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
Three new tests for the naive timestamp fix (PR NousResearch#807): - test_ensure_aware_naive_preserves_absolute_time: verifies UTC equivalent is preserved when interpreting naive datetimes as system-local time - test_ensure_aware_normalizes_aware_to_hermes_tz: verifies already-aware datetimes are normalized to Hermes tz without shifting the instant - test_ensure_aware_due_job_not_skipped_when_system_ahead: end-to-end regression test for the original bug scenario
olympus-terminal
pushed a commit
to olympus-terminal/hermes-agent
that referenced
this pull request
May 16, 2026
Legacy cron job rows may store next_run_at without timezone info. _ensure_aware() previously stamped the Hermes-configured tz directly via replace(tzinfo=...), which shifts absolute time when system-local tz differs from Hermes tz — causing overdue jobs to appear not due. Now: naive datetimes are interpreted as system-local wall time first, then converted to Hermes tz. Aware datetimes are normalized to Hermes tz for consistency. Cherry-picked from PR NousResearch#807, rebased onto current main. Fixes NousResearch#806 Co-authored-by: 0xNyk <0xNyk@users.noreply.github.com>
olympus-terminal
pushed a commit
to olympus-terminal/hermes-agent
that referenced
this pull request
May 16, 2026
Three new tests for the naive timestamp fix (PR NousResearch#807): - test_ensure_aware_naive_preserves_absolute_time: verifies UTC equivalent is preserved when interpreting naive datetimes as system-local time - test_ensure_aware_normalizes_aware_to_hermes_tz: verifies already-aware datetimes are normalized to Hermes tz without shifting the instant - test_ensure_aware_due_job_not_skipped_when_system_ahead: end-to-end regression test for the original bug scenario
CumulusService
pushed a commit
to Cumulus-Service-GmbH/hermes-agent
that referenced
this pull request
May 30, 2026
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>
Egavasyug
pushed a commit
to Egavasyug/hermes-agent
that referenced
this pull request
Jun 10, 2026
Legacy cron job rows may store next_run_at without timezone info. _ensure_aware() previously stamped the Hermes-configured tz directly via replace(tzinfo=...), which shifts absolute time when system-local tz differs from Hermes tz — causing overdue jobs to appear not due. Now: naive datetimes are interpreted as system-local wall time first, then converted to Hermes tz. Aware datetimes are normalized to Hermes tz for consistency. Cherry-picked from PR NousResearch#807, rebased onto current main. Fixes NousResearch#806 Co-authored-by: 0xNyk <0xNyk@users.noreply.github.com>
Egavasyug
pushed a commit
to Egavasyug/hermes-agent
that referenced
this pull request
Jun 10, 2026
Three new tests for the naive timestamp fix (PR NousResearch#807): - test_ensure_aware_naive_preserves_absolute_time: verifies UTC equivalent is preserved when interpreting naive datetimes as system-local time - test_ensure_aware_normalizes_aware_to_hermes_tz: verifies already-aware datetimes are normalized to Hermes tz without shifting the instant - test_ensure_aware_due_job_not_skipped_when_system_ahead: end-to-end regression test for the original bug scenario
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.
Summary
Why
Legacy cron job rows may store next_run_at without timezone info.
When Hermes timezone differs from system local timezone, direct tz attachment can shift absolute time and incorrectly mark overdue jobs as not due.
Validation
Closes #806