Repository navigation
fix(issue-pr-loop): finish open PRs before starting new issues - #7327
Conversation
Handle undispositioned review feedback while checks still run, and queue no new issue while -MaxOpenPrs (default 8) unparked loop PRs are open. Ported from thomhurst/TUnit#7423.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. CodeRabbit Verify
|
[Medium impact] The changes affect which work the issue-PR loop queues. The PR appears safe to merge, with two non-blocking gaps that can delay review feedback. FindingsSummaryAdds
Author Reviews (1) · Last reviewed commit: "fix(issue-pr-loop): finish open PRs befo..." · Reviewed by Greptile |
| function Get-PrActivity { | ||
| $query = 'query($owner: String!, $name: String!, $cursor: String) { repository(owner: $owner, name: $name) { ' + | ||
| 'pullRequests(states: OPEN, first: 100, after: $cursor) { pageInfo { hasNextPage endCursor } ' + | ||
| 'nodes { number commits(last: 1) { nodes { commit { committedDate } } } reviewThreads(first: 100) { nodes { isResolved } } } } } }' |
There was a problem hiding this comment.
Later review threads are missed
Get-PrActivity reads only the first 100 review threads on each PR. If those are resolved but a later thread from a COMMENTED review is unresolved, Test-HasNewFeedback returns false. The loop then skips the PR while checks run, despite its unanswered feedback. Paginate the thread connection before deciding there is no feedback, and test an unresolved thread beyond the first page.
| else { '' } | ||
| # A green, clean PR usually needs only the merge gate or a disposition reply. | ||
| New-Candidate 'pr' ([int]$pr.number) $rank (Get-PrFingerprint $pr) ($rank -eq 0) | ||
| New-Candidate 'pr' ([int]$pr.number) $rank (Get-PrFingerprint $pr) ($rank -eq 0) $hint |
There was a problem hiding this comment.
Reopened threads stay deferred
The new feedback signal does not reach the saved fingerprint. If a reviewer reopens a resolved thread on a PR already deferred for running checks, the head, checks, review submittedAt, and conversation comments can all remain unchanged. Get-Candidates includes the PR, but Select-Item still drops it through Test-Deferred. Include thread activity in both survey and post-unit fingerprints so fresh feedback wakes the PR without waiting for checks or expiry.
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 05288db7e8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| function Get-PrActivity { | ||
| $query = 'query($owner: String!, $name: String!, $cursor: String) { repository(owner: $owner, name: $name) { ' + | ||
| 'pullRequests(states: OPEN, first: 100, after: $cursor) { pageInfo { hasNextPage endCursor } ' + | ||
| 'nodes { number commits(last: 1) { nodes { commit { committedDate } } } reviewThreads(first: 100) { nodes { isResolved } } } } } }' |
There was a problem hiding this comment.
Paginate review threads before counting unresolved feedback
For a PR with more than 100 review threads, this query only examines the first 100, even though the outer PR connection is paginated. If those threads are resolved but a later thread remains open, Test-HasNewFeedback returns false and Get-Candidates skips the PR while checks run, or incorrectly assigns it light merge-gate effort once checks pass. Fetch subsequent thread pages before concluding that no unresolved feedback exists, as scripts/Assert-PrGreen.ps1 already does. This also preserves the repository's requirement to handle reopened and undispositioned threads.
AGENTS.md reference: AGENTS.md:L54-L54
Useful? React with 👍 / 👎.
Problem
Loop workers skipped every PR whose checks were still running and started new issues instead. Open PRs piled up, and each one in flight raises the chance of conflicts.
Change
scripts/Start-IssuePrLoop.ps1:-MaxOpenPrs(default 8, 0 = no limit). While that many of the loop's open PRs lackneeds-human/on-hold, no fresh issue is queued. Stranded branches, stalein-progressclaims, and parents with all sub-issues closed still are. The skipped count shows in survey stats as "held by the open-PR limit".Test-HasNewFeedback: a PR with unresolved review threads, or an outsideCHANGES_REQUESTEDreview newer than both the head commit and the loop's last reply, is no longer skipped for pending checks. It ranks with failed-CI PRs, is not a light unit, and its hint says to handle the feedback without waiting for checks. Conversation comments do not count, since a review with no findings is also a comment.Get-PrActivity: one paginated GraphQL query for each open PR's head commit time and unresolved thread count. (gh pr list --json commitsexceeds GitHub's GraphQL node limit.)scripts/Test-IssuePrLoop.ps1covers feedback detection and the open-PR limit, including new issue fixtures. The matching SKILL.md priority-list change was pushed tomainseparately.Ported from thomhurst/TUnit#7423.
Validation
pwsh -NoProfile -File scripts/Test-IssuePrLoop.ps1passes.Get-PrActivitywas run live against this repository and returned head commit times and thread counts for all open PRs.