You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* fix(pipeline): cancel pipeline returns 200 OK but keeps running (#8787)
Three independent bugs caused pipeline cancellation to silently fail:
1. CancelPipeline discarded errors from CancelTask and never cancelled
TASK_CREATED tasks in future stages. Now running tasks are cancelled
via context, non-running tasks are batch-updated to TASK_CANCELLED in
the DB, and errors are logged and returned.
2. gitextractor's storeRepoSnapshot (go-git path) had no ctx.Done()
checks in its commit/blame loops, making it unresponsive to
cancellation for 30+ minutes on large repos. Added cancellation
checkpoints following the pattern already used elsewhere in the file.
3. Cancelled tasks were marked TASK_FAILED instead of TASK_CANCELLED,
and ComputePipelineStatus never returned TASK_CANCELLED. Now RunTask
checks for context cancellation and writes TASK_CANCELLED, and
ComputePipelineStatus returns TASK_CANCELLED when the pipeline was
cancelled by the user.
Test gaps: RunTask deferred status logic, CancelPipeline flow, and
storeRepoSnapshot have no existing unit tests. These are pre-existing
gaps not introduced by this change. The only existing test,
TestComputePipelineStatus, has been extended to cover isCancelled=true.
Closes#8787
Related: #5585, #4188
* refactor(pipeline): improve CancelPipeline readability and correctness
Extract cancelRunningTasks and cancelPendingTasksInDB helpers from
CancelPipeline for better separation of concerns. Also fixes:
- .As(NotFound) replaced with .GetType() to prevent swallowing wrapped errors
- Added TASK_RESUME to cancelPendingTasksInDB status filter
- Error message now includes pipeline ID for traceability
- Added TestCancelPipeline e2e tests with 3 subtests
0 commit comments