Skip to content

fix(cron): reject past one-shot in update_job fallback + resume_job (#59395) - #59447

Merged
kshitijk4poor merged 2 commits into
NousResearch:mainfrom
kshitijk4poor:salvage/59428-resume-past-oneshot
Jul 6, 2026
Merged

fix(cron): reject past one-shot in update_job fallback + resume_job (#59395)#59447
kshitijk4poor merged 2 commits into
NousResearch:mainfrom
kshitijk4poor:salvage/59428-resume-past-oneshot

Conversation

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

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 in cronjob list but never fires). Salvages the additive parts of #59428.

Background

create_job() and update_job()'s schedule-change path already reject past one-shots (landed via #59410#59438). Two entry points were still unguarded:

  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 run_at has already passed. Empirically confirmed on current main: this produces state="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 ValueError when compute_next_run() returns None and kind == "once".

Changes

  • cron/jobs.py — guard the update_job fallback-recompute path and resume_job (raise before any disk write / before delegating to update_job, so no partial state).
  • tests/cron/test_jobs.pyresume_job on 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-attribution requires it).

The redundant update_job schedule-change hunk from the original #59428 was dropped — it's already on main via #59438.

Validation

Before (main, post-#59438) After
resume paused past one-shot ghost job (scheduled, next_run_at=None, never fires) ValueError, not revived
update fallback recompute → past one-shot stored None silently ValueError
resume/update future one-shot works works (unchanged)
one-shot post-fire lifecycle auto-deleted auto-deleted (unaffected)
tests/cron/ full suite 638 passed, 0 failed

ruff 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.

isheng-eqi and others added 2 commits July 6, 2026 12:31
…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.
@alt-glitch alt-glitch added type/bug Something isn't working comp/cron Cron scheduler and job management P1 High — major feature broken, no workaround labels Jul 6, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Salvage/superset of open #59428 (same two call sites: update_job fallback-recompute + resume_job); the redundant update_job schedule-change hunk was dropped as it already shipped via merged #59438. Related, not a duplicate. Completes the #59395 bug-class fix.

@kshitijk4poor
kshitijk4poor merged commit c67aab7 into NousResearch:main Jul 6, 2026
31 checks passed
@kshitijk4poor
kshitijk4poor deleted the salvage/59428-resume-past-oneshot branch August 5, 2026 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cron Cron scheduler and job management P1 High — major feature broken, no workaround type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants