Repository navigation
Conversation
CreatePullRequestReview only set Body when an event was given, so a pending review created with a body was saved with an empty body. GitHub then refuses to add the body later. Send the body whenever it is set. Fixes github#3948
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are identified, and the supplied evidence covers the pending-review body change with corresponding mocked GraphQL and granular output tests.
No open issues 🎉
What changed in this PR
Updates pull request review creation so a non-empty body is preserved when creating a pending review without an event, for both consolidated and granular review tools while leaving submitted-review behavior unchanged.
Changes:
- Include
Bodyin the GraphQL mutation for pending reviews with non-empty bodies. - Add mocked GraphQL coverage for pending review bodies.
- Update granular output expectations to verify body propagation.
| File | Description |
|---|---|
| pkg/github/typed_granular_pull_request_outputs_test.go | Updates granular review output expectations to verify that a pending review body reaches the mutation variables. |
| pkg/github/pullrequests.go | Preserves non-empty bodies when creating pending pull request reviews without an event. |
| pkg/github/pullrequests_test.go | Adds mocked GraphQL coverage confirming that pending review creation includes the body. |
Review effort: Lite (adaptive)
SoulmatelynchVFX
left a comment
There was a problem hiding this comment.
The create path change looks right, and since GranularCreatePullRequestReview funnels into the same CreatePullRequestReview (pullrequests_granular.go:387), both tool surfaces get it. Two things around it:
-
The new comment says "GitHub won't let it be added later", which is not what the API says.
updatePullRequestReviewexists and takespullRequestReviewIdplus a requiredbody(githubv4UpdatePullRequestReviewInput,input.go:4279-4283in the pinned client). What this server lacks is a method for it, not what GitHub allows. Worth rewording to "this tool has no way to set the body afterwards" — otherwise the comment reads as a permanent API limit and discourages adding anupdate_pendingmethod later. -
SubmitPendingPullRequestReviewstill sets the body unconditionally atpullrequests.go:2190:Body: newGQLStringlikePtr[githubv4.String](¶ms.Body). That helper only returns nil when the pointer is nil (:2624-2630), and¶ms.Bodyis never nil, sosubmit_pendingalways sendsbody: ""when the caller omits it. Before this PR a pending review could not hold a body, so that was harmless; after it, create-with-body followed by submit-without-body sends an explicit empty string over a body that was just stored. I did not verify server-side whether an explicit""clears it or is ignored, so I am not calling it a regression — but the two paths now disagree about what "no body" means, and either making submit nil-on-empty or documenting the intended behaviour would settle it.
I read the diff and the head files at refs/pull/3953/head; no Go toolchain here, so go test was not run, and the mocked mutation tests are the only evidence for the GraphQL shape.
Prepared with AI assistance.
Summary
pull_request_review_writewithmethod: "create"and noeventnow keepsbodyon the pending review. Before, the body was dropped without any error.Why
CreatePullRequestReviewsetBodyonly when aneventwas given. GitHub accepts a body on a pending review, but won't let you add one afterwards ("Could not edit a review with a missing body"), so the text was lost for good.Fixes #3948
What changed
CreatePullRequestReviewalso sendsBodywhen there is no event and the body is not empty. Nothing changes when an event is given.TestCreatePendingPullRequestReview: the mutation must include the body.create_pull_request_reviewcase intyped_granular_pull_request_outputs_test.gothat sent"body": "ignored"now checks that the body reaches the mutation variables.MCP impact
The schema is unchanged.
createwithouteventnow storesbodyon the pending review, for bothpull_request_review_writeandcreate_pull_request_review.Prompts tested (tool changes only)
Security / limits
Tool renaming
deprecated_tool_aliases.goLint & tests
./script/lint(ran gofmt and golangci-lint v2.14.0 directly: 0 issues)./script/test(go test ./...passes;go test -race ./pkg/githubpasses). Both new checks fail without the fix and pass with it.Docs
Skills