Fix re-review detection and improve PR list pagination - #196
Merged
Conversation
FilterWaitingOnMe included a personally-requested PR only when I had not acted since the last push or the last action by someone else. That test is exactly wrong for a re-review: GitHub clears a review request the moment the reviewer submits a review, and "re-request review" puts them back into RequestedReviewers — so on a re-request my prior review is newer than both the last commit and the last comment, and every re-requested PR was filtered out. A live entry in RequestedReviewers is itself proof that the request is outstanding, so being requested now includes the PR outright. Three other paths dropped PRs the same section should have surfaced: - A dismissed review (stale-review dismissal, CODEOWNERS re-request) throws away my approval without adding me back to RequestedReviewers, so nothing in the filter noticed I owed a re-review. InteractionState now carries MyReviewDismissed, computed from the state of my most recent review. - GetInteractionState fetched reviews, review comments, issue comments and commits with no pagination options — 30 entries each, oldest first. On an active PR my latest review, the reply waiting on me, and the newest commit all fell off the end, skewing every timestamp the state is built from. All four lists now page through (100 per page, 5 pages max), and the last push time scans for the maximum commit date instead of trusting the final element, which pagination and rebases both make unreliable. - GetPRs only ever reads the first two pages of a repo's open PRs. Under the default created-desc ordering, an older PR that just had a review re-requested never reached the filters at all; sorting by updated-desc makes the window track activity instead. FilterWaitingOnAuthor now excludes PRs where I have an open request or a dismissed review, so a re-requested PR does not land in both sections, and FilterWaitingOnMe logs its per-PR decision at debug level. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AbmVRyFX9qnTSoHkgodZBh
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This change fixes the detection of re-review requests (where a dismissed review means you owe a re-review) and improves pagination handling for PR metadata fetches. The core issue: GitHub doesn't add you back to
RequestedReviewerswhen your review is dismissed, so the old logic missed these cases entirely. Additionally, paginated API endpoints were only fetching the first page, causing stale timestamps.Changes
Re-review detection: Added
MyReviewDismissedfield toInteractionStateto track when your latest review has been dismissed (stale-review dismissal, CODEOWNERS re-request, or manual dismissal). This is now a first-class signal inFilterWaitingOnMe, alongside pending review requests and unresponded comments.Simplified FilterWaitingOnMe logic: Removed the timestamp-based gating that was hiding re-review cases. A pending review request now unconditionally includes the PR, since GitHub clears the request only when you submit a review and re-requesting puts you back in
RequestedReviewers.Fixed pagination in GetInteractionState: Replaced single-page fetches with
listAllPages()helper that walks all pages (up to 5) for reviews, review comments, issue comments, and commits. GitHub's default ordering is oldest-first, so unpaginated calls miss recent activity.Robust commit timestamp extraction: Added
latestCommitTime()helper that scans for the maximum commit timestamp rather than trusting the last element, since force-pushes and rebases produce lists where the newest commit is not final.PR list sorting: Changed
GetPRs()to sort byupdated(descending) instead of relying on the defaultcreatedordering. This ensures recently-touched PRs (including re-review requests) stay in the fetch window.Helper function: Extracted
reviewRequestedFrom()to check if a login has a personal review request, with case-insensitive comparison.FilterWaitingOnAuthor fix: Now excludes PRs where you have an open request or dismissed review, preventing the same PR from appearing in both "Waiting on Me" and "Waiting on Author" sections.
Documentation: Updated
docs/filters.mdto explain the three conditions forFilterWaitingOnMeand clarify that only personal review requests count.Test Plan
go build ./...passesgo test ./...passesMyReviewDismisseddetection (TestCalculateInteractionStateReviewDismissed)latestCommitTime()with edge cases (nil entries, out-of-order commits)FilterWaitingOnMeandFilterWaitingOnAuthortests to cover re-review and dismissal scenarioshttps://claude.ai/code/session_01AbmVRyFX9qnTSoHkgodZBh