Skip to content

fix(prstatus): ignore CI runs superseded by a newer run of the same job - #310

Merged
afitzgerald merged 1 commit into
mainfrom
alan/think-checks-are-failing
Sep 30, 2026
Merged

afitzgerald merged 1 commit into
mainfrom
alan/think-checks-are-failing

Conversation

@afitzgerald

Copy link
Copy Markdown
Collaborator

When a workflow is started twice for the same commit and the second run cancels the first (a concurrency group or a manual re-run), GitHub keeps both runs in statusCheckRollup. aggregateCI counted the stale CANCELLED entry as a failure, so a PR where every job passed showed as failing.

latestRuns now keeps only the newest run of each job (by workflow + job name, newest startedAt) before aggregating:

  • A queued run that hasn't started yet counts as the newest, so a failed run followed by a queued re-run shows PENDING.
  • If the latest run of a job is itself cancelled, the PR still shows FAILING.
  • StatusContexts and unnamed checks pass through unchanged.

Tests: three new TestAggregateCI cases, one built from a real PR's rollup. The two cases for the bug fail without the fix. Unit and e2e suites pass with -race -shuffle=on.

A run cancelled by a newer one (concurrency group, manual re-run) stays in
statusCheckRollup next to its replacement, and aggregateCI counted its
CANCELLED conclusion as a failure, so a green PR showed as failing.
Keep only the latest run per workflow+job before aggregating.
@afitzgerald
afitzgerald merged commit 963325c into main Sep 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant