Skip to content

Avoid discovery reads for ordinary PR reviewer updates - #35575

Merged
OrcaWin merged 2 commits into
mainfrom
OrcaWin/github-reviewer-write
Oct 29, 2026
Merged

OrcaWin merged 2 commits into
mainfrom
OrcaWin/github-reviewer-write

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​79 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​79
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​29 $\color{#cf222e}{\Huge{\mathbf{−}}}$​8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​21

Adding or removing ordinary PR reviewers currently invokes CLI discovery even when Orca already knows the repository, PR number and reviewer logins. Send those updates directly to the requested_reviewers REST endpoint with one mutation.

This avoids the CLI's PR discovery read while still performing one write. Team names, comma-separated input, bot identifiers and special aliases retain the existing CLI interpretation. Mixed selections also use the CLI. Input trimming, explicit repository/host/WSL/SSH routing, permits, mutation invalidation and error results are preserved. Failed writes are never retried through a second mutation path.

Validation: 47 tests pass across four files, including mutation routing and invalidation. Replaying the original production module fails both direct-request regressions while all 16 syntax/error controls pass. A loopback HTTP check with the installed CLI confirms POST and DELETE each send exactly one request with {"reviewers":["alice","bob"]}; no live PR was mutated as a benchmark. pnpm check:changed --maxWorkers=2 --timeout=6 passed all 20 non-test checks; broad related-test discovery timed out at six minutes without results. Claude independently passed 91 tests across seven suites with no actionable findings. No IPC or UI changes.

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

The add and remove reviewer operations now use shared logic to select an update path. Standard reviewer logins use the requested-reviewers API. Other reviewer values use gh pr edit. Tests cover both paths and check request arguments, repository routing, resource handling, and lookup invalidation.

Priority: Low

Merge Risk: Low · up to 2a826

Reviewer updates for ordinary usernames now use one direct API call. Manually typing the unsuffixed Copilot reviewer login can still fail, because it is sent without the [bot] suffix. This is a narrow edge case with a workaround, which is to use the @copilot alias. The fix is small and can land before or after merge.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description explains the change, rationale, preserved behavior, and validation results. However, it does not follow the required template structure and omits or leaves incomplete required items, i… Rewrite the description using all required template headings. Add the linked issue under “Linked Issue,” state “N/A” with a reason under “Visual Proof” if applicable, complete the testing and checklist items, and address AI disclosure and r…
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly summarizes the main change: avoiding discovery reads for ordinary pull request reviewer updates.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the change, rationale, preserved behavior, and validation results. However, it does not follow the required template structure and omits or leaves incomplete required items, including the linked issue, explicit visual-proof statement, testing checkboxes, AI disclosure, review notes, agent-skill boundary, and checklist.

Resolution

Rewrite the description using all required template headings. Add the linked issue under “Linked Issue,” state “N/A” with a reason under “Visual Proof” if applicable, complete the testing and checklist items, and address AI disclosure and review notes.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 2 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; restoring the failed-write test is a non-blocking improvement.

Findings

  1. P2 Failed writes lose test coverage ▶

Summary

Ordinary reviewer logins now go straight to GitHub’s requested_reviewers endpoint.

  • Ordinary reviewer lists use one direct pull request write.

Reviews (2) · Last reviewed commit: "test(github): trim redundant cases" · Reviewed by Greptile

)
}
)
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Failed writes lose test coverage

The deleted test checked that a rejected reviewer update returns its error, releases its permit, and never tries another write path. The remaining tests make mocks.exec succeed, so they no longer protect these promises for failed add and remove operations. Restoring that test would help catch later changes that break the PR’s single-write promise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6ea3f520-2a85-4b3b-9525-4a2d877ebabe
Commits

Reviewing files that changed from the base of the PR and between f5c84ea and 2a826c9.

Files selected for processing: 2
  • src/main/github/client-pr-reviewer-direct-update.test.ts
  • src/main/github/client/update/pr-reviewers.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

logins: string[],
operation: 'add' | 'remove'
): string[] {
if (logins.every((login) => /^[a-z\d](?:[a-z\d-]{0,37}[a-z\d])?$/i.test(login))) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor · Functional Correctness · Quick win

Supported by static analysis

Script executed:

rg -n -i 'copilot-pull-request-reviewer|copilot.*reviewer|\[bot\]' src --glob '!*.test.ts' | head -50
sed -n '1,100p' src/main/github/client/update/pr-reviewers.ts

Repository: stablyai/orca

Length of output: 4438


Script executed:

set -o pipefail
printf '%s\n' '--- exact and related reviewer references ---'
rg -n -i -F -e 'copilot-pull-request-reviewer' -e 'reviewerUpdateArgs' -e 'requestPRReviewers' -e 'removePRReviewers' -e 'suggested reviewers' -e 'suggestion' src --glob '*.{ts,tsx}' || test "$?" -eq 1
printf '%s\n' '--- changed file tests and diff ---'
git diff --no-ext-diff --unified=80 18c4e6bc473f20db2d5e70b89acad813bd71349b 2a826c9aee5ce1e0c17f64c265a194d984d6a343 -- src/main/github/client/update/pr-reviewers.ts
rg -n -F -e 'pr-reviewers' -e 'requestPRReviewers' -e 'removePRReviewers' src --glob '*.{test,spec}.{ts,tsx}' || test "$?" -eq 1
printf '%s\n' '--- likely reviewer list producers ---'
rg -n -i 'reviewer|requested_reviewers|suggest' src/main/github src/renderer --glob '*.{ts,tsx}' | head -240

Repository: stablyai/orca

Length of output: 41894


Web query:

GitHub CLI source gh pr edit add-reviewer bot login normalization copilot-pull-request-reviewer

Result:

<source_evidence>
<source kind="find_in_page">
<title></title>
<location>https://raw.githubusercontent.com/cli/cli/trunk/pkg/cmd/pr/edit/edit.go</location>
<excerpt>citeturn3view0 [wordlim: 200] Crawled: today; Content type: text/plain; Source: find({&quot;ref_id&quot;:&quot;turn2view0&quot;,&quot;pattern&quot;:&quot;Copilot&quot;}); Total lines: 594
L79: 			If some attachments upload and others fail, the pull request is still updated with the
L80: 			ones that succeeded. The command then exits with a non-zero status, but the pull
L81: 			request&#39;s URL is still printed to stdout.
L82: 
L83: 			The %[1]s--add-assignee%[1]s and %[1]s--remove-assignee%[1]s flags both support
L84: 			the following special values:
L85: 			- %[1]s@me%[1]s: assign or unassign yourself
L86: 			- %[1]s@copilot%[1]s: assign or unassign Copilot (not supported on GitHub Enterprise Server)
L87: 			The %[1]s--add-reviewer%[1]s and %[1]s--remove-reviewer%[1]s flags support
L88: 			the following special value:
L89: 			- %[1]s@copilot%[1]s: request or remove review from Copilot (not supported on GitHub Enterprise Server)
L90: 		`, &quot;`&quot;),
L91: 		Example: heredoc.Doc(`
L92: 			# Edit the title and body of a pull request
L93: 			$ gh pr edit 23 --title &quot;I found a bug&quot; --body &quot;Nothing works&quot;
L94: 
L95: 			# Use a file as the body
L96: 			$ gh pr edit 23 --body-file body.txt
L97: 			# Append a screenshot to the body, with alt text after &quot;#&quot;
L98: 			$ gh pr edit 23 --attach &#39;./login.png#The login error state&#39;
L99: 
L100: 			# Append multiple files by repeating the flag
L101: 			$ gh pr edit 23 --attach ./before.png --attach ./after.png
L102: 
L103: 			# Manage labels
L104: 			$ gh pr edit 23 --add-label &quot;bug,help wanted&quot; --remove-label &quot;core&quot;
L105: 
L106: 			# Manage reviewers
L107: 			$ gh pr edit 23 --add-reviewer monalisa,hubot --remove-reviewer myorg/team-name
L108: 
L109: 			# Re-request review
L110: 			$ gh pr edit 23 --add-reviewer monalisa
L111: 			# Request a review from GitHub Copilot
L112: 			$ gh pr edit 23 --add-reviewer &quot;@copilot&quot;
L113: 
L114: 			# Manage assignees
L115: 			$ gh pr edit 23 --add-assignee &quot;@me&quot; --remove-assignee monalisa,hubot
L116: 
L117: 			# Assign GitHub Copilot
L118: 			$ gh pr edit 23 --add-assignee &quot;@copilot&quot;
L119: 			# Manage projects and milestones
L120: 			$ gh pr edit 23 --add-project &quot;Roadmap&quot; --remove-project v1,v2
L121: 			$ gh pr edit 23 --milestone &quot;Version 1&quot;
L122: 			$ gh pr edit 23 --remove-milestone
L123: 		`),
L124: 		Args: cobra.MaximumNArgs(1),
L125: 		RunE: func(cmd *cobra.Command, args []string) error {
L126: 			opts.Finder = shared.NewFinder(f)
L127: 
L128: 			// support `-R, --repo` override
L129: 			opts.BaseRepo = f.BaseRepo
L130: 
L131: 			if len(args) &gt; 0 {
L132: 				opts.SelectorArg = args[0]
L133: 			}
L134: 			if opts.SelectorArg != &quot;&quot; {
L135: 				// If a URL is provided, we need to parse it to override the
L136: 				// base repository, especially the hostname part. That&#39;s because
L137: 				// we need a feature detector down in this command, and that
L138: 				// needs to know the API host. If the command is run outside of
L139: 				// a git repo, we cannot instantiate the detector unless we have
L140: 				// already parsed the URL.
L141: 				if baseRepo, _, _, err := shared.ParseURL(opts.SelectorArg); err == nil {
L142: 					opts.BaseRepo = func() (ghrepo.Interface, error) {
L143: 						return baseRepo, nil
L144: 					}
L145: 				}
L146: 			}
L147: 			flags := cmd.Flags()
L148: 
L149: 			bodyProvided := flags.Changed(&quot;body&quot;)
L150: 			bodyFileProvided := bodyFile != &quot;&quot;
L151: 			if err := cmdutil.MutuallyExclusive(
L152: 				&quot;specify only one of `--body` or `--body-file`&quot;,
L153: 				bodyProvided,
L154: 				bodyFileProvided,
L155: 			); err != nil {
L156: 				return err
L157: 			}
L158: 			if bodyProvided || bodyFileProvided {
L159: 				opts.Editable.Body.Edited = true
L160: 				if bodyFileProvided {
L161: 					var err error
L162: 					opts.Editable.Body.Value, opts.BodyDir, err = cmdutil.ReadMarkdownBodyFile(bodyFile, opts.IO.In)
L163: 					if err != nil {
L164: 						return err
L165: 					}
L166: 				}
L167: 			}
L198: 				// Note that when `--remove-milestone` is provided, the value of
L199: 				// `opts.Editable.Milestone.Value` will automatically be empty,
L200: 				// which results in milestone association removal. For reference,
L201: 				// see the `Editable.MilestoneId` method.
L202: 			}
L203: 
L204: 			var err error
L205: 			opts.AttachEvent = attachments.BeginTelemetry(telemetry, cmd.CommandPath(), opts.AttachFlag.Count())
L206: 			opts.Assets, err = opts.AttachFlag.UserAssets()
L207: 			if err != nil {
L208: 				return err
L209: 			}
L210: 			if !opts.Editable.Dirty() &amp;&amp; len(opts.Assets) == 0 {
L211: 				opts.Interactive = true
L212: 			}
L213: 
L214: 			if opts.Interactive &amp;&amp; !opts.IO.CanPrompt() {
L215: 				return cmdutil.FlagErrorf(&quot;--title, --body, --reviewer, --assignee, --label, --project, or --milestone required when not running interactively&quot;)
L216: 			}
L217: 
L218: 			if runF != nil {
L219: 				return runF(opts)
L220: 			}
L221: 
L222: 			return editRun(opts)
L223: 		},
L224: 	}
L225: 	cmd.Flags().StringVarP(&amp;opts.Editable.Title.Value, &quot;title&quot;, &quot;t&quot;, &quot;&quot;, &quot;Set the new title.&quot;)
L226: 	cmd.Flags().StringVarP(&amp;opts.Editable.Body.Value, &quot;body&quot;, &quot;b&quot;, &quot;&quot;, &quot;Set the new body.&quot;)
L227: 	cmd.Flags().StringVarP(&amp;bodyFile, &quot;body-file&quot;, &quot;F&quot;, &quot;&quot;, &quot;Read body text from `file` (use \&quot;-\&quot; to read from standard input)&quot;)
L228: 	cmd.Flags().StringVarP(&amp;opts.Editable.Base.Value, &quot;base&quot;, &quot;B&quot;, &quot;&quot;, &quot;Change the base `branch` for this pull request&quot;)
L229: 	cmd.Flags().StringSliceVar(&amp;opts.Editable.Reviewers.Add, &quot;add-reviewer&quot;, nil, &quot;Add or re-request reviewers by their `login`. Use \&quot;@copilot\&quot; to request review from Copilot.&quot;)
L230: 	cmd.Flags().StringSliceVar(&amp;opts.Editable.Reviewers.Remove, &quot;remove-reviewer&quot;, nil, &quot;Remove reviewers by their `login`. Use \&quot;@copilot\&quot; to remove review request from Copilot.&quot;)
L231: 	cmd.Flags().StringSliceVar(&amp;opts.Editable.Assignees.Add, &quot;add-assignee&quot;, nil, &quot;Add assigned users by their `login`. Use \&quot;@me\&quot; to assign yourself, or \&quot;@copilot\&quot; to assign Copilot.&quot;)
L232: 	cmd.Flags().StringSliceVar(&amp;opts.Editable.Assignees.Remove, &quot;remove-assignee&quot;, nil, &quot;Remove assigned users by their `login`. Use \&quot;@me\&quot; to unassign yourself, or \&quot;@copilot\&quot; to unassign Copilot.&quot;)
L233: 	cmd.Flags().StringSliceVar(&amp;opts.Editable.Labels.Add, &quot;add-label&quot;, nil, &quot;Add labels by `name`&quot;)
L234: 	cmd.Flags().StringSliceVar(&amp;opts.Editable.Labels.Remove, &quot;remove-label&quot;, nil, &quot;Remove labels by `name`&quot;)
L235: 	cmd.Flags().StringSliceVar(&amp;opts.Editable.Projects.Add, &quot;add-project&quot;, nil, &quot;Add the pull request to projects by `title`&quot;)
L236: 	cmd.Flags().StringSliceVar(&amp;opts.Editable.Projects.Remove, &quot;remove-project&quot;, nil, &quot;Remove the pull request from projects by `title`&quot;)
L237: 	cmd.Flags().StringVarP(&amp;opts.Editable.Milestone.Value, &quot;milestone&quot;, &quot;m&quot;, &quot;&quot;, &quot;Edit the milestone the pull request belongs to by `name`&quot;)
L238: 	cmd.Flags().BoolVar(&amp;removeMilestone, &quot;remove-milestone&quot;, false, &quot;Remove the milestone association from the pull request&quot;)
L239: 	opts.AttachFlag = attachments.AddFlag(cmd)
L240: 	_ = cmdutil.RegisterBranchCompletionFlags(f.GitClient, cmd, &quot;base&quot;)
L241: 	for _, flagName := range []string{&quot;add-reviewer&quot;, &quot;remove-reviewer&quot;} {
L242: 		_ = cmd.RegisterFlagCompletionFunc(flagName, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
L243: 			baseRepo, err := f.BaseRepo()
L244: 			if err != nil {
L245: 				return nil, cobra.ShellCompDirectiveError
L246: 			}
L247: 			httpClient, err := f.HttpClient()
L248: 			if err != nil {
L249: 				return nil, cobra.ShellCompDirectiveError
L250: 			}
L251: 			results, err := shared.RequestableReviewersForCompletion(httpClient, baseRepo)
L480: 		// Replace @copilot with the Copilot reviewer login (only on github.com).
L481: 		// Also use DefaultLogins (not Default display names) for computing the …[truncated]</excerpt>
</source>
<source kind="find_in_page">
<title></title>
<location>https://raw.githubusercontent.com/cli/cli/trunk/pkg/cmd/pr/shared/editable.go</location>
<excerpt>citeturn3view3 [wordlim: 200] Crawled: today; Content type: text/plain; Source: find({&quot;ref_id&quot;:&quot;turn2view1&quot;,&quot;pattern&quot;:&quot;Reviewers&quot;}); Total lines: 665
L346: func EditFieldsSurvey(p EditPrompter, editable *Editable, editorCommand string) error {
L347: 	var err error
L348: 	if editable.Title.Edited {
L349: 		editable.Title.Value, err = p.Input(&quot;Title&quot;, editable.Title.Default)
L350: 		if err != nil {
L351: 			return err
L352: 		}
L353: 	}
L354: 	if editable.Body.Edited {
L355: 		editable.Body.Value, err = p.MarkdownEditor(&quot;Body&quot;, editable.Body.Default, false)
L356: 		if err != nil {
L357: 			return err
L358: 		}
L359: 	}
L360: 	if editable.Reviewers.Edited {
L361: 		if editable.ReviewerSearchFunc != nil {
L362: 			editable.Reviewers.Options = []string{}
L363: 			editable.Reviewers.Value, err = p.MultiSelectWithSearch(
L364: 				&quot;Reviewers&quot;,
L365: 				&quot;Search reviewers&quot;,
L366: 				editable.Reviewers.DefaultLogins,
L367: 				// No persistent options - teams are included in search results
L368: 				[]string{},
L369: 				editable.ReviewerSearchFunc)
L370: 			if err != nil {
L371: 				return err
L372: 			}
L373: 		} else {
L374: 			editable.Reviewers.Value, err = multiSelectSurvey(
L375: 				p, &quot;Reviewers&quot;, editable.Reviewers.Default, editable.Reviewers.Options)
L376: 			if err != nil {
L377: 				return err
L378: 			}
L379: 		}
L380: 	}
L381: 	if editable.Assignees.Edited {
L382: 		if editable.AssigneeSearchFunc != nil {
L383: 			editable.Assignees.Options = []string{}
L384: 			editable.Assignees.Value, err = p.MultiSelectWithSearch(
L385: 				&quot;Assignees&quot;,
L386: 				&quot;Search assignees&quot;,
L387: 				editable.Assignees.DefaultLogins,
L388: 				// No persistent options required here as teams cannot be assignees.
L389: 				[]string{},
L390: 				editable.AssigneeSearchFunc)
L391: 			if err != nil {
L392: 				return err
L393: 			}
L394: 		} else {
L395: 			editable.Assignees.Value, err = multiSelectSurvey(
L396: 				p, &quot;Assignees&quot;, editable.Assignees.Default, editable.Assignees.Options)
L397: 			if err != nil {
L398: 				return err
L399: 			}
L400: 		}
L401: 	}
L402: 	if editable.Labels.Edited {
L403: 		editable.Labels.Add, err = multiSelectSurvey(
L404: 			p, &quot;Labels&quot;, editable.Labels.Default, editable.Labels.Options)
L405: 		if err != nil {
L406: 			return err
L407: 		}
L408: 		for _, prev := range editable.Labels.Default {
L409: 			if !slices.Contains(editable.Labels.Add, prev) {
L410: 				editable.Labels.Remove = append(editable.Labels.Remove, prev)
L411: 			}
L412: 		}
L413: 	}
L414: 	if editable.Projects.Edited {
L415: 		editable.Projects.Value, err = multiSelectSurvey(
L416: 			p, &quot;Projects&quot;, editable.Projects.Default, editable.Projects.Options)
L417: 		if err != nil {
L418: 			return err
L419: 		}
L420: 	}
L421: 	if editable.Milestone.Edited {
L422: 		editable.Milestone.Value, err = milestoneSurvey(p, editable.Milestone.Default, editable.Milestone.Options)
L423: 		if err != nil {
L424: 			return err
L425: 		}
L426: 	}
L427: 	if editable.IssueType.Edited {
L428: 		if len(editable.IssueType.Options) &gt; 0 {
L429: 			var selected int
L430: 			selected, err = p.Select(&quot;Type&quot;, editable.IssueType.Default, editable.IssueType.Options)
L431: 			if err != nil {
L432: 				return err
L433: 			}
L434: 			editable.IssueType.Value = editable.IssueType.Options[selected]
L435: 		}
L436: 	}
L437: 	confirm, err := p.Confirm(&quot;Submit?&quot;, true)
L438: 	if err != nil {
L439: 		return err
L440: 	}
L441: 	if !confirm {
L442: 		return fmt.Errorf(&quot;Discarding...&quot;)
L443: 	}
L444: 	return nil
L445: }
L446: 
L447: func FieldsToEditSurvey(p EditPrompter, editable *Editable) error {
L448: 	opts := []string{&quot;Title&quot;, &quot;Body&quot;}
L449: 	if editable.Reviewers.Selectable {
L450: 		opts = append(opts, &quot;Reviewers&quot;)
L451: 	}
L452: 	opts = append(opts, &quot;Assignees…[truncated]</excerpt>
</source>
<source kind="open_page">
<title></title>
<location>https://raw.githubusercontent.com/cli/cli/trunk/pkg/cmd/pr/edit/edit.go</location>
<excerpt>citeturn2view0 [wordlim: 200] Crawled: today; Content type: text/plain; Source: open({&quot;ref_id&quot;:&quot;https://raw.githubusercontent.com/cli/cli/trunk/pkg/cmd/pr/edit/edit.go&quot;,&quot;lineno&quot;:null}); Total lines: 594
L0: package edit
L1: 
L2: import (
L3: 	&quot;context&quot;
L4: 	&quot;errors&quot;
L5: 	&quot;fmt&quot;
L6: 	&quot;net/http&quot;
L7: 	&quot;slices&quot;
L8: 	&quot;strings&quot;
L9: 	&quot;time&quot;
L10: 	&quot;github.com/MakeNowJust/heredoc&quot;
L11: 	&quot;github.com/cli/cli/v2/api&quot;
L12: 	&quot;github.com/cli/cli/v2/internal/attachments&quot;
L13: 	fd &quot;github.com/cli/cli/v2/internal/featuredetection&quot;
L14: 	&quot;github.com/cli/cli/v2/internal/gh&quot;
L15: 	&quot;github.com/cli/cli/v2/internal/gh/ghtelemetry&quot;
L16: 	&quot;github.com/cli/cli/v2/internal/ghrepo&quot;
L17: 	&quot;github.com/cli/cli/v2/internal/prompter&quot;
L18: 	shared &quot;github.com/cli/cli/v2/pkg/cmd/pr/shared&quot;
L19: 	&quot;github.com/cli/cli/v2/pkg/cmdutil&quot;
L20: 	&quot;github.com/cli/cli/v2/pkg/iostreams&quot;
L21: 	&quot;github.com/cli/cli/v2/pkg/set&quot;
L22: 	&quot;github.com/spf13/cobra&quot;
L23: 	&quot;golang.org/x/sync/errgroup&quot;
L24: )
L25: type EditOptions struct {
L26: 	HttpClient func() (*http.Client, error)
L27: 	IO         *iostreams.IOStreams
L28: 
L29: 	Finder          shared.PRFinder
L30: 	Surveyor        Surveyor
L31: 	Fetcher         EditableOptionsFetcher
L32: 	EditorRetriever EditorRetriever
L33: 	Prompter        shared.EditPrompter
L34: 	Detector        fd.Detector
L35: 	BaseRepo        func() (ghrepo.Interface, error)
L36: 
L37: 	SelectorArg string
L38: 	Interactive bool
L39: 	BodyDir     string
L40: 	AttachFlag  *attachments.Flag
L41: 	AttachEvent *attachments.TelemetryEvent
L42: 	Assets      []attachments.UserAsset
L43: 
L44: 	shared.Editable
L45: }
L46: func NewCmdEdit(f *cmdutil.Factory, telemetry ghtelemetry.InvocationRecorder, runF func(*EditOptions) error) *cobra.Command {
L47: 	opts := &amp;EditOptions{
L48: 		IO:              f.IOStreams,
L49: 		HttpClient:      f.HttpClient,
L50: 		Surveyor:        surveyor{P: f.Prompter},
L51: 		Fetcher:         fetcher{},
L52: 		EditorRetriever: editorRetriever{config: f.Config},
L53: 		Prompter:        f.Prompter,
L54: 	}
L55: 
L56: 	var bodyFile string
L57: 	var removeMilestone bool
L58: 	cmd := &amp;cobra.Command{
L59: 		Use:   &quot;edit [&lt;number&gt; | &lt;url&gt; | &lt;branch&gt;]&quot;,
L60: 		Short: &quot;Edit a pull request&quot;,
L61: 		Long: heredoc.Docf(`
L62: 			Edit a pull request.
L63: 
L64: 			Without an argument, the pull request that belongs to the current branch
L65: 			is selected.
L66: 
L67: 			Editing a pull request&#39;s projects requires authorization with the %[1]sproject%[1]s scope.
L68: 			To authorize, run %[1]sgh auth refresh -s project%[1]s.
L69: 			Use %[1]s--attach%[1]s to upload an image or video. Without a body flag the pull
L70: 			request keeps the body it already has and the attachment is appended to it. If the
L71: 			body references an attached file, such as %[1]s![alt](./login.png)%[1]s, that reference
L72: 			is rewritten to point at the uploaded asset instead. Paths in a %[1]s--body-file%[1]s are
L73: 			relative to its directory, falling back to the working directory.
L74: 			You can attach up to 50 files per command.
L75: 			Alt text for an image follows the path after %[1]s#%[1]s, as in
L76: 			%[1]s--attach &#39;./login.png#The login error state&#39;%[1]s. Without it the filename is used.
L77: 			A reference already in the body keeps the alt text written there. Video renders
L78: 			as a player and has no alt text, so it cannot be given any.
L79: 			If some attachments upload and others fail, the pull request is still updated with the
L80: 			ones that succeeded. The command then exits with a non-zero status, but the pull
L81: 			request&#39;s URL is still printed to stdout.
L82: 
L83: 			The %[1]s--add-assignee%[1]s and %[1]s--remove-assignee%[1]s flags both s…[truncated]</excerpt>
</source>
<source kind="open_page">
<title></title>
<location>https://raw.githubusercontent.com/cli/cli/trunk/pkg/cmd/pr/shared/editable.go</location>
<excerpt>citeturn2view1 [wordlim: 200] Crawled: today; Content type: text/plain; Source: open({&quot;ref_id&quot;:&quot;https://raw.githubusercontent.com/cli/cli/trunk/pkg/cmd/pr/shared/editable.go&quot;,&quot;lineno&quot;:null}); Total lines: 665
L0: package shared
L1: 
L2: import (
L3: 	&quot;fmt&quot;
L4: 	&quot;slices&quot;
L5: 
L6: 	&quot;github.com/cli/cli/v2/api&quot;
L7: 	&quot;github.com/cli/cli/v2/internal/gh&quot;
L8: 	&quot;github.com/cli/cli/v2/internal/ghrepo&quot;
L9: 	&quot;github.com/cli/cli/v2/internal/prompter&quot;
L10: 	&quot;github.com/cli/cli/v2/pkg/set&quot;
L11: )
L12: type Editable struct {
L13: 	Title              EditableString
L14: 	Body               EditableString
L15: 	Base               EditableString
L16: 	Reviewers          EditableReviewers
L17: 	ReviewerSearchFunc func(string) prompter.MultiSelectSearchResult
L18: 	Assignees          EditableAssignees
L19: 	AssigneeSearchFunc func(string) prompter.MultiSelectSearchResult
L20: 	Labels             EditableSlice
L21: 	Projects           EditableProjects
L22: 	Milestone          EditableString
L23: 	IssueType          EditableString
L24: 	IssueTypeNameToID  map[string]string
L25: 	Metadata           api.RepoMetadataResult
L26: 	// TODO ApiActorsSupported
L27: 	// ApiActorsSupported indicates the host supports actor-based APIs (github.com, ghe.com).
L28: 	// When true, mutations use logins directly instead of resolving node IDs.
L29: 	// Remove this flag (and collapse to actor-only paths) once GHES supports
L30: 	// replaceActorsForAssignable and requestReviewsByLogin mutations.
L31: 	ApiActorsSupported bool
L32: }
L33: type EditableString struct {
L34: 	Value   string
L35: 	Default string
L36: 	Options []string
L37: 	Edited  bool
L38: 	// Selectable controls whether the interactive survey offers this
L39: 	// field as one of the things the user can choose to edit. Flag-only
L40: 	// fields leave it false.
L41: 	Selectable bool
L42: }
L43: type EditableSlice struct {
L44: 	Value   []string
L45: 	Add     []string
L46: 	Remove  []string
L47: 	Default []string
L48: 	Options []string
L49: 	Edited  bool
L50: 	// Selectable controls whether the interactive survey offers this
L51: 	// field as one of the things the user can choose to edit. Flag-only
L52: 	// fields leave it false.
L53: 	Selectable bool
L54: }
L55: 
L56: // EditableAssignees is a special case of EditableSlice.
L57: type EditableAssignees struct {
L58: 	EditableSlice
L59: 	DefaultLogins []string // For disambiguating actors from display names
L60: }
L61: // EditableReviewers is a special case of EditableSlice.
L62: type EditableReviewers struct {
L63: 	EditableSlice
L64: 	DefaultLogins []string // For disambiguating actors from display names
L65: }
L66: 
L67: // ProjectsV2 mutations require a mapping of an item ID to a project ID.
L68: // Keep that map along with standard EditableSlice data.
L69: type EditableProjects struct {
L70: 	EditableSlice
L71: 	ProjectItems map[string]string
L72: }
L73: func (e Editable) Dirty() bool {
L74: 	return e.Title.Edited ||
L75: 		e.Body.Edited ||
L76: 		e.Base.Edited ||
L77: 		e.Reviewers.Edited ||
L78: 		e.Assignees.Edited ||
L79: 		e.Labels.Edited ||
L80: 		e.Projects.Edited ||
L81: 		e.Milestone.Edited ||
L82: 		e.IssueType.Edited
L83: }
L84: 
L85: func (e Editable) TitleValue() *string {
L86: 	if !e.Title.Edited {
L87: 		return nil
L88: 	}
L89: 	return &amp;e.Title.Value
L90: }
L91: 
L92: func (e Editable) BodyValue() *string {
L93: 	if !e.Body.Edited {
L94: 		return nil
L95: 	}
L96: 	return &amp;e.Body.Value
L97: }
L98: func (e Editable) AssigneeIds(client *api.Client, repo ghrepo.Interface) (*[]string, error) {
L99: 	if !e.Assignees.Edited {
L100: 		return nil, nil
L101: 	}
L102: 
L103: 	// If assignees came in from command line flags, we need to
L104: 	// curate the final list of assignees from the default list.
L105: 	if len(e.Assignees.Add) != 0 || len(e.Assignees.Remove) != 0 {
L106: 		// TODO ApiActorsSupported
L107: 		replacer := NewSpecialAssigneeReplacer(client, repo.RepoHost(), e.ApiActorsSupported, true)
L108: 
L109: 		assigneeSet := set.NewStringSet()
L110: 		// This check below is required because in a non-interactive flow,
L111: 		// the user gives us a login and not the DisplayName, and when
L112: 		// we have actor assignees e.Assignees.Default will contain
L113: 		// DisplayNames and not logins (this is to accommodate special actor
L114: 		// display names in the interactive flow).
L115: 		// So, we need to add the default logins here instead of the DisplayNames.
L116: 		// Otherwise, the value the user provided won&#39;t be found in the
L117: 		// set to be added or removed, causing unexpected behavior.
L118: 		// TODO ApiActorsSupported
L119: 		if e.ApiActorsSupported {
L120: 			assigneeSet.AddValues(e.Assignees.DefaultLogins)
L121: 		} else {
L122: 			assigneeSet.AddValues(e.Assignees.Default)
L123: 		}
L124: 		add, err := replacer.ReplaceSlice(e.Assignees.Add)
L125: 		if err != nil {
L126: 			return nil, err
L127: 		}
L128: 		assigneeSet.AddValues(add)
L129: 
L130: 		remove, err := replacer.ReplaceSlice(e.Assignees.Remove)
L131: 		if err != nil {
L132: 			return nil, err
L133: 		}
L134: 		assigneeSet.RemoveValues(remove)
L135: 
L136: 		e.Assignees.Value = assigneeSet.ToSlice()
L137: 	}
L138: 	a, err := e.Metadata.MembersToIDs(e.Assignees.Value)
L139: 	return &amp;a, err
L140: }
L141: // AssigneeLogins computes the final list of assignee logins from the current
L142: // defaults plus any Add/Remove operations. Unlike AssigneeIds, this does not
L143: // resolve logins to node IDs, and is used on github.com where the
L144: // ReplaceActorsForAssignable mutation accepts logins directly.
L145: func (e Editable) AssigneeLogins(client *api.Client, repo ghrepo.Interface) ([]string, error) {
L146: 	if !e.Assignees.Edited {
L147: 		return nil, nil
L148: 	}
L149: 	if len(e.Assignees.Add) != 0 || len(e.Assignees.Remove) != 0 {
L150: 		replacer := NewSpecialAssigneeReplacer(client, repo.RepoHost(), true, true)
L151: 
L152: 		assigneeSet := set.NewStringSet()
L153: 		assigneeSet.AddValues(e.Assignees.DefaultLogins)
L154: 
L155: 		add, err := replacer.ReplaceSlice(e.Assignees.Add)
L156: 		if err != nil {
L157: 			return nil, err
L158: 		}
L159: 		assigneeSet.AddValues(add)
L160: 
L161: 		remove, err := replacer.ReplaceSlice(e.Assignees.Remove)
L162: 		if err != nil {
L163: 			return nil, err
L164: 		}
L165: 		assigneeSet.RemoveValues(remove)
L166: 		e.Assignees.Value = assigneeSet.ToSlice()
L167: 	}
L168: 
L169: 	return e.Assignees.Value, nil
L170: }
L171: 
L172: // SpecialAssigneeReplacer expands special assignee names (@me, Copilot actors)
L173: // in login slices. Use NewSpecialAssigneeReplacer to create one.
L174: type SpecialAssigneeReplacer struct {
L175: 	meReplacer      *MeReplacer
L176: 	copilotReplacer *CopilotReplacer
L177: 	actorAssignees  bool
L178: }
L179: // NewSpecialAssigneeReplacer creates a replacer that expands @me and (when
L180: // actorAssignees is true) Copilot actor names in assignee slices.
L181: // copilotUseLogin controls whether Copilot actors are replaced with their
L182: // login (true) or display name (false, used for web mode).
L183: func NewSpecialAssigneeReplacer(client *api.Client, host string, actorAssignees bool, copilotUseLogin bool) *SpecialAssigneeReplacer {
L184: 	return &amp;SpecialAssigneeReplacer{
L185: 		meReplacer:      NewMeReplacer(client, host),
L186: 		copilotReplacer: NewCopilotReplacer(copilotUseLogin),
L187: 		actorAssignees:  actorAssignees,
L188: 	}
L189: }
L190: func (r *SpecialAssigneeReplacer) ReplaceSlice(logins []string) ([]string, error) {
L191: 	replaced, err := r.meReplacer.ReplaceSlice(logins)
L192: 	if err != nil {
L193: 		return nil, err
L194: 	}
L195: 	if r.actorAssignees {
L196: 		replaced = r.copilotReplacer.ReplaceSlice(replaced)
L197: 	}
L198: 	return replaced, nil
L199: }
L200: // ProjectIds returns a slice containing IDs of projects v1 that the issue or a PR has to be linked to.
L201: func (e Editable) ProjectIds() (*[]string, error) {
L202: 	if !e.Projects.Edited {
L203: 		return nil, nil
L204: 	}
L205: 	if len(e.Projects.Add) != 0 || len(e.Projects.Remove) != 0 {
L206: 		s := set.NewStringSet()
L207: 		s.AddValues(e.Projects.Default)
L208: 		s.AddValues(e.Projects.Add)
L209: 		s.RemoveValues(e.Projects.Remove)
L210: 		e.Projects.Value = s.ToSlice()
L211: 	}
L212: 	p, _, err := e.Metadata.ProjectsTitlesToIDs(e.Projects.Value)
L213: 	return &amp;p, err
L214: }
</excerpt>
</source>
<source kind="open_page">
<title></title>
<location>https://raw.githubusercontent.com/cli/cli/trunk/pkg/cmd/pr/create/create.go</location>
<excerpt>citeturn2view2 [wordlim: 200] Crawled: today; Content type: text/plain; Source: open({&quot;ref_id&quot;:&quot;https://raw.githubusercontent.com/cli/cli/trunk/pkg/cmd/pr/create/create.go&quot;,&quot;lineno&quot;:null}); Total lines: 1299
L0: package create
L1: 
L2: import (
L3: 	&quot;context&quot;
L4: 	&quot;errors&quot;
L5: 	&quot;fmt&quot;
L6: 	&quot;io&quot;
L7: 	&quot;net/http&quot;
L8: 	&quot;net/url&quot;
L9: 	&quot;os&quot;
L10: 	&quot;regexp&quot;
L11: 	&quot;slices&quot;
L12: 	&quot;strings&quot;
L13: 	&quot;time&quot;
L14: 	&quot;github.com/MakeNowJust/heredoc&quot;
L15: 	&quot;github.com/cenkalti/backoff/v4&quot;
L16: 	&quot;github.com/cli/cli/v2/api&quot;
L17: 	ghContext &quot;github.com/cli/cli/v2/context&quot;
L18: 	&quot;github.com/cli/cli/v2/git&quot;
L19: 	&quot;github.com/cli/cli/v2/internal/attachments&quot;
L20: 	&quot;github.com/cli/cli/v2/internal/browser&quot;
L21: 	fd &quot;github.com/cli/cli/v2/internal/featuredetection&quot;
L22: 	&quot;github.com/cli/cli/v2/internal/gh&quot;
L23: 	&quot;github.com/cli/cli/v2/internal/gh/ghtelemetry&quot;
L24: 	&quot;github.com/cli/cli/v2/internal/ghrepo&quot;
L25: 	&quot;github.com/cli/cli/v2/internal/prompter&quot;
L26: 	&quot;github.com/cli/cli/v2/internal/text&quot;
L27: 	&quot;github.com/cli/cli/v2/pkg/cmd/pr/shared&quot;
L28: 	&quot;github.com/cli/cli/v2/pkg/cmdutil&quot;
L29: 	&quot;github.com/cli/cli/v2/pkg/iostreams&quot;
L30: 	&quot;github.com/cli/cli/v2/pkg/markdown&quot;
L31: 	o &quot;github.com/cli/cli/v2/pkg/option&quot;
L32: 	&quot;github.com/spf13/cobra&quot;
L33: )
L34: type CreateOptions struct {
L35: 	// This struct stores user input and factory functions
L36: 	Detector         fd.Detector
L37: 	HttpClient       func() (*http.Client, error)
L38: 	GitClient        *git.Client
L39: 	Config           func() (gh.Config, error)
L40: 	IO               *iostreams.IOStreams
L41: 	Remotes          func() (ghContext.Remotes, error)
L42: 	Branch           func() (string, error)
L43: 	Browser          browser.Browser
L44: 	Prompter         shared.Prompt
L45: 	Finder           shared.PRFinder
L46: 	TitledEditSurvey func(string, string) (string, string, error)
L47: 	TitleProvided bool
L48: 	BodyProvided  bool
L49: 
L50: 	RootDirOverride string
L51: 	RepoOverride    string
L52: 
L53: 	Autofill    bool
L54: 	FillVerbose bool
L55: 	FillFirst   bool
L56: 	EditorMode  bool
L57: 	WebMode     bool
L58: 	RecoverFile string
L59: 
L60: 	IsDraft    bool
L61: 	Title      string
L62: 	Body       string
L63: 	BaseBranch string
L64: 	HeadBranch string
L65: 
L66: 	Reviewers []string
L67: 	Assignees []string
L68: 	Labels    []string
L69: 	Projects  []string
L70: 	Milestone string
L71: 
L72: 	MaintainerCanModify bool
L73: 	Template            string
L74: 
L75: 	DryRun bool
L76: 	BodyDir     string
L77: 	AttachFlag  *attachments.Flag
L78: 	AttachEvent *attachments.TelemetryEvent
L79: 	Assets      []attachments.UserAsset
L80: }
L81: // creationRefs is an interface that provides the necessary information for creating a pull request in the API.
L82: // Upcasting to concrete implementations can provide further context on other operations (forking and pushing).
L83: type creationRefs interface {
L84: 	// QualifiedHeadRef returns a stringified form of the head ref, varying depending
L85: 	// on whether the head ref is in the same repository as the base ref. If they are
L86: 	// the same repository, we return the branch name only. If they are different repositories,
L87: 	// we return the owner and branch name in the form &lt;owner&gt;:&lt;branch&gt;.
L88: 	QualifiedHeadRef() string
L89: 	// UnqualifiedHeadRef returns a head ref in the form of the branch name only.
L90: 	UnqualifiedHeadRef() string
L91: 	//BaseRef returns the base branch name.
L92: 	BaseRef() string
L93: 	// While the only thing really required from an api.Repository is the repository ID, changing that
L94: 	// would require changing the API function signatures, and the refactor that introduced this refs
L…[truncated]</excerpt>
</source>
<omitted_sources count="54">Additional source records were omitted from this bounded result.</omitted_sources>
</source_evidence>

Citations:

- 1: https://raw.githubusercontent.com/cli/cli/trunk/pkg/cmd/pr/edit/edit.go
- 2: https://docs.github.com/en/copilot/how-tos/use-copilot-agents/request-a-code-review/use-code-review?tool=cli&utm_source=openai

Script executed:

set -o pipefail
printf '%s\n' '--- reviewer UI and normalization ---'
sed -n '1,280p' src/renderer/src/components/pull-request-page/reviewers/request-actions.ts
sed -n '1,260p' src/shared/github/pr-reviewer-display.ts
sed -n '120,190p' src/renderer/src/components/pull-request-page/page/tabs-shell.tsx
printf '%s\n' '--- reviewer mutation bridge and handler ---'
sed -n '50,105p' src/preload/api/gh-bridge-mutations-and-projects.ts
sed -n '150,190p' src/preload/api/github-pull-request-api.ts
sed -n '180,245p' src/main/ipc/github-pr-mutation-handlers.ts
printf '%s\n' '--- direct-update test complete relevant block ---'
sed -n '1,125p' src/main/github/client-pr-reviewer-direct-update.test.ts
printf '%s\n' '--- all exact Copilot login references, including tests and non-src files ---'
rg -n -i -F --hidden --glob '!node_modules' --glob '!.git' -e 'copilot-pull-request-reviewer' -e '@copilot' -e 'copilot.*reviewer' .

Repository: stablyai/orca

Length of output: 25883


Web query:

site:github.com/cli/cli "copilot-pull-request-reviewer"

Result:

<source_evidence>
<source kind="search">
<title>Using GitHub Copilot code review - GitHub Docs</title>
<location>https://docs.github.com/en/copilot/how-tos/use-copilot-agents/request-a-code-review/use-code-review?tool=cli</location>
<excerpt>citeturn0search5 [wordlim: 200] Crawled: last month; You can also request a review from Copilot through the GitHub REST API by requesting `copilot-pull-request-reviewer[bot]` as a reviewer. ... These instructions explain how to use Copilot code review with the GitHub CLI.
For more information, see Incorporating feedback in your pull request.

You can also invoke Copilot cloud agent to implement suggested changes. To do this, you must:

     * Enable GitHub Copilot code review and Copilot cloud agent.
     * On review comments from GitHub Copilot code review, click Fix with Copilot. This creates a draft comment on the pull request, where you can instruct Copilot to address specific feedback. You can then select whether Copilot will create a new pull request against your branch or a commit to the same pull request with the suggestions applied.
  6. Copilot&#39;s review comments behave like review comments from humans. You can add reactions to them, comment on them, resolve them and hide them.

Any comments you add to Copilot&#39;s review comments will be visible to humans, but they won&#39;t be visible to Copilot, and Copilot won&#39;t reply.

You can also request a review from Copilot through the GitHub REST API by requesting `copilot-pull-request-reviewer[bot]` as a reviewer. For more information, see REST API endpoints for review requests.

## Using Copilot code review

These instructions explain how to use Copilot code review with the GitHub CLI. To see instructions for other popular coding environments, click the appropriate tab at the top of the page.

### Requesting a review when creating a pull request

You can request a review from Copilot when creating a new pull request using `gh pr create`:

Shell
    
    gh pr create --reviewer @copilot
    
    
    `gh pr create --reviewer @copilot
    `

You can also select Copilot interactively from the searchable reviewer prompt during `gh pr create`.
    
    `? Reviewers  [Use arrows to move, space to select, &lt;right&gt; to all, &lt;left&gt; to none, type to filter]
      [ ]  Search (7472 more)
      [x]  monalisa (Mona Lisa)
    &gt; [x]  Copilot (AI)
    `

### Requesting a review on an existing pull request

To request a review from Copilot on an existing pull request, use `gh pr edit`. If you are not on the pull request&#39;s branch, specify the pull request number:

Shell
    
    gh pr edit PR-NUMBER --add-reviewer @copilot
    
    
    `gh pr edit PR-NUMBER --add-reviewer @copilot
    `

Replace `PR-NUMBER` with the number of the pull request you want reviewed. If you have the pull request&#39;s branch checked out, you can omit the number.</excerpt>
</source>
<source kind="search">
<title>Copilot code review · cli/cli@175188d · GitHub</title>
<location>https://github.com/cli/cli/actions/runs/19280132933</location>
<excerpt>citeturn0search6 [wordlim: 200] Published: last year; Crawled: 3 weeks ago; cli / cli Public ... # Copilot code review #22 ... ## copilot-pull-request-reviewer ... Details: Resource not accessible by integration - https://docs.github.com/rest [Button: Show more] [Button: Show less]

cli / cli Public

  * Notifications You must be signed in to change notification settings
  * Fork 9.1k
  * Star

  * Code
  * Issues 1k
  * Pull requests 74
  * Discussions
  * Actions
  * Projects
  * Security and quality 17
  * Insights

# Copilot code review #22

  * Sign in to view logs

## Summary

# Copilot code review

## 

Copilot code review #22

### Uh oh!

There was an error while loading. Please reload this page.

Triggered via dynamic November 11, 2025 22:22

Copilot

⁠ 175188d

refs/pull/12140/head

Status Success

Total duration 5m 3s

## copilot-pull-request-reviewer

on: dynamic

Prepare 5s Prepare

Autovalidate 0s Autovalidate

Matrix: CodeQL analysis

1 job completed

Show all jobs

Agent 2m 3s Agent

Upload results 7s Upload results

Cleanup artifacts 6s Cleanup artifacts

## Annotations

1 warning

CodeQL analysis (go) This run of the CodeQL Action does not have permission to access the CodeQL Action API endpoints. This could be because the Action is running on a pull request from a fork. If not, please ensure the workflow has at least the &#39;security-events: read&#39; permission. Details: Resource not accessible by integration - https://docs.github.com/rest [Button: Show more] [Button: Show less]

You can’t perform that action at this time.</excerpt>
</source>
<source kind="search">
<title>Copilot code review · cli/cli@f648460 · GitHub</title>
<location>https://github.com/cli/cli/actions/runs/26292737192</location>
<excerpt>citeturn0search0 [wordlim: 200] Published: 5 months ago; Crawled: 3 weeks ago; cli / cli Public ... # Copilot code review #249 ... ## copilot-pull-request-reviewer

cli / cli Public

  * Notifications You must be signed in to change notification settings
  * Fork 9.1k
  * Star

  * Code
  * Issues 1k
  * Pull requests 74
  * Discussions
  * Actions
  * Projects
  * Security and quality 17
  * Insights

# Copilot code review #249

  * Sign in to view logs

## Summary

# Copilot code review

## 

Copilot code review #249

### Uh oh!

There was an error while loading. Please reload this page.

Triggered via dynamic May 22, 2026 14:10

Copilot

⁠ f648460

refs/pull/13491/head

Status Success

Total duration 1m 58s

## copilot-pull-request-reviewer

on: dynamic

Prepare 6s Prepare

Agent 1m 21s Agent

Upload results 7s Upload results

Cleanup artifacts 3s Cleanup artifacts</excerpt>
</source>
<source kind="search">
<title>Copilot code review · cli/cli@ded47e2 · GitHub</title>
<location>https://github.com/cli/cli/actions/runs/26237670340</location>
<excerpt>citeturn0search1 [wordlim: 200] Published: 5 months ago; Crawled: 3 weeks ago; cli / cli Public ... # Copilot code review #244 ... ## copilot-pull-request-reviewer

cli / cli Public

  * Notifications You must be signed in to change notification settings
  * Fork 9.1k
  * Star

  * Code
  * Issues 1k
  * Pull requests 74
  * Discussions
  * Actions
  * Projects
  * Security and quality 17
  * Insights

# Copilot code review #244

  * Sign in to view logs

## Summary

# Copilot code review

## 

Copilot code review #244

### Uh oh!

There was an error while loading. Please reload this page.

Triggered via dynamic May 21, 2026 16:02

Copilot

⁠ ded47e2

refs/pull/13481/head

Status Success

Total duration 2m 25s

## copilot-pull-request-reviewer

on: dynamic

Prepare 5s Prepare

Agent 1m 42s Agent

Upload results 12s Upload results

Cleanup artifacts 4s Cleanup artifacts</excerpt>
</source>
<source kind="search">
<title>Using GitHub Copilot code review - GitHub Docs</title>
<location>https://docs.github.com/en/copilot/how-tos/use-copilot-agents/use-code-review</location>
<excerpt>citeturn0search2 [wordlim: 200] Crawled: today; Learn how to request a code review from GitHub Copilot. ... You can also request a review from Copilot through the GitHub REST API by requesting `copilot-pull-request-reviewer[bot]` as a reviewer.
For more information, see Incorporating feedback in your pull request.

You can also invoke Copilot cloud agent to implement suggested changes. To do this, you must:

     * Enable GitHub Copilot code review and Copilot cloud agent.
     * On review comments from GitHub Copilot code review, click Fix with Copilot. This creates a draft comment on the pull request, where you can instruct Copilot to address specific feedback. You can then select whether Copilot will create a new pull request against your branch or a commit to the same pull request with the suggestions applied.
  6. Copilot&#39;s review comments behave like review comments from humans. You can add reactions to them, comment on them, resolve them and hide them.

Any comments you add to Copilot&#39;s review comments will be visible to humans, but they won&#39;t be visible to Copilot, and Copilot won&#39;t reply.

You can also request a review from Copilot through the GitHub REST API by requesting `copilot-pull-request-reviewer[bot]` as a reviewer. For more information, see REST API endpoints for review requests.
</excerpt>
</source>
<omitted_sources count="8">Additional source records were omitted from this bounded result.</omitted_sources>
</source_evidence>

Citations:

- 1: https://github.com/cli/cli/actions/runs/19280132933?utm_source=openai
- 2: https://docs.github.com/en/copilot/how-tos/use-copilot-agents/request-a-code-review/use-code-review?tool=cli&utm_source=openai

Web query:

GitHub CLI source NewCopilotReplacer ReplaceSlice copilot reviewer login gh pr edit

Result:

<source_evidence>
<source kind="search">
<title>GitHub CLI: pkg/cmd/pr/shared/params.go | Fossies</title>
<location>https://fossies.org/linux/gh-cli/pkg/cmd/pr/shared/params.go</location>
<excerpt>citeturn0search0 [wordlim: 200] Published: last month; Crawled: last month;       338 // NewCopilotReplacer creates a replacer for assignee @copilot references.
      339 func NewCopilotReplacer(returnLogin bool) *CopilotReplacer {
      265     }
      266     return query.AdvancedIssueSearchString()
      267 }
      268 
      269 func QueryHasStateClause(searchQuery string) bool {
      270     argv, err := shlex.Split(searchQuery)
      271     if err != nil {
      272         return false
      273     }
      274 
      275     for _, arg := range argv {
      276         if arg == &quot;is:closed&quot; || arg == &quot;is:merged&quot; || arg == &quot;state:closed&quot; || arg == &quot;state:merged&quot; || strings.HasPrefix(arg, &quot;merged:&quot;) || strings.HasPrefix(arg, &quot;closed:&quot;) {
      277             return true
      278         }
      279     }
      280 
      281     return false
      282 }
      283 
      284 // MeReplacer resolves usages of `@me` to the handle of the currently logged in user.
      285 type MeReplacer struct {
      286     apiClient *api.Client
      287     hostname  string
      288     login     string
      289 }
      290 
      291 func NewMeReplacer(apiClient *api.Client, hostname string) *MeReplacer {
      292     return &amp;MeReplacer{
      293         apiClient: apiClient,
      294         hostname:  hostname,
      295     }
      296 }
      297 
      298 func (r *MeReplacer) currentLogin() (string, error) {
      299     if r.login != &quot;&quot; {
      300         return r.login, nil
      301     }
      302     login, err := api.CurrentLoginName(r.apiClient, r.hostname)
      303     if err != nil {
      304         return &quot;&quot;, fmt.Errorf(&quot;failed resolving `@me` to your user handle: %w&quot;, err)
      305     }
      306     r.login = login
      307     return login, nil
      308 }
      309 
      310 func (r *MeReplacer) Replace(handle string) (string, error) {
      311     if handle == &quot;@me&quot; {
      312         return r.currentLogin()
      313     }
      314     return handle, nil
      315 }
      316 
      317 func (r *MeReplacer) ReplaceSlice(handles []string) ([]string, error) {
      318     res := make([]string, len(handles))
      319     for i, h := range handles {
      320         var err error
      321         res[i], err = r.Replace(h)
      322         if err != nil {
      323             return nil, err
      324         }
      325     }
      326     return res, nil
      327 }
      328 
      329 // CopilotReplacer resolves usages of `@copilot` to either Copilot&#39;s login or name.
      330 // Login is generally needed for API calls; name is used when launching web browser.
      331 type CopilotReplacer struct {
      332     returnLogin bool
      333     // copilotLogin is the login to use when replacing @copilot.
      334     // Different Copilot features use different bot logins.
      335     copilotLogin string
      336 }
      337 
      338 // NewCopilotReplacer creates a replacer for assignee @copilot references.
      339 func NewCopilotReplacer(returnLogin bool) *CopilotReplacer {
      340     return &amp;CopilotReplacer{
      341         returnLogin:  returnLogin,
      342         copilotLogin: api.CopilotAssigneeLogin,
      343     }
      344 }
      345 
      346 // NewCopilotReviewerReplacer creates a replacer for reviewer @copilot references.
      347 func NewCopilotReviewerReplacer() *CopilotReplacer {
      348     return &amp;CopilotReplacer{
      349         returnLogin:  true,
      350         copilotLogin: api.CopilotReviewerLogin,
      351     }
      352 }
      353 
      354 func (r *CopilotReplacer) replace(handle string) string {
      355     if !strings.EqualFold(handle, &quot;@copilot&quot;) {
      356         return handle
      357     }
      358     if r.returnLogin {
      359         return r.copilotLogin
      360     }
      361     return api.CopilotActorName
      362 }
      363 
      364 // ReplaceSlice replaces usages of `@copilot` in a slice with Copilot&#39;s login.
      365 func (r *CopilotReplacer) ReplaceSlice(handles []string) []string {
</excerpt>
</source>
<source kind="search">
<title>cli/pkg/cmd/pr/create/create.go at trunk · cli/cli · GitHub</title>
<location>https://github.com/cli/cli/blob/trunk/pkg/cmd/pr/create/create.go</location>
<excerpt>citeturn1search0 [wordlim: 200] Crawled: 5 days ago; &quot;github.com/cli/cli/v2/pkg/cmd/pr/shared&quot;

&quot;github.com/cli/cli/v2/pkg/cmdutil&quot; ... TitledEditSurvey: shared.TitledEditSurvey(&amp;shared.UserEditor{Config: f.Config, IO: f.IOStreams}), ... _ = cmd.RegisterFlagCompletionFunc(&quot;reviewer&quot;, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { ... x := regexPattern.ReplaceAllString(commit.Body, &quot; &quot;)
fl.BoolVarP(&amp;opts.WebMode, &quot;web&quot;, &quot;w&quot;, false, &quot;Open the web browser to create a pull request&quot;)

fl.BoolVarP(&amp;opts.FillVerbose, &quot;fill-verbose&quot;, &quot;&quot;, false, &quot;Use commits msg+body for description&quot;)

fl.BoolVarP(&amp;opts.Autofill, &quot;fill&quot;, &quot;f&quot;, false, &quot;Use commit info for title and body&quot;)

fl.BoolVar(&amp;opts.FillFirst, &quot;fill-first&quot;, false, &quot;Use first commit info for title and body&quot;)

fl.StringSliceVarP(&amp;opts.Reviewers, &quot;reviewer&quot;, &quot;r&quot;, nil, &quot;Request reviews from people or teams by their `handle`&quot;)

fl.StringSliceVarP(&amp;opts.Assignees, &quot;assignee&quot;, &quot;a&quot;, nil, &quot;Assign people by their `login`. Use \&quot;@me\&quot; to self-assign.&quot;)

fl.StringSliceVarP(&amp;opts.Labels, &quot;label&quot;, &quot;l&quot;, nil, &quot;Add labels by `name`&quot;)

fl.StringSliceVarP(&amp;opts.Projects, &quot;project&quot;, &quot;p&quot;, nil, &quot;Add the pull request to projects by `title`&quot;)

fl.StringVarP(&amp;opts.Milestone, &quot;milestone&quot;, &quot;m&quot;, &quot;&quot;, &quot;Add the pull request to a milestone by `name`&quot;)

fl.Bool(&quot;no-maintainer-edit&quot;, false, &quot;Disable maintainer&#39;s ability to modify pull request&quot;)

fl.StringVar(&amp;opts.RecoverFile, &quot;recover&quot;, &quot;&quot;, &quot;Recover input from a failed run of create&quot;)

fl.StringVarP(&amp;opts.Template, &quot;template&quot;, &quot;T&quot;, &quot;&quot;, &quot;Template `file` to use as starting body text&quot;)

fl.BoolVar(&amp;opts.DryRun, &quot;dry-run&quot;, false, &quot;Print details instead of creating the PR. May still push git changes.&quot;)

opts.AttachFlag = attachments.AddFlag(cmd)

_ = cmdutil.RegisterBranchCompletionFlags(f.GitClient, cmd, &quot;base&quot;, &quot;head&quot;)

_ = cmd.RegisterFlagCompletionFunc(&quot;reviewer&quot;, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {

results, err := requestableReviewersForCompletion(opts)

if err != nil {

return nil, cobra.ShellCompDirectiveError

}

return results, cobra.ShellCompDirectiveNoFileComp

})

return cmd

}

func createRun(opts *CreateOptions) error {

ctx, err := NewCreateContext(opts)

if err != nil {

return err

}

if isSameRef(ctx.PRRefs) {

return fmt.Errorf(&quot;head branch %q is the same as base branch %q, cannot create a pull request&quot;, ctx.PRRefs.UnqualifiedHeadRef(), ctx.PRRefs.BaseRef())

m)^`)

func initDefaultTitleBody(ctx CreateContext, state *shared.IssueMetadataState, useFirstCommit bool, addBody bool) error {

commits, err := ctx.GitClient.Commits(context.Background(), ctx.BaseTrackingBranch, ctx.PRRefs.UnqualifiedHeadRef())

if err != nil {

return err

}

if len(commits) == 1 || useFirstCommit {

state.Title = commits[len(commits)-1].Title

state.Body = commits[len(commits)-1].Body

} else {

state.Title = humanize(ctx.PRRefs.UnqualifiedHeadRef())

var body strings.Builder

for i, commit := range slices.Backward(commits) {

fmt.Fprintf(&amp;body, &quot;- **%s**\n&quot;, commit.Title)

if addBody {

x := regexPattern.ReplaceAllString(commit.Body, &quot; &quot;)

fmt.Fprintf(&amp;body, &quot;%s&quot;, x)

if i &gt; 0 {

fmt.Fprintln(&amp;body)

fmt.Fprintln(&amp;body)

}

}

}

state.Body = body.String()

}

return nil

}

func NewIssueState(ctx CreateContext, opts CreateOptions, apiActorsSupported bool) (*shared.IssueMetadataState, error) {

var milestoneTitles []string

if opts.Milestone != &quot;&quot; {

milestoneTitles = []string{opts.Milestone}

}

assigneeReplacer := shared.NewSpecialAssigneeReplacer(ctx.Client, ctx.PRRefs.BaseRepo().RepoHost(), apiActorsSupported, !opts.WebMode)

assignees, err := assigneeReplacer.ReplaceSlice(opts.Assignees)

if err != nil {

return nil, err

}

copilotReplacer := shared.NewCopilotReviewerReplacer()

reviewers := copilotReplacer.ReplaceSlice(opts.Reviewers)

state := &amp;shared.IssueMetadataState{

Type: shared.PRMetadata,

Reviewers: reviewers,

Assignees: assignees,

Labels: opts.Labels,

ProjectTitles: opts.Projects,

Milestones: milestoneTitles,

Draft: opts.IsDraft,

}

if opts.FillVerbose || opts.Autofill || opts.FillFirst || !opts.TitleProvided || !opts.BodyProvided {

err := initDefaultTitleBody(ctx, state, opts.FillFirst, opts.FillVerbose)

if err != nil &amp;&amp; (opts.FillVerbose || opts.Autofill || opts.FillFirst) {

return nil, fmt.Errorf(&quot;could not compute title or body defaults: %w&quot;, err)

}

}

return state, nil

}
</excerpt>
</source>
<source kind="search">
<title>GitHub CLI | Take GitHub to the command line</title>
<location>https://cli.github.com/manual/gh_pr_edit</location>
<excerpt>citeturn1search3 [wordlim: 200] Crawled: yesterday;   * `@copilot`: request or remove review from Copilot (not supported on GitHub Enterprise Server) ...     $ gh pr edit 23 --add-reviewer &quot;@copilot&quot;

## gh pr edit
    
    `gh pr edit [&lt;number&gt; | &lt;url&gt; | &lt;branch&gt;] [flags]
    `

Edit a pull request.

Without an argument, the pull request that belongs to the current branch is selected.

Editing a pull request&#39;s projects requires authorization with the `project` scope. To authorize, run `gh auth refresh -s project`.

Use `--attach` to upload an image or video. Without a body flag the pull request keeps the body it already has and the attachment is appended to it. If the body references an attached file, such as `![alt](./login.png)`, that reference is rewritten to point at the uploaded asset instead. Paths in a `--body-file` are relative to its directory, falling back to the working directory. You can attach up to 50 files per command.

Alt text for an image follows the path after `#`, as in `--attach &#39;./login.png#The login error state&#39;`. Without it the filename is used. A reference already in the body keeps the alt text written there. Video renders as a player and has no alt text, so it cannot be given any.

If some attachments upload and others fail, the pull request is still updated with the ones that succeeded. The command then exits with a non-zero status, but the pull request&#39;s URL is still printed to stdout.

The `--add-assignee` and `--remove-assignee` flags both support the following special values:

  * `@me`: assign or unassign yourself
  * `@copilot`: assign or unassign Copilot (not supported on GitHub Enterprise Server)

The `--add-reviewer` and `--remove-reviewer` flags support the following special value:

  * `@copilot`: request or remove review from Copilot (not supported on GitHub Enterprise Server)

### Options

`--add-assignee &lt;login&gt;`
    Add assigned users by their login. Use &quot;@me&quot; to assign yourself, or &quot;@copilot&quot; to assign Copilot.
`--add-label &lt;name&gt;`
    Add labels by name
`--add-project &lt;title&gt;`
    Add the pull request to projects by title
`--add-reviewer &lt;login&gt;`
    Add or re-request reviewers by their login. Use &quot;@copilot&quot; to request review from Copilot.
`--attach &lt;file&gt;`
    Attach an image or video file, in &#39;&lt;file&gt;#&lt;image alt text&gt;&#39; format
`-B`, `--base &lt;branch&gt;`
    Change the base branch for this pull request
`-b`, `--body &lt;string&gt;`
    Set the new body.
`-F`, `--body-file &lt;file&gt;`
    Read body text from file (use &quot;-&quot; to read from standard input)
`-m`, `--milestone &lt;name&gt;`
    Edit the milestone the pull request belongs to by name
`--remove-assignee &lt;login&gt;`
    Remove assigned users by their login. Use &quot;@me&quot; to unassign yourself, or &quot;@copilot&quot; to unassign Copilot.
`--remove-label &lt;name&gt;`
    Remove labels by name
`--remove-milestone`
    Remove the milestone association from the pull request
`--remove-project &lt;title&gt;`
    Remove the pull request from projects by title
`--remove-reviewer &lt;login&gt;`
    Remove reviewers by their login. Use &quot;@copilot&quot; to remove review request from Copilot.
`-t`, `--title &lt;string&gt;`
    Set the new title.

### Options inherited from parent commands

`-R`, `--repo &lt;[HOST/]OWNER/REPO&gt;`
    Select another repository using the [HOST/]OWNER/REPO format

### Examples
    
    `# Edit the title and body of a pull request
    $ gh pr edit 23 --title &quot;I found a bug&quot; --body &quot;Nothing works&quot;
    
    # Use a file as the body
    $ gh pr edit 23 --body-file body.txt
    
    # Append a screenshot to the body, with alt text after &quot;#&quot;
    $ gh pr edit 23 --attach &#39;./login.png#The login error state&#39;
    
    # Append multiple files by repeating the flag
    $ gh pr edit 23 --attach ./before.png --attach ./after.png
    
    # Manage labels
    $ gh pr edit 23 --add-label &quot;bug,help wanted&quot; --remove-label &quot;core&quot;
    
    # Manage reviewers
    $ gh pr edit 23 --add-reviewer monalisa,hubot --remove-reviewer myorg/team-name
    
    # Re-request review
    $ gh pr edit 23 --add-reviewer monalisa
    
    # Request a review from GitHub Copilot
    $ gh pr edit 23 --add-reviewer &quot;@copilot&quot;
    
    # Manage assignees
    $ gh pr edit 23 --add-assignee &quot;@me&quot; --remove-assignee monalisa,hubot
    
    # Assign GitHub Copilot
    $ gh pr edit 23 --add-assignee &quot;@copilot&quot;
    
    # Manage projects and milestones
    $ gh pr edit 23 --add-project &quot;Roadmap&quot; --remove-project v1,v2
    $ gh pr edit 23 --milestone &quot;Version 1&quot;
    $ gh pr edit 23 --remove-milestone`

### See also

  * gh pr</excerpt>
</source>
<source kind="search">
<title>shared package - github.com/cli/cli/v2/pkg/cmd/pr/shared - Go Packages</title>
<location>https://pkg.go.dev/github.com/cli/cli/v2%40v2.101.0/pkg/cmd/pr/shared</location>
<excerpt>citeturn0search1 [wordlim: 200] Published: last month; Crawled: last month;   *     * func NewCopilotReplacer(returnLogin bool) *CopilotReplacer
    * func ConfirmPRSubmission(p Prompt, allowPreview, allowMetadata, isDraft bool) (Action, error)
  * type CachedBranchConfigGitConfigClient
  *     * func (c CachedBranchConfigGitConfigClient) ReadBranchConfig(ctx context.Context, branchName string) (git.BranchConfig, error)
  * type Comment
  * type Commentable
  * type CommentableOptions
  * type CopilotReplacer
  *     * func NewCopilotReplacer(returnLogin bool) *CopilotReplacer
    * func NewCopilotReviewerReplacer() *CopilotReplacer
  *     * func (r *CopilotReplacer) ReplaceSlice(handles []string) []string
  * type DefaultPRHead
  *     * func TryDetermineDefaultPRHead(gitClient GitConfigClient, remoteToRepo remoteToRepoResolver, branch string) (DefaultPRHead, error)
  * type EditPrompter
  * type Editable
  *     * func (e Editable) AssigneeIds(client *api.Client, repo ghrepo.Interface) (*[]string, error)
#### type CopilotReplacer ¶ added in v2.73.0
    
    type CopilotReplacer struct {
    	// contains filtered or unexported fields
    }

CopilotReplacer resolves usages of `@copilot` to either Copilot&#39;s login or name. Login is generally needed for API calls; name is used when launching web browser.

#### func NewCopilotReplacer ¶ added in v2.73.0
    
    func NewCopilotReplacer(returnLogin bool) *CopilotReplacer

NewCopilotReplacer creates a replacer for assignee @copilot references.

#### func NewCopilotReviewerReplacer ¶ added in v2.87.0
    
    func NewCopilotReviewerReplacer() *CopilotReplacer

NewCopilotReviewerReplacer creates a replacer for reviewer @copilot references.

#### func (*CopilotReplacer) ReplaceSlice ¶ added in v2.73.0
    
    func (r *CopilotReplacer) ReplaceSlice(handles []string) []string

ReplaceSlice replaces usages of `@copilot` in a slice with Copilot&#39;s login.

#### type DefaultPRHead ¶ added in v2.71.0
    
    type DefaultPRHead struct {
    	Repo       o.Option[ghrepo.Interface]
    	BranchName string
    }

DefaultPRHead is a neighbour to defaultPushTarget, but instead of holding basic git remote information, it holds a resolved repository in `gh` terms.

Since we may not be able to determine a default remote for a branch, this is also true of the resolved repository.

#### func TryDetermineDefaultPRHead ¶ added in v2.71.0
    
    func TryDetermineDefaultPRHead(gitClient GitConfigClient, remoteToRepo remoteToRepoResolver, branch string) (DefaultPRHead, error)

TryDetermineDefaultPRHead is a thin wrapper around determineDefaultPushTarget, which attempts to convert a present remote into a resolved repository. </excerpt>
</source>
<source kind="search">
<title>shared package - github.com/cli/cli/v2/pkg/cmd/pr/shared - Go Packages</title>
<location>https://pkg.go.dev/github.com/cli/cli/v2%40v2.102.0/pkg/cmd/pr/shared</location>
<excerpt>citeturn0search2 [wordlim: 200] Published: 4 weeks ago; Crawled: 2 weeks ago; github.com/cli/cli ...         * NewCopilotReplacer(returnLogin)

When a project reaches major version v1 it is considered stable.

  * Learn more about best practices

## Repository

github.com/cli/cli

## Links

  * Open Source Insights

  * Documentation
    * Index
    * Constants
    * Variables
    * Functions
      * AddMetadataToIssueParams(client, baseRepo, params, tb, projectV1Support)
    * Types
      * type Action
        * ConfirmIssueSubmission(p, allowPreview, allowMetadata)
        * ConfirmPRSubmission(p, allowPreview, allowMetadata, isDraft)
      * type CachedBranchConfigGitConfigClient
        * (c) ReadBranchConfig(ctx, branchName)
      * type Comment
      * type Commentable
      * type CommentableOptions
      * type CopilotReplacer
        * NewCopilotReplacer(returnLogin)
        * NewCopilotReviewerReplacer()
        * (tb) HasMetadata()
        * (tb) IsDirty()
        * (tb) MarkDirty()
      * type ListOptions
      * type MeReplacer
        * NewMeReplacer(apiClient, hostname)
        * (r) Replace(handle)
        * (r) ReplaceSlice(handles)
      * type MetadataFetcher
        * (mf) RepoMetadataFetch(input)
      * type NotFoundError
        * (err) Unwrap()
      * type PRFindRefs
        * (r) BaseRepo()
        * (r) Matches(baseBranchName, qualifiedHeadRef)
        * (r) QualifiedHeadRef()
        * (r) UnqualifiedHeadRef()
      * type PRFinder
        * NewFinder(factory)
      * type PRLister
        * NewLister(httpClient)
      * type Prompt
      * type PullRequestFindRefsResolver
        * NewPullRequestFindRefsResolver(gitConfigClient, remotesFn)
        * (r) ResolvePullRequestRefs(baseRepo, baseBranchName, localBranchName)
      * type QualifiedHeadRef
        * NewQualifiedHeadRef(owner, branchName)
        * NewQualifiedHeadRefWithoutOwner(branchName)
        * ParseQualifiedHeadRef(ref)
        * (r) BranchName()
        * (r) String()
      * type RemoteNameToRepoFn
      * type RepoMetadataFetcher
      * type SpecialAssigneeReplacer
        * NewSpecialAssigneeReplacer(client, host, actorAssignees, copilotUseLogin)
        * (r) ReplaceSlice(logins)
      * type Template
      * type UserEditor
        * (e) Edit(filename, initialValue)
      * type WorktreeTarget
        * ResolveWorktreeTarget(client, path)

  * type PRLister
  *     * func NewLister(httpClient *http.Client) PRLister
  * type Prompt
  * type PullRequestFindRefsResolver
  *     * func NewPullRequestFindRefsResolver(gitConfigClient GitConfigClient, remotesFn func() (ghContext.Remotes, error)) PullRequestFindRefsResolver
  *     * func (r *PullRequestFindRefsResolver) ResolvePullRequestRefs(baseRepo ghrepo.Interface, baseBranchName, localBranchName string) (PRFindRefs, error)
  * type QualifiedHeadRef
  *     * func NewQualifiedHeadRef(owner string, branchName string) QualifiedHeadRef
    * func NewQualifiedHeadRefWithoutOwner(branchName string) QualifiedHeadRef
    * func ParseQualifiedHeadRef(ref string) (QualifiedHeadRef, error)
  *     * func (r QualifiedHeadRef) BranchName() string
    * func (r QualifiedHeadRef) String() string
  * type RemoteNameToRepoFn
  * type RepoMetadataFetcher
  * type SpecialAssigneeReplacer
  *     * func NewSpecialAssigneeReplacer(client *api.Client, host string, actorAssignees bool, copilotUseLogin bool) *SpecialAssigneeReplacer
  *     * func (r *SpecialAssigneeReplacer) ReplaceSlice(logins []string) ([]string, error)
  * type Template
  * type UserEditor
  *     * func (e *UserEditor) Edit(filename, initialValue string) (string, error)
  * type WorktreeTarget
  *     * func ResolveWorktreeTarget(client *git.Client, path string) (WorktreeTarget, error)

#### type RemoteNameToRepoFn ¶ added in v2.71.0
    
    type RemoteNameToRepoFn func(remoteName string) (ghrepo.Interface, error)

#### type RepoMetadataFetcher ¶
    
    type RepoMetadataFetcher interface {
    	RepoMetadataFetch(api.RepoMetadataInput) (*api.RepoMetadataResult, error)
    }

#### type SpecialAssigneeReplacer ¶ added in v2.89.0
    
    type SpecialAssigneeReplacer struct {
    	// contains filtered or unexported fields
    }

SpecialAssigneeReplacer expands special assignee names (@me, Copilot actors) in login slices. Use NewSpecialAssigneeReplacer to create one.

#### func NewSpecialAssigneeReplacer ¶ added in v2.89.0
    
    func NewSpecialAssigneeReplacer(client *api.Client, host string, actorAssignees bool, copilotUseLogin bool) *SpecialAssigneeReplacer

NewSpecialAssigneeReplacer creates a replacer that expands @me and (when actorAssignees is true) Copilot actor names in assignee slices. copilotUseLogin controls whether Copilot actors are replaced with their login (true) or display name (false, used for web mode).

#### func (*SpecialAssigneeReplacer) ReplaceSlice ¶ added in v2.89.0
    
    func (r *SpecialAssigneeReplacer) ReplaceSlice(logins []string) ([]string, error)

#### type Template ¶
    
    type Template interface {
    	Name() string
    	NameForSubmit() string
    	Body() []byte
    	Title() string
    }

#### type UserEditor ¶ added in v2.53.0
    
    type UserEditor struct {
    	IO     *iostreams.IOStreams
    	Config func() (gh.Config, error)
    }

#### func (*UserEditor) Edit ¶ added in v2.53.0
    
    func (e *UserEditor) Edit(filename, initialValue string) (string, error)

#### type WorktreeTarget ¶ added in v2.99.0
    
    type WorktreeTarget struct {
    	Path  string
    	Reuse bool
    }

WorktreeTarget describes whether a path is a new worktree location or the root of an existing linked worktree that can be reused.

#### func ResolveWorktreeTarget ¶ added in v2.99.0
    
    func ResolveWorktreeTarget(client *git.Client, path string) (WorktreeTarget, error)

ResolveWorktreeTarget validates path and determines whether it is the root of an existing linked worktree for the current repository.

</excerpt>
</source>
<omitted_sources count="22">Additional source records were omitted from this bounded result.</omitted_sources>
</source_evidence>

Citations:

- 1: https://cli.github.com/manual/gh_pr_edit?utm_source=openai
- 2: https://fossies.org/linux/gh-cli/pkg/cmd/pr/shared/params.go?utm_source=openai
- 3: https://github.com/cli/cli/blob/trunk/pkg/cmd/pr/create/create.go?utm_source=openai

Normalize the unsuffixed Copilot login before routing.

A user-entered copilot-pull-request-reviewer reaches the direct REST path and is sent without [bot], while gh pr edit only recognizes @copilot. Excluding the login from the direct path is not sufficient unless the CLI fallback receives @copilot.

Suggested fix
--- "a/src/main/github/client/update/pr-reviewers.ts"
+++ "b/src/main/github/client/update/pr-reviewers.ts"
@@ -2,31 +2,40 @@
 import { ghExecFileAsync, acquire, release, type LocalGitExecOptions } from '../../gh-utils'
 import { resolveGitHubRepoExecution, type GitHubApiRepository } from '../../github-api-repository'
 
 function reviewerUpdateArgs(
   repository: GitHubApiRepository,
   prNumber: number,
   logins: string[],
   operation: 'add' | 'remove'
 ): string[] {
-  if (logins.every((login) => /^[a-z\d](?:[a-z\d-]{0,37}[a-z\d])?$/i.test(login))) {
+  const hasUnsuffixedCopilot = logins.some(
+    (login) => login.toLowerCase() === 'copilot-pull-request-reviewer'
+  )
+  const cliLogins = logins.map((login) =>
+    login.toLowerCase() === 'copilot-pull-request-reviewer' ? '@copilot' : login
+  )
+  if (
+    !hasUnsuffixedCopilot &&
+    logins.every((login) => /^[a-z\d](?:[a-z\d-]{0,37}[a-z\d])?$/i.test(login))
+  ) {
     return [
       'api',
       '-X',
       operation === 'add' ? 'POST' : 'DELETE',
       `repos/${repository.owner}/${repository.repo}/pulls/${prNumber}/requested_reviewers`,
       ...logins.flatMap((login) => ['--raw-field', `reviewers[]=${login}`])
     ]
   }
   return [
     'pr',
     'edit',
     String(prNumber),
     operation === 'add' ? '--add-reviewer' : '--remove-reviewer',
-    logins.join(','),
+    cliLogins.join(','),
     '--repo',
     `${repository.owner}/${repository.repo}`
   ]
 }
 
 export async function requestPRReviewers(
   repoPath: string,

Add coverage for unsuffixed Copilot input with both a human reviewer and each mutation direction.

@OrcaWin
OrcaWin merged commit 50e0b8d into main Oct 29, 2026
40 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.

1 participant