LearnNewsExamplesConnect
Frontmatter
assigneesneo-opus-vega
createdAtOct 23, 2026, 3:49 PM
updatedAtOct 23, 2026, 8:59 PM
githubUrlhttps://github.com/neomjs/neo/issues/20061
authorneo-opus-vega
commentsCount4
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtOct 23, 2026, 4:38 PM
milestonev13.3.1

Merged PRs read red from the mergeability controller's post-merge runs

neo-opus-vega
neo-opus-vega commented on Oct 23, 2026, 3:49 PM

Context

Operator, 2026-10-23: PRs merge only at fully green CI, yet the merged-PR list shows most of them red, which reads to an outside evaluator as a team merging broken PRs. Measured on the 30 most recently merged neomjs/neo PRs at 13:4xZ (statusCheckRollup of each PR's last head commit, the field the list icon renders):

PRs
rollup FAILURE 19 of 30
of those, red only from runs that started after mergedAt 12
still red without the controller's items (superseded same-head runs, below) 7

The 60 red contexts across those 19 heads, by source:

red context count started
Review Admission Mergeability matrix job PR (N), CANCELLED 28 after merge
Review Admission Mergeability matrix job PR (N), FAILURE 13 after merge
commit status review-admission/mergeability = error 11 after merge
File Size Guard / check-size, CANCELLED 6 before merge
PR Baseline / baseline / PR body, FAILURE 2 before merge

Receipts: run 39960822280 (pull_request_target, created 13:23:40Z, three seconds after #20055 merged at 13:23:37Z) is anchored on #20055's head 2989e393c4 and spawned PR (19958), PR (20024), PR (20044), PR (20049), PR (20052), all five cancelled with zero steps run. Run 39960695212 on #20051's head 92e67a589e (created 13:22:45Z; #20051 merged 13:22:42Z) ran job 120437832432 PR (20055) at 13:26:29Z, three minutes after #20055 had merged, and ended ##[error] PR #20055 mergeability stayed null after 4 bounded polls after logging PR #20055 already publishes review-admission/mergeability=error: the error status an earlier such job had written onto #20055's merged head.

Live latest-open sweep: the newest 20 open issues read at 2026-10-23 13:48Z; no equivalent. review-admission across all states: #17692 (origin, closed) and #18226 (coverage restoration, closed); neither names the symptom. Memory Core rationale sweep (query_raw_memories on the merged-head symptom): no prior decision. A2A claims of the last hour: none on this surface. Own open assignments: none on this surface.

The Problem

.github/workflows/review-admission-mergeability.yml publishes the review-admission/mergeability commit status onto every open dev-target PR head (#17692). Two of its paths run after a PR has stopped being a PR under review, and both leave red on heads that earned green:

  1. The merged-close sweep anchors on the merged head. pull_request_target with types: [..., closed] fires on the merge; discover treats closed && merged as a board trigger and spawns one publish matrix job per open PR. GitHub anchors a pull_request_target run's check runs on the event PR's head SHA, so every PR (N) job of that sweep is a check run on the merged PR. The same merge is also a push to dev, which runs the identical sweep anchored on the new dev commit: the closed-event sweep re-evaluates nothing the push sweep does not, it only doubles the burst. The doubled jobs then collapse in the per-PR concurrency group (cancel-in-progress: false keeps one running and one pending; a third arrival cancels the pending one), and a cancelled job is a red check run on the merged head for good.

  2. A job whose target merged mid-sweep writes error onto that merged head. pulls.get on a closed PR returns mergeable: null permanently; the bounded poll exhausts, publish('error', …) lands on the now-merged head, and core.setFailed reds the job, a second red context on whichever head anchored the run. With several approved PRs merging within a minute, the board sweep of merge 1 regularly targets the PR of merge 2.

Both are cosmetic for the gate itself (manage_pr_reviewers(add) reads the live status of open PRs) and both are permanent on the merged head, because check runs and the latest status per context on a SHA are what the list icon rolls up.

Superseded same-head runs (the residual 7 of 30), out of this ticket's scope but named: a workflow re-triggered on an unchanged head by a body edit (pull_request: edited) leaves its first run's conclusion on that head beside the later green one; GitHub's rollup counts every check run, not the latest per name (#20032: two cancelled check-size runs at 07:17Z and 07:20Z, three green ones later on the same head, rollup FAILURE). File Size Guard cancels the in-progress same-head run under cancel-in-progress: true (6); PR Baseline / PR body failed once on an earlier body revision and passed on the next (2). That class is #20064.

The Architectural Reality

  • .github/workflows/review-admission-mergeability.yml:6-8: pull_request_target types include closed; :11-12: push: branches: [dev] fires on the same merge; :15-17: workflow_run on Data Sync covers the [skip ci] commits. The header comments (:4-5, :9-10) state the trigger rationale: head movement evaluates one PR, base movement sweeps the board.
  • :41-61: discover branches on isClosed / isMergedClose: merged close → board sweep; unmerged close → prs = [] (a no-op run that still anchors a green check run on the closed head).
  • :153-158: per-PR concurrency group with cancel-in-progress: false, the serialization that makes a burst's pending jobs cancel.
  • :178-182: readPull returns the PR without reading state; :248-250, :268-270: mergeable === null continues the poll; :297-298: exhaustion publishes error and fails the job; :304-313: any thrown error also publishes error on lastCoordinate.
  • GitHub anchors pull_request_target check runs on the PR head (run 39960822280, event pull_request_target, is listed by gh run list --commit 2989e393c4, #20055's head, created 13:23:40Z) and push check runs on the pushed commit; commit statuses are per SHA + context with latest-write-wins; the PR list icon renders the head commit's statusCheckRollup.state, in which any CANCELLED / FAILURE / ERROR context makes the state FAILURE.
  • No unit arm at dev d0f92ff6a6 evaluates the committed controller script (grep -ril mergeability test/ is empty; the WorkflowConcurrency.spec.mjs restoration #18226 names is not in the tree), so the evidence for this change is a scratch evaluation of the committed github-script block against mocks plus the post-merge rollup census.

Design authority: #17692's AC lists "merged-close, ordinary dev push, and trusted Data Sync completion" as the three board triggers. The merged-close arm's purpose (re-evaluate after a base move) is fully carried by the push the same merge produces; dropping the arm removes a duplicate sweep, not a re-evaluation. The error-on-closed-head behaviour was never specified: #17692 specifies error for exhausted null on a live PR coordinate, and a closed PR has no live coordinate.

The Fix

.github/workflows/review-admission-mergeability.yml, nothing else:

  1. Drop closed from the pull_request_target types and delete the isClosed / isMergedClose branches in discover (PR event → [eventPr], everything else → board sweep). The header comment gains the one sentence that says why: the merge's own push sweeps the board, anchored on the dev commit.
  2. A PR observed closed gets no status and no failure. readPull throws a PullClosed sentinel when data.state !== 'open'; the catch returns on it with core.info before the error-publish branch. The merged head keeps whatever verdict it earned while open. One window stays, inherited from #17692's API shape: publish awaits getCombinedStatusForRef after the job's last open read, so a close inside that await can still land one write on the merged head; so can the >32 overflow sweep's list-snapshot writes and the generic-error fallback. None of these is the measured class (0 of the 52 items); the AC-3 census records them if they occur (Euclid's review boundary, 14:14Z).
  3. No change to the per-PR concurrency, the poll bounds, the overflow cap or the push / workflow_run / workflow_dispatch triggers.

About as many lines leave (the trigger type, the dead branching) as arrive (the guard).

Contract Ledger Matrix

Target Surface Source of Authority Proposed Behavior Fallback Docs Evidence
review-admission/mergeability status on a PR head live pulls.get of an open PR (#17692) unchanged for open PRs; a PR observed closed or merged at any of its job's reads receives no write and the job ends green with an info line the next push: dev sweep re-evaluates every open PR as today; a close inside the status write's own await (publication window), an overflow snapshot write or the generic-error fallback can still land one write, recorded by the AC-3 census workflow header + the readPull comment AC-2 harness: closed PR → zero createCommitStatus, zero setFailed; open null-exhausted PR → error + setFailed as before
Controller triggers GitHub event model (#17692) pull_request_target on opened / reopened / synchronize / ready_for_review; board sweeps on push: dev, Data Sync workflow_run, workflow_dispatch none needed: a merge is a push workflow header the YAML; AC-3
Merged-PR head statusCheckRollup GitHub rollup no Review Admission Mergeability check run from a closed-event sweep and no review-admission/mergeability write by a job that observed the close lands on a head after its PR merged; publication-window, overflow and generic-error writes are the named residual — — AC-3

Decision Record impact

none: the controller keeps the #17692 shape; one duplicate trigger arm and one unspecified write path leave.

Acceptance Criteria

  • AC-1 Trigger: the committed on.pull_request_target.types is exactly [opened, reopened, synchronize, ready_for_review]; discover has no closed branch; push: dev, workflow_run and workflow_dispatch are unchanged.
  • AC-2 Closed-PR guard, evaluated red-first: the committed publish script string, run against a mocked github whose pulls.get returns {state: 'closed', merged: true, mergeable: null, head, base}, makes zero repos.createCommitStatus calls and zero core.setFailed calls (on dev today: one error write and one setFailed); the same harness with {state: 'open', mergeable: null} throughout still publishes error and fails, and {state: 'open', mergeable: false} still publishes failure (the #17692 behaviour, unchanged). All arms' output in the PR body.
  • AC-3 Post-merge only, bounded to the observed-close guard: for the first five or more PRs merged after this change lands, (a) no pull_request_target run anchored on the merged head is created after mergedAt (the closed-event trigger is gone; a run queued before the close may still start after it), (b) no Review Admission Mergeability check run on the head concludes red (FAILURE / CANCELLED) with a start after mergedAt: a job that starts late and ends green on PullClosed is recorded, not counted, and (c) any review-admission/mergeability status created after mergedAt is a publication-window, overflow or generic-error write, recorded with its run id as the census's residual, owner #20022. Census on this ticket, with the gh api graphql query of the Context measurement.
  • AC-4 Gate intact: an open PR that conflicts with dev after a later merge still turns review-admission/mergeability to failure on the next push: dev sweep (one live instance, or the AC-2 harness arm).

Out of Scope

  • The publication window (a close between the job's last open read and its status POST), the >32 overflow sweep's list-snapshot writes and the generic-error fallback: inherited from #17692's API shape (GitHub offers no atomic compare-and-write), 0 of the 52 measured items, recorded by the AC-3 census under #20022; a redesign is not for this patch.
  • The superseded same-head runs (File Size Guard cancellations, PR Baseline / PR body first-revision failures): #20064.
  • The dev commit list, where 21 of the last 30 commits roll up red mostly from Engine Tests / E2E (engine tier) push runs cancelled by the next merge (cancel-in-progress: true keyed on github.ref): a runner-budget decision, the operator's.
  • The per-PR concurrency shape of the controller (after this change its cancellations land on dev commits only; 37 of the dev list's 215 red contexts today).
  • Making the status a required context (#17171's domain).

Avoided Traps

  • continue-on-error or a green-on-failure job: a failed or cancelled job's check run is red in the rollup regardless of the run's conclusion.
  • Deleting the controller's push sweep to stop the burst: the push sweep is the load-bearing base-move response (#17692); the closed sweep is the duplicate.
  • Keying the per-PR concurrency by run id: removes the cancellations by letting stale writes race, the exact hazard #17692 serialized against.

Related

#17692 (origin; PR #17696), #18226 (coverage restoration, closed, spec absent at dev), #20064 (the same-head rerun class), #20022 (the v13.3.1 cut; the operator's item for the patch), #17171 (required-context policy).

Retrieval Hint: "merged PRs red rollup review-admission mergeability closed trigger post-merge sweep"

— Vega (Claude Fable 5.1, Claude Code) 🌿

tobiu referenced in commit e1a9e52 - "fix(ci): the mergeability controller leaves merged heads alone (#20061) (#20062)" on Oct 23, 2026, 4:38 PM
tobiu closed this issue on Oct 23, 2026, 4:38 PM