ronantakizawa/codereview-bench huggingface dataset:
Repository: cli/cli
File: pkg/cmd/agent-task/create/create.go (Go)

Code before:

	opts.CapiClient = func() (capi.CapiClient, error) {
		cfg, err := f.Config()
		if err != nil {
			return nil, err
		}
		httpClient, err := f.HttpClient()
		if err != nil {
			return nil, err
		}
		authCfg := cfg.Authentication()
		return capi.NewCAPIClient(httpClient, authCfg), nil
	}

	return cmd
}

func createRun(opts *CreateOptions) error {
	if opts.ProblemStatement == "" {
		return cmdutil.FlagErrorf("a problem statement is required")
	}
	if opts.BaseRepo == nil {
		return errors.New("failed to resolve repository")
	}
	repo, err := opts.BaseRepo()
	if err != nil || repo == nil || repo.RepoOwner() == "" || repo.RepoName() == "" {
		// Not printing the error that came back from BaseRepo() here because we want
		// something clear, human friendly, and actionable.
		return fmt.Errorf("error: a repository is required; re-run in a repository or supply one with --repo owner/name")
	}

	client, err := opts.CapiClient()
	if err != nil {
		return err
	}

	ctx := context.Background()
	opts.IO.StartProgressIndicatorWithLabel(fmt.Sprintf("Creating agent task in %s/%s...", repo.RepoOwner(), repo.RepoName()))
	defer opts.IO.StopProgressIndicator()

	job, err := client.CreateJob(ctx, repo.RepoOwner(), repo.RepoName(), opts.ProblemStatement)
	if err != nil {
		return err
	}

	// Print this agent session URL and exit if we happen to get it.
	// Right now, this never happens.
	if job.PullRequest != nil && job.PullRequest.Number > 0 {
		fmt.Fprintf(opts.IO.Out, "%s\n", agentSessionWebURL(repo, job))
		return nil
	}

Review comment (suggestion):
I think it's a bit extra:


```suggestion
	if err != nil || repo == nil {
```

Code after:
		},
	}
	if f != nil {
		cmdutil.EnableRepoOverride(cmd, f)
	}

	opts.CapiClient = func() (capi.CapiClient, error) {
		cfg, err := f.Config()
		if err != nil {
			return nil, err
		}
		httpClient, err := f.HttpClient()
		if err != nil {
			return nil, err
		}
		authCfg := cfg.Authentication()
		return capi.NewCAPIClient(httpClient, authCfg), nil
	}

	return cmd
}

func createRun(opts *CreateOptions) error {
	if opts.ProblemStatement == "" {
		return cmdutil.FlagErrorf("a task description is required")
	}
	if opts.BaseRepo == nil {
		return errors.New("failed to resolve repository")
	}
	repo, err := opts.BaseRepo()
	if err != nil || repo == nil {
		// Not printing the error that came back from BaseRepo() here because we want
		// something clear, human friendly, and actionable.
		return fmt.Errorf("a repository is required; re-run in a repository or supply one with --repo owner/name")
	}

	client, err := opts.CapiClient()
	if err != nil {
		return err
	}

	ctx := context.Background()
	opts.IO.StartProgressIndicatorWithLabel(fmt.Sprintf("Creating agent task in %s/%s...", repo.RepoOwner(), repo.RepoName()))
	defer opts.IO.StopProgressIndicator()

	job, err := client.CreateJob(ctx, repo.RepoOwner(), repo.RepoName(), opts.ProblemStatement)
	if err != nil {
		return err
	}

	// Print this agent session URL and exit if we happen to get it.
Repository: cli/cli
File: pkg/cmd/agent-task/create/create.go (Go)

Code before:
}

// fetchJobWithBackoff polls the job resource until a PR number is present or the overall
// timeout elapses. It returns the updated Job on success, (nil, nil) on timeout,
// and (nil, error) only for non-retryable failures.
func fetchJobWithBackoff(ctx context.Context, client capi.CapiClient, repo ghrepo.Interface, jobID string, errOut io.Writer, bo backoff.BackOff) (*capi.Job, error) {
	// sentinel error to signal retry without surfacing to caller
	var errPRNotReady = errors.New("job not ready")

	var result *capi.Job
	retryErr := backoff.Retry(func() error {
		j, getErr := client.GetJob(ctx, repo.RepoOwner(), repo.RepoName(), jobID)
		if getErr != nil {
			fmt.Fprintf(errOut, "warning: failed to get job status: %v\n", getErr)
			return errPRNotReady
		}
		if j.PullRequest != nil && j.PullRequest.Number > 0 {
			result = j
			return nil
		}
		return errPRNotReady
	}, backoff.WithContext(bo, ctx))

	if retryErr != nil {
		if errors.Is(retryErr, errPRNotReady) {
			// Timed out or failed to fetch
			return nil, nil
		}
		return nil, retryErr
	}
	return result, nil
}


Review comment (suggestion):
If we changed the error handling, then this comment should be just `// Timed out`.

Code after:
func agentSessionWebURL(repo ghrepo.Interface, j *capi.Job) string {
	if j.PullRequest == nil {
		return ""
	}
	if j.SessionID == "" {
		return fmt.Sprintf("https://github.com/%s/%s/pull/%d", url.PathEscape(repo.RepoOwner()), url.PathEscape(repo.RepoName()), j.PullRequest.Number)
	}
	return fmt.Sprintf("https://github.com/%s/%s/pull/%d/agent-sessions/%s", url.PathEscape(repo.RepoOwner()), url.PathEscape(repo.RepoName()), j.PullRequest.Number, url.PathEscape(j.SessionID))
}

// fetchJobWithBackoff polls the job resource until a PR number is present or the overall
// timeout elapses. It returns the updated Job on success, (nil, nil) on timeout,
// and (nil, error) only for non-retryable failures.
func fetchJobWithBackoff(ctx context.Context, client capi.CapiClient, repo ghrepo.Interface, jobID string, bo backoff.BackOff) (*capi.Job, error) {
	// sentinel error to signal timeout
	var errPRNotReady = errors.New("job not ready")

	var result *capi.Job
	retryErr := backoff.Retry(func() error {
		j, err := client.GetJob(ctx, repo.RepoOwner(), repo.RepoName(), jobID)
		if err != nil {
			// Do not retry on GetJob errors; surface immediately.
			return backoff.Permanent(err)
		}
		if j.PullRequest != nil && j.PullRequest.Number > 0 {
			result = j
			return nil
		}
		return errPRNotReady
	}, backoff.WithContext(bo, ctx))

	if retryErr != nil {
		if errors.Is(retryErr, errPRNotReady) {
			// Timed out
			return nil, nil
		}
		return nil, retryErr
	}
	return result, nil
}
Repository: cli/cli
File: pkg/cmd/agent-task/create/create.go (Go)

Code before:
				trimmed := strings.TrimSpace(string(fileContent))
				if trimmed == "" {
					return cmdutil.FlagErrorf("task description file is empty")
				}
				opts.ProblemStatement = trimmed
			}
			if opts.ProblemStatement == "" {
				return cmdutil.FlagErrorf("a task description is required")
			}
			// Support -R/--repo override
			if f != nil {
				opts.BaseRepo = f.BaseRepo
			}
			if runF != nil {
				return runF(opts)
			}
			return createRun(opts)
		},
		Example: heredoc.Doc(`
			# Create a task from an inline description
			$ gh agent-task create "build me a new app"

			# Create a task from a file
			$ gh agent-task create -F task-desc.md
		`),
	}
	if f != nil {
		cmdutil.EnableRepoOverride(cmd, f)
	}

	cmd.Flags().StringVarP(&fromFileName, "from-file", "F", "", "Read task description from file")

	opts.CapiClient = func() (capi.CapiClient, error) {
		cfg, err := f.Config()
		if err != nil {
			return nil, err
		}
		httpClient, err := f.HttpClient()
		if err != nil {
			return nil, err
		}
		authCfg := cfg.Authentication()
		return capi.NewCAPIClient(httpClient, authCfg), nil
	}

	return cmd
}

func createRun(opts *CreateOptions) error {
	if opts.ProblemStatement == "" {
		return cmdutil.FlagErrorf("a task description is required")

Review comment (suggestion):
Maybe also another example to read the problem statement from stdin:

```
# Create a task with problem statement from stdin
$ echo "build me a new app" | gh agent-task create -F -
```

Code after:
				}
				trimmed := strings.TrimSpace(string(fileContent))
				if trimmed == "" {
					return cmdutil.FlagErrorf("task description file is empty")
				}
				opts.ProblemStatement = trimmed
			}
			if opts.ProblemStatement == "" {
				return cmdutil.FlagErrorf("a task description is required")
			}
			// Support -R/--repo override
			if f != nil {
				opts.BaseRepo = f.BaseRepo
			}
			if runF != nil {
				return runF(opts)
			}
			return createRun(opts)
		},
		Example: heredoc.Doc(`
			# Create a task from an inline description
			$ gh agent-task create "build me a new app"

			# Create a task from a file
			$ gh agent-task create -F task-desc.md
		`),
	}
	if f != nil {
		cmdutil.EnableRepoOverride(cmd, f)
	}

	cmd.Flags().StringVarP(&fromFileName, "from-file", "F", "", "Read task description from file")
	cmd.Flags().StringVarP(&opts.BaseBranch, "base", "b", "", "Base branch for the task")

	opts.CapiClient = func() (capi.CapiClient, error) {
		cfg, err := f.Config()
		if err != nil {
			return nil, err
		}
		httpClient, err := f.HttpClient()
		if err != nil {
			return nil, err
		}
		authCfg := cfg.Authentication()
		return capi.NewCAPIClient(httpClient, authCfg), nil
	}

	return cmd
}

func createRun(opts *CreateOptions) error {
Repository: cli/cli
File: pkg/cmd/agent-task/create/create_test.go (Go)

Code before:
			fileContent: "   \n\n",
			expectedErr: "task description file is empty",
		},
	}

	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			ios, stdinBuf, _, _ := iostreams.Test()

			// Provide file content either via stdin ( -F - ) or by creating a temp file
			if tt.fileContent != "" {
				isStdin := len(tt.args) == 2 && tt.args[0] == "-F" && tt.args[1] == "-"
				hasFileToken := slices.Contains(tt.args, "{{FILE}}")

				switch {
				case isStdin:
					stdinBuf.WriteString(tt.fileContent)
				case hasFileToken:
					dir := t.TempDir()
					path := filepath.Join(dir, "task.md")
					if err := os.WriteFile(path, []byte(tt.fileContent), 0o600); err != nil {
						t.Fatalf("failed to write temp file: %v", err)
					}
					for i, a := range tt.args {
						if a == "{{FILE}}" {
							tt.args[i] = path
						}
					}
				}
			}

			f := &cmdutil.Factory{IOStreams: ios}
			var gotOpts *CreateOptions
			cmd := NewCmdCreate(f, func(o *CreateOptions) error {
				gotOpts = o
				return nil
			})
			cmd.SetArgs(tt.args)
			_, err := cmd.ExecuteC()

			if tt.expectedErr != "" {
				require.Error(t, err)
				require.Equal(t, tt.expectedErr, err.Error())
				return
			}
			require.NoError(t, err)
			if tt.wantOpts != nil {
				require.Equal(t, tt.wantOpts.ProblemStatement, gotOpts.ProblemStatement)
			}
		})
	}

Review comment (bug):
This can be simplified a bit:


```suggestion
					path := filepath.Join(t.TempDir(), "task.md")
					err := os.WriteFile(path, []byte(tt.fileContent), 0o600)
					require.NoError(t, err, "failed to write temp file: %v", err)
					for i, a := range tt.args {
						if a == "{{FILE}}" {
							tt.args[i] = path
						}
					}
```

Code after:
		},
	}

	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			ios, stdinBuf, _, _ := iostreams.Test()

			// Provide file content either via stdin ( -F - ) or by creating a temp file
			if tt.fileContent != "" {
				isStdin := len(tt.args) == 2 && tt.args[0] == "-F" && tt.args[1] == "-"
				hasFileToken := slices.Contains(tt.args, "{{FILE}}")

				switch {
				case isStdin:
					stdinBuf.WriteString(tt.fileContent)
				case hasFileToken:
					dir := t.TempDir()
					path := filepath.Join(dir, "task.md")
					if err := os.WriteFile(path, []byte(tt.fileContent), 0o600); err != nil {
						t.Fatalf("failed to write temp file: %v", err)
					}
					for i, a := range tt.args {
						if a == "{{FILE}}" {
							tt.args[i] = path
						}
					}
				}
			}

			f := &cmdutil.Factory{IOStreams: ios}
			var gotOpts *CreateOptions
			cmd := NewCmdCreate(f, func(o *CreateOptions) error {
				gotOpts = o
				return nil
			})
			cmd.SetArgs(tt.args)
			_, err := cmd.ExecuteC()

			if tt.expectedErr != "" {
				require.Error(t, err)
				require.Equal(t, tt.expectedErr, err.Error())
				return
			}
			require.NoError(t, err)
			if tt.wantOpts != nil {
				require.Equal(t, tt.wantOpts.ProblemStatement, gotOpts.ProblemStatement)
			}
		})
	}
}
Repository: cli/cli
File: pkg/cmd/agent-task/create/create_test.go (Go)

Code before:
				case isStdin:
					stdinBuf.WriteString(tt.fileContent)
				case hasFileToken:
					dir := t.TempDir()
					path := filepath.Join(dir, "task.md")
					if err := os.WriteFile(path, []byte(tt.fileContent), 0o600); err != nil {
						t.Fatalf("failed to write temp file: %v", err)
					}
					for i, a := range tt.args {
						if a == "{{FILE}}" {
							tt.args[i] = path
						}
					}
				}
			}

			f := &cmdutil.Factory{IOStreams: ios}
			var gotOpts *CreateOptions
			cmd := NewCmdCreate(f, func(o *CreateOptions) error {
				gotOpts = o
				return nil
			})
			cmd.SetArgs(tt.args)
			_, err := cmd.ExecuteC()

			if tt.expectedErr != "" {
				require.Error(t, err)
				require.Equal(t, tt.expectedErr, err.Error())
				return
			}
			require.NoError(t, err)
			if tt.wantOpts != nil {
				require.Equal(t, tt.wantOpts.ProblemStatement, gotOpts.ProblemStatement)
			}
		})
	}
}

func Test_createRun(t *testing.T) {
	createdJobSuccessResponse := heredoc.Doc(`{
		"job_id":"job123",
		"session_id":"sess1",
		"actor":{"id":1,"login":"octocat"},
		"created_at":"2025-08-29T00:00:00Z",
		"updated_at":"2025-08-29T00:00:00Z"
	}`)
	createdJobSuccessWithPRResponse := heredoc.Doc(`{
		"job_id":"job123",
		"session_id":"sess1",
		"actor":{"id":1,"login":"octocat"},
		"created_at":"2025-08-29T00:00:00Z",

Review comment (suggestion):
Can be simplified to a single `require.EqualError` call:

```suggestion
				require.EqualError(t, err, tt.expectedErr)
```

Code after:
				case hasFileToken:
					dir := t.TempDir()
					path := filepath.Join(dir, "task.md")
					if err := os.WriteFile(path, []byte(tt.fileContent), 0o600); err != nil {
						t.Fatalf("failed to write temp file: %v", err)
					}
					for i, a := range tt.args {
						if a == "{{FILE}}" {
							tt.args[i] = path
						}
					}
				}
			}

			f := &cmdutil.Factory{IOStreams: ios}
			var gotOpts *CreateOptions
			cmd := NewCmdCreate(f, func(o *CreateOptions) error {
				gotOpts = o
				return nil
			})
			cmd.SetArgs(tt.args)
			_, err := cmd.ExecuteC()

			if tt.expectedErr != "" {
				require.Error(t, err)
				require.Equal(t, tt.expectedErr, err.Error())
				return
			}
			require.NoError(t, err)
			if tt.wantOpts != nil {
				require.Equal(t, tt.wantOpts.ProblemStatement, gotOpts.ProblemStatement)
			}
		})
	}
}

func Test_createRun(t *testing.T) {
	createdJobSuccessResponse := heredoc.Doc(`{
		"job_id":"job123",
		"session_id":"sess1",
		"actor":{"id":1,"login":"octocat"},
		"created_at":"2025-08-29T00:00:00Z",
		"updated_at":"2025-08-29T00:00:00Z"
	}`)
	createdJobSuccessWithPRResponse := heredoc.Doc(`{
		"job_id":"job123",
		"session_id":"sess1",
		"actor":{"id":1,"login":"octocat"},
		"created_at":"2025-08-29T00:00:00Z",
		"updated_at":"2025-08-29T00:00:00Z",
		"pull_request":{"id":101,"number":42}
Repository: cli/cli
File: pkg/cmd/agent-task/create/create.go (Go)

Code before:
				return cmdutil.FlagErrorf("a task description is required")
			}
			// Support -R/--repo override
			if f != nil {
				opts.BaseRepo = f.BaseRepo
			}
			if runF != nil {
				return runF(opts)
			}
			return createRun(opts)
		},
		Example: heredoc.Doc(`
			# Create a task from an inline description
			$ gh agent-task create "build me a new app"

			# Create a task from a file
			$ gh agent-task create -F task-desc.md
		`),
	}
	if f != nil {
		cmdutil.EnableRepoOverride(cmd, f)
	}

	cmd.Flags().StringVarP(&fromFileName, "from-file", "F", "", "Read task description from file")

	opts.CapiClient = func() (capi.CapiClient, error) {
		cfg, err := f.Config()
		if err != nil {
			return nil, err
		}
		httpClient, err := f.HttpClient()
		if err != nil {
			return nil, err
		}
		authCfg := cfg.Authentication()
		return capi.NewCAPIClient(httpClient, authCfg), nil
	}

	return cmd
}

func createRun(opts *CreateOptions) error {
	if opts.ProblemStatement == "" {
		return cmdutil.FlagErrorf("a task description is required")
	}
	if opts.BaseRepo == nil {
		return errors.New("failed to resolve repository")
	}
	repo, err := opts.BaseRepo()
	if err != nil || repo == nil {
		// Not printing the error that came back from BaseRepo() here because we want

Review comment (suggestion):
Maybe we should also add an example to the docs?

```
# Create a task based on an existing branch
$ gh agent-task create "fix errors" --base branch
```

Code after:
			if opts.ProblemStatement == "" {
				return cmdutil.FlagErrorf("a task description is required")
			}
			// Support -R/--repo override
			if f != nil {
				opts.BaseRepo = f.BaseRepo
			}
			if runF != nil {
				return runF(opts)
			}
			return createRun(opts)
		},
		Example: heredoc.Doc(`
			# Create a task from an inline description
			$ gh agent-task create "build me a new app"

			# Create a task from a file
			$ gh agent-task create -F task-desc.md
		`),
	}
	if f != nil {
		cmdutil.EnableRepoOverride(cmd, f)
	}

	cmd.Flags().StringVarP(&fromFileName, "from-file", "F", "", "Read task description from file")
	cmd.Flags().StringVarP(&opts.BaseBranch, "base", "b", "", "Base branch for the task")

	opts.CapiClient = func() (capi.CapiClient, error) {
		cfg, err := f.Config()
		if err != nil {
			return nil, err
		}
		httpClient, err := f.HttpClient()
		if err != nil {
			return nil, err
		}
		authCfg := cfg.Authentication()
		return capi.NewCAPIClient(httpClient, authCfg), nil
	}

	return cmd
}

func createRun(opts *CreateOptions) error {
	if opts.ProblemStatement == "" {
		return cmdutil.FlagErrorf("a task description is required")
	}
	if opts.BaseRepo == nil {
		return errors.New("failed to resolve repository")
	}
	repo, err := opts.BaseRepo()
Repository: cli/cli
File: pkg/cmd/repo/setdefault/setdefault.go (Go)

Code before:

			# Set a repository using a git remote name
			$ gh repo set-default origin

			# View the current default repository
			$ gh repo set-default --view

			# Show more repository options in the interactive picker
			$ git remote add newrepo https://github.com/owner/repo
			$ gh repo set-default
		`),
		Args: cobra.MaximumNArgs(1),
		RunE: func(cmd *cobra.Command, args []string) error {
			if isLocal, err := opts.GitClient.IsLocalGitRepo(cmd.Context()); err != nil {
				return err
			} else if !isLocal {
				return errors.New("must be run from inside a git repository")
			}

			if len(args) > 0 {
				var err error
				opts.Repo, err = ghrepo.FromFullName(args[0])
				if err != nil {
					if opts.Remotes == nil {
						return fmt.Errorf("given arg is not a valid repo or git remote: %w", err)
					}

					remotes, remoteErr := opts.Remotes()
					if remoteErr != nil {
						return remoteErr
					}

					remote, findErr := remotes.FindByName(args[0])
					if findErr != nil {
						return fmt.Errorf("given arg is not a valid repo or git remote: %w", err)
					}
					opts.Repo = remote.Repo
				}
			}

			if !opts.ViewMode && !opts.IO.CanPrompt() && opts.Repo == nil {
				return cmdutil.FlagErrorf("repository required when not running interactively")
			}

			if runF != nil {
				return runF(opts)
			}

			return setDefaultRun(opts)
		},
	}

Review comment (suggestion):
This check is redundant/confusing as `opts.Remotes` is always assigned with a non-nil value here:

https://github.com/cli/cli/blob/c858c524b1777a14e9d89dd50648fcded4227289/pkg/cmd/factory/default.go#L40

Code after:

			# Set a repository using a git remote name
			$ gh repo set-default origin

			# View the current default repository
			$ gh repo set-default --view

			# Show more repository options in the interactive picker
			$ git remote add newrepo https://github.com/owner/repo
			$ gh repo set-default
		`),
		Args: cobra.MaximumNArgs(1),
		RunE: func(cmd *cobra.Command, args []string) error {
			if isLocal, err := opts.GitClient.IsLocalGitRepo(cmd.Context()); err != nil {
				return err
			} else if !isLocal {
				return errors.New("must be run from inside a git repository")
			}

			if len(args) > 0 {
				var err error
				opts.Repo, err = ghrepo.FromFullName(args[0])
				if err != nil {
					remotes, remoteErr := opts.Remotes()
					if remoteErr != nil {
						return remoteErr
					}

					remote, findErr := remotes.FindByName(args[0])
					if findErr != nil {
						return fmt.Errorf("given arg is not a valid repo or git remote: %w", err)
					}
					opts.Repo = remote.Repo
				}
			}

			if !opts.ViewMode && !opts.IO.CanPrompt() && opts.Repo == nil {
				return cmdutil.FlagErrorf("repository required when not running interactively")
			}

			if runF != nil {
				return runF(opts)
			}

			return setDefaultRun(opts)
		},
	}

	cmd.Flags().BoolVarP(&opts.ViewMode, "view", "v", false, "View the current default repository")
	cmd.Flags().BoolVarP(&opts.UnsetMode, "unset", "u", false, "Unset the current default repository")
Repository: cli/cli
File: api/queries_pr.go (Go)

Code before:
							ID       string
							Login    string
							Name     string
							TypeName string `graphql:"__typename"`
						} `graphql:"... on User"`
						Bot struct {
							ID       string
							Login    string
							TypeName string `graphql:"__typename"`
						} `graphql:"... on Bot"`
					}
				} `graphql:"suggestedActors(first: 10, query: $query)"`
			} `graphql:"... on Issue"`
			PullRequest struct {
				SuggestedActors struct {
					Nodes []struct {
						User struct {
							ID       string
							Login    string
							Name     string
							TypeName string `graphql:"__typename"`
						} `graphql:"... on User"`
						Bot struct {
							ID       string
							Login    string
							TypeName string `graphql:"__typename"`
						} `graphql:"... on Bot"`
					}
				} `graphql:"suggestedActors(first: 10, query: $query)"`
			} `graphql:"... on PullRequest"`
		} `graphql:"node(id: $id)"`
	}

	variables := map[string]interface{}{
		"id": githubv4.ID(assignableID),
	}
	if query != "" {
		variables["query"] = githubv4.String(query)
	} else {
		variables["query"] = (*githubv4.String)(nil)
	}

	var result responseData
	if err := client.Query(repo.RepoHost(), "SuggestedAssignableActors", &result, variables); err != nil {
		return nil, err
	}

	var nodes []struct {
		User struct {
			ID       string
			Login    string

Review comment (suggestion):
The same thing:


```suggestion
					Nodes []struct {
					    TypeName string `graphql:"__typename"`
						User struct {
							ID       string
							Login    string
							Name     string							
						} `graphql:"... on User"`
						Bot struct {
							ID       string
							Login    string
						} `graphql:"... on Bot"`
					}
```

Code after:
						User struct {
							ID       string
							Login    string
							Name     string
						} `graphql:"... on User"`
						Bot struct {
							ID       string
							Login    string
						} `graphql:"... on Bot"`
					}
				} `graphql:"suggestedActors(first: 10, query: $query)"`
			} `graphql:"... on Issue"`
			PullRequest struct {
				SuggestedActors struct {
					Nodes []struct {
					    TypeName string `graphql:"__typename"`
						User struct {
							ID       string
							Login    string
							Name     string							
						} `graphql:"... on User"`
						Bot struct {
							ID       string
							Login    string
						} `graphql:"... on Bot"`
					}
				} `graphql:"suggestedActors(first: 10, query: $query)"`
			} `graphql:"... on PullRequest"`
		} `graphql:"node(id: $id)"`
	}

	variables := map[string]interface{}{
		"id": githubv4.ID(assignableID),
	}
	if query != "" {
		variables["query"] = githubv4.String(query)
	} else {
		variables["query"] = (*githubv4.String)(nil)
	}

	var result responseData
	if err := client.Query(repo.RepoHost(), "SuggestedAssignableActors", &result, variables); err != nil {
		return nil, err
	}

	var nodes []struct {
		TypeName string `graphql:"__typename"`
		User struct {
			ID       string
			Login    string
			Name     string