Skip to content

gh pr edit --remove-reviewer does not work when removing all reviewers #10958

Description

@tobias-tengler

Describe the bug

I can request a review from a team for a pull-request using the following command:

gh pr edit 180 --add-reviewer <org>/<team-name> --repo <org-name>/<repo-name>

But I can not remove the same team with the following command:

gh pr edit 180 --remove-reviewer <org>/<team-name> --repo <org-name>/<repo-name>

(it works for regular users)

The CLI exits with code 0 and no error is logged, but the team is not removed from the PR.
I can remove the team through the PR UI though.

The repository is an internal one and I'm an owner of the organization.

Affected version

2.72.0

Activity

  1. tobias-tengler commented on May 9, 2025

    @tobias-tengler
    Author

    If I execute the command through my account on the CLI and I'm not part of the team I'm trying to remove it seems to work fine. So it seems to be related to the actor's membership status in the team?

    I tried using a GitHub app from within a GitHub action to not trigger it through my account, but the action also seems to run into the same problem of not being able to remove the team that I'm apart of.
    I'm also the author of the PR in question - might this be part of the problem?

  2. babakks commented on May 12, 2025

    @babakks
    Member

    Thanks for reporting this issue, @tobias-tengler!

    I looked into this and I could reproduce it. The gist is there's an if-statement that aborts the process of updating reviewers if the final slices of both user reviewers and team reviewers are empty, which is not correct because in your case (and what I tried) the user wants to drop all reviewers. Here's the code piece I'm talking about:

    cli/pkg/cmd/pr/edit/edit.go

    Lines 281 to 289 in 90532e8

    func updatePullRequestReviews(httpClient *http.Client, repo ghrepo.Interface, id string, editable shared.Editable) error {
    userIds, teamIds, err := editable.ReviewerIds()
    if err != nil {
    return err
    }
    if (userIds == nil || len(*userIds) == 0) &&
    (teamIds == nil || len(*teamIds) == 0) {
    return nil
    }

    I could temporarily fix this by dropping the len(.)==0 conditions, but I think the code needs a bit more polishing, especially the pointer-to-slice implementation which is not a Go idiomatic way of handling slices.

    @tobias-tengler, to make sure I'm not missing any other factors here, could you please also share with me the output of running the command below? Please redact unnecessary details/secrets.

    GH_DEBUG=api gh pr edit 180 --remove-reviewer <org>/<team-name> --repo <org-name>/<repo-name>
  3. added
    more-info-neededMore info needed from user/contributor
    coreThis issue is not accepting PRs from outside contributors
    gh-prrelating to the gh pr command
    and removed on May 12, 2025
  4. babakks commented on May 12, 2025

    @babakks
    Member

    Here's the A/C based on my observations, so far.

    Acceptance Criteria

    Removing user reviewer

    Given I have a PR with only a user reviewer assigned to it
    When I run gh pr edit --remove-reviewer <user>
    Then the PR is updated and has no reviewers

    Removing team reviewer

    Given I have a PR with only a team reviewer assigned to it
    When I run gh pr edit --remove-reviewer <org>/<team>
    Then the PR is updated and has no reviewers

    Removing both

    Given I have a PR with both a user and a team reviewer assigned to it
    When I run gh pr edit --remove-reviewer <user>,<org>/<team>
    Then the PR is updated and has no reviewers

  5. tobias-tengler commented on May 12, 2025

    @tobias-tengler
    Author

    Thanks for looking into this @babakks!

    Here's the censored output if I run your command:

    Output
    * Request at 2025-05-12 14:33:59.205884 +0200 CEST m=+0.054530376
    * Request to https://api.github.com/graphql
    > POST /graphql HTTP/1.1
    > Host: api.github.com
    > Accept: application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview
    > Authorization: token xxx
    > Content-Length: 666
    > Content-Type: application/json; charset=utf-8
    > Graphql-Features: merge_queue
    > Time-Zone: Europe/Zurich
    > User-Agent: GitHub CLI 2.72.0
    
    GraphQL query:
    query PullRequestByNumber($owner: String!, $repo: String!, $pr_number: Int!) {
        repository(owner: $owner, name: $repo) {
          pullRequest(number: $pr_number) {id,url,title,body,baseRefName,reviewRequests(first: 100) {nodes {requestedReviewer {__typename,...on User{login},...on Team{organization{login}name,slug}}}},assignees(first:100){nodes{id,login,name},totalCount},labels(first:100){nodes{id,name,description,color},totalCount},projectCards(first:100){nodes{project{name}column{name}},totalCount},milestone{number,title,description,dueOn},number}
        }
      }
    GraphQL variables: {"owner":"<org>","pr_number":180,"repo":"<repo>"}
    
    < HTTP/2.0 200 OK
    < Access-Control-Allow-Origin: *
    < Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
    < Content-Security-Policy: default-src 'none'
    < Content-Type: application/json; charset=utf-8
    < Date: Mon, 12 May 2025 12:33:59 GMT
    < Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
    < Server: github.com
    < Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
    < Vary: Accept-Encoding, Accept, X-Requested-With
    < X-Accepted-Oauth-Scopes: repo
    < X-Content-Type-Options: nosniff
    < X-Frame-Options: deny
    < X-Github-Media-Type: github.v4; param=merge-info-preview.nebula-preview; format=json
    < X-Github-Request-Id: EB36:135BE5:123F26F7:12C5428E:6821EAB7
    < X-Oauth-Client-Id: xxx
    < X-Oauth-Scopes: gist, read:org, repo, workflow
    < X-Ratelimit-Limit: 5000
    < X-Ratelimit-Remaining: 4985
    < X-Ratelimit-Reset: 1747056766
    < X-Ratelimit-Resource: graphql
    < X-Ratelimit-Used: 15
    < X-Xss-Protection: 0
    
    {
      "data": {
        "repository": {
          "pullRequest": {
            "id": "PR_kwDOKigQ4s6VckuE",
            "url": "",
            "title": "<pr-title>",
            "body": "",
            "baseRefName": "master",
            "reviewRequests": {
              "nodes": [
                {
                  "requestedReviewer": {
                    "__typename": "Team",
                    "organization": {
                      "login": "<org>"
                    },
                    "name": "<team-name>",
                    "slug": "<team-slug>"
                  }
                }
              ]
            },
            "assignees": {
              "nodes": [],
              "totalCount": 0
            },
            "labels": {
              "nodes": [],
              "totalCount": 0
            },
            "projectCards": {
              "nodes": [],
              "totalCount": 0
            },
            "milestone": null,
            "number": 180
          }
        }
      }
    }
    
    * Request took 471.792625ms
    * Request at 2025-05-12 14:33:59.704706 +0200 CEST m=+0.553351668
    * Request to https://api.github.com/graphql
    > POST /graphql HTTP/1.1
    > Host: api.github.com
    > Accept: application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview
    > Authorization: token xxx
    > Content-Length: 472
    > Content-Type: application/json
    > Graphql-Features: merge_queue
    > Time-Zone: Europe/Zurich
    > User-Agent: GitHub CLI 2.72.0
    
    GraphQL query:
    query PullRequestProjectItems($endCursor:String$name:String!$number:Int!$owner:String!){repository(owner: $owner, name: $name){pullRequest(number: $number){projectItems(first: 100, after: $endCursor){nodes{id,project{id,title},status:fieldValueByName(name: "Status"){... on ProjectV2ItemFieldSingleSelectValue{optionId,name}}},pageInfo{hasNextPage,endCursor}}}}}
    GraphQL variables: {"endCursor":null,"name":"<repo>","number":180,"owner":"<org>"}
    
    < HTTP/2.0 200 OK
    < Access-Control-Allow-Origin: *
    < Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
    < Content-Security-Policy: default-src 'none'
    < Content-Type: application/json; charset=utf-8
    < Date: Mon, 12 May 2025 12:33:59 GMT
    < Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
    < Server: github.com
    < Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
    < Vary: Accept-Encoding, Accept, X-Requested-With
    < X-Accepted-Oauth-Scopes: repo
    < X-Content-Type-Options: nosniff
    < X-Frame-Options: deny
    < X-Github-Media-Type: github.v4; param=merge-info-preview.nebula-preview; format=json
    < X-Github-Request-Id: EB36:135BE5:123F295B:12C544E1:6821EAB7
    < X-Oauth-Client-Id: xxx
    < X-Oauth-Scopes: gist, read:org, repo, workflow
    < X-Ratelimit-Limit: 5000
    < X-Ratelimit-Remaining: 4984
    < X-Ratelimit-Reset: 1747056766
    < X-Ratelimit-Resource: graphql
    < X-Ratelimit-Used: 16
    < X-Xss-Protection: 0
    
    {
      "errors": [
        {
          "type": "INSUFFICIENT_SCOPES",
          "locations": [
            {
              "line": 1,
              "column": 207
            }
          ],
          "message": "Your token has not been granted the required scopes to execute this query. The 'id' field requires one of the following scopes: ['read:project'], but your token has only been granted the: ['gist', 'read:org', 'repo', 'workflow'] scopes. Please modify your token's scopes at: https://github.com/settings/tokens."
        },
        {
          "type": "INSUFFICIENT_SCOPES",
          "locations": [
            {
              "line": 1,
              "column": 218
            }
          ],
          "message": "Your token has not been granted the required scopes to execute this query. The 'id' field requires one of the following scopes: ['read:project'], but your token has only been granted the: ['gist', 'read:org', 'repo', 'workflow'] scopes. Please modify your token's scopes at: https://github.com/settings/tokens."
        },
        {
          "type": "INSUFFICIENT_SCOPES",
          "locations": [
            {
              "line": 1,
              "column": 221
            }
          ],
          "message": "Your token has not been granted the required scopes to execute this query. The 'title' field requires one of the following scopes: ['read:project'], but your token has only been granted the: ['gist', 'read:org', 'repo', 'workflow'] scopes. Please modify your token's scopes at: https://github.com/settings/tokens."
        },
        {
          "type": "INSUFFICIENT_SCOPES",
          "locations": [
            {
              "line": 1,
              "column": 311
            }
          ],
          "message": "Your token has not been granted the required scopes to execute this query. The 'optionId' field requires one of the following scopes: ['read:project'], but your token has only been granted the: ['gist', 'read:org', 'repo', 'workflow'] scopes. Please modify your token's scopes at: https://github.com/settings/tokens."
        },
        {
          "type": "INSUFFICIENT_SCOPES",
          "locations": [
            {
              "line": 1,
              "column": 320
            }
          ],
          "message": "Your token has not been granted the required scopes to execute this query. The 'name' field requires one of the following scopes: ['read:project'], but your token has only been granted the: ['gist', 'read:org', 'repo', 'workflow'] scopes. Please modify your token's scopes at: https://github.com/settings/tokens."
        }
      ]
    }
    
    * Request took 194.735666ms
    * Request at 2025-05-12 14:33:59.933034 +0200 CEST m=+0.781678834
    * Request to https://api.github.com/graphql
    > POST /graphql HTTP/1.1
    > Host: api.github.com
    > Accept: application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview
    > Authorization: token xxx
    > Content-Length: 314
    > Content-Type: application/json
    > Graphql-Features: merge_queue
    > Time-Zone: Europe/Zurich
    > User-Agent: GitHub CLI 2.72.0
    
    GraphQL query:
    query RepositoryAssignableUsers($endCursor:String$name:String!$owner:String!){repository(owner: $owner, name: $name){assignableUsers(first: 100, after: $endCursor){nodes{id,login,name},pageInfo{hasNextPage,endCursor}}}}
    GraphQL variables: {"endCursor":null,"name":"<repo>","owner":"<owner>"}
    
    * Request at 2025-05-12 14:33:59.93395 +0200 CEST m=+0.782595251
    * Request to https://api.github.com/graphql
    > POST /graphql HTTP/1.1
    > Host: api.github.com
    > Accept: application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview
    > Authorization: token xxx
    > Content-Length: 45
    > Content-Type: application/json
    > Graphql-Features: merge_queue
    > Time-Zone: Europe/Zurich
    > User-Agent: GitHub CLI 2.72.0
    
    {
      "query": "query UserCurrent{viewer{login}}"
    }
    
    * Request at 2025-05-12 14:33:59.934653 +0200 CEST m=+0.783298209
    * Request to https://api.github.com/graphql
    > POST /graphql HTTP/1.1
    > Host: api.github.com
    > Accept: application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview
    > Authorization: token xxx
    > Content-Length: 283
    > Content-Type: application/json
    > Graphql-Features: merge_queue
    > Time-Zone: Europe/Zurich
    > User-Agent: GitHub CLI 2.72.0
    
    GraphQL query:
    query OrganizationTeamList($endCursor:String$owner:String!){organization(login: $owner){teams(first: 100, orderBy: {field: NAME, direction: ASC}, after: $endCursor){nodes{id,slug},pageInfo{hasNextPage,endCursor}}}}
    GraphQL variables: {"endCursor":null,"owner":"<owner>"}
    
    < HTTP/2.0 200 OK
    < Access-Control-Allow-Origin: *
    < Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
    < Content-Security-Policy: default-src 'none'
    < Content-Type: application/json; charset=utf-8
    < Date: Mon, 12 May 2025 12:34:00 GMT
    < Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
    < Server: github.com
    < Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
    < Vary: Accept-Encoding, Accept, X-Requested-With
    < X-Accepted-Oauth-Scopes: repo
    < X-Content-Type-Options: nosniff
    < X-Frame-Options: deny
    < X-Github-Media-Type: github.v4; param=merge-info-preview.nebula-preview; format=json
    < X-Github-Request-Id: EB36:135BE5:123F2AB5:12C54686:6821EAB7
    < X-Oauth-Client-Id: xxx
    < X-Oauth-Scopes: gist, read:org, repo, workflow
    < X-Ratelimit-Limit: 5000
    < X-Ratelimit-Remaining: 4983
    < X-Ratelimit-Reset: 1747056766
    < X-Ratelimit-Resource: graphql
    < X-Ratelimit-Used: 17
    < X-Xss-Protection: 0
    
    {
      "data": {
        "viewer": {
          "login": "tobias-tengler"
        }
      }
    }
    
    * Request took 189.753542ms
    < HTTP/2.0 200 OK
    < Access-Control-Allow-Origin: *
    < Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
    < Content-Security-Policy: default-src 'none'
    < Content-Type: application/json; charset=utf-8
    < Date: Mon, 12 May 2025 12:34:00 GMT
    < Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
    < Server: github.com
    < Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
    < Vary: Accept-Encoding, Accept, X-Requested-With
    < X-Accepted-Oauth-Scopes: repo
    < X-Content-Type-Options: nosniff
    < X-Frame-Options: deny
    < X-Github-Media-Type: github.v4; param=merge-info-preview.nebula-preview; format=json
    < X-Github-Request-Id: EB36:135BE5:123F2AB6:12C5468C:6821EAB7
    < X-Oauth-Client-Id: xxx
    < X-Oauth-Scopes: gist, read:org, repo, workflow
    < X-Ratelimit-Limit: 5000
    < X-Ratelimit-Remaining: 4982
    < X-Ratelimit-Reset: 1747056766
    < X-Ratelimit-Resource: graphql
    < X-Ratelimit-Used: 18
    < X-Xss-Protection: 0
    
    {
      "data": {
        "organization": {
          "teams": {
            "nodes": [
              // teams
            ],
            "pageInfo": {
              "hasNextPage": false,
              "endCursor": "Y3Vyc29yOnYyOpQCpFpldXOkWmV1c84Al9s0"
            }
          }
        }
      }
    }
    
    * Request took 712.317375ms
    < HTTP/2.0 200 OK
    < Access-Control-Allow-Origin: *
    < Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
    < Content-Security-Policy: default-src 'none'
    < Content-Type: application/json; charset=utf-8
    < Date: Mon, 12 May 2025 12:34:01 GMT
    < Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
    < Server: github.com
    < Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
    < Vary: Accept-Encoding, Accept, X-Requested-With
    < X-Accepted-Oauth-Scopes: repo
    < X-Content-Type-Options: nosniff
    < X-Frame-Options: deny
    < X-Github-Media-Type: github.v4; param=merge-info-preview.nebula-preview; format=json
    < X-Github-Request-Id: EB36:135BE5:123F2AB4:12C54685:6821EAB7
    < X-Oauth-Client-Id: xxx
    < X-Oauth-Scopes: gist, read:org, repo, workflow
    < X-Ratelimit-Limit: 5000
    < X-Ratelimit-Remaining: 4981
    < X-Ratelimit-Reset: 1747056766
    < X-Ratelimit-Resource: graphql
    < X-Ratelimit-Used: 19
    < X-Xss-Protection: 0
    
    {
      "data": {
        "repository": {
          "assignableUsers": {
            "nodes": [
              // users
            ],
            "pageInfo": {
              "hasNextPage": true,
              "endCursor": "Y3Vyc29yOnYyOpKrVGF2ZXJub3NoY2HOAWinPg=="
            }
          }
        }
      }
    }
    
    * Request took 1.123239792s
    * Request at 2025-05-12 14:34:01.078584 +0200 CEST m=+1.927227459
    * Request to https://api.github.com/graphql
    > POST /graphql HTTP/1.1
    > Host: api.github.com
    > Accept: application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview
    > Authorization: token xxx
    > Content-Length: 353
    > Content-Type: application/json
    > Graphql-Features: merge_queue
    > Time-Zone: Europe/Zurich
    > User-Agent: GitHub CLI 2.72.0
    
    GraphQL query:
    query RepositoryAssignableUsers($endCursor:String!$name:String!$owner:String!){repository(owner: $owner, name: $name){assignableUsers(first: 100, after: $endCursor){nodes{id,login,name},pageInfo{hasNextPage,endCursor}}}}
    GraphQL variables: {"endCursor":"Y3Vyc29yOnYyOpKrVGF2ZXJub3NoY2HOAWinPg==","name":"<repo>","owner":"<owner>"}
    
    < HTTP/2.0 200 OK
    < Access-Control-Allow-Origin: *
    < Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
    < Content-Security-Policy: default-src 'none'
    < Content-Type: application/json; charset=utf-8
    < Date: Mon, 12 May 2025 12:34:01 GMT
    < Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
    < Server: github.com
    < Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
    < Vary: Accept-Encoding, Accept, X-Requested-With
    < X-Accepted-Oauth-Scopes: repo
    < X-Content-Type-Options: nosniff
    < X-Frame-Options: deny
    < X-Github-Media-Type: github.v4; param=merge-info-preview.nebula-preview; format=json
    < X-Github-Request-Id: EB36:135BE5:123F31C6:12C54D64:6821EAB9
    < X-Oauth-Client-Id: xxx
    < X-Oauth-Scopes: gist, read:org, repo, workflow
    < X-Ratelimit-Limit: 5000
    < X-Ratelimit-Remaining: 4980
    < X-Ratelimit-Reset: 1747056766
    < X-Ratelimit-Resource: graphql
    < X-Ratelimit-Used: 20
    < X-Xss-Protection: 0
    
    {
      "data": {
        "repository": {
          "assignableUsers": {
            "nodes": [
             // users
            ],
            "pageInfo": {
              "hasNextPage": false,
              "endCursor": "Y3Vyc29yOnYyOpKneHVhbm1vY84EP3xg"
            }
          }
        }
      }
    }
    
    * Request took 384.987584ms
    * Request at 2025-05-12 14:34:01.495648 +0200 CEST m=+2.344290876
    * Request to https://api.github.com/graphql
    > POST /graphql HTTP/1.1
    > Host: api.github.com
    > Accept: application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview
    > Authorization: token xxx
    > Content-Length: 179
    > Content-Type: application/json
    > Graphql-Features: merge_queue
    > Time-Zone: Europe/Zurich
    > User-Agent: GitHub CLI 2.72.0
    
    GraphQL query:
    mutation PullRequestUpdate($input:UpdatePullRequestInput!){updatePullRequest(input: $input){__typename}}
    GraphQL variables: {"input":{"pullRequestId":"PR_kwDOKigQ4s6VckuE"}}
    
    < HTTP/2.0 200 OK
    < Access-Control-Allow-Origin: *
    < Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
    < Content-Security-Policy: default-src 'none'
    < Content-Type: application/json; charset=utf-8
    < Date: Mon, 12 May 2025 12:34:02 GMT
    < Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
    < Server: github.com
    < Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
    < Vary: Accept-Encoding, Accept, X-Requested-With
    < X-Accepted-Oauth-Scopes: repo
    < X-Content-Type-Options: nosniff
    < X-Frame-Options: deny
    < X-Github-Media-Type: github.v4; param=merge-info-preview.nebula-preview; format=json
    < X-Github-Request-Id: EB36:135BE5:123F341D:12C54FC7:6821EAB9
    < X-Oauth-Client-Id: xxx
    < X-Oauth-Scopes: gist, read:org, repo, workflow
    < X-Ratelimit-Limit: 5000
    < X-Ratelimit-Remaining: 4979
    < X-Ratelimit-Reset: 1747056766
    < X-Ratelimit-Resource: graphql
    < X-Ratelimit-Used: 21
    < X-Xss-Protection: 0
    
    {
      "data": {
        "updatePullRequest": {
          "__typename": "UpdatePullRequestPayload"
        }
      }
    }
    
    * Request took 581.4915ms
    https://github.com/<owner>/<repo>/pull/180
  6. babakks commented on May 12, 2025

    @babakks
    Member

    Thanks for the prompt reply, @tobias-tengler! 🙏

    This confirms what I'm referring to. There is no mutation request for updating the reviewers in the trail, just like what I observed on my end. It should have something like this near the end of the trail (which will drop all reviewers assigned).

    GraphQL query:
    mutation PullRequestUpdateRequestReviews($input:RequestReviewsInput!){requestReviews(input: $input){pullRequest{id}}}
    GraphQL variables: {"input":{"pullRequestId":"???","userIds":[],"teamIds":[],"union":false}}
    
    ...
    
    {
      "data": {
        "requestReviews": {
          "pullRequest": {
            "id": "???"
          }
        }
      }
    }

    To reiterate on your original issue, it's not with the teams. It happens whenever you're removing all reviewers regardless of their type (user or team). For example, if you have a PR with just a single user reviewer assigned to it, removing that reviewer would also fail.

  7. tobias-tengler commented on May 12, 2025

    @tobias-tengler
    Author

    I didn't even think that it could be related to the number of reviewers, because I thought there already was another reviewing team 🤦‍♂️
    Image
    Turns out it was just the preview of a team that would get added as CODEOWNERS once I published the PR.
    This also explains why it was working for me with another team, since I was adding that team in addition to the team I was trying to remove, so there actually would've been a team left, once the other team was removed.

    So it seems to be caused by the issue that you've found!

  8. babakks commented on May 12, 2025

    @babakks
    Member

    Turns out it was just the preview of a team that would get added as CODEOWNERS once I published the PR.
    This also explains why it was working for me with another team, since I was adding that team in addition to the team I was trying to remove, so there actually would've been a team left, once the other team was removed.

    Makes sense. Thanks for confirmation.

  9. self-assigned this
    on May 12, 2025
  10. linked a pull request that will close this issueFix bug when removing all PR reviewers #10975on May 13, 2025
  11. babakks commented on May 13, 2025

    @babakks
    Member

    @tobias-tengler, I have created #10975 to fix this issue.

    If you like, you can try building from source (the PR's branch) and check if the changes work for you.

  12. babakks commented on May 13, 2025

    @babakks
    Member

    @tobias-tengler The fix has been merged and will be available in the next release.

  13. changed the title [-]gh pr edit --remove-reviewer does not work for teams[/-] [+]gh pr edit --remove-reviewer does not work when removing all reviewers[/+] on May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreThis issue is not accepting PRs from outside contributorsgh-prrelating to the gh pr command

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions