fix(cron): reject past one-shot in update_job fallback + resume_job (#59395) - #59447
Merged
kshitijk4poor merged 2 commits intoJul 6, 2026
Merged
Conversation
…esume_job (NousResearch#59395) Completes the NousResearch#59395 bug-class fix. create_job and update_job's schedule-change path already reject past one-shots (via NousResearch#59410/NousResearch#59438); this closes the two remaining doors that stored next_run_at=None for a 'once' schedule and re-created the silent ghost job: 1. update_job fallback-recompute (the safety-net that re-derives next_run_at when it's missing on an enabled, non-paused job) 2. resume_job (resuming a paused one-shot whose time has already passed — empirically confirmed to create a scheduled job that never fires) The redundant update_job schedule-change hunk from the original PR was dropped (already on main via NousResearch#59438). Adds resume-reject + update-reject/ accept regression tests. Salvaged from NousResearch#59428 by isheng-eqi.
check-attribution CI fails on unmapped bare (non-noreply) contributor emails. isheng-eqi's commit email (ishengeqi@163.com) has no + so it does not auto-resolve — add the explicit mapping.
Collaborator
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
Completes the #59395 bug-class fix by closing the two remaining doors that could persist a one-shot cron job with
next_run_at=None(a "ghost job" that looks healthy incronjob listbut never fires). Salvages the additive parts of #59428.Background
create_job()andupdate_job()'s schedule-change path already reject past one-shots (landed via #59410 → #59438). Two entry points were still unguarded:update_jobfallback-recompute — the safety-net that re-derivesnext_run_atwhen it's missing on an enabled, non-paused job.resume_job— resuming a paused one-shot whoserun_athas already passed. Empirically confirmed on currentmain: this producesstate="scheduled",enabled=True,next_run_at=None— the exact ghost job, through a door fix(cron): reject one-shot jobs with a past timestamp at create + update (#59395) #59438 didn't close.Both now raise
ValueErrorwhencompute_next_run()returnsNoneandkind == "once".Changes
cron/jobs.py— guard theupdate_jobfallback-recompute path andresume_job(raise before any disk write / before delegating toupdate_job, so no partial state).tests/cron/test_jobs.py—resume_jobon a paused past one-shot raises (recreates the confirmed ghost scenario); update-to-past raises; update-to-future / within-grace still accepted.scripts/release.py— AUTHOR_MAP entry for @isheng-eqi (bare email, doesn't auto-resolve;check-attributionrequires it).The redundant
update_jobschedule-change hunk from the original #59428 was dropped — it's already onmainvia #59438.Validation
scheduled,next_run_at=None, never fires)ValueError, not revivedNonesilentlyValueErrortests/cron/full suiteruff clean, ty 3==3 (zero net-new).
Credit
Salvaged from #59428 by @isheng-eqi — cherry-picked to preserve authorship (additive guards + tests), redundant schedule-change hunk dropped. This is the third and final PR in the #59395 cron-ghost-job cluster (create → update-schedule → update-fallback + resume). Closes #59428.