create_pull_request / update_pull_request return an error after the PR was created or edited (reviewer step fails)
維護者通常 2 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 57/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- github, go
研究方向
Start with pkg/github/pullrequests.go at PullRequests.Create and PullRequests.Edit, then follow their reviewer and draft-state error paths. Check how the tool formats successful results and errors so a partial failure can still report the PR number and URL alongside the failed follow-up. Done means create and update results preserve the successful PR change details when reviewer or draft steps fail, with coverage for those cases.
由索引模型根據 Issue 內容生成。
描述
Describe the bug
Both tools do several REST and GraphQL calls in sequence. If the reviewer request fails after the main call has succeeded, the tool returns isError with only the reviewer error:
create_pull_request: the PR has been created, but the error text has no PR number or URL. A caller that retries getsA pull request already exists for OWNER:head, and still has no number.update_pull_request: the title (and any other edited fields) has already been applied, but the result is an error, so a caller will assume nothing changed.
Conditions (tested): the reviewer request fails with GitHub 422 when the reviewer is the PR author ("Review cannot be requested from pull request author.") or is not a collaborator ("Reviews may only be requested from collaborators…"). A login that doesn't exist does not fail: GitHub accepts the request, the tool reports success, and the PR ends up with no requested reviewer.
Code (main 99d6d650, unchanged since v2.1.0): pkg/github/pullrequests.go:855 (PullRequests.Create), then :874-899 (RequestReviewers; on failure it returns NewGitHubAPIErrorResponse(ctx, "failed to request reviewers", …) (:882; the status variant at :899 is only reached for a non-2xx response without a Go error) and drops pr). For updates: :1090 (PullRequests.Edit), :1109-1173 (draft-state GraphQL mutation), then :1176-1209 (error return at :1190) (RequestReviewers, same error path). By code reading, the draft mutation step can partially apply the same way. Not tested.
Related: #3424 (open; clients cannot tell 'refused' from 'may have happened' for write errors).
Affected version
v2.1.0 (image sha256:f6056fc1…0f8a, commit 4bcdcdf8) and main nightly (image sha256:48bc16d0…338f, revision 99d6d650).
Steps to reproduce the behavior
(123 stands for the issue/PR number.)
- Call it with the authenticated user (the PR author) as reviewer:
Result:{"name":"create_pull_request","arguments":{"owner":"OWNER","repo":"REPO","title":"t","head":"feature","base":"scratch-base","body":"b","reviewers":["<authenticated user's login>"]}}isErrorwithfailed to request reviewers: Review cannot be requested from pull request author..GET /pulls?head=OWNER:featureshows the PR open. - Repeat the same call. Result:
failed to create pull request: Validation Failed … A pull request already exists for OWNER:feature. - Step 1 with
"reviewers":["octocat"](not a collaborator) behaves the same way. - Step 1 with
"reviewers":["no-such-user-zz9"]returns success{"id":"…","url":".../pull/N"}, andrequested_reviewersis empty. - Call:
Result:{"name":"update_pull_request","arguments":{"owner":"OWNER","repo":"REPO","pullNumber":123,"title":"changed","reviewers":["<author login>"]}}isError(failed to request reviewers: …), butGET /pulls/Nshowstitle: "changed". A non-collaborator reviewer behaves the same.
Expected vs actual behavior
Expected: when the PR was created or edited, the result says so and includes the number and URL, with the reviewer failure reported as a warning or partial failure ("PR N created; requesting reviewers failed: …").
Actual: a bare error, which reads as if nothing happened. On create, the PR number is lost, and a retry can't recover it.
Suggested fix: after a successful create or edit, don't return early on reviewer or draft errors. Return the normal result with the PR number and URL, plus a message listing which follow-up steps failed. Optionally, validate reviewers (author or collaborator) before creating.
Logs
create_pull_request reviewers=[author] -> ISERROR failed to request reviewers: Review cannot be requested from pull request author. (PR created)
retry -> ISERROR failed to create pull request: Validation Failed / PullRequest (custom): A pull request already exists for OWNER:feature.
create_pull_request reviewers=[octocat] -> ISERROR failed to request reviewers: Reviews may only be requested from collaborators. … (PR created)
create_pull_request reviewers=[no-such-user] -> OK {"id":"…","url":"…/pull/N"}; requested_reviewers []
update_pull_request title+reviewers=[author] -> ISERROR failed to request reviewers: …; title after = "changed"
Same results on v2.1.0 and main.
Found during an independent audit of v2.1.0 on a throwaway org and private test repo. Prepared with AI assistance (Claude Code); reproduced by two independent test runs before filing.
- 主要語言
- Go
- 星號
- 34.2k
- 分支
- 5.3k
- 平均合併
- 5 天 18 小時
- 30 天內合併 PR
- 13
環境準備
- 提供 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
github/github-mcp-server 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 69/100
github/github-mcp-server#3760 ·
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 82/100
github/github-mcp-server#3758 ·
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 69/100
github/github-mcp-server#3729 ·
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 65/100
github/github-mcp-server#3722 ·
維護者通常 2 天內回覆
-
Insiders Feedback: PR created UI doesn't link to the PR可能已有人在做 @genius-0963 於 5 天前認領。 未關閉bug insiders user-experience
難度 2/5 1-3 小時 新手友好度 65/100
github/github-mcp-server#3658 ·
維護者通常 2 天內回覆
查看 github/github-mcp-server 的全部 Issue
相似的 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 72/100
open-feature/flagd-schemas#237 ·
-
enhancement
難度 2/5 1-3 小時 新手友好度 72/100
superplanehq/superplane#9234 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 65/100
betterleaks/betterleaks#469 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 82/100
prime-radiant-inc/evener#5901 ·
維護者通常 1 天內回覆