Skip to content

fix: review-agent dedup bot review bodies with inline comments#78134

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
bryan-cox:fix-review-agent-bot-body-dedup
Apr 21, 2026
Merged

fix: review-agent dedup bot review bodies with inline comments#78134
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
bryan-cox:fix-review-agent-bot-body-dedup

Conversation

@bryan-cox

@bryan-cox bryan-cox commented Apr 21, 2026

Copy link
Copy Markdown
Member

Summary

  • Skip approved bot (e.g. CodeRabbit) review bodies in the comment analyzer when the review also has inline comments, since those are already handled by analyze_review_threads
  • Adds comments(first: 0) { totalCount } to the reviews GraphQL query to check for inline comment existence

Problem

The comment analyzer has three independent functions: analyze_review_threads, analyze_review_bodies, and analyze_issue_comments. When a bot like CodeRabbit submits a review with both a body ("Actionable comments posted: 1") and inline code 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 and one inline comment about trust bundle sync stalling. The analyzer flagged both. Claude posted:

Fix

Skip approved bot review bodies when totalCount > 0 inline comments exist. Bot review bodies are machine-generated summaries of their inline comments. Human review bodies are always kept since they often contain distinct architectural feedback.

Verified against PR #8280 data:

Review Author Type inline_count Result
4146142149 coderabbitai approved_bot 1 SKIPPED
4138831511 coderabbitai approved_bot 1 SKIPPED
4144456157 csrwng human 2 KEPT

Test plan

  • Verify review-agent periodic job does not post duplicate responses for CodeRabbit reviews with inline comments
  • Verify human review bodies (e.g. csrwng) are still addressed even when inline comments exist

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved pull request review processing to eliminate duplicate flagging when inline review comments are present, reducing unnecessary notifications and redundant handling.

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 openshift#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 <[email protected]>
@openshift-ci openshift-ci Bot requested review from csrwng and enxebre April 21, 2026 18:04
@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 21, 2026
@coderabbitai

coderabbitai Bot commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 6debfeb0-1a9f-465d-a523-8d0821a0f60e

📥 Commits

Reviewing files that changed from the base of the PR and between 451fac7 and aecb3be.

📒 Files selected for processing (1)
  • ci-operator/step-registry/hypershift/review-agent/process/hypershift-review-agent-process-commands.sh

Walkthrough

A bash script is modified to expand a GraphQL query to fetch inline comment counts and add conditional logic that skips flagging review bodies when approved bots have corresponding inline comments, reducing duplicate handling.

Changes

Cohort / File(s) Summary
GraphQL Query and Review Processing Logic
ci-operator/step-registry/hypershift/review-agent/process/hypershift-review-agent-process-commands.sh
Expanded GraphQL query in analyze_review_bodies() to fetch comments(first: 0) { totalCount } for each review. Added conditional logic to skip flagging review bodies when approved-bot reviews have inline comments present (inline_count > 0), eliminating duplicated handling between body and inline thread analysis.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 12
✅ Passed checks (12 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: deduplicating bot review bodies that have inline comments, which is the core fix in this PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Stable And Deterministic Test Names ✅ Passed This PR modifies a shell script for CI operator steps, not Ginkgo test files, so the Ginkgo test name stability check is not applicable.
Test Structure And Quality ✅ Passed The custom check for Ginkgo test structure is not applicable to this PR. The PR only modifies a bash shell script, not Ginkgo test code.
Microshift Test Compatibility ✅ Passed PR modifies bash CI script, not adding Ginkgo e2e tests; check condition for test code evaluation does not apply.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR modifies CI automation script for GitHub PR comment analysis, not Ginkgo e2e tests or test infrastructure.
Topology-Aware Scheduling Compatibility ✅ Passed PR modifies a CI/CD automation script for PR comment analysis, not deployment manifests or scheduling constraints affecting OpenShift topology compatibility.
Ote Binary Stdout Contract ✅ Passed The modified file is a bash shell script containing embedded Python code for PR analysis, not a Go binary designed to communicate with openshift-tests.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed This check is not applicable to this PR. The custom check verifies Ginkgo e2e tests for IPv6 and disconnected network compatibility, but this PR only modifies a shell script for CI/CD review processing.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

[REHEARSALNOTIFIER]
@bryan-cox: the pj-rehearse plugin accommodates running rehearsal tests for the changes in this PR. Expand 'Interacting with pj-rehearse' for usage details. The following rehearsable tests have been affected by this change:

Test name Repo Type Reason
pull-ci-openshift-hypershift-main-address-review-comments openshift/hypershift presubmit Registry content changed
pull-ci-openshift-hypershift-release-5.1-address-review-comments openshift/hypershift presubmit Registry content changed
pull-ci-openshift-hypershift-release-5.0-address-review-comments openshift/hypershift presubmit Registry content changed
pull-ci-openshift-hypershift-release-4.23-address-review-comments openshift/hypershift presubmit Registry content changed
pull-ci-openshift-hypershift-release-4.22-address-review-comments openshift/hypershift presubmit Registry content changed
periodic-ci-openshift-hypershift-main-periodic-review-agent N/A periodic Registry content changed
periodic-ci-openshift-hypershift-release-4.22-periodic-review-agent N/A periodic Registry content changed

Prior to this PR being merged, you will need to either run and acknowledge or opt to skip these rehearsals.

Interacting with pj-rehearse

Comment: /pj-rehearse to run up to 5 rehearsals
Comment: /pj-rehearse skip to opt-out of rehearsals
Comment: /pj-rehearse {test-name}, with each test separated by a space, to run one or more specific rehearsals
Comment: /pj-rehearse more to run up to 10 rehearsals
Comment: /pj-rehearse max to run up to 25 rehearsals
Comment: /pj-rehearse auto-ack to run up to 5 rehearsals, and add the rehearsals-ack label on success
Comment: /pj-rehearse list to get an up-to-date list of affected jobs
Comment: /pj-rehearse abort to abort all active rehearsals
Comment: /pj-rehearse network-access-allowed to allow rehearsals of tests that have the restrict_network_access field set to false. This must be executed by an openshift org member who is not the PR author

Once you are satisfied with the results of the rehearsals, comment: /pj-rehearse ack to unblock merge. When the rehearsals-ack label is present on your PR, merge will no longer be blocked by rehearsals.
If you would like the rehearsals-ack label removed, comment: /pj-rehearse reject to re-block merging.

@bryan-cox

Copy link
Copy Markdown
Member Author

/pj-rehearse skip

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

@bryan-cox: now processing your pj-rehearse request. Please allow up to 10 minutes for jobs to trigger or cancel.

@openshift-merge-bot openshift-merge-bot Bot added the rehearsals-ack Signifies that rehearsal jobs have been acknowledged label Apr 21, 2026
@csrwng

csrwng commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Apr 21, 2026
@openshift-ci

openshift-ci Bot commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bryan-cox, csrwng

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci

openshift-ci Bot commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

@bryan-cox: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot Bot merged commit bb3825a into openshift:main Apr 21, 2026
10 checks passed
Prucek pushed a commit to Prucek/release that referenced this pull request Apr 29, 2026
…hift#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 openshift#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 <[email protected]>
BATMAN-JD pushed a commit to BATMAN-JD/release that referenced this pull request May 1, 2026
…hift#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 openshift#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 <[email protected]>
fjglira pushed a commit to fjglira/release that referenced this pull request Jun 3, 2026
…hift#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 openshift#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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. rehearsals-ack Signifies that rehearsal jobs have been acknowledged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants