Proposal: improve ca-pr-self-reviewer — prevent repetitive approval comments on already-approved PRs #2372

Open
opened 2026-04-03 17:24:20 +00:00 by freemo · 0 comments
Owner

Agent Improvement Proposal

Pattern Detected

Type: Comment noise / redundant work
Affected Agent: ca-pr-self-reviewer (dispatched by ca-continuous-pr-reviewer)
Evidence:

On issue #2180 ("bug(agents): ca-backlog-groomer incorrectly closes PRs as duplicates"), the ca-pr-self-reviewer posted 7 nearly identical approval comments for PR #1325 within a 25-minute window (06:09 to 06:34 UTC on 2026-04-03):

Time Comment
06:09:22 "PR #1325 has been reviewed and approved... Awaiting human merge decision."
06:16:09 "PR #1325 has been reviewed and approved ... Awaiting human merge decision."
06:22:54 "PR #1325 has been reviewed and approved... CI Note: failures not attributable..."
06:28:13 "PR #1325 has been reviewed and approved ... Awaiting human merge..."
06:32:14 "PR #1325 has been reviewed and approved... requires human-initiated merge."
06:34:08 "PR #1325 has been reviewed and approved... awaiting human merge decision."
07:09:37 "PR #1325 reviewed, approved, and merged." (final, after actual merge)

The root cause is in the interaction between ca-continuous-pr-reviewer and ca-pr-self-reviewer:

  • The PR had the needs feedback label, so it couldn't be merged automatically.
  • Each review cycle, the continuous reviewer dispatched a NEW ca-pr-self-reviewer session for the same PR (as a "merge_retry").
  • Each new reviewer session posted a fresh approval comment without checking if the PR was already approved.

Proposed Change

Add a pre-review check to ca-pr-self-reviewer that detects existing approvals:

  1. Add an "Existing Review Check" step before Step 4 (Review Against Criteria):

    ### 0. Check for Existing Approvals (Before Reviewing)
    
    Before starting your review, check if this PR already has an
    APPROVED review from a bot user:
    
    1. Fetch existing reviews via forgejo_list_pull_reviews
    2. If any review has state=APPROVED and was posted by the bot user:
       - Do NOT post another approval review or comment
       - Skip directly to the merge step (Step 5)
       - If merge is blocked (needs feedback, CI failing), return
         immediately with the appropriate merge_status
    3. Only proceed with a full review if no existing approval exists,
       OR if new commits have been pushed since the last approval
    
  2. Add a deduplication check for issue comments. Before posting "PR #N reviewed and approved" on the linked issue, check if a similar comment already exists. If so, skip.

  3. Add guidance to the continuous PR reviewer to not dispatch merge retries for awaiting_human PRs. Once a PR is marked awaiting_human, it should be added to reviewed_prs and not re-dispatched until a human acts on it.

Expected Impact

  • Eliminates repetitive approval comments (estimated 80-90% reduction in comment noise).
  • Reduces wasted compute from redundant review sessions.
  • Cleaner PR comment threads that are easier for humans to read.

Risk Assessment

  • Very low risk: Skipping redundant approvals doesn't change the review quality — the PR was already thoroughly reviewed on the first pass.
  • Edge case: If a PR receives new commits after approval, the existing approval check should detect the SHA mismatch and proceed with a re-review. This is already handled by the continuous reviewer's "Source C" logic.

This is a proposal from the agent evolver. A human must approve this issue before the change will be implemented. To approve: remove the needs feedback label, add State/Verified, or comment with approval.


Automated by CleverAgents Bot
Supervisor: Agent Evolver | Agent: ca-agent-evolver

## Agent Improvement Proposal ### Pattern Detected **Type**: Comment noise / redundant work **Affected Agent**: `ca-pr-self-reviewer` (dispatched by `ca-continuous-pr-reviewer`) **Evidence**: On issue #2180 ("bug(agents): ca-backlog-groomer incorrectly closes PRs as duplicates"), the `ca-pr-self-reviewer` posted **7 nearly identical approval comments** for PR #1325 within a 25-minute window (06:09 to 06:34 UTC on 2026-04-03): | Time | Comment | |---|---| | 06:09:22 | "PR #1325 has been reviewed and **approved**... Awaiting human merge decision." | | 06:16:09 | "PR #1325 has been reviewed and **approved** ✅... Awaiting human merge decision." | | 06:22:54 | "PR #1325 has been reviewed and **approved**... CI Note: failures not attributable..." | | 06:28:13 | "PR #1325 has been reviewed and **approved** ✅... Awaiting human merge..." | | 06:32:14 | "PR #1325 has been reviewed and **approved**... requires human-initiated merge." | | 06:34:08 | "PR #1325 has been reviewed and approved... awaiting human merge decision." | | 07:09:37 | "PR #1325 reviewed, approved, and merged." (final, after actual merge) | The root cause is in the interaction between `ca-continuous-pr-reviewer` and `ca-pr-self-reviewer`: - The PR had the `needs feedback` label, so it couldn't be merged automatically. - Each review cycle, the continuous reviewer dispatched a NEW `ca-pr-self-reviewer` session for the same PR (as a "merge_retry"). - Each new reviewer session posted a fresh approval comment without checking if the PR was already approved. ### Proposed Change Add a **pre-review check** to `ca-pr-self-reviewer` that detects existing approvals: 1. **Add an "Existing Review Check" step** before Step 4 (Review Against Criteria): ``` ### 0. Check for Existing Approvals (Before Reviewing) Before starting your review, check if this PR already has an APPROVED review from a bot user: 1. Fetch existing reviews via forgejo_list_pull_reviews 2. If any review has state=APPROVED and was posted by the bot user: - Do NOT post another approval review or comment - Skip directly to the merge step (Step 5) - If merge is blocked (needs feedback, CI failing), return immediately with the appropriate merge_status 3. Only proceed with a full review if no existing approval exists, OR if new commits have been pushed since the last approval ``` 2. **Add a deduplication check for issue comments.** Before posting "PR #N reviewed and approved" on the linked issue, check if a similar comment already exists. If so, skip. 3. **Add guidance to the continuous PR reviewer** to not dispatch merge retries for `awaiting_human` PRs. Once a PR is marked `awaiting_human`, it should be added to `reviewed_prs` and not re-dispatched until a human acts on it. ### Expected Impact - Eliminates repetitive approval comments (estimated 80-90% reduction in comment noise). - Reduces wasted compute from redundant review sessions. - Cleaner PR comment threads that are easier for humans to read. ### Risk Assessment - **Very low risk**: Skipping redundant approvals doesn't change the review quality — the PR was already thoroughly reviewed on the first pass. - **Edge case**: If a PR receives new commits after approval, the existing approval check should detect the SHA mismatch and proceed with a re-review. This is already handled by the continuous reviewer's "Source C" logic. --- *This is a proposal from the agent evolver. A human must approve this issue before the change will be implemented. To approve: remove the `needs feedback` label, add `State/Verified`, or comment with approval.* --- **Automated by CleverAgents Bot** Supervisor: Agent Evolver | Agent: ca-agent-evolver
freemo added this to the v3.7.0 milestone 2026-04-03 17:24:50 +00:00
freemo removed this from the v3.7.0 milestone 2026-04-07 01:00:28 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#2372
No description provided.