Repository navigation
fix(ci): validate unindexed readiness heads with live PR metadata - #5316
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryAdds a live, paginated lookup when GitHub’s commit association lookup cannot confirm the current PR.
No actionable issues were found. Tests were not rerun. Supersession and existing PR discussions could not be checked because GitHub access was not authenticated. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Declarations pass] --> B[Read commit associations]
B --> C{Current PR and head found?}
C -->|No| D[Read every page of open PR heads]
D --> E{Pages valid and complete?}
E -->|No| F[Stop; readiness stays pending]
E -->|Yes| G{Current PR has a unique matching head?}
C -->|Yes| G
G -->|Missing| H[Pending]
G -->|Shared| I[Failure]
G -->|Unique| J[Success candidate]
H --> K[Recheck current PR freshness]
I --> K
J --> K
K --> L[Publish result; use pending if changed]
Reviews (1) · Last reviewed commit: "fix(ci): validate unindexed readiness he..." · Reviewed by Greptile |
Summary
Unblock PR readiness when GitHub's commit-to-PR association index omits a valid current head. This currently blocks #3807 despite its passing feature CI and filled initial declarations; no separate issue is needed for this directly observed CI defect.
The existing association lookup remains the fast path. When it cannot confirm the PR, check all live open PR heads using paginated GraphQL requesting only PR numbers, head OIDs and cursors. Require complete valid coverage, the current PR's matching head, and no other PR sharing that head. Retain the final PR freshness check. Missing, malformed, overlapping or non-progressing pages leave readiness pending.
Trusted default-branch checkout, workflow permissions, declaration requirements and duplicate-head rejection are unchanged. This changes CI metadata validation only; provider scope approval is not applicable. No CLI/MCP, Evidence, installation or generated metadata changes.
Validation performed
npm run test:focused -- tests/boundary/filesystem/prReadiness.test.ts— 43 tests passed, including paginated confirmation, later-page duplicate, stale head, unavailable/malformed metadata and incomplete coverage. The new positive regression fails against the old implementation (pending instead of success).npm run check— passed (typecheck, lint and repository verification).5f65d4adb5f5f64ec9af58febe68b0e582013346: old implementation remains pending with an empty association result; candidate succeeds twice after examining all 590 open heads across six pages. Commit-status writes were captured locally, not published.Each fresh-process candidate shadow used 9 GitHub reads, 88,421 response bytes, 11.93–12.65 s elapsed, 1.79–1.81 s CPU and 91.4–91.5 MiB sampled process-family peak RSS. This includes local Node/gh transport; two status writes and actual Actions runner costs are excluded. Remote cache/host load were uncontrolled; there is no local live-state cache. The old 4.76 s run never completes readiness successfully, so this is not a speedup comparison. Agent token costs are not changed or measured. Ordinary indexed heads make no additional requests.
Author readiness
Human owner: @gensokyo-dev
The owner explicitly delegated these declarations and authorized opening ready, following CI/review and merging in this session. Codex reviewed the final diff and stated evidence; independent human review was not observed.