Skip to content

Review agent: detect stale-branch merge artifacts and suggest rebasing #1741

Description

@fullsend-ai-retro

What happened

On PR #59, a docs-only PR accumulated 8 CHANGES_REQUESTED reviews over 2 days before being approved on the 9th review. The branch docs/fullsend-agents-walkthrough had not been rebased onto main, so the diff included .github/workflows/fullsend.yaml, CODEOWNERS, and .fullsend/customized/* — files that were already merged to main via other PRs. The review agent treated these as intentional changes and repeatedly flagged: workflow pin regression @1bf016d9 vs @v0 (7 times), CONTRIBUTOR auth scope (3 times), protected-path violations (6 times), and permissions breadth (2 times). Each push triggered a new review cycle that re-discovered the same stale-branch artifacts. Once the author rebased (reducing the diff to just config.yaml and docs/fullsend-agents.md), the bot approved on the very next run.

What could go better

The review agent currently treats every file in the PR diff as an intentional change by the author. It cannot distinguish between 'author modified this file' and 'this file appears in the diff because the branch is behind base.' This led to 8 wasted review cycles (significant token cost) and noise that obscured the 2 genuinely useful findings (missing fix role in config, GCP project IDs in docs). Existing issues cover adjacent problems: #1446 addresses out-of-diff findings, #1013 addresses dedup across iterations, and #1355 addresses skipping re-review on rebases. However, none address the specific scenario where the review agent could detect that diff files are merge artifacts and short-circuit to a 'please rebase' suggestion. Confidence: high — the evidence is clear from the 8 review bodies and their inline comments, which overwhelmingly targeted files that were not authored in this PR.

Proposed change

Add a pre-review check in the review agent that compares the PR diff file list against the merge-base. Specifically: before running the full review, compute git diff --name-only <merge-base>...<base-branch-head> to identify files that changed on the base branch after the PR branch diverged. If any files in the PR diff are also in this set (i.e., they're merge artifacts, not author changes), the review agent should: (1) exclude those files from severity-bearing findings, (2) add a single top-level comment suggesting the author rebase, and (3) not issue CHANGES_REQUESTED solely based on merge-artifact findings. This check could live in the review agent's pre-processing step or in the harness before dispatching the review. The implementation should be in the review agent definition or harness config in fullsend-ai/fullsend.

Validation criteria

On the next 3 PRs where the branch is behind base and the diff includes merge-artifact files: (1) the review agent should not file CHANGES_REQUESTED solely based on findings in merge-artifact files, (2) it should suggest rebasing in a single comment rather than filing individual findings per artifact file, and (3) total review cycles on stale-branch PRs should drop from 5+ to 1-2. Token cost per review cycle on such PRs should decrease proportionally.


Generated by retro agent from https://github.com/redhat-developer/rhdh-agentic/pull/59

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/retroRetro agentagent/reviewReview agentcomponent/dispatchWorkflow dispatch and triggersfeatureFeature-category issue awaiting human prioritizationpriority/mediumNormal priority, plan for next cycletriagedTriaged but awaiting human prioritizationtype/featureNew capability request

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions