Repository navigation
MUL-8510: fix(ghsnapshot): drop cancelled workflow runs that a newer run of the same workflow replaced from the PR rollup - #9860
Merged
Conversation
…ed out of the rollup filter=latest only drops older attempts inside one check suite. A second workflow run on the same head is a separate suite, so a cancelled earlier run kept the rollup at FAILURE after the newer run went green, and a --until-pr checks wakeup never fired. A suite is dropped only when GitHub concluded it cancelled and a newer suite from the same app reports a check with the same name. The suites list is read only when such a repeat exists. Closes #9830 Co-authored-by: multica-agent <github@multica.ai>
…ropping them Matching a cancelled check suite to a newer one by app and check name could drop a run of one workflow because an unrelated workflow passed a job with the same name, reporting a false success. Only the Actions API says which workflow and event a check suite belongs to. When the installation token has the optional Actions read permission, read the head's workflow runs and drop a cancelled run only when a newer run of the same workflow for the same event has reported checks and is finished or still running. Without that permission nothing is dropped, as before. Document the optional permission. Co-authored-by: multica-agent <github@multica.ai>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…eded-check-suites
Co-authored-by: multica-agent <github@multica.ai>
3 tasks done
adambenhassen
pushed a commit
to adambenhassen/multica
that referenced
this pull request
Nov 5, 2026
…run of the same workflow replaced from the PR rollup (multica-ai#9860) * fix(ghsnapshot): leave cancelled check suites that a newer run replaced out of the rollup filter=latest only drops older attempts inside one check suite. A second workflow run on the same head is a separate suite, so a cancelled earlier run kept the rollup at FAILURE after the newer run went green, and a --until-pr checks wakeup never fired. A suite is dropped only when GitHub concluded it cancelled and a newer suite from the same app reports a check with the same name. The suites list is read only when such a repeat exists. Closes multica-ai#9830 Co-authored-by: multica-agent <github@multica.ai> * fix(ghsnapshot): confirm replaced runs by workflow and event before dropping them Matching a cancelled check suite to a newer one by app and check name could drop a run of one workflow because an unrelated workflow passed a job with the same name, reporting a false success. Only the Actions API says which workflow and event a check suite belongs to. When the installation token has the optional Actions read permission, read the head's workflow runs and drop a cancelled run only when a newer run of the same workflow for the same event has reported checks and is finished or still running. Without that permission nothing is dropped, as before. Document the optional permission. Co-authored-by: multica-agent <github@multica.ai> * test(ghsnapshot): drop the reviews route reverted on main Co-authored-by: multica-agent <github@multica.ai> --------- Co-authored-by: multica-agent <github@multica.ai> (cherry picked from commit 82492f9)
EulerBlind
pushed a commit
to EulerBlind/multica
that referenced
this pull request
Nov 6, 2026
…run of the same workflow replaced from the PR rollup (multica-ai#9860) * fix(ghsnapshot): leave cancelled check suites that a newer run replaced out of the rollup filter=latest only drops older attempts inside one check suite. A second workflow run on the same head is a separate suite, so a cancelled earlier run kept the rollup at FAILURE after the newer run went green, and a --until-pr checks wakeup never fired. A suite is dropped only when GitHub concluded it cancelled and a newer suite from the same app reports a check with the same name. The suites list is read only when such a repeat exists. Closes multica-ai#9830 Co-authored-by: multica-agent <github@multica.ai> * fix(ghsnapshot): confirm replaced runs by workflow and event before dropping them Matching a cancelled check suite to a newer one by app and check name could drop a run of one workflow because an unrelated workflow passed a job with the same name, reporting a false success. Only the Actions API says which workflow and event a check suite belongs to. When the installation token has the optional Actions read permission, read the head's workflow runs and drop a cancelled run only when a newer run of the same workflow for the same event has reported checks and is finished or still running. Without that permission nothing is dropped, as before. Document the optional permission. Co-authored-by: multica-agent <github@multica.ai> * test(ghsnapshot): drop the reviews route reverted on main Co-authored-by: multica-agent <github@multica.ai> --------- Co-authored-by: multica-agent <github@multica.ai> (cherry picked from commit 82492f9)
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.
What does this PR do?
When the same workflow runs twice on one PR head and the first run is cancelled (
cancel-in-progress, a re-trigger onedited), the PR rollup staysFAILUREafter the newer run goes green, so a--until-pr checkswakeup never fires./commits/{sha}/check-runs?filter=latestonly drops older attempts inside one check suite. Each workflow run is its own suite, so the cancelled run's check runs stay in the response next to the newer run's, androllupContextsfails on them.This PR drops a cancelled run's check suite from the snapshot only when the Actions API confirms that a newer run of the same workflow for the same event replaced it on the same head. It also requires that the newer run has already reported check runs and is either finished or still has one running, so the rollup reads
PENDINGrather than passing before the replacement reports.A run that concluded
failureis never dropped. A cancellation with no replacement still fails. A run of a different workflow, or of the same workflow for a different event (for examplepushvspull_request), never replaces another one.Permissions
Only the Actions API says which workflow and event a check suite belongs to. The Checks API has no such field: check suites and check runs carry the app, the suite ID and the job name, and
external_idchanges on every run. GraphQLCheckSuite.workflowRunalso needs Actions read. Matching by app and check name alone (the first version of this PR, and #9837) can drop a cancelled CI run because an unrelated workflow passed a job with the same name, which reports a false success.So the fix uses the optional Actions read permission:
GET /actions/runs?head_sha=…once, and only when a failing Actions check sits beside another Actions check suite. PRs with one run per workflow, or with only passing checks, make the same requests as before.main. Nothing fails and no request is made. The token's granted permissions come from the installation-token response, so no extra call is needed to find out.The GitHub integration docs (all five languages) list Actions as optional and say what it changes.
Related Issue
Closes #9830
Type of Change
Changes Made
server/internal/integrations/ghsnapshot/client.go: keep thepermissionsmap from the installation-token response with the cached token, and addtokenCanRead.server/internal/integrations/ghsnapshot/snapshot.go: decodecheck_suite.idandapp.slugon check runs.fetchSupersededSuitesreads the head's workflow runs (Actions read only), groups them by(workflow_id, event), and returns the check suites of cancelled runs that the newest run of their group replaced, subject to the conditions above. The workflow-runs list gets the same head, duplicate-ID and pagination checks as the other collections. A failed read rejects the snapshot, so the last-known snapshot stays, as for any other fetch error.server/internal/integrations/ghsnapshot/rest_snapshot_test.go:TestFetchPRSnapshotRESTSupersededSuitescovers:--until-pr checksnever fires after the newer run goes green #9830 case (test=cancelled,always()gate=failure, then a green run of the same workflow);FAILURE), and the same workflow for another event;PENDING), one that hasn't reported checks yet, and one between jobs;apps/docs/content/docs/github-integration*.mdx: optional Actions read permission.How to Test
mainand against the first commit of this PR. Onmain, the [Bug]: PR checks rollup stays FAILURE when an older, cancelled workflow run exists on the same head SHA, so--until-pr checksnever fires after the newer run goes green #9830 case rolls upFAILUREwith contextstest, gate, test, gate. With this change the whole package passes under-race, including the DB tests against a freshly migrated database.test+gate, then a passing Docstest) now staysFAILUREwith all three contexts.f8f87b8, CI and Zizmor each ran twice, first runs cancelled): without Actions readFAILUREwith 29 contexts and no Actions request; with itSUCCESSwith 23 contexts and one Actions request.SUCCESSeither way, no Actions request.Known limits:
FAILUREuntil the next refresh. This is unchanged from today.Checklist
AI Disclosure
AI tool used: Multica Agent
Prompt / approach: Checked the reporter's analysis against live GitHub API responses (multica, vite, aiohttp, pip), replayed candidate rules on real check data, then changed the rule to confirm workflow identity after review found that check names can collide across workflows.