Conversation
gh pr editAdd CCR and reviewer MultiSelectWithSearchgh pr edit: Add CCR and reviewer MultiSelectWithSearch
gh pr edit: Add CCR and reviewer MultiSelectWithSearchgh pr edit: Add support for Copilot as reviewer with search capability, performance and accessibility improvements
Enables Copilot to be requested as a pull request reviewer, supporting both interactive and non-interactive flows. Introduces new reviewer search functionality, updates reviewer partitioning to distinguish users, bots, and teams, and adds a GraphQL mutation for reviewer management on github.com. Updates help text, tests, and internal APIs to support Copilot reviewer login and display names, while maintaining compatibility with GitHub Enterprise Server.
617a88d to
738b82d
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Copilot Code Review (CCR) support and a multi-select-with-search experience for editing PR reviewers via gh pr edit, including new API queries/mutations to support bots and improved reviewer display names.
Changes:
- Introduces reviewer search plumbing in the edit flow and adds a github.com-specific GraphQL mutation path for setting reviewers (including Copilot bot).
- Extends PR review-request GraphQL selection to include
Botand adds display-name helpers for reviewers (e.g., “Copilot (AI)”). - Adds
@copilotreviewer replacement support and related unit tests.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/cmd/pr/shared/params_test.go | Adds tests for @copilot reviewer replacement behavior. |
| pkg/cmd/pr/shared/params.go | Splits Copilot replacement into assignee vs reviewer logins. |
| pkg/cmd/pr/shared/editable.go | Introduces EditableReviewers, wires reviewer search prompting, and optimizes metadata fetching decisions. |
| pkg/cmd/pr/edit/edit_test.go | Updates edit command tests for new reviewer flow/mutation behavior and GHES compatibility. |
| pkg/cmd/pr/edit/edit.go | Wires reviewer search, partitions reviewers by type, and adds github.com GraphQL vs GHES REST reviewer update paths. |
| api/query_builder.go | Adds ...on Bot{login} to PR review request selection for Copilot support. |
| api/queries_repo.go | Introduces separate constants for Copilot assignee vs reviewer bot logins. |
| api/queries_pr.go | Adds display helpers, REST team slug extraction, new reviewer mutation, and reviewer suggestion query/types. |
Comments suppressed due to low confidence (1)
pkg/cmd/pr/edit/edit.go:582
partitionReviewersByTypeclassifies bots only when the value equalsapi.CopilotReviewerLogin. If the search flow (or existing review requests) yields any other bot login, it will be treated as a user and sent to the wrong mutation input. Either broaden bot detection (e.g., by encoding type in the selection key or maintaining a map of login→type from search results) or ensure only Copilot bots can be selected.
// partitionReviewersByType splits reviewer identifiers into users, bots, and teams.
// Team identifiers are in the form "org/slug" and are returned as-is.
// Bot logins (currently only Copilot) are identified and returned separately.
func partitionReviewersByType(values []string) (users []string, bots []string, teams []string) {
for _, v := range values {
if v == "" {
continue
}
if strings.ContainsRune(v, '/') {
// Team: org/slug format, pass as-is
teams = append(teams, v)
} else if v == api.CopilotReviewerLogin {
bots = append(bots, v)
} else {
users = append(users, v)
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Always send explicit lists for userLogins, botLogins, and teamSlugs in RequestReviewsByLogin mutation, even when empty. Previously, empty slices were omitted due to omitempty JSON behavior and len > 0 checks, which prevented clearing all reviewers when using replace mode. Empty slices are harmless no-ops in union mode, so we now send them unconditionally for simpler logic. Add test to verify the mutation receives empty slices when all reviewers are removed.
Each source (suggestions, collaborators, teams) has base quota of 5. Unfilled slots cascade to later sources, allowing up to 15 total. Adds unit tests with HTTP mocks.
Fetch name field in reviewRequests GraphQL query and show as 'login (Name)'.
Query aliased fields without search filter to get stable counts.
Reword the comment for CopilotAssigneeLogin to indicate it refers to Copilot when retrieved as an assignee. This updates wording from the previous 'Actor/assignable actors' phrasing for clarity; no code behavior changed.
Remove a redundant struct-level comment and update the DefaultLogins field comment in pkg/cmd/pr/shared/editable.go to more accurately describe its purpose: used to disambiguate actors from display names rather than to compute add/remove sets.
Add clarifying comment in pkg/cmd/pr/edit/edit.go to note that missing assignee/reviewer search functions trigger a downstream fallback to legacy fetching. In pkg/cmd/pr/shared/editable.go remove a redundant line and add a TODO urging migration of non-interactive assignee updates to use the new logins input with ReplaceActorsForAssignable to avoid unnecessary fetching. These are comment and doc changes to clarify intent and future improvements.
Update comment in FetchOptions to specify that the APIs used for both GHES and GitHub.com accept user logins and team slugs directly, clarifying why non-interactive flows with Add/Remove don't need to fetch reviewers/teams. Comment-only change; no functional modifications.
Address PR review comments: code consistency and DRY improvements - Add botTypeName const for consistency with teamTypeName - Create extractTeamSlugs helper using strings.SplitN to simplify team slug extraction logic - Replace duplicate code in AddPullRequestReviews and RemovePullRequestReviews with extractTeamSlugs helper - Fix ClientMutationId naming with explicit graphql tag for consistency with other mutations in the codebase
d7e41c1 to
ebf932a
Compare
Member
Author
|
Merging this but we shouldn't release until backend API is updated to be case-insensitive ℹ️ |
Member
Author
|
Merging this but we shouldn't release until backend API is updated to be case-insensitive ℹ️ |
tmeijn
pushed a commit
to tmeijn/dotfiles
that referenced
this pull request
Feb 25, 2026
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [cli/cli](https://github.com/cli/cli) | minor | `v2.86.0` → `v2.87.3` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>cli/cli (cli/cli)</summary> ### [`v2.87.3`](https://github.com/cli/cli/releases/tag/v2.87.3): GitHub CLI 2.87.3 [Compare Source](cli/cli@v2.87.2...v2.87.3) #### What's Changed - Fix project mutation query variable usage by [@​williammartin](https://github.com/williammartin) in [#​12757](cli/cli#12757) **Full Changelog**: <cli/cli@v2.87.2...v2.87.3> ### [`v2.87.2`](https://github.com/cli/cli/releases/tag/v2.87.2): GitHub CLI 2.87.2 [Compare Source](cli/cli@v2.87.1...v2.87.2) #### ℹ️ Note This release was cut primarily to resolve a publishing issue. We recommend reviewing [the v2.87.1 release notes](https://github.com/cli/cli/releases/tag/v2.87.1) for the complete set of latest features and fixes. #### What's Changed - chore(deps): bump golang.org/x/crypto from 0.47.0 to 0.48.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​12659](cli/cli#12659) **Full Changelog**: <cli/cli@v2.87.1...v2.87.2> ### [`v2.87.1`](https://github.com/cli/cli/releases/tag/v2.87.1): GitHub CLI 2.87.1 [Compare Source](cli/cli@v2.87.0...v2.87.1) ####⚠️ Incomplete Release The v2.87.1 release experienced a failure in our workflow and is not fully published to the designated package managers/repositories. This is resolved in [v2.87.2](https://github.com/cli/cli/releases/tag/v2.87.2), so we recommend using that release instead. #### What's Changed - Remove license bundling debris by [@​williammartin](https://github.com/williammartin) in [#​12716](cli/cli#12716) - fix(agent-task/capi): use a fixed CAPI API version by [@​babakks](https://github.com/babakks) in [#​12731](cli/cli#12731) **Full Changelog**: <cli/cli@v2.87.0...v2.87.1> ### [`v2.87.0`](https://github.com/cli/cli/releases/tag/v2.87.0): GitHub CLI 2.87.0 [Compare Source](cli/cli@v2.86.0...v2.87.0) #### `gh workflow run` immediately returns workflow run URL One of our most requested features - with the latest changes in GitHub API, `gh workflow run` will immediately print the created workflow run URL. #### Improved `gh auth login` experience in VM/WSL environments We have observed rare cases of time drift between the wall and monotonic clocks, mostly in WSL or VM environments, causing failures during polling for the OAuth token. This new release implements measures to account for such situations. If you continue to experience `gh auth login` issues in WSL, please comment in [#​9370](cli/cli#9370) ####Request Copilot Code Review from `gh` + performance improvements `gh pr edit` now supports [Copilot Code Review](https://docs.github.com/en/copilot/using-github-copilot/code-review/using-copilot-code-review) as a reviewer. You can request a review from Copilot using the `--add-reviewer @​copilot` flag or interactively by selecting reviewers in the prompts. This release also introduces a new search experience for selecting reviewers and assignees in `gh pr edit`. Instead of loading all collaborators and teams upfront, results are now fetched based on inputs to a new search option. Initial options are suggestions based on those involved with the pull request already. ``` ? Reviewers [Use arrows to move, space to select, <right> to all, <left> to none, type to filter] [ ] Search (7472 more) [x] BagToad (Kynan Ware) > [x] Copilot (AI) ``` This experience will follow in `gh pr create` and `gh issue` for assignees in a later release. #### What's Changed ##### ✨ Features - Bundle licenses at release time by [@​williammartin](https://github.com/williammartin) in [#​12625](cli/cli#12625) - Add `--query` flag to `project item-list` by [@​williammartin](https://github.com/williammartin) in [#​12696](cli/cli#12696) - feat(workflow run): retrieve workflow dispatch run details by [@​babakks](https://github.com/babakks) in [#​12695](cli/cli#12695) - Pin REST API version to 2022-11-28 by [@​williammartin](https://github.com/williammartin) in [#​12680](cli/cli#12680) - Respect `--exit-status` with `--log` and `--log-failed` in `run view` by [@​williammartin](https://github.com/williammartin) in [#​12679](cli/cli#12679) - Fork with default branch only during pr create by [@​williammartin](https://github.com/williammartin) in [#​12673](cli/cli#12673) - `gh pr edit`: Add support for Copilot as reviewer with search capability, performance and accessibility improvements by [@​BagToad](https://github.com/BagToad) in [#​12567](cli/cli#12567) - `gh pr edit`: new interactive prompt for assignee selection, performance and accessibility improvements by [@​BagToad](https://github.com/BagToad) in [#​12526](cli/cli#12526) ##### 📚 Docs & Chores - Clean up project item-list query addition changes by [@​williammartin](https://github.com/williammartin) in [#​12714](cli/cli#12714) - `gh release upload`: Clarify `--clobber` flag deletes assets before re-uploading by [@​BagToad](https://github.com/BagToad) in [#​12711](cli/cli#12711) - Add usage examples to `gh gist edit` command by [@​BagToad](https://github.com/BagToad) in [#​12710](cli/cli#12710) - Remove feedback issue template by [@​BagToad](https://github.com/BagToad) in [#​12708](cli/cli#12708) - Migrate issue triage workflows to shared workflows by [@​BagToad](https://github.com/BagToad) in [#​12677](cli/cli#12677) - Migrate MR triage workflows to shared workflows by [@​BagToad](https://github.com/BagToad) in [#​12707](cli/cli#12707) - Add missing TODO comments for featuredetection if-statements by [@​BagToad](https://github.com/BagToad) in [#​12701](cli/cli#12701) - Add manual dispatch to bump-go workflow by [@​BagToad](https://github.com/BagToad) in [#​12631](cli/cli#12631) - typo: dont to don't by [@​cuiweixie](https://github.com/cuiweixie) in [#​12554](cli/cli#12554) - Fix fmt.Errorf format argument in ParseFullReference by [@​mikelolasagasti](https://github.com/mikelolasagasti) in [#​12516](cli/cli#12516) - Lint source.md by [@​Sethispr](https://github.com/Sethispr) in [#​12521](cli/cli#12521) #####
Dependencies - chore(deps): bump golang.org/x/text from 0.32.0 to 0.33.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​12468](cli/cli#12468) - chore(deps): bump golang.org/x/term from 0.38.0 to 0.39.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​12616](cli/cli#12616) - Bump go to 1.25.7 by [@​BagToad](https://github.com/BagToad) in [#​12630](cli/cli#12630) - chore(deps): bump golang.org/x/crypto from 0.46.0 to 0.47.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​12629](cli/cli#12629) - chore: bump `cli/oauth` to `v1.2.2` by [@​babakks](https://github.com/babakks) in [#​12573](cli/cli#12573) - update Go to 1.25.6 by [@​BagToad](https://github.com/BagToad) in [#​12580](cli/cli#12580) - chore(deps): bump actions/attest-build-provenance from 3.1.0 to 3.2.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​12558](cli/cli#12558) - chore(deps): bump github.com/sigstore/rekor from 1.4.3 to 1.5.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​12524](cli/cli#12524) - chore(deps): bump github.com/theupdateframework/go-tuf/v2 from 2.3.1 to 2.4.1 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​12555](cli/cli#12555) - chore(deps): bump github.com/gdamore/tcell/v2 from 2.13.4 to 2.13.7 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​12469](cli/cli#12469) - chore(deps): bump github.com/sigstore/sigstore from 1.10.0 to 1.10.4 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​12525](cli/cli#12525) - chore(deps): bump github.com/theupdateframework/go-tuf/v2 from 2.3.0 to 2.3.1 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​12515](cli/cli#12515) - chore(deps): bump actions/download-artifact from 6 to 7 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​12314](cli/cli#12314) - chore(deps): bump actions/upload-artifact from 5 to 6 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​12315](cli/cli#12315) - chore(deps): bump goreleaser/goreleaser-action from 6.0.0 to 6.4.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​12354](cli/cli#12354) #### New Contributors - [@​Sethispr](https://github.com/Sethispr) made their first contribution in [#​12521](cli/cli#12521) - [@​cuiweixie](https://github.com/cuiweixie) made their first contribution in [#​12554](cli/cli#12554) **Full Changelog**: <cli/cli@v2.86.0...v2.87.0> </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNC4yIiwidXBkYXRlZEluVmVyIjoiNDMuMzEuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6Om1pbm9yIl19-->
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.
Description
Adds Copilot Code Review (CCR) support and multiselect-with-search for reviewers in
gh pr edit.Key changes
API layer (
api/queries_pr.go):RequestReviewsByLoginGraphQL mutation withuserLogins,botLogins,teamSlugs(github.com only)SuggestedReviewerActorsquery combiningsuggestedReviewerActors, collaborators, and org teamsReviewerCandidateinterface withReviewerUser,ReviewerBot,ReviewerTeamtypesDisplayName()/DisplayNames()methods for user-friendly display (e.g., "Copilot (AI)")org/slug→slug) moved into REST functionsQuery builder (
api/query_builder.go):...on Bot{login}toprReviewRequestsfor Copilot support (silently ignored on GHES)Edit command (
pkg/cmd/pr/edit/edit.go):reviewerSearchFuncfor multiselect-with-searchupdatePullRequestReviewsGraphQL(github.com) vsupdatePullRequestReviewsREST(GHES)partitionReviewersByTypeto separate users, bots, teams@copilotflag support for--add-reviewer/--remove-reviewerShared (
pkg/cmd/pr/shared/):EditableReviewersstruct with separateDefault(display) andDefaultLogins(API)NewCopilotReviewerReplacerfor@copilot→copilot-pull-request-reviewerNotes for reviewers
requestReviewsByLoginusesunion: false(replace mode) to set the entire reviewer set[bot]suffix in API layer before mutation