Skip to content

fix: Add mandatory CI check verification before claiming PR review complete #369

@rjmurillo-bot

Description

@rjmurillo-bot

Problem

PR comment responder claimed PR #199 was "MERGEABLE" based on incomplete verification. The agent resolved all review threads and checked mergeable status, but failed to verify CI checks were passing.

Evidence: Run 20487393463 failed with MUST: HANDOFF.md Updated: FAIL in session 56, but the agent claimed completion without checking CI.

Root Cause Analysis

What Was Checked

  1. ✅ Resolved all 11 review threads via GraphQL mutations
  2. ✅ Verified 0 unresolved threads via GraphQL query
  3. ✅ Ran gh pr view 199 --json state,mergeable,reviewDecision{"mergeable":"MERGEABLE",...}

What Was Missed

❌ Did NOT run gh pr checks 199 to verify CI status

The mergeable: "MERGEABLE" field only indicates:

  • No merge conflicts
  • Branch is compatible with base

It does NOT indicate:

  • CI checks passing
  • Required status checks satisfied

The Flawed Logic

Agent checked: mergeable == "MERGEABLE" + reviewThreads all resolved
Agent concluded: PR is ready to merge

Correct check should be:
- mergeable == "MERGEABLE" (no conflicts)
- reviewThreads all resolved
- gh pr checks all SUCCESS  ← MISSING
- no new comments after wait ← MISSING

Completion Criteria Gap

The .claude/commands/pr-review.md template correctly lists:

Criterion Verification Required
All comments resolved Each comment has [COMPLETE] or [WONTFIX] status Yes
No new comments Re-check after 45s wait returned 0 new Yes
CI checks pass gh pr checks all green Yes
No unresolved threads GraphQL query for unresolved reviewThreads Yes
Commits pushed git status shows "up to date with origin" Yes

The agent verified criteria 1, 4, and 5 but skipped criteria 2 and 3.

Proposed Fix

1. Update pr-comment-responder agent

Add mandatory CI verification step before Phase 8 completion:

# After all other verification, BEFORE claiming completion
FAILED_CHECKS=$(gh pr checks $PR_NUMBER --json name,state,conclusion | \
  jq '[.[] | select(.conclusion != "success" and .conclusion != "skipped" and .conclusion != null)]')

if [ "$(echo "$FAILED_CHECKS" | jq 'length')" -gt 0 ]; then
  echo "[BLOCKED] CI checks not passing:"
  echo "$FAILED_CHECKS" | jq -r '.[].name'
  # Do NOT claim completion
fi

2. Update /pr-review skill

Add verification step after pushing commits:

# Wait for CI to start (avoid race condition)
sleep 10

# Check CI status
gh pr checks $PR_NUMBER --watch --fail-fast || {
  echo "[BLOCKED] CI checks failed. Cannot claim completion."
  exit 1
}

3. Create Serena memory skill

Store as skill-pr-review-007-ci-verification.md:

  • Pattern: Always verify CI before claiming completion
  • Trigger: After resolving review threads and pushing commits
  • Verification: gh pr checks returns all success/skipped

Acceptance Criteria

  • PR comment responder runs gh pr checks before claiming completion
  • /pr-review skill waits for CI after pushing commits
  • Summary output includes CI status for each check
  • If CI fails, agent does NOT claim PR is mergeable
  • Skill memory created and indexed

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-memoryContext persistence agentagent-qaTesting and verification agentarea-skillsSkills documentation and patternsarea-workflowsGitHub Actions workflowsautomationAutomated workflows and processesbugSomething isn't workingenhancementNew feature or requestpriority:P1Important: Affects user experience significantly, high business value

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions