Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,44 @@ permissions:
actions: write
pull-requests: read

# Each completed run gets its own group: one run can resolve several PRs, and
# a shared key would let an unrelated completion supersede queued dispatches.
# Coalesce by target, not by triggering run (2026-11-18 storm: this workflow
# started 243 runs in 78 minutes and dispatched 73 of them). Keying per
# triggering run id gave every completion its own group, so nothing ever
# coalesced: the six required checks of one PR all completing at the same head
# meant six queued dispatches of the same work. GitHub keeps at most one
# running plus one pending run per group, so keying the group by the target the
# completed run evaluated collapses a burst into a single dispatch of the
# freshest state: first by the PR number GitHub associates with the run, then,
# for fork runs whose pull_requests GitHub leaves empty (issue #2133), by the
# branch identity the resolver below actually matches on.
#
# The fork fallback must include the branch, not just the head SHA. Two fork PRs
# can carry the same commit on different branches (a cherry-picked stack does
# exactly that), and the resolver distinguishes them only by head branch: a
# SHA-only key would put both PRs in one group, so a pending run for the second
# branch would be superseded by a later completion for the first and its
# reconciliation would never dispatch. head_branch, together with the head
# repository owner it belongs to, is the resolver's branch identity, so two
# branches never share a group. Two distinct branches carrying the same commit
# do not coalesce, which is the intended correction: they are different PR
# targets. Repeated completions for one target share branch and SHA and still
# coalesce.
#
# cancel-in-progress stays false: a running dispatch must finish every PR it
# resolved, so only pending duplicates are dropped. The run id is the last
# fallback so a payload with neither an associated PR nor a head branch and SHA
# keeps a unique group instead of every such run colliding on one key.
concurrency:
group: label-pr-review-state-fork-review-followup-${{ github.event.workflow_run.id }}
group: >-
label-pr-review-state-fork-review-followup-${{
github.event.workflow_run.pull_requests[0].number ||
((github.event.workflow_run.head_branch && github.event.workflow_run.head_sha) &&
format('{0}:{1}@{2}',
github.event.workflow_run.head_repository.owner.login || 'unknown',
github.event.workflow_run.head_branch,
github.event.workflow_run.head_sha)) ||
github.event.workflow_run.id
}}
cancel-in-progress: false

jobs:
Expand Down
35 changes: 32 additions & 3 deletions .github/workflows/label-pr-review-state.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,24 @@ on:
# writes (issue #2046). The privileged follow-up for those runs lives in
# label-pr-review-state-fork-review-followup.yml: GitHub rejects a workflow
# that lists itself in workflow_run.workflows (issue #2086).
#
# A workflow belongs in this list only when its completion can change the
# answer for a required status check, because the reconcile below reads
# only the required checks from the branch ruleset and never inspects which
# workflow completed, its conclusion, or its outputs. "Code QA Roo Code"
# publishes check-translations, compile, knip and both platform-unit-test
# rows; "E2E Tests (Mocked)" publishes e2e-mock. Those six are the entire
# required set on main, so no completion of any other workflow can change a
# label this workflow writes.
#
# "Webview Visual Regression" was in this list but no workflow has that
# display name: the visual workflow is "Visual Regression"
# (visual-regression.yml), so the entry never matched anything and only
# looked like coverage. "CodeQL Advanced" does run, but it publishes none of
# the six required checks, so each of its completions started a full
# reconciliation that could only recompute the labels already written.
workflow_run:
workflows: ["Code QA Roo Code", "E2E Tests (Mocked)", "Webview Visual Regression", "CodeQL Advanced"]
workflows: ["Code QA Roo Code", "E2E Tests (Mocked)"]
types: [completed]

permissions:
Expand Down Expand Up @@ -94,9 +110,22 @@ concurrency:
jobs:
resolve:
name: Zoo Code / resolve PRs to reconcile
# Loop guard (self-triggered label writes): the reconciliation writes the
# labels it also listens for, so every mutating run used to start one
# more run through the labeled/unlabeled pull_request_target events it
# caused itself. Reconciliation is idempotent, so a run woken only by
# this workflow's own label write would recompute the state it just
# wrote and write it again; skipping it breaks that loop. Only label
# events authored by github-actions[bot] for a label this workflow
# manages are skipped: a human edit to one of those labels, and any
# other bot or workflow label write, still reconciles.
if: >-
github.event_name != 'issue_comment' ||
(github.event.issue.pull_request && github.event.comment.user.login == 'coderabbitai[bot]')
(github.event_name != 'issue_comment' ||
(github.event.issue.pull_request && github.event.comment.user.login == 'coderabbitai[bot]')) &&
!(github.event_name == 'pull_request_target' &&
contains(fromJSON('["labeled", "unlabeled"]'), github.event.action) &&
github.event.sender.login == 'github-actions[bot]' &&
contains(fromJSON('["awaiting-author", "awaiting-coderabbit", "awaiting-ready", "awaiting-maintainer", "awaiting-review", "coderabbit-review-active", "community-approved", "has-conflicts", "stale-inactive", "stale-awaiting-author"]'), github.event.label.name))
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
runs-on: ubuntu-latest
outputs:
pr_numbers: ${{ steps.resolve.outputs.pr_numbers }}
Expand Down
Loading
Loading