fix: postPrReview falls back to a plain comment when self-review is blocked#99
Merged
Conversation
…locked
Live-confirmed root cause: GitHub's REST API rejects REQUEST_CHANGES reviews
from a PR's own author ("Review Can not request changes on your own pull
request", HTTP 422) — the normal case for this repo, since the orchestrator's
GH_TOKEN both opens every PR and posts its AI review. Both the inline-comment
attempt and the existing body-only fallback hit the identical 422, so every
changes-requested verdict has silently failed to post, historically. Doesn't
break safety (auto-merge is gated by the reducer's own in-memory state, not
GitHub's review status) but means the AI's feedback never actually reached a
human.
postPrReview now tries, in order: (1) inline review, (2) body-only review,
(3) a plain PR comment carrying the same verdict + summary + per-file
comments (formatReviewAsComment) — a plain comment has no self-review
restriction. Live-verified against PR #96: both review attempts 422'd exactly
as predicted, and the comment posted successfully.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
While manually re-triggering a review on PR #96 (to validate #98's reviewer-auth fix), posting the review result to GitHub failed. Root cause, confirmed via a raw
gh apicall:GitHub's REST API rejects
REQUEST_CHANGESreviews from a PR's own author — the normal case for this repo, since the orchestrator'sGH_TOKENboth opens every PR and posts its AI review. BothpostPrReview's inline-comment attempt and its existing body-only fallback hit the identical 422 (the restriction is about the review event type, not inline positioning), so everychanges-requestedverdict has silently failed to post, historically. This doesn't compromise safety — auto-merge is gated by the reducer's own in-memory state, not GitHub's review status — but it does mean the AI's feedback has never actually been visible to a human until I posted one manually as a workaround.Change
postPrReviewnow tries, in order:formatReviewAsComment, a new pure helper) — plain comments have no self-review restrictionTest plan
npm test— 209/209 passing (3 new tests forformatReviewAsComment)tsc --noEmit— clean