fix(cron): prevent migration repair from swallowing manual triggers (#78516) - #5
Open
blut-agent wants to merge 2 commits into
Open
fix(cron): prevent migration repair from swallowing manual triggers (#78516)#5blut-agent wants to merge 2 commits into
blut-agent wants to merge 2 commits into
Conversation
blut-agent
force-pushed
the
bugfix/cron-trigger-migration-20260804
branch
from
August 6, 2026 11:17
f2493fb to
e718418
Compare
blut-agent
force-pushed
the
bugfix/cron-trigger-migration-20260804
branch
from
August 8, 2026 16:33
f3be572 to
df85b25
Compare
blut-agent
force-pushed
the
main
branch
2 times, most recently
from
August 11, 2026 14:16
c0106e5 to
813793d
Compare
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.
Problem
When
trigger_job()setsnext_run_atto_hermes_now().isoformat()(essentially 'now'), the migration repair branch in_get_due_jobs_locked()can recomputenext_run_atfrom the cron expression and skip the job — swallowing the dashboard 'Run now' button when there's a timezone offset mismatch.This was reported in issue NousResearch#78516 where the dashboard 'Run now' button appeared to do nothing because the scheduler tick would detect a timezone offset mismatch and recompute the next run time, effectively skipping the manual trigger.
Fix
Add a proximity check (
_MANUAL_TRIGGER_PROXIMITY_SECS = 60): ifnext_run_dtis within 60 seconds ofnow, treat it as a manual trigger fromtrigger_job()and let the job fire. Genuine stale runs (>60s ago) still get the migration repair treatment.Changes
_MANUAL_TRIGGER_PROXIMITY_SECS = 60constant and a proximity check in the migration repair branch of_get_due_jobs_locked()TestManualTriggerProximityclass with two regression testsTests
test_trigger_not_swallowed_when_within_proximity: Verifies that a manual trigger (next_run_at within 60s of now) is NOT swallowed by the migration repairtest_trigger_swallowed_when_stale: Verifies that genuine stale runs (>60s ago with offset mismatch) still get the migration repair treatmentAll 56 cron tests pass.