Conversation
An rrule created without an explicit dtstart defaults it to the creation time, and celery's ScheduleEntry defaults last_run_at to the same instant. remaining_estimate asks dateutil for rrule.after(last_run_at), which is exclusive, so the occurrence sitting exactly on dtstart is skipped and the first run is delayed by a full interval. Marked expectedFailure so CI stays green. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WWqTCzv8BkUkgVg11xpgqQ
This was referenced Jul 27, 2026
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.
Adds a failing regression test for #74, reproduced on
main(2f96d0a).The mechanism
An
rrulebuilt without an explicitdtstartdefaults it to the creation time(
redbeat/schedules.py:53), and celery'sScheduleEntrydefaultslast_run_atto the same instant.
remaining_estimatethen asks dateutil forrrule.after(last_run_at)(redbeat/schedules.py:93), which is exclusive —so the occurrence sitting exactly on
dtstartis passed over and the first runis delayed by a full interval.
For
rrule('MINUTELY', interval=3, count=4)created at 21:19:58,due_atis21:22:58 rather than 21:19:58:
This is the first of the two problems @concreted separated out in
#74 (comment).
What's in here
tests/test_issue_74.pyholds two tests:test_first_occurrence_is_due_at_dtstart— the bug, marked@unittest.expectedFailureso CI stays green.unittestreports anunexpected success as a failure, so the day this is fixed the suite says so.
test_first_occurrence_is_delayed_by_one_interval— pins today's behaviour, soa fix can't pass the first test without also having to touch this one
deliberately.
At fix time
This is a triage artifact, not a permanent home. Whoever fixes this should move
the first test into
tests/test_schedules.py, drop theexpectedFailuremarker, rename it for the behaviour it checks rather than the issue number,
delete
test_first_occurrence_is_delayed_by_one_interval, and delete this file.The same note is in the class docstring.
Not addressed here: the second problem in #74 — an rrule whose occurrences are
all in the past is never scheduled at all (
due_atisNone,scoreis-1). That one is a design question about whether missed occurrences shouldfire, not a clear defect, so I left it for the maintainer.