Skip to content

review-pr: duplicate CI failure comment during dismiss-and-recomment flow #1383

@worktrunk-bot

Description

@worktrunk-bot

Problem

In run 22831994262 on PR #1381, the review bot posted the same CI failure comment twice within 7 seconds (23:11:10 and 23:11:17 UTC). Both reviews are COMMENTED on commit a464e0d4 with identical bodies starting "CI failed — 11 shell wrapper / PTY snapshot tests need updating..."

Evidence from the GitHub API:

Review 3912161478: COMMENTED at 2026-03-08T23:11:10Z
Review 3912161573: COMMENTED at 2026-03-08T23:11:17Z

Root Cause

This is a different code path than the one fixed in #1321 (which added a retry guard for initial review submission). This duplicate occurs during the dismiss-and-recomment flow when the bot:

  1. Approves the PR
  2. CI fails
  3. Bot tries to dismiss its own approval via gh api .../dismissals (POST — fails)
  4. Bot posts CI failure comment via gh pr review --comment
  5. Bot retries dismissal via gh api .../dismissals -X PUT (succeeds)
  6. Bot posts CI failure comment again via gh pr review --comment

The existing retry guard (added in #1322) checks for an existing review before the initial review submission. But this flow bypasses that guard because it's posting a CI failure follow-up comment, not the initial review verdict.

Suggested Fix

The review-pr skill's CI monitoring section should include a duplicate check before posting CI failure comments, similar to the existing guard for initial reviews:

# Before posting CI failure comment, check if one was already posted for this SHA
EXISTING_COMMENT=$(gh api "repos/$REPO/pulls/<number>/reviews" \
  --jq "[.[] | select(.user.login == \"$BOT_LOGIN\" and .commit_id == \"$HEAD_SHA\" and .state == \"COMMENTED\")] | last | .submitted_at // empty")

If a COMMENTED review already exists for the current SHA, skip posting another one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    claude-behaviorIssues with Claude CI bot behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions