Skip to content

Commit bb3825a

Browse files
bryan-coxclaude
andauthored
fix: review-agent dedup bot review bodies with inline comments (#78134)
The comment analyzer flags review bodies and review threads independently. When an approved bot (e.g. CodeRabbit) submits a review with both a body and inline comments, both get flagged as separate needs_attention items. Claude addresses each independently, producing duplicate responses. Observed on openshift/hypershift#8280: CodeRabbit review #4146142149 had a body ("Actionable comments posted: 1") and one inline comment about trust bundle sync stalling. The analyzer returned both as separate items. Claude posted an inline reply to the thread at 11:04:10Z, then two issue comments at 11:04:20Z and 11:06:19Z — both "Re: #pullrequestreview-4146142149" with overlapping content. Root cause: analyze_review_bodies uses per-comment reply matching (checking if any bot comment references the review ID/URL). Since no bot comment had yet referenced review 4146142149, it was flagged. Meanwhile, analyze_review_threads independently flagged the same review's inline thread. Both items entered the needs_attention list. Fix: add comments { totalCount } to the reviews GraphQL query and skip approved bot review bodies when inline comments exist. Bot review bodies are machine-generated summaries of their inline comments (already handled by analyze_review_threads). Human review bodies are always kept since they often contain distinct feedback. Verified against PR #8280: - CodeRabbit review 4146142149: SKIPPED (approved_bot, inline_count=1) - CodeRabbit review 4138831511: SKIPPED (approved_bot, inline_count=1) - csrwng review 4144456157: KEPT (human, inline_count=2) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8a83a38 commit bb3825a

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

ci-operator/step-registry/hypershift/review-agent/process/hypershift-review-agent-process-commands.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ def analyze_review_bodies(pr_number: int) -> list[dict]:
417417
body
418418
state
419419
submittedAt
420+
comments(first: 0) { totalCount }
420421
}
421422
}
422423
}
@@ -463,6 +464,15 @@ def analyze_review_bodies(pr_number: int) -> list[dict]:
463464
if not is_authorized_author(author):
464465
continue
465466
467+
# Skip approved bot review bodies when inline comments exist.
468+
# Bot review bodies (e.g. CodeRabbit's "Actionable comments posted: N")
469+
# are machine-generated summaries of their inline comments. Those inline
470+
# comments are already handled by analyze_review_threads, so flagging the
471+
# body too causes Claude to address the same feedback twice.
472+
inline_count = review.get("comments", {}).get("totalCount", 0)
473+
if is_approved_bot(author) and inline_count > 0:
474+
continue
475+
466476
review_id = review["id"]
467477
review_url = review.get("url", "")
468478

0 commit comments

Comments
 (0)