Fork PRs created from the GitHub Copilot app can't enable "Allow edits by maintainers" (`maintainer_can_modify` silently ignored)

Ouverte
#5,605 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
45/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Active
Stack technique
github, github-actions, python

Piste de recherche

Start by tracing how the Copilot app provides GH_TOKEN to remote sessions and how the CLI creates fork pull requests with gh pr create. Compare the token permissions and the maintainer_can_modify value during creation and update; the issue does not name source files or tests. Done means fork PRs have maintainer edits enabled by default, or the app clearly reports when its token cannot set the option.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

area:authentication
Describe the bug

When the Copilot agent opens a PR from the user's fork into an upstream repo (gh pr create --head <user>:<branch>, using the GH_TOKEN the GitHub Copilot app provides), the PR is created with "Allow edits by maintainers" off. Trying to turn it on afterwards with PATCH /repos/{owner}/{repo}/pulls/{n} and maintainer_can_modify=true returns success but leaves the value false. gh pr edit on the same PR fails with Resource not accessible by integration.

The token appears to be a GitHub App user token (X-OAuth-Scopes is empty). My guess is that it lacks the access to the fork that this setting needs, and GitHub drops the field without reporting an error.

Impact: maintainer and bot workflows can't push to these PRs. For example, our /fix:link-cache bot falls back to pushing to refs/pull/<n>/head and fails with ! [remote rejected] HEAD -> refs/pull/12889/head (deny updating a hidden ref).

Affected version

Copilot CLI 1.0.109, run by the GitHub Copilot app in a remote (cloud) session.

Steps to reproduce the behavior
  1. In a Copilot app session on an upstream repo where you have a fork, have the agent push a branch to the fork and run gh pr create -R <upstream> --head <user>:<branch> .... Maintainer edits aren't turned off (no --no-maintainer-edit).
  2. Run gh pr view <n> --json maintainerCanModify and get false.
  3. Run gh api -X PATCH repos/<upstream>/pulls/<n> -F maintainer_can_modify=true --jq .maintainer_can_modify. It exits 0 and prints false.
  4. Example: open-telemetry/opentelemetry.io#12889, which has maintainerCanModify: false, and its failed bot push in https://github.com/open-telemetry/opentelemetry.io/actions/runs/46047662218
Expected behavior

Fork PRs created by the agent have "Allow edits by maintainers" on, matching gh pr create's default. If the token can't set it, the agent or app reports that instead of failing silently. A setting to choose the default would also help.

Additional context
  • I couldn't find a setting for this in the app's .github/github-app.yml reference or in the cloud agent customization docs.
  • Workaround: tick the checkbox by hand on each PR.
  • Possibly related: PyGithub/PyGithub#3297 (discussion: maintainer_can_modify has no effect).
  • Side note: in the same session, gh issue create -R github/copilot-cli with the app's token also failed with Resource not accessible by integration (createIssue).
Langage dominant
Python
Étoiles
11.5k
Forks
2k
Merge moyen
6 h 34 min
PR mergées (30 j)
3

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de github/copilot-cli

Toutes les issues de github/copilot-cli

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.