Repository navigation
fix(webhook): resolve fork pull requests for check runs by head SHA - #3428
Conversation
GitHub delivers the check runs of a fork pull request with an empty
pull_requests array, and GET /commits/{sha}/pulls lists no pull request
for the fork's head commit in the base repository. The commit lookup
therefore found no PR, so failed-CI follow-ups, the Ultrafix check hook
and auto-merge were never evaluated for fork PRs (#3423:
a failed lint check produced no follow-up comment).
When the commit lists no open PR, scan the repository's open pull
requests for a matching head SHA (pages of 100, bounded). Results are
cached as before, so a default-branch push pays the listing once per
cached lookup.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
/review |
|
✅ AI Code Review Complete requested by @integry Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR addresses missing fork-PR resolution with a bounded open-PR scan and reuses the existing lookup cache. It is merge-ready within scope, conditional on pending checks completing successfully. ✅ Bounded lookup — Scans at most five pages of 100 PRs, matches head SHAs case-insensitively, and stops on a short page. ✅ Preserved cache behavior — Fallback matches receive the positive cache TTL; request failures propagate to existing error handling without caching an empty result. This review is based on the supplied code and context; no commands or tests were run. Current checks show no failures and seven pending. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Test successful follow-up dispatchIn S2: 🟢 Document the scan limitThe updated ScoreThe implementation is focused, preserves existing failure handling, and covers pagination and cache TTL behavior. No merge-blocking defect was identified; final readiness remains conditional on pending checks. 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
Problem
PR #3423 (a fork PR from
bharveyos/propr) had its lint check fail, yet no failed-CI follow-up comment was posted even thoughautoFollowupOnFailedCiis on for this repository.GitHub delivers the check runs of a fork pull request with an empty
pull_requestsarray, andGET /repos/{owner}/{repo}/commits/{sha}/pullsreturns nothing for a fork head commit (verified against the open PRs here: same-repo PRs #3427 and #3420 resolve, fork PRs #3423 and #3421 return[]).resolveTargetPRstherefore found no PR and the handler took the debug-levelcheck_run skipped: no associated PRsbranch. The same gap silently skipped the Ultrafix check hook and auto-merge for fork PRs.The workflow-side "Report Build Failure" / "Report Full Test Failure" jobs are deliberately skipped for fork PRs (read-only token), so the daemon lookup was the only path, and it did not work.
Fix
When the commit lists no open pull request, scan the repository's open pull requests (most recently updated first, pages of 100, bounded by
OPEN_PRS_HEAD_LOOKUP_MAX_PAGES) for one whosehead.shamatches the check run'shead_sha. The result goes through the existing commit → PR cache, so a default-branch push (which legitimately has no PR) pays the extra listing once per cached lookup.Also corrects the follow-up docs, which claimed fork check runs were already matched by commit.
Tests
test/checkRunHandler.test.ts: fork PR resolved by head SHA for a failed check run; the no-PR case now also scans open PRs; paging stops at a short page; the scan is bounded; found PRs are cached with the positive TTL.test/checkRunHandler.test.ts(125 pass),test/ultrafixRecoveryIntake.test.tsandtest/ciFailureRecovery.test.ts(13 pass);eslint --max-warnings 0on the changed source is clean.🤖 Generated with Claude Code