Skip to content

pr-gate: read every rollup page, fail closed on an incomplete one - #866

Merged
michaeljgrimm merged 1 commit into
mainfrom
codex/pr-gate-pagination
Oct 26, 2026
Merged

michaeljgrimm merged 1 commit into
mainfrom
codex/pr-gate-pagination

Conversation

@michaeljgrimm

Copy link
Copy Markdown
Contributor

What

scripts/pr-gate.mjs asked for statusCheckRollup { contexts(first: 100) } and only logged hasNextPage, then judged the first 100 checks. #698 (RR-87, rr-87-gate-rollup-completeness) had added pagination with a fresh-cursor, same-commit and count check; the MR-34 rewrite (#808) dropped it.

Is it a real gap?

Yes, in principle. A full-ci PR reports about 50 checks, so the 100-item page normally covers it, but nothing enforced that. With more than 100 contexts, the gate judged a partial list:

  • --required all: a failure on a later page was never seen, so it could report green.
  • default --required verify: latestPerName picks the newest report per name, so an older verify on page 1 and its re-run (or a newer failure) on page 2 gives the wrong verdict, red or green.

Fix

  • The first page now also reads endCursor.
  • When hasNextPage is true the gate reads the following pages of the same commit (readAllChecks, one extra query per page, only when needed; the batched poll stays one query per interval).
  • It fails closed: when a page is malformed, repeats a cursor, belongs to another commit, fails to load, or the rollup exceeds 1,100 checks (MAX_CONTEXT_PAGES), the gate judges nothing that poll (logs it, retries next interval, times out with 75 at worst). It never reports green or red from a partial list.

Tests

scripts/pr-gate.test.mjs: page size and cursor in the query, a failure hidden on page 2, a re-run on page 2, three pages, commit targets, no extra query for a small rollup, and each fail-closed case (failed query, other commit, missing commit, malformed page, repeated cursor, missing cursor, endless rollup, healing on the next poll).

No changelog fragment (tooling). pnpm check:changed passes.

🤖 Generated with Claude Code

… is incomplete

The MR-34 rewrite dropped the rollup-pagination checks that #698 added. The gate asked for
contexts(first: 100) and only logged hasNextPage, then judged the first 100 checks: a failure
or a newer re-run on a later page was missed (--required all could report green, a stale
verify could report red or green). When the first page says there is more, the gate now
reads the following pages of the same commit (one extra query per page, only then), and
judges nothing for that poll when a page is malformed, repeats a cursor, belongs to another
commit, fails to load, or the rollup exceeds 1,100 checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@michaeljgrimm
michaeljgrimm merged commit ba011a3 into main Oct 26, 2026
33 checks passed
@michaeljgrimm
michaeljgrimm deleted the codex/pr-gate-pagination branch November 7, 2026 18:10
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