Skip to content

Fix re-review detection and improve PR list pagination - #196

Merged
C-Hipple merged 1 commit into
mainfrom
claude/waitingonme-filter-debug-9op76p
Jul 29, 2026
Merged

Fix re-review detection and improve PR list pagination#196
C-Hipple merged 1 commit into
mainfrom
claude/waitingonme-filter-debug-9op76p

Conversation

@C-Hipple

Copy link
Copy Markdown
Owner

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 RequestedReviewers when 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 MyReviewDismissed field to InteractionState to track when your latest review has been dismissed (stale-review dismissal, CODEOWNERS re-request, or manual dismissal). This is now a first-class signal in FilterWaitingOnMe, 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 by updated (descending) instead of relying on the default created ordering. 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.md to explain the three conditions for FilterWaitingOnMe and clarify that only personal review requests count.

Test Plan

  • go build ./... passes
  • go test ./... passes
  • Added unit tests for MyReviewDismissed detection (TestCalculateInteractionStateReviewDismissed)
  • Added unit tests for latestCommitTime() with edge cases (nil entries, out-of-order commits)
  • Updated existing FilterWaitingOnMe and FilterWaitingOnAuthor tests to cover re-review and dismissal scenarios

https://claude.ai/code/session_01AbmVRyFX9qnTSoHkgodZBh

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
@C-Hipple
C-Hipple merged commit 6b1c7c0 into main Jul 29, 2026
7 checks passed
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.

2 participants