Skip to content

fix: include bodyless reviews in gh-pr-review output #18#19

Merged
four-bytes-robby merged 1 commit into
mainfrom
fix/18-gh-pr-review-bodyless
Jun 14, 2026
Merged

fix: include bodyless reviews in gh-pr-review output #18#19
four-bytes-robby merged 1 commit into
mainfrom
fix/18-gh-pr-review-bodyless

Conversation

@four-bytes-robby

@four-bytes-robby four-bytes-robby commented Jun 14, 2026

Copy link
Copy Markdown
Member

Closes #18

Problem

In src/tools/gh-pr-review.ts, reviews without a body (text) were filtered out on line 55:

const substantiveReviews = reviews.filter((r) => r.body && r.body.trim().length > 0);

This dropped formal review decisions like APPROVED or CHANGES_REQUESTED when the reviewer clicked without leaving a comment — making the tool unreliable for merge-gating.

Fix

  1. Removed the body-based filter — all reviews are now kept regardless of body presence
  2. Safe null handling — replaced unsafe review.body! non-null assertions with (review.body ?? '').trim() || '(no comment)'
  3. Empty body display — reviews without a body now show (no comment) instead of being dropped

Changes

Before After
Bodyless reviews silently dropped All reviews included
review.body! could crash at runtime Null-safe with fallback
"(no comment)" never shown Empty reviews show "(no comment)"

Testing

  • All 143 existing tests pass (0 failures)
  • No new dependencies required

Summary by cubic

Include bodyless PR reviews in gh-pr-review output so formal decisions (APPROVED, CHANGES_REQUESTED) are shown and merge gating is reliable. Adds null-safe body handling with a “(no comment)” fallback.

  • Bug Fixes
    • Removed the body-based filter; process all reviews.
    • Safe body formatting: (review.body ?? '').trim() with “(no comment)” and 500-char truncation.
    • Updated logging to report the full reviews.length.

Written for commit e26879d. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

Bug Fixes

  • Improved handling of empty pull request reviews by displaying "(no comment)" placeholder text
  • Enhanced text truncation logic for review content
  • Added early exit when no reviews or comments are available

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

Recent review info
Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 55df2fe5-61f7-46e4-b37e-d418d6839157

Commits

Reviewing files that changed from the base of the PR and between 993107a and e26879d.

Files selected for processing (1)
  • src/tools/gh-pr-review.ts

Walkthrough

Walkthrough

The ghPrReviewTool no longer filters reviews to only those with non-empty bodies. An early return is added when both comments and reviews are empty. Each review body is now trimmed and substituted with (no comment) when blank, and truncation uses the trimmed text. The debug payload reports total review count.

Changes

Review rendering logic fix

Layer / File(s) Summary
Review loop, early return, and debug payload
src/tools/gh-pr-review.ts
Replaces the substantiveReviews filter with direct iteration over all reviews, adds an early return when both comments and reviews are empty, trims each review body and defaults to (no comment) when blank, truncates using the trimmed text, and updates the gh_pr_review.success debug payload to use reviews.length instead of the former filtered count.

Estimated code review effort

3 (Moderate) | ~15 minutes

Possibly related issues

Finishing Touches
Generate docstrings
  • Create stacked PR
  • Commit on current branch
Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/18-gh-pr-review-bodyless
Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/18-gh-pr-review-bodyless

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


Comment @coderabbitai help to get the list of available commands and usage tips.

@four-bytes-robby four-bytes-robby merged commit 654cf7f into main Jun 14, 2026
4 of 5 checks passed
@four-bytes-robby four-bytes-robby deleted the fix/18-gh-pr-review-bodyless branch June 14, 2026 21:44
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.

fix: gh-pr-review tool loses review-state by filtering out bodyless reviews

1 participant