fix(github): teams with access show in the reviewer picker #35126
main fromrefs/pull/35126/head·opened View on GitHubNote
🤖 Written by Claude Opus 5.5 on behalf of Illia
Fresh from current main, replacing #31150, which was closed for conflicts.
Problem#
On GitHub, the pull request reviewer picker can't find a team. Typing a team name such as frontend shows "Nobody with access matches that.", so a team can only be asked for a review on GitHub itself. The picker lists assignableUsers (people only), plus teams already requested on the pull request, so those requests can be taken back.
Change#
listReviewerCandidates (GitHub)
ReviewerCandidates # people + already requested reviewers
+ ReviewerTeams # organization teams, in parallel, same `query`
+ keep teams whose repositories include owner/name
+ on any failure: no teams, people still listed
merge: requested → teams → people
ReviewerTeamsreadsorganization(login: owner).teams. It needsread:org, and a GraphQL query GitHub refuses fails whole. That's why teams were left out ofReviewerCandidates. They stay in their own query and are dropped on failure (a token withoutread:org, or a repository owned by a user).- GitHub refuses a review request to a team without access to the repository, so each team's
repositories(query: name)is checked for the exactowner/name. The REST list of a repository's teams needs admin (it returns 404 withrepo+read:orgas a non-admin), so it can't be used here. - The host search from #22489 now covers teams too: the typed text also goes to
teams(query:), which GitHub matches on team name and slug, and host-matched teams are kept alongside host-matched people. - An already requested team is listed once. More than 100 teams sets the existing
truncatedflag, which turns the host search on. - No client or contract change: web and mobile already render
kind: "team"candidates, and requests already sendteam_reviewers.
Scope and approval#
A small, focused fix for an obvious bug, with no prior issue. The capability is half there already: the candidate contract has kind: "team", both pickers render team rows, the request payload sends team_reviewers, and the mobile picker says "Search people and teams with access to this repository." But the GitHub adapter never returns a team that hasn't been requested yet, so none of this can be reached. This PR changes only the GitHub reviewer candidate read. Other hosts are unchanged. #19375 made teams that were already requested show up.
Verification#
| Before | After |
|---|---|
![]() | ![]() |
- Manual check: local dev server on this branch against a real organization pull request. The picker lists the 9 teams with access to the repository before the people (the organization has 11; the 2 without access aren't offered). Typing
frontendlists thefrontendteam, tagged "team". The before capture is from #31150's base, where the picker behaved the same for this case. - Live
teams(first: 100, query: "front")on that organization returns thefrontendteam with the repository in its access list. GitHubPullRequestApi.test.ts: teams with access appear between the requested reviewers and the people; anINSUFFICIENT_SCOPESrefusal of the teams query still returns the people; a typed query is sent to both reads and keeps host-matched teams. All three fail onmain.gitHubPullRequestJson.test.ts: the access filter is case-insensitive and drops a loosequerymatch (acme/web-legacy), a requested team appears once, and a teams next page setstruncated.vp run check:changed: format, lint, knip, GraphQL codegen check, typecheck and tests pass.- Not checked: sending a team review request from the picker. It uses the existing
team_reviewerspath, and I didn't want to ping a real team.
Done with Claude Opus 5.5 in Claude Code, run through T3 Code.

