fix: show GitHub's reason when it refuses a pull request review #13293
main fromrefs/pull/13293/head·opened View on GitHubWhat Changed#
When GitHub refuses a pull request review, the error toast now says why, e.g. "Line could not be resolved", instead of only "The review could not be submitted".
VcsProcesskeeps GitHub's validation reasons from a failedgh apicall's error body ashostMessageonVcsProcessExitError. Only theerrorsstrings (or theirmessagefields) are kept, joined and bounded to 300 characters. Stderr and the rest of the body are still dropped.GitHubCliCommandError.detailuses that reason when there is one, and falls back to "GitHub CLI command failed." as before.PullRequestReviewFormshows the detail throughreadableFailure, like the merge, label and reviewer actions already do. The draft is still kept.
Why#
Part of #12549. This is step 3 of the triage. GitHub refuses the whole review over one comment it cannot place, and its reason gets lost at three layers:
gh2.100.0 prints only the top-level message on stderr (gh: Unprocessable Entity (HTTP 422)). When a body hasmessage,parseErrorResponsenever readserrors, so the reason is only in the JSON body on stdout, which the process boundary dropped.GitHubCliCommandError.detailwas the constant "GitHub CLI command failed."- The review form toasted a fixed title and ignored the detail.
The reason comes from the body and not from stderr because stderr never contains it. It is extracted at the process boundary because that is the last point where the body still exists, and that layer already classifies failures before discarding output. Only GitHub's own sentences come out, never the raw body or stderr.
Only gh api is read, because it is the only gh command that prints the response body. Other
failed gh api calls that GitHub answers with a validation reason now carry it too, since they
share GitHubCliCommandError. Authentication, rate-limit and not-found failures are unchanged.
UI Changes#
The review failure toast gains a description line.
- Before: title "The review could not be submitted", no description.
- After: the same title, plus GitHub's reason, e.g. "Line could not be resolved". Without a reason, it shows "Your draft is kept, so you can send it again."
No screenshot: reproducing it requires a real pull request that GitHub refuses a review on.
Checklist#
- This PR is small and focused
- I explained what changed and why
- I included before/after screenshots for any UI changes (the text change is described above)
- I included a video for animation/interaction changes (n/a)
Tests: VcsProcess.test.ts covers string errors, error objects, a non-JSON body, errors without a
message, a non-gh command, a gh command other than api, and the length bound. GitHubCli.test.ts covers the detail with and
without a reason. Both fail on main. Ran fmt, lint, and typecheck on contracts, server and
web. All of apps/web passes (5,390), and so do apps/server and contracts, except 3
ServerEnvironment.test.ts cases that fail on main too, in my environment.
Model: Claude Opus 5.5. Harness: Claude Code (via T3 Code).
Summary by CodeRabbit#
- Bug Fixes
- GitHub API errors now display the rejection details provided by GitHub, making validation issues easier to understand.
- When submitting a pull request review fails, the error notification now includes a readable explanation and confirms that your draft is kept so you can try again.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
85e34a94-899c-49c9-9649-7081d8dedbfa📥 Commits
Reviewing files that changed from the base of the PR and between f5ef0ddb90a8c36584e181b1913e7b8a5df30ffc and 92f68c68fdb14690ef92135561edeee94fc13308.
📒 Files selected for processing (6)
apps/server/src/sourceControl/GitHubCli.test.tsapps/server/src/sourceControl/GitHubCli.tsapps/server/src/vcs/VcsProcess.test.tsapps/server/src/vcs/VcsProcess.tsapps/web/src/components/pullRequest/PullRequestReviewForm.tsxpackages/contracts/src/vcs.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📝 Walkthrough
Walkthrough#
The change adds host-provided validation reasons to VCS process errors, surfaces them in GitHub CLI error details, and adds readable failure descriptions to pull request review submission error toasts.
Changes#
GitHub error message surfacing
Layer / File(s) Summary Capture GitHub API refusal reasons
packages/contracts/src/vcs.ts,apps/server/src/vcs/VcsProcess.ts,apps/server/src/vcs/VcsProcess.test.tsThe VCS error model now carries an optional hostMessage. Failedgh apicommands extract validation messages from JSON output, join them with;, and cap the result at 300 characters. Tests cover extraction, cases without a usable message, and the length limit.Show host messages in CLI errors
apps/server/src/sourceControl/GitHubCli.ts,apps/server/src/sourceControl/GitHubCli.test.tsGitHubCliCommandError.detailuses the host message when the cause is aVcsProcessExitError. It uses the existing generic detail when no host message is available.Add failure details to review-form toast
apps/web/src/components/pullRequest/PullRequestReviewForm.tsxWhen review submission fails, the error toast includes a readable failure description and the fallback text, “Your draft is kept, so you can send it again.” Estimated code review effort: 3 (Moderate) | ~20 minutes
Suggested reviewers:
bil0000,juliusmarminge,maria-rcksMerge Risk: ⚪ Minimal · up to
92f68Failed review submissions can show GitHub’s reason when available and retain a fallback message otherwise. No actionable merge risk is established.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)#
Check name Status Explanation Resolution Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold. ✅ Passed checks (4 passed)
Check name Status Explanation Title check ✅ Passed The title clearly and concisely describes the main change: showing GitHub's refusal reason when a pull request review fails. Description check ✅ Passed The description is complete and relevant. It explains what changed, why the change is needed, the UI impact, testing, and checklist status. It also documents why screenshots are not provided and inclu… Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request. Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request. - Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create a new PR
Comment `@coderabbitai help` to get the list of available commands.Note
This comment is posted by Julius' dot
Closing for missing UI verification evidence. The PR explicitly omits screenshots of the changed review-failure toast. Please add before/after screenshots showing GitHub's validation reason reaching the toast and the retained draft, then request reconsideration. The server and client test results do not replace the required UI evidence.
juliusmarminge closed this
Sign in to join this conversation.
Approvability#
Verdict: Not approved
Macroscope's review found this PR not approvable — The functional change is a focused error-reporting fix that safely carries bounded GitHub validation messages into the review toast. However, the test additions also introduce line-level suppressions for a static-analysis diagnostic, so human review is required.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).