fix(pr-poller): detect cross-fork PRs via SHA search - #68
Merged
Conversation
Collaborator
|
Is this related to #69 that I just found? |
Collaborator
Author
|
It might, I'll look |
associatedPullRequests against the upstream repo returns empty for cross-fork PRs — the link between commit and PR only exists on the head fork's side, and we can't know which of potentially thousands of forks to query. GitHub's search index, however, includes PR commit SHAs and returns the right PR with a single upstream call. Swap the alias for search(query:\"type:pr repo:o/n <sha>\") so both cross-fork PRs and synthetic-local-branch cases (gh pr checkout style) resolve in the same single-round-trip GraphQL request. Adds a test for the gradle #32046 cross-fork scenario plus filtering of non-PR Issue nodes from search results. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
A worktree sitting on main/master was being credited with the most-recently-squashed PR's status. Root cause: the SHA-based search fallback indexes the squash commit's SHA against the merged PR, so search(query: \"... <main-HEAD-sha>\") returns the just-merged PR; that PR's headRefOid is the original feature branch, not main's HEAD, so the exact-SHA check missed but the old same-origin fallback then claimed it. Two complementary guards: * Skip the per-request resolution entirely when the worktree's branch equals the repository's default branch (from defaultBranchRef.name). * Tighten resolvePRForWorktree so search-alias nodes require an exact SHA match — search results are too loose to trust via same-origin fallback the way branch-name nodes are. Tests cover the main and master cases, plus a regression test that the SHA-matched search hit still wins when branch-name returns a different PR (the existing fork-disambiguation behavior). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…tive Extends the default-branch guard to any branch a PR is currently targeting (develop, integration, release/*, …). After resolving PRs we collect the union of baseBranch values; any worktree sitting on one of those branches gets its PR assignment cleared. Self-derives — no config or hardcoded list — and free, since every PR node already carries baseRefName. Renderer mirror: the no-PR / Active sidebar group now sorts merge-point worktrees (main + any branch that's a PR base) immediately after the main worktree, before feature worktrees, so the long-lived merge points stay reachable at the top. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
big-guy
force-pushed
the
more-missing-upstream-prs
branch
from
May 23, 2026 05:12
6d164eb to
337c9aa
Compare
Collaborator
Author
|
@frenchie4111 give this a look and see if it fixes what you were seeing. |
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
object(oid).associatedPullRequeststosearch(query:"type:pr repo:o/n <sha>", type:ISSUE).associatedPullRequestsagainst the upstream repo is empty for cross-fork PRs (the link only exists on the head fork's side, and we can't enumerate forks), so worktrees tracking commits whose PR lives on a fork — e.g. gradle/gradle PR #32046 fromMattAlp/gradle— were silently failing to resolve.gh pr checkout-style synthetic local branch names whose name doesn't match the PR'shead.ref.Test plan
npx vitest run— 1168 tests pass, including new cross-fork and non-PR-issue-filter cases🤖 Generated with Claude Code