Repository navigation
fix(backstage-template-execution): ignore concurrency-cancelled duplicates in actions-runs gate - #67
Merged
Conversation
…cates in actions-runs gate On PR open GitHub may start a workflow twice with identical run_started_at and run_attempt; the concurrency group cancels one copy. The newest-per-workflow pick was then arbitrary and could land on the cancelled copy, refusing a green head (stuttgart-things#3889). In the Actions-runs fallback, drop cancelled runs when the same workflow has a non-cancelled run on the SHA (all-cancelled still refuses), and break remaining ties by run id so the pick is deterministic. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016TtmNGbCHXQGtqnrT926ZN
This branch was successfully deployed
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.
Why
The Actions-runs fallback from #65 refused a real merge: stuttgart-things/stuttgart-things#3889, head
5cbeb476f. The worker loggedpr head checks source=actions-runs total=14 distinct=5 notGreen=1.On PR open, GitHub started several workflows twice. Every copy had the same
run_started_at(19:52:56Z) andrun_attempt1. Each workflow's concurrency group cancelled one copy, and the other endedsuccessorskipped. Example: "PR Packer Build with Dagger" came back cancelled, cancelled, skipped, skipped. Because the start time and attempt were equal, the newest-per-workflow_idpick depended on the API's list order. It landed on a cancelled copy and refused the merge.What (fallback path only)
workflow_id, acompleted/cancelledrun is ignored when the same workflow has at least one non-cancelled run for the SHA, because a concurrency run superseded it. If all runs of a workflow are cancelled, the gate still reportsname (cancelled)and refuses.run_started_at(orcreated_atif that is missing), thenrun_attempt, then runid. Theidis assigned in increasing order, so the pick no longer depends on list order.The check-runs path is unchanged. It probably has the same tie problem, since duplicated workflows produce same-named cancelled job check runs with equal
started_at. Fixing it would change that path's behaviour, so it is left for a separate decision.Tests
go build ./...,go vet ./...,go test ./...,gofmt -l(clean) inworkflows/backstage-template-execution. New table testTestUnfinishedChecksFallbackCancelledDuplicates:id, in both list ordersThree of these cases fail against the code on main and pass with this change.
🤖 Generated with Claude Code
https://claude.ai/code/session_016TtmNGbCHXQGtqnrT926ZN