Repository navigation
Only auto-cancel older pipelines - #7345
Merged
Merged
Conversation
lafriks
approved these changes
Oct 19, 2026
Contributor
|
@savv could you check out the linter? https://ci.woodpecker-ci.org/repos/3780/pipeline/38897/31#L3 |
Signed-off-by: Chris Savvopoulos <chris@green-triangle.com>
savv
force-pushed
the
codex/fix-pipeline-cancel-race
branch
from
November 9, 2026 08:48
f15cb3f to
4252162
Compare
Contributor
Author
thanks for the feedback! and sorry for the delay. All addressed. |
6543
approved these changes
Nov 9, 2026
6543
enabled auto-merge (squash)
November 9, 2026 10:27
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7345 +/- ##
==========================================
+ Coverage 66.16% 66.26% +0.10%
==========================================
Files 449 449
Lines 22422 22422
==========================================
+ Hits 14835 14858 +23
+ Misses 7587 7564 -23 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Concurrent webhook handlers can each see the other pipeline in
GetActivePipelineListand cancel it, leaving no surviving run.We observed this on v3.18.1 after two synchronize deliveries for the same PR and commit arrived 61 ms apart: each run recorded the other as
superseded_by.The same cancellation logic is present on current main.
Only cancel pipelines with a lower repository-scoped pipeline number; exclude both the current run and newer runs.
The regression test uses identical active-run snapshots to reproduce both handler orders for PR and push events, and checks that other contexts/events are untouched.
Test: the four ordering cases fail on the original code because both runs are canceled; they pass with this fix.
Test:
go test -race -tags test ./server/pipeline -count=1passes (Go 1.27.2, macOS arm64).