Skip to content

fix(utils): improve address-reviews reliability#425

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift-eng:mainfrom
bryan-cox:improve-address-reviews
Apr 20, 2026
Merged

fix(utils): improve address-reviews reliability#425
openshift-merge-bot[bot] merged 1 commit into
openshift-eng:mainfrom
bryan-cox:improve-address-reviews

Conversation

@bryan-cox

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

Copy link
Copy Markdown
Contributor

Summary

Addresses three failures reported by Alberto on hypershift PRs (PR 8249, PR 7810, PR 8223):

  • Outdated comment filter: Comments on stale diff hunks (line=null, original_line≠null) were incorrectly filtered out. Now only truly orphaned comments (both null) are discarded.
  • ACTION_INSTRUCTION category: Repo-level instructions ("please rebase", "make sure verify passes") now have dedicated handling, processed before code changes. Rebase dynamically detects the correct remote and base branch.
  • Pre-push verification (Step 3.5): Detects available verification commands (make verifymake lintgo build/vetnpm lint), blocks push on failure, max 3 retries with 15-minute timeout.

Also includes original_line in both first-pass and second-pass API queries, retry bounds on verification, and a note about post-rebase line number staleness.

Test plan

  • Run /utils:address-reviews on a PR with outdated inline comments (line=null, original_line set) — verify they are fetched and addressed
  • Run on a PR with a "please rebase" comment — verify rebase happens before code changes
  • Run on a PR where make verify fails — verify it blocks push and retries

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Bumped plugin version to 0.0.9
  • New Features

    • Improved PR review comment handling to preserve comments tied to original lines and better distinguish stale-hunk vs orphaned comments
    • Added an “Action Instructions” category for repo operations (rebase, verify, squash, run tests)
    • Added a pre-push verification step with automated retry (up to 3 attempts) and block-on-failure behavior

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 20, 2026
@bryan-cox bryan-cox force-pushed the improve-address-reviews branch from a0e5bb8 to 61791c6 Compare April 20, 2026 15:04
@coderabbitai

coderabbitai Bot commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

The utils plugin version is bumped from 0.0.8 to 0.0.9 across metadata and manifest files. Documentation for the address-reviews command was expanded to handle original_line for stale comments, add an ACTION_INSTRUCTION category, and introduce a pre-push verification step with retries and timeout.

Changes

Cohort / File(s) Summary
Plugin Version Updates
​.claude-plugin/marketplace.json, docs/data.json, plugins/utils/.claude-plugin/plugin.json
Plugin utils version updated from 0.0.80.0.9 in marketplace, docs, and plugin manifest files.
Address Reviews Command Documentation
plugins/utils/commands/address-reviews.md
Documentation extended: preserve comments with original_line, include line/original_line in kept-comment data, add ACTION_INSTRUCTION category and prioritize its handling, add "Action Instructions" step (rebase flow) and a "Step 3.5: Pre-Push Verification" with 15-minute timeout, up to 3 fix-and-retry cycles, and blocking on persistent failure.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Git Push Safety Rules ❌ Error The address-reviews.md file contains git push --force-with-lease at line 262 without user confirmation, violating Git Push Safety Rules. Replace --force-with-lease with regular git push and add explicit user confirmation requirement before push execution.
✅ Passed checks (7 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main objective of the PR, which is to improve the reliability of the address-reviews command through multiple bug fixes and feature additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
No Real People Names In Style References ✅ Passed The pull request does not contain references to real people's names used as style references in the plugin command documentation.
No Assumed Git Remote Names ✅ Passed No hardcoded git remote names found in address-reviews.md; PR implements dynamic remote discovery as documented.
No Untrusted Mcp Servers ✅ Passed PR introduces only version bumps and documentation updates with no new MCP server installations or untrusted external dependencies.
Ai-Helpers Overlap Detection ✅ Passed PR modifies only the existing address-reviews command to improve reliability; no new overlapping commands, skills, or agents are introduced.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@plugins/utils/commands/address-reviews.md`:
- Around line 225-231: Add a language identifier (e.g., text) to the two fenced
code blocks that show verification logs: the block containing "✅ Verification
passed (make verify)" and the block containing "❌ Verification failed — fixing
issues before push" so the code fences become ```text ... ``` to satisfy
markdownlint MD040.
- Around line 215-221: The documentation claims a 15-minute timeout for "Run
verification" but doesn't enforce it; update the flow text around the "make
verify 2>&1" example and the retry logic so the verification command is
explicitly executed with a 15-minute timeout wrapper (e.g., shell timeout or
equivalent in the automation runner), ensure failures/timeouts are captured as
errors, and modify the retry handling to treat a timeout as a failed attempt and
include the last timeout/error text in the final message "Verification continues
to fail after 3 attempts. Last error: [error]. Manual intervention needed."
- Around line 136-140: The remote detection using grep
'openshift/hypershift\|upstream' is repo-specific; change the logic around
BASE_REMOTE so it picks a sensible remote in any repo: prefer a remote literally
named "upstream" if present, otherwise prefer "origin", and as a final fallback
pick the first remote returned by git remote (use commands around BASE_REMOTE
and git remote -v/gist of git remote). Update the BASE_REMOTE assignment and the
comment to reflect this new order, keeping the later git fetch "$BASE_REMOTE" &&
git rebase "$BASE_REMOTE/$BASE_BRANCH" unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0a82b5a3-4802-4de7-a0a0-9c9131316ab8

📥 Commits

Reviewing files that changed from the base of the PR and between 6ee68cf and 61791c6.

📒 Files selected for processing (4)
  • .claude-plugin/marketplace.json
  • docs/data.json
  • plugins/utils/.claude-plugin/plugin.json
  • plugins/utils/commands/address-reviews.md

Comment thread plugins/utils/commands/address-reviews.md Outdated
Comment thread plugins/utils/commands/address-reviews.md
Comment thread plugins/utils/commands/address-reviews.md Outdated
…, rebase, and verification

Addresses three failures reported by Alberto on hypershift PRs:

1. Comments on stale diff hunks (line=null, original_line≠null) were being
   incorrectly filtered as "outdated" — now only truly orphaned comments
   (both null) are filtered out.

2. Repo-level instructions like "please rebase" and "make sure verify passes"
   had no dedicated handling — adds ACTION_INSTRUCTION category processed
   before code changes, with dynamic remote/branch detection for rebase.

3. No pre-push verification existed — adds Step 3.5 that detects available
   verification commands (make verify, make lint, go build, npm lint) and
   blocks push on failure with max 3 retries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bryan-cox bryan-cox force-pushed the improve-address-reviews branch from 61791c6 to 9251288 Compare April 20, 2026 15:13

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (3)
plugins/utils/commands/address-reviews.md (3)

217-217: Clarify if both Go commands must pass.

For the Go verification case, two commands are listed (go build ./... and go vet ./...). Should both pass, or is either sufficient?

📝 Suggested clarification
-   - `go.mod` exists → `go build ./...` and `go vet ./...`
+   - `go.mod` exists → run both `go build ./...` and `go vet ./...` (both must pass)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/utils/commands/address-reviews.md` at line 217, The documentation
line that reads "`go.mod` exists → `go build ./...` and `go vet ./...`" is
ambiguous about whether both commands must succeed; update the text to
explicitly state that both `go build ./...` and `go vet ./...` must pass for the
Go verification case so reviewers know to require successful builds and vetting.
Locate the sentence containing the exact snippet "`go.mod` exists → `go build
./...` and `go vet ./...`" and modify it to a clear statement such as "Both `go
build ./...` and `go vet ./...` must pass" (keeping the surrounding style
consistent).

214-219: Clarify how to detect Makefile targets.

The verification detection checks for "Makefile with a verify target" but doesn't specify how to programmatically determine if a target exists. Consider adding implementation guidance.

📝 Suggested clarification
 1. **Detect available verification commands** (check in order, use the first that exists):
-   - `Makefile` or `makefile` with a `verify` target → `make verify`
-   - `Makefile` with a `lint` target → `make lint`
+   - `Makefile` or `makefile` with a `verify` target (check: `make -n verify 2>&1` doesn't output "No rule") → `make verify`
+   - `Makefile` with a `lint` target (check: `make -n lint 2>&1` doesn't output "No rule") → `make lint`
    - `go.mod` exists → `go build ./...` and `go vet ./...`
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/utils/commands/address-reviews.md` around lines 214 - 219, Clarify
how to detect Makefile targets by specifying the detection approach: when
checking for a Makefile/makefile, either (a) attempt a safe non-executing make
query (e.g., run make -n verify or make -q verify and treat success/exit code as
presence of the target) or (b) fall back to parsing the Makefile file contents
for a target definition using a regex that matches a target at line start (e.g.,
^verify\s*:) to detect the `verify` target; document that the code should prefer
the make query method for accuracy and fall back to file content parsing if make
is unavailable, and ensure the check is case-insensitive for the filename and
robust to whitespace/comments in the Makefile definition.

226-227: Clarify the retry "fix" mechanism.

The instructions state "fix the issues, amend the relevant commit, and re-run verification" but don't specify whether fixes are automated (if so, how?) or require manual user intervention. This ambiguity could lead to inconsistent implementations.

📝 Suggested clarification
-   - If verification fails: fix the issues, amend the relevant commit, and re-run verification
+   - If verification fails: analyze the error output, attempt to fix the issues automatically when possible (e.g., formatting issues), or ask the user for guidance on non-trivial failures. Then amend the relevant commit and re-run verification.
    - Maximum 3 retry attempts. If verification still fails after 3 fix-and-retry cycles, stop and report to the user: "Verification continues to fail after 3 attempts. Last error: [error]. Manual intervention needed."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/utils/commands/address-reviews.md` around lines 226 - 227, Update the
two bullets "If verification fails: fix the issues, amend the relevant commit,
and re-run verification" and "Maximum 3 retry attempts..." to explicitly state
whether fixes are manual or automated; if manual, say "manually fix the issues
in your working tree, amend the relevant commit (git commit --amend) and re-run
verification" and require user confirmation between attempts; if automated fixes
are supported, document the exact command/flag (e.g., --auto-fix), what kinds of
fixes it will perform, and any limits, and ensure the final stop message
includes whether auto-fix was attempted and the last error ("Verification
continues to fail after 3 attempts. Last error: [error]. Manual intervention
needed. Auto-fix attempted: yes/no").
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@plugins/utils/commands/address-reviews.md`:
- Line 217: The documentation line that reads "`go.mod` exists → `go build
./...` and `go vet ./...`" is ambiguous about whether both commands must
succeed; update the text to explicitly state that both `go build ./...` and `go
vet ./...` must pass for the Go verification case so reviewers know to require
successful builds and vetting. Locate the sentence containing the exact snippet
"`go.mod` exists → `go build ./...` and `go vet ./...`" and modify it to a clear
statement such as "Both `go build ./...` and `go vet ./...` must pass" (keeping
the surrounding style consistent).
- Around line 214-219: Clarify how to detect Makefile targets by specifying the
detection approach: when checking for a Makefile/makefile, either (a) attempt a
safe non-executing make query (e.g., run make -n verify or make -q verify and
treat success/exit code as presence of the target) or (b) fall back to parsing
the Makefile file contents for a target definition using a regex that matches a
target at line start (e.g., ^verify\s*:) to detect the `verify` target; document
that the code should prefer the make query method for accuracy and fall back to
file content parsing if make is unavailable, and ensure the check is
case-insensitive for the filename and robust to whitespace/comments in the
Makefile definition.
- Around line 226-227: Update the two bullets "If verification fails: fix the
issues, amend the relevant commit, and re-run verification" and "Maximum 3 retry
attempts..." to explicitly state whether fixes are manual or automated; if
manual, say "manually fix the issues in your working tree, amend the relevant
commit (git commit --amend) and re-run verification" and require user
confirmation between attempts; if automated fixes are supported, document the
exact command/flag (e.g., --auto-fix), what kinds of fixes it will perform, and
any limits, and ensure the final stop message includes whether auto-fix was
attempted and the last error ("Verification continues to fail after 3 attempts.
Last error: [error]. Manual intervention needed. Auto-fix attempted: yes/no").

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: cea90616-5bf5-453c-a2ee-e0d574d6931f

📥 Commits

Reviewing files that changed from the base of the PR and between 61791c6 and 9251288.

📒 Files selected for processing (4)
  • .claude-plugin/marketplace.json
  • docs/data.json
  • plugins/utils/.claude-plugin/plugin.json
  • plugins/utils/commands/address-reviews.md
✅ Files skipped from review due to trivial changes (3)
  • plugins/utils/.claude-plugin/plugin.json
  • docs/data.json
  • .claude-plugin/marketplace.json

@enxebre

enxebre commented Apr 20, 2026

Copy link
Copy Markdown
Collaborator

/lgtm

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

openshift-ci Bot commented Apr 20, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

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

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-merge-bot openshift-merge-bot Bot merged commit d621f33 into openshift-eng:main Apr 20, 2026
5 checks passed
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants