gh pr edit --add-reviewer can remove reviewers assigned automatically by GitHub

Abierto
#14,937 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
57/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
github, go
Área
api, cli

Línea de trabajo

Read pkg/cmd/pr/edit/edit.go around the reviewer update using union: false, then trace the add-only and removal paths. Check the existing tests for gh pr edit and add coverage for preserving a concurrently assigned reviewer during an add-only request. Done means additions preserve existing and concurrent requests while removal and interactive deselection still work.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug gh-pr priority-3

Describe the bug

gh pr edit --add-reviewer can remove a reviewer selected by a team's automatic review assignment.

Observed with gh 2.103.3 on github.com. After requesting a team configured for round-robin assignment, the PR timeline showed an individual reviewer being requested and then removed one second later. Only the team request remained, where-as the (round-robin picked) individual should've been assigned as well.

The command should add review requests without removing requests created concurrently by GitHub.

Steps to reproduce

  1. Configure a GitHub team with automatic review assignment enabled.

  2. Create a draft PR.

  3. Mark it ready and immediately request the team:

    gh pr ready <number> --repo <owner>/<repository>
    
    gh pr edit <number> --repo <owner>/<repository> \
      --add-reviewer <organization>/<team>
    
  4. Inspect the PR timeline and requested reviewers.

This appears timing-dependent. The observed timeline was:

09:02:53  Requested review from the team.
09:02:53  Requested review from an automatically selected team member.
09:02:54  Removed the individual review request.

No explicit reviewer-removal command was run.

Expected behavior

--add-reviewer adds the supplied reviewers while preserving existing and concurrently created review requests.

Actual behavior

An automatically assigned individual reviewer can be removed.

Suspected cause

The implementation reads existing review requests, merges additions locally, then replaces the server's reviewer list using union: false.

A review request created after the initial read can therefore be omitted from the replacement list. This mechanism is consistent with the observed timeline.

Possible fix

For non-interactive, add-only operations, send only the requested additions with union: true.

Changing every reviewer update to union: true would break --remove-reviewer and interactive deselection, so those paths need to retain replacement behavior or use separate removal operations.

Related issues

  • #7721: reviewer removal caused by an empty --add-reviewer argument.
  • #9604: interactions between reviewer requests and automatic code-owner assignment during PR creation.
Lenguaje dominante
Go
Estrellas
47.4k
Forks
9.5k
Merge medio
18 h 34 min
PR fusionados (30 d)
70

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de cli/cli

Todos los issues de cli/cli

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.