@@ -67,6 +67,12 @@ export function isRunnableJob(params: {
6767 if ( hasActiveCronRun ( job ) ) {
6868 return false ;
6969 }
70+ const next = job . state . nextRunAtMs ;
71+ // Ordinary ticks cannot recover a missed cron slot before a future wake.
72+ // Keep their dominant no-due path ahead of run-history normalization.
73+ if ( ! params . allowCronMissedRunByLastRun && hasScheduledNextRunAtMs ( next ) && nowMs < next ) {
74+ return false ;
75+ }
7076 const lastRunStatus = resolveJobLastRunStatus ( job ) ;
7177 if ( params . skipAtIfAlreadyRan && job . schedule . kind === "at" && lastRunStatus ) {
7278 const lastRun = job . state . lastRunAtMs ;
@@ -88,8 +94,7 @@ export function isRunnableJob(params: {
8894 }
8995 return false ;
9096 }
91- const next = job . state . nextRunAtMs ;
92- if ( isErrorBackoffPending ( params . state , job , nowMs ) ) {
97+ if ( isErrorBackoffPending ( job , nowMs , lastRunStatus ) ) {
9398 // Error retry windows are anchored at run end; persisted start-based
9499 // retry timestamps from older state must not bypass active backoff.
95100 return false ;
@@ -122,8 +127,12 @@ export function isRunnableJob(params: {
122127 return hasMissedCronSlotSinceLastRun ( job , nowMs ) ;
123128}
124129
125- function isErrorBackoffPending ( _state : CronServiceState , job : CronJob , nowMs : number ) : boolean {
126- if ( job . schedule . kind === "at" || resolveJobLastRunStatus ( job ) !== "error" ) {
130+ function isErrorBackoffPending (
131+ job : CronJob ,
132+ nowMs : number ,
133+ lastRunStatus : ReturnType < typeof resolveJobLastRunStatus > ,
134+ ) : boolean {
135+ if ( job . schedule . kind === "at" || lastRunStatus !== "error" ) {
127136 return false ;
128137 }
129138 const backoffUntilMs = resolveJobErrorBackoffUntilMs ( job , DEFAULT_ERROR_BACKOFF_SCHEDULE_MS ) ;
0 commit comments