Skip to content

fix: postPrReview falls back to a plain comment when self-review is blocked#99

Merged
lsfera merged 1 commit into
mainfrom
fix/review-self-author-fallback
Jul 3, 2026
Merged

fix: postPrReview falls back to a plain comment when self-review is blocked#99
lsfera merged 1 commit into
mainfrom
fix/review-self-author-fallback

Conversation

@lsfera

@lsfera lsfera commented Jul 3, 2026

Copy link
Copy Markdown
Owner

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 api call:

{"message":"Unprocessable Entity","errors":["Review Can not request changes on your own pull request"],...}

GitHub's REST API rejects REQUEST_CHANGES reviews from a PR's own author — the normal case for this repo, since the orchestrator's GH_TOKEN both opens every PR and posts its AI review. Both postPrReview'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 every changes-requested verdict 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

postPrReview now tries, in order:

  1. inline review (existing)
  2. body-only review, no inline comments (existing)
  3. new: a plain PR comment with the same verdict + summary + per-file comments (formatReviewAsComment, a new pure helper) — plain comments have no self-review restriction

Test plan

…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.
@lsfera lsfera merged commit 54bca0f into main Jul 3, 2026
3 checks passed
@lsfera lsfera deleted the fix/review-self-author-fallback branch July 3, 2026 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant