Skip to content

Commit 3a4684d

Browse files
Document why requestReviewsByLogin is the only path for bot reviewers
Spent a session re-verifying every alternative; recording the findings inline so future maintainers don't repeat them. The bot's REST login (Copilot, from GET user/175728472) is rejected by /requested_reviewers because that endpoint validates type=User only. GraphQL requestReviews rejects bot node IDs at schema level. The UI 🔄 button hits a github.com Rails endpoint that needs a session cookie + CSRF — gh's OAuth token cannot satisfy it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 98e18d1 commit 3a4684d

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

skills/copilot-pr-autopilot/scripts/01-request-review.ps1

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,18 @@ $beforeId = $beforeEvent.Id
185185
# ---------- trigger via GraphQL requestReviewsByLogin ----------
186186

187187
$mut = 'mutation($p:ID!){requestReviewsByLogin(input:{pullRequestId:$p,botLogins:["copilot-pull-request-reviewer"]}){pullRequest{number}}}'
188+
# Why this path and not REST or `requestReviews`? Verified end-to-end:
189+
# - REST POST /pulls/{n}/requested_reviewers `reviewers:["Copilot"]`
190+
# (the bot's REST login per `GET user/175728472`) → 404. The REST
191+
# `reviewers` field accepts type=User only; bots are rejected even
192+
# when the login resolves to a Bot record.
193+
# - GraphQL `requestReviews` rejects bot node IDs ("Could not resolve
194+
# to User node with the global id of 'BOT_…'") at schema level.
195+
# - `requestReviewsByLogin.botLogins` is the ONLY public path for bot
196+
# reviewers; trade-off is that it requires repo Triage/Write.
197+
# - The UI 🔄 button uses a github.com Rails endpoint with a session
198+
# cookie + CSRF that gh's OAuth token cannot satisfy.
199+
# Catch the auth-gated case below and surface the two real workarounds.
188200
$r = Invoke-Gh -GhArgs @('api','graphql','-f',"query=$mut",'-f',"p=$prNodeId")
189201
if ($r.ExitCode -ne 0) {
190202
$isPermErr = ($r.Stderr -match '(?i)does not have (the )?correct permissions|forbidden|HTTP 403')

0 commit comments

Comments
 (0)