Skip to content

Interrupted one-time schedules can replay completed effects after restart #384

Description

@Calmingstorm

Confirmed replay after interrupted one-time execution

Reviewed master at 886c36d8ebe861aa987059a1744d45b78797baae (v4.7.0). Suggested priority: P2.

Stopping the scheduler cancels its active loop. A due one-time callback interrupted after beginning keeps its past-due next_run in the persistent schedule store. CancelledError bypasses ordinary failure/uncertainty handling, and completion/removal never occurs. Restart runs the one-time callback again, potentially repeating steps already performed.

Source: stop/cancellation, completion publication, failure handler, due reservation.

Isolated reproduction

Create a due one-time schedule in a temporary store. Its fake callback records an accepted effect in memory, signals entry, then blocks. Call production Scheduler.stop(), construct a new scheduler from the same store, and tick once with a completing callback.

after shutdown: effects=1, schedule_count=1, next_run remains past due
after restart tick: effects=2, schedule_count=0

Reproduced twice and independently source-reviewed against production shutdown wiring. No Discord or external effect occurred; the fixture counter represents a completed earlier workflow step.

Expected behavior / acceptance criteria

  • Persist a meaningful interrupted/unknown outcome for started one-time work, distinguish it from work that never began, and prevent silent unsafe replay.
  • Define recovery for side-effecting workflows separately from any deliberate at-least-once reminder policy; do not solve this by blindly deleting all interrupted jobs.
  • Test interruption after an early workflow step and before a later step, restart, and explicit operator recovery.
  • Preserve the standing paused-recurring-schedule rule: resume only at its next interval, no catch-up.

Behavior change: recovery of interrupted one-time schedules changes and needs an explicit contract. This issue does not promise exactly-once arbitrary external effects. No source changes were made.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions