Skip to content

cancelTasks on CancelSchedule only covers latest execution #82

@dean0x

Description

@dean0x

Problem

When cancelTasks: true is passed to CancelSchedule, only the latest execution's tasks are cancelled. For CRON schedules with overlapping runs (e.g. a long-running pipeline that hasn't finished when the next trigger fires), older execution tasks remain running.

Current behavior

ScheduleManagerService.cancelSchedule() fetches getExecutionHistory(scheduleId, 1) — only the most recent execution — and cancels its pipelineTaskIds or taskId.

Expected behavior

All non-terminal execution tasks should be cancelled when cancelTasks: true, not just the latest.

Suggested approach

  • Fetch all executions with status: 'triggered' (not just limit 1)
  • For each execution, cancel its pipeline task IDs
  • Consider adding a findActiveExecutions(scheduleId) method to ScheduleRepository

Context

Identified during PR #80 review. Deferred because the fix requires a new repository method and broader testing.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions