Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Comments

Close side panel

gh pr edit: new interactive prompt for assignee selection, performance and accessibility improvements#12526

Merged
BagToad merged 23 commits intotrunkcli/cli:trunkfrom
github-cli-1070-multi-select-with-search-ccrcli/cli:github-cli-1070-multi-select-with-search-ccrCopy head branch name to clipboard
Jan 27, 2026
Merged

gh pr edit: new interactive prompt for assignee selection, performance and accessibility improvements#12526
BagToad merged 23 commits intotrunkcli/cli:trunkfrom
github-cli-1070-multi-select-with-search-ccrcli/cli:github-cli-1070-multi-select-with-search-ccrCopy head branch name to clipboard

Conversation

@BagToad
Copy link
Member

@BagToad BagToad commented Jan 22, 2026

Description

Implements multiselect with search for gh pr edit assignees, addressing performance and accessibility issues in large organizations. Part of larger work to improve the reviewer and assignee experience in gh.

Key changes

  • New MultiSelectWithSearch prompter: Adds a search sentinel option to multiselect lists, allowing dynamic fetching of assignees via API search rather than loading all org members upfront
  • SuggestedAssignableActors API: New GraphQL query to fetch suggested actors for an assignable (Issue/PR) node with optional search filtering
  • gh pr edit assignee flow: Wires up the new prompter for interactive assignee selection when ActorIsAssignable feature is detected
  • Prompter interface expansion: Both surveyPrompter and accessiblePrompter implement the new method, with full test coverage
  • Preview command: Adds multi-select-with-search to gh preview prompter for testing

Notes for reviewers

  • This PR only covers assignees for gh pr edit; reviewers will follow in a subsequent PR

@BagToad BagToad force-pushed the github-cli-1070-multi-select-with-search-ccr branch from 25ce0f4 to 2a50965 Compare January 22, 2026 21:51
@BagToad BagToad changed the title WIP: Multiselect with search for gh pr edit WIP: Multiselect with search for gh pr edit with assignees Jan 22, 2026
BagToad and others added 15 commits January 26, 2026 13:29
Updated the Prompt interface in survey.go to include parameter names for all methods, improving code readability and clarity.
Initial implementation of MultiSelectWithSearch:

- Implement by survey and accessible prompters. They use the same internal func under the hood.
- Implement in `gh preview prompter` for initial testing and demonstration
- Implement interface changes across the codebase and mocks to satisfy compiler.
- Implement tests for new MultiSelectWithSearch prompter
Introduces SuggestedAssignableActors API query and wires up a dynamic assignee search function in the PR edit command. Updates Editable and EditPrompter interfaces to support search-based multi-select for assignees, improving the user experience when assigning users to pull requests.
The assigneeSearchFunc now receives the editable struct to update its Metadata.AssignableActors field with suggested assignable actors. This change ensures that the editable struct has the necessary actor metadata for later PR updates.
Added a comment explaining how to enable logging in expect-based tests by using expect.WithLogger. This helps developers debug by printing characters read to stdout.
Refactored the MultiSelectWithSearch function and related interfaces to use a MultiSelectSearchResult struct instead of multiple return values. This change improves clarity and extensibility of the search function signature, and updates all usages, mocks, and tests accordingly.
Updated test mocks and logic to consistently use lowercase 'monalisa' for login names and display names for user assignees. Improved handling of dynamic assignee fetching in interactive flows by relying on searchFunc and metadata population, and clarified logic in FetchOptions to fetch assignees only when necessary. These changes ensure more accurate simulation of interactive assignment and better test coverage for actor assignee features.
Updated the TODO comment to specify wiring up the reviewer search function if or when it exists, providing clearer intent for future development.
Co-authored-by: Babak K. Shandiz <babakks@github.com>
Co-authored-by: Babak K. Shandiz <babakks@github.com>
Simplifies SuggestedAssignableActors by no longer including the viewer in the returned actors list when the query is blank. Removes related logic and variables for viewer handling.
Refactored the construction of the variables map by directly assigning the 'query' key, removing the conditional logic for nil assignment.
Added detailed comments to the assigneeSearchFunc explaining its purpose and the importance of updating assignable actors metadata for later ID resolution when mutating assignees with the GraphQL API.
@BagToad BagToad force-pushed the github-cli-1070-multi-select-with-search-ccr branch from f3c2378 to e3a3a01 Compare January 26, 2026 20:29
@BagToad BagToad changed the title WIP: Multiselect with search for gh pr edit with assignees Multiselect with search for gh pr edit with assignees Jan 26, 2026
@BagToad BagToad changed the title Multiselect with search for gh pr edit with assignees gh pr edit: new interactive prompt for assignee selection, performance and accessibility improvements Jan 26, 2026
Deleted the Viewer struct from the responseData type in SuggestedAssignableActors as it was not being used.
Introduces a test case to verify that the interactive edit flow on GitHub Enterprise Server uses the legacy assignee selection without search, ensuring correct behavior when editing pull request assignees.
Introduces a test case to verify that errors returned from the MultiSelectWithSearch search function are properly propagated to the caller.
Updated SuggestedAssignableActors to return the total count of available assignees in the repository. Modified assigneeSearchFunc to use this count to calculate and display the number of additional assignees beyond the current results.
@BagToad BagToad marked this pull request as ready for review January 26, 2026 21:52
@BagToad BagToad requested a review from a team as a code owner January 26, 2026 21:52
@BagToad BagToad requested review from babakks and Copilot January 26, 2026 21:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an interactive multi-select prompt with on-demand search for assignee selection in gh pr edit, aiming to avoid loading large org member lists upfront and to improve accessibility.

Changes:

  • Introduces MultiSelectWithSearch in the prompter layer (survey + accessible) and extends mocks/tests to support it.
  • Wires assignee search into gh pr edit when ActorIsAssignable is available, plus a preview command to exercise the new prompt.
  • Adds a new GraphQL helper (SuggestedAssignableActors) intended to back dynamic assignee search.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
pkg/cmd/preview/prompter/prompter.go Adds a preview entry point for the new multi-select-with-search prompt.
pkg/cmd/pr/shared/survey.go Extends shared survey prompt interface to include MultiSelectWithSearch.
pkg/cmd/pr/shared/editable.go Adds assignee search hook to the editable model and uses MultiSelectWithSearch when available.
pkg/cmd/pr/edit/edit.go Wires assignee search function into gh pr edit for Actor assignees and updates fetch behavior.
pkg/cmd/pr/edit/edit_test.go Updates PR edit tests for the new Actor assignee flow and metadata handling.
pkg/cmd/issue/edit/edit_test.go Updates issue edit test fixtures for actor login casing changes.
internal/prompter/prompter.go Adds MultiSelectWithSearch implementation and supporting types.
internal/prompter/accessible_prompter_test.go Adds accessible prompter tests covering the new search flow.
internal/prompter/test.go Extends mock prompter helpers to stub MultiSelectWithSearch.
internal/prompter/prompter_mock.go Extends generated mock to support MultiSelectWithSearch calls.
api/queries_pr.go Adds SuggestedAssignableActors GraphQL query helper.
Comments suppressed due to low confidence (2)

internal/prompter/prompter.go:394

  • The search sentinel uses an empty-string key (optionKeys = append(optionKeys, "")). If defaultValues, persistentValues, or searchFunc results ever contain an empty key, it will collide with the sentinel and can drop selections or create duplicates. Filter out empty keys (and/or use a reserved non-empty sentinel key).
		// 1. Search sentinel.
		optionKeys = append(optionKeys, "")
		if moreResults > 0 {
			optionLabels = append(optionLabels, fmt.Sprintf("Search (%d more)", moreResults))
		} else {

pkg/cmd/pr/edit/edit.go:386

  • MoreResults is set to availableAssigneesCount (repo-wide assignable user total), but multiSelectWithSearch displays this as "Search (%d more)", which implies “more results for this search”. Either compute an actual remaining-results count (if available) or adjust the label/semantics so the number isn’t misleading.
		return prompter.MultiSelectSearchResult{
			Keys:        logins,
			Labels:      displayNames,
			MoreResults: availableAssigneesCount,
			Err:         nil,

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

internal/prompter/prompter.go Outdated Show resolved Hide resolved
searchResultKeys := searchResult.Keys
searchResultLabels := searchResult.Labels
moreResults := searchResult.MoreResults

Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

multiSelectWithSearch indexes searchResultLabels[i] for each key without validating slice lengths. If a searchFunc returns mismatched Keys/Labels lengths, this will panic. Validate lengths and return a clear error (or use a slice of {Key, Label} pairs).

Suggested change
if len(searchResultLabels) != len(searchResultKeys) {
return nil, fmt.Errorf("failed to search: mismatched result lengths: %d keys, %d labels", len(searchResultKeys), len(searchResultLabels))
}

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd rather see the panic error

api/queries_pr.go Show resolved Hide resolved
pkg/cmd/pr/edit/edit.go Show resolved Hide resolved
api/queries_pr.go Show resolved Hide resolved
BagToad and others added 3 commits January 26, 2026 15:05
Cleaned up obsolete TODO comments related to assignee and reviewer selection logic in the MetadataSurvey function.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Deleted a comment about the query variable being passed as null when empty, as it is no longer relevant or necessary.
Copy link
Member

@babakks babakks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Reviewed in sync! 🍻

@BagToad BagToad merged commit 6adf803 into trunk Jan 27, 2026
11 checks passed
@BagToad BagToad deleted the github-cli-1070-multi-select-with-search-ccr branch January 27, 2026 16:16
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.