Skip to content

Commit 2d10fac

Browse files
committed
fix(cron): remove /2 divisor from pre-execution watchdog formula
The pre-execution (stale-progress) watchdog uses Math.min(CAP, Math.floor(jobTimeoutMs / 2)) to determine when to abort a cron job that has not emitted a new execution phase event. The /2 divisor means a job configured with timeoutSeconds: 600 is silently killed at 300s if the tool execution produces no intermediate phase events. This affects any shell command that runs silently for its entire duration: rclone sync, rsync, pg_dump, large file transfers, etc. The Codex process spawns the tool, the tool runs, and eventually returns output — but during that window the stale-progress watchdog fires at half the job timeout. Remove the /2 divisor so the pre-execution watchdog respects the full job timeout. The job-level timeout already provides the hard upper bound; the stale-progress detector should not impose a stricter one for silent but active processes. Before: rclone sync killed at 300s (half of 600s job timeout) After: rclone sync completes at ~301s (durationMs=300967 aborted=false) Fixes #83110
1 parent 2ab7624 commit 2d10fac

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎src/cron/service/timer.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ function formatCronAgentExecutionPhase(execution?: CronAgentExecutionStarted): s
390390
function resolveCronAgentPreExecutionWatchdogMs(jobTimeoutMs: number): number {
391391
return Math.max(
392392
CRON_AGENT_PRE_EXECUTION_MIN_WATCHDOG_MS,
393-
Math.min(CRON_AGENT_PRE_EXECUTION_WATCHDOG_MS, Math.floor(jobTimeoutMs / 2)),
393+
Math.min(CRON_AGENT_PRE_EXECUTION_WATCHDOG_MS, jobTimeoutMs),
394394
);
395395
}
396396

0 commit comments

Comments
 (0)