Skip to content

Add commands to manage Copilot code review settings and policies #15022

Open

Agent suggestions

Public preview

Description

@cagesellchen

Describe the feature or problem you’d like to solve

GitHub now has REST endpoints for configuring Copilot code review: repository and organization settings, the organization's runner, and the organization and enterprise policy that turns Copilot code review on or off. They are in GitHub's public REST API description (github/rest-api-description).

Customers who manage GitHub settings as code (for example, with Terraform, or with scripts in CI) want to read and set these values from the command line without writing raw gh api calls. Today gh can request a review from Copilot (gh pr edit --add-reviewer @copilot), but it can't configure Copilot code review.

The endpoints:

Scope Endpoint Methods
Repository /repos/{owner}/{repo}/copilot/code-review/settings GET, PATCH
Organization /orgs/{org}/copilot/code-review/settings GET, PATCH
Organization /orgs/{org}/copilot/code-review/runner GET, PUT
Organization /orgs/{org}/copilot/policies/code-review GET, PUT
Enterprise /enterprises/{enterprise}/copilot/policies/code-review GET, PUT

Proposed solution

A new top-level command, gh copilot-review, with three groups and six leaf commands covering all ten operations:

Command Scope flags Endpoints
gh copilot-review settings view current repository, -R OWNER/REPO, or --org ORG GET repository or organization settings
gh copilot-review settings edit same as above PATCH repository or organization settings
gh copilot-review runner view --org ORG (required) GET organization runner
gh copilot-review runner set --org ORG (required) PUT organization runner
gh copilot-review policy view --org ORG or --enterprise ENTERPRISE (one required) GET organization or enterprise policy
gh copilot-review policy set same as above PUT organization or enterprise policy

It follows existing gh patterns:

  • Scope selection: settings defaults to the current repository and supports -R, like gh secret and gh variable. --org switches to the organization endpoint, and -R with --org is a usage error. runner and policy have no repository scope.
  • Partial updates: settings edit sends only the flags you pass. Unset booleans aren't sent, which matches the PATCH semantics. --review-effort inherit clears the value, as the API does.
  • Validation: client-side validation covers what the CLI knows statically: the --severity-filter and --type enums, --state per scope, and --type labeled needing --label or --group. Review efforts aren't hard-coded, because each repository or organization has its own available_review_efforts, so the server validates them.
  • Output: a TTY gets a titled key/value view and a ✓ line after changes. Non-TTY output is tab-separated key:\tvalue lines, and set/edit commands print nothing on success. --json, --jq, and --template return the API fields in camelCase.
  • Errors: API errors, such as a 409 when an enterprise manages the setting, are passed through with the API's message.
  • Hosts: organization and enterprise commands use the default host. Repository commands use the repository's host.

Prototype: https://github.com/cagesellchen/cli/tree/cagesellchen-copilot-code-review-settings-commands, a single package at pkg/cmd/copilot-review with unit tests. I'll hold the pull request until the UX here is agreed.

Usage examples

# Settings as code: read the effective review effort for a repository
$ gh copilot-review settings view -R OWNER/REPO --json reviewEffort --jq .reviewEffort.effective
balanced

# Change several repository settings at once; omitted settings are left alone
$ gh copilot-review settings edit -R OWNER/REPO --review-effort inherit --severity-filter low_and_medium --mcp=false
✓ Updated Copilot code review settings for OWNER/REPO

# Organization default review effort
$ gh copilot-review settings edit --org ORG --review-effort lite
✓ Updated Copilot code review settings for ORG

# Self-hosted runners for Copilot code review
$ gh copilot-review runner set --org ORG --type labeled --label linux,gpu --allow-repo-customization=false
✓ Set Copilot code review runner for ORG

# Turn Copilot code review on for an organization, or let organization owners decide at the enterprise level
$ gh copilot-review policy set --org ORG --state enabled
✓ Set Copilot code review policy for ORG to enabled
$ gh copilot-review policy set --enterprise ENTERPRISE --state configured_by_organization_admins
✓ Set Copilot code review policy for ENTERPRISE to configured_by_organization_admins

Sample output

These samples come from the prototype's unit tests, which run it against stubbed API responses, not live data.

$ gh copilot-review settings view
Copilot code review settings for OWNER/REPO

Review effort: balanced (inherited)
Available review efforts: lite, balanced
Severity filter: low
Custom instructions: enabled
MCP servers: disabled

$ gh copilot-review settings view --org ORG
Copilot code review settings for ORG

Default review effort: balanced (configured deep is unavailable)
GitHub default: balanced
Available review efforts: lite, balanced
Managed by: enterprise
Editable: false

$ gh copilot-review runner view --org ORG
Copilot code review runner for ORG

Runner type: labeled
Runner labels: linux, gpu
Runner group: copilot
Repository customization: true
Configured by: code_review

$ gh copilot-review policy view --org ORG
Copilot code review policy for ORG

Effective state: enabled
Configured state: not set
Managed by: enterprise
Editable: false

$ gh copilot-review settings view --org ORG --json defaultReviewEffort
{"defaultReviewEffort":{"configured":"deep","editable":false,"effective":"balanced","githubDefault":"balanced","managedBy":"enterprise"}}

$ gh copilot-review settings view | cat
review effort:	balanced (inherited)
available review efforts:	lite, balanced
severity filter:	low
custom instructions:	enabled
mcp servers:	disabled

--help output

This is real --help output from the prototype build. The shared LEARN MORE section is omitted.

gh copilot-review --help
$ gh copilot-review --help
Manage Copilot code review settings, runners, and policies for repositories,
organizations, and enterprises.

These commands configure Copilot code review; they do not request reviews. To request
a review from Copilot, use `gh pr edit --add-reviewer @copilot`.

Managing Copilot code review in the GitHub CLI is in preview and subject to change
without notice.


USAGE
  gh copilot-review <command> [flags]

AVAILABLE COMMANDS
  policy:         View and set the Copilot code review policy
  runner:         View and set the Copilot code review runner for an organization
  settings:       View and edit Copilot code review settings

INHERITED FLAGS
  --help[=true|false]   Show help for command

EXAMPLES
  # View the Copilot code review settings for the current repository
  $ gh copilot-review settings view

  # Leave low-severity comments out of reviews in a repository
  $ gh copilot-review settings edit -R OWNER/REPO --severity-filter low

  # Enable Copilot code review for an organization
  $ gh copilot-review policy set --org ORG --state enabled
gh copilot-review settings --help
$ gh copilot-review settings --help
View and edit Copilot code review settings for a repository or an organization.

Repository settings tune how Copilot code review reviews pull requests in the repository.
Organization settings set the default review effort for repositories that don't choose
their own. These settings do not enable Copilot code review; see `gh copilot-review policy`.


USAGE
  gh copilot-review settings <command> [flags]

AVAILABLE COMMANDS
  edit:           Edit Copilot code review settings
  view:           View Copilot code review settings

FLAGS
  -R, --repo [HOST/]OWNER/REPO   Select another repository using the [HOST/]OWNER/REPO format

INHERITED FLAGS
  --help[=true|false]   Show help for command
gh copilot-review settings view --help
$ gh copilot-review settings view --help
View the Copilot code review settings for a repository or an organization.

Without --org, shows the settings for the current repository or the one selected with --repo.
Repository settings require the admin role; organization settings require an organization owner.

For more information about output formatting flags, see `gh help formatting`.

USAGE
  gh copilot-review settings view [flags]

FLAGS
  -q, --jq expression      Filter JSON output using a jq expression
      --json fields        Output JSON with the specified fields
  -o, --org organization   View the settings for an organization
  -t, --template string    Format JSON output using a Go template; see "gh help formatting"

INHERITED FLAGS
      --help[=true|false]        Show help for command
  -R, --repo [HOST/]OWNER/REPO   Select another repository using the [HOST/]OWNER/REPO format

JSON FIELDS
  availableReviewEfforts, customInstructionsEnabled, defaultReviewEffort,
  mcpEnabled, reviewEffort, severityFilter

EXAMPLES
  # View the settings for the current repository
  $ gh copilot-review settings view

  # View the settings for an organization
  $ gh copilot-review settings view --org ORG

  # Print the effective review effort for a repository
  $ gh copilot-review settings view -R OWNER/REPO --json reviewEffort --jq .reviewEffort.effective
gh copilot-review settings edit --help
$ gh copilot-review settings edit --help
Edit the Copilot code review settings for a repository or an organization.

Settings that you don't specify are not changed. Use `--review-effort inherit` to clear
the review effort so it is inherited from the organization, the enterprise, or GitHub's default.
Only review efforts that are available to the repository or organization are accepted; see
`gh copilot-review settings view`.

Organizations can only set `--review-effort`, which is the default for repositories that
don't choose their own.


USAGE
  gh copilot-review settings edit [flags]

FLAGS
      --custom-instructions[=true|false]   Use the repository's custom instructions in reviews
      --mcp[=true|false]                   Let reviews use MCP servers
  -o, --org organization                   Edit the settings for an organization
      --review-effort effort               Set the review effort, or "inherit" to clear it
      --severity-filter string             Leave review comments of these severities out of reviews: {no_filter|low|low_and_medium}

INHERITED FLAGS
      --help[=true|false]        Show help for command
  -R, --repo [HOST/]OWNER/REPO   Select another repository using the [HOST/]OWNER/REPO format

EXAMPLES
  # Set the review effort for the current repository
  $ gh copilot-review settings edit --review-effort balanced

  # Inherit the review effort and stop using MCP servers in a repository
  $ gh copilot-review settings edit -R OWNER/REPO --review-effort inherit --mcp=false

  # Set the default review effort for an organization
  $ gh copilot-review settings edit --org ORG --review-effort lite
gh copilot-review runner --help
$ gh copilot-review runner --help
View and set the runners that Copilot code review uses in an organization.

Until an organization sets a Copilot code review runner, Copilot code review uses the
organization's Copilot coding agent runner configuration.


USAGE
  gh copilot-review runner <command> [flags]

AVAILABLE COMMANDS
  set:            Set the Copilot code review runner for an organization
  view:           View the Copilot code review runner for an organization

INHERITED FLAGS
  --help[=true|false]   Show help for command
gh copilot-review runner view --help
$ gh copilot-review runner view --help
View the runner configuration that Copilot code review uses in an organization.

Requires an organization owner.

For more information about output formatting flags, see `gh help formatting`.

USAGE
  gh copilot-review runner view [flags]

FLAGS
  -q, --jq expression      Filter JSON output using a jq expression
      --json fields        Output JSON with the specified fields
  -o, --org organization   The organization to view
  -t, --template string    Format JSON output using a Go template; see "gh help formatting"

INHERITED FLAGS
  --help[=true|false]   Show help for command

JSON FIELDS
  allowRepositoryCustomization, configuredBy, runnerGroupName, runnerLabels,
  runnerType

EXAMPLES
  $ gh copilot-review runner view --org ORG
gh copilot-review runner set --help
$ gh copilot-review runner set --help
Set the runner configuration that Copilot code review uses in an organization.

A `standard` runner uses GitHub-hosted runners. A `labeled` runner uses runners that
match `--label` or `--group`, and needs at least one of them. This replaces the whole
runner configuration. When `--allow-repo-customization` is omitted, the current value is kept.

Requires an organization owner.


USAGE
  gh copilot-review runner set [flags]

FLAGS
      --allow-repo-customization[=true|false]   Let repositories choose their own runners
      --group group                             Use runners from this runner group
      --label label                             Use runners with this label
  -o, --org organization                        The organization to configure
      --type string                             Runner type: {standard|labeled}

INHERITED FLAGS
  --help[=true|false]   Show help for command

EXAMPLES
  # Use GitHub-hosted runners
  $ gh copilot-review runner set --org ORG --type standard

  # Use self-hosted runners from a runner group, and stop repositories from choosing their own
  $ gh copilot-review runner set --org ORG --type labeled --group copilot-runners --allow-repo-customization=false
gh copilot-review policy --help
$ gh copilot-review policy --help
View and set whether Copilot code review is enabled for an organization or an enterprise.

An enterprise can enable or disable Copilot code review for all of its organizations, or
let organization owners decide.


USAGE
  gh copilot-review policy <command> [flags]

AVAILABLE COMMANDS
  set:            Set the Copilot code review policy
  view:           View the Copilot code review policy

INHERITED FLAGS
  --help[=true|false]   Show help for command
gh copilot-review policy view --help
$ gh copilot-review policy view --help
View the Copilot code review policy for an organization or an enterprise.

For an organization, shows the configured and effective policy, and whether the
organization or its enterprise manages it. Requires an organization owner.

For an enterprise, shows the configured policy. Requires an enterprise owner.

For more information about output formatting flags, see `gh help formatting`.

USAGE
  gh copilot-review policy view [flags]

FLAGS
  -e, --enterprise enterprise   View the policy for an enterprise
  -q, --jq expression           Filter JSON output using a jq expression
      --json fields             Output JSON with the specified fields
  -o, --org organization        View the policy for an organization
  -t, --template string         Format JSON output using a Go template; see "gh help formatting"

INHERITED FLAGS
  --help[=true|false]   Show help for command

JSON FIELDS
  configuredState, editable, effectiveState, managedBy, policyState

EXAMPLES
  # View the policy for an organization
  $ gh copilot-review policy view --org ORG

  # View the policy for an enterprise
  $ gh copilot-review policy view --enterprise ENTERPRISE
gh copilot-review policy set --help
$ gh copilot-review policy set --help
Set the Copilot code review policy for an organization or an enterprise.

For an organization, `--state` is one of: enabled, disabled.
The request fails when the organization's enterprise manages the policy.
Requires an organization owner.

For an enterprise, `--state` is one of: enabled_for_all_organizations, disabled_for_all_organizations, configured_by_organization_admins.
Requires an enterprise owner.


USAGE
  gh copilot-review policy set [flags]

FLAGS
  -e, --enterprise enterprise   Set the policy for an enterprise
  -o, --org organization        Set the policy for an organization
  -s, --state state             The policy state

INHERITED FLAGS
  --help[=true|false]   Show help for command

EXAMPLES
  # Enable Copilot code review for an organization
  $ gh copilot-review policy set --org ORG --state enabled

  # Let organization owners decide whether to enable Copilot code review
  $ gh copilot-review policy set --enterprise ENTERPRISE --state configured_by_organization_admins

Additional context

Open questions for the CLI team:

  1. Command name. gh copilot already runs the Copilot CLI, so these commands can't be nested under it. Options are gh copilot-review (this prototype), gh code-review, or a sub-tree of an existing command. copilot-review is the first top-level name longer than 14 characters, so the prototype widens the root help name column by one, which shifts every command list in gh help by one column.
  2. Flag values. The prototype uses the API's enum values exactly (for example, --state configured_by_organization_admins and --severity-filter low_and_medium), so flags, --json output, and Terraform or API values all match. The alternative is friendlier hyphenated aliases mapped to the API values.
  3. Package layout. All six commands live in one package (pkg/cmd/copilot-review), like codespace, rather than one package per leaf command like most gh commands. I'm happy to split them up.
  4. Preview label. The group is marked "(preview)", like agent-task and discussion.

Other notes:

  • These endpoints are available on GitHub.com and GHE.com, not GHES. Organization and enterprise endpoints don't accept GitHub App tokens or fine-grained personal access tokens. Permission errors come straight from the API.
  • Requesting Copilot reviews is out of scope here; that's gh pr edit --add-reviewer @copilot and related work.

Activity

  1. cli-triage commented on Nov 10, 2026

    @cli-triage

    GitHub CLI 2.103.3 does not have a command for these settings. Its root help only exposes gh copilot for running Copilot CLI. gh api can call the REST endpoints today, but it does not provide the scoped commands, validation, structured views, and update flow requested here.

    The proposal clearly covers repository, organization, and enterprise use cases and separates configuration from requesting a review. The open UX questions, especially command placement and naming, are useful for maintainer review before implementation.

    Supporting reports

    Generated by issue triage.

  2. babakks commented on Nov 16, 2026

    @babakks
    Member

    Thanks for proposing these administration commands, @cagesellchen! 🙏

    As the bot already noted, this needs design discussion, particularly around command placement, naming, and scope. I’m marking this as an enhancement and leaving it open for community feedback.

    We don’t have a timeline or commitment to prioritize this. Community upvotes and examples of how these commands would help will inform whether we consider it for future planning.

  3. added
    core
    enhancement
    on Nov 16, 2026
  4. github-actions commented on Nov 16, 2026

    @github-actions
    Contributor

    Thank you for your issue! We have categorized it as an enhancement (feature or improvement) request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.

    Unless you see the help wanted Contributions welcome label, we are not currently looking for external contributions for this feature.

    If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.

  5. removed
    needs-triage
    on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    coreenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions