← Back to PRs

#11813: fix(cron): ensure 'at' schedule type correctly registers nextWakeAtMs during update

by leo-reifying open 2026-02-08 10:49 View on GitHub →
stale
Fixes #11795. This PR simplifies `computeJobNextRunAtMs` for 'at' schedules by delegating to `computeNextRunAtMs`, which correctly handles past/future checks. This ensures that when a job is updated to an 'at' schedule, the scheduler correctly registers the next wake time. <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR fixes cron job updates for one-shot `at` schedules by simplifying `computeJobNextRunAtMs` to delegate to `computeNextRunAtMs`, which applies the past/future cutoff consistently (and still supports legacy `atMs`). It also adds a Vitest regression test reproducing issue #11795 by updating an existing cron job to an `at` schedule in the past and then in the future, asserting `nextWakeAtMs` behavior matches expectations. <h3>Confidence Score: 4/5</h3> - This PR is likely safe to merge after fixing minor test hygiene issues. - The core logic change is small and delegates to the existing schedule computation, which already contains the legacy `atMs` handling and the past/future cutoff needed for the reported bug. The main remaining issues are in the new regression test (unused variables and loose typing via `as any`), which could fail CI or reduce test robustness. - src/cron/repro_11795.test.ts <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs