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

未關閉
#5,605 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
45/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
github, github-actions, python

研究方向

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.

由索引模型根據 Issue 內容生成。

描述

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).
主要語言
Python
星號
11.5k
分支
2k
平均合併
6 小時 34 分鐘
30 天內合併 PR
3

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

github/copilot-cli 的其他 Issue

查看 github/copilot-cli 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。