Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix: show GitHub's reason when it refuses a pull request review #13293

Closedagomesp(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/13293/headopened View on GitHub

What 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".

  • VcsProcess keeps GitHub's validation reasons from a failed gh api call's error body as hostMessage on VcsProcessExitError. Only the errors strings (or their message fields) are kept, joined and bounded to 300 characters. Stderr and the rest of the body are still dropped.
  • GitHubCliCommandError.detail uses that reason when there is one, and falls back to "GitHub CLI command failed." as before.
  • PullRequestReviewForm shows the detail through readableFailure, 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:

  1. gh 2.100.0 prints only the top-level message on stderr (gh: Unprocessable Entity (HTTP 422)). When a body has message, parseErrorResponse never reads errors, so the reason is only in the JSON body on stdout, which the process boundary dropped.
  2. GitHubCliCommandError.detail was the constant "GitHub CLI command failed."
  3. 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

    2. 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).
    3. Review in Change Stack →

      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.ts
      • apps/server/src/sourceControl/GitHubCli.ts
      • apps/server/src/vcs/VcsProcess.test.ts
      • apps/server/src/vcs/VcsProcess.ts
      • apps/web/src/components/pullRequest/PullRequestReviewForm.tsx
      • packages/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.ts
      The VCS error model now carries an optional hostMessage. Failed gh api commands 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.ts
      GitHubCliCommandError.detail uses the host message when the cause is a VcsProcessExitError. 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.tsx
      When 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-rcks

      Merge Risk: ⚪ Minimal · up to 92f68

      Failed 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 nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring 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 nameStatusExplanation
      Title check✅ PassedThe title clearly and concisely describes the main change: showing GitHub's refusal reason when a pull request review fails.
      Description check✅ PassedThe 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✅ PassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes check✅ PassedCheck 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.
    4. 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.

    5. juliusmarminge closed this

Sign in to join this conversation.