claude-code - 💡(How to fix) Fix [Feature Request] CI-wait gate: prevent premature 'done' declarations [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#46233Fetched 2026-04-11 06:25:38
View on GitHub
Comments
2
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×3commented ×2closed ×1

Follow-up to #45738 (Pattern 5: premature done) and #45731.

Claude declares PR work complete before CI finishes and review threads are resolved. In one session: 20 review threads across 8 fix-commits on a single PR. Each push generated new bot findings. Claude declared 'done' multiple times between rounds.

Root Cause

Bot reviewers (Copilot, Codex, DeepSeek, Cursor) run asynchronously after each push. Claude's pattern: push → immediately declare done → user points out new threads → fix → push → declare done again → repeat. A mandatory wait+verify loop breaks this cycle.

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single report
  • I am using the latest version of Claude Code

Summary

Follow-up to #45738 (Pattern 5: premature done) and #45731.

Claude declares PR work complete before CI finishes and review threads are resolved. In one session: 20 review threads across 8 fix-commits on a single PR. Each push generated new bot findings. Claude declared 'done' multiple times between rounds.

Proposed Solution

A CI-wait loop that Claude must execute before declaring done:

  1. Wait minimum 3 minutes after last push (bots need processing time)
  2. Check gh pr checks via API — all required checks completed
  3. Query review threads via GraphQL — 0 open threads confirmed programmatically
  4. If either fails → fix → push → restart wait loop

'Done' should require API-verified evidence, not visual inspection.

Why This Matters

Bot reviewers (Copilot, Codex, DeepSeek, Cursor) run asynchronously after each push. Claude's pattern: push → immediately declare done → user points out new threads → fix → push → declare done again → repeat. A mandatory wait+verify loop breaks this cycle.

Environment

  • Claude Code CLI (latest)
  • Model: Claude Opus (Max plan)
  • macOS

extent analysis

TL;DR

Implement a CI-wait loop in Claude to ensure all required checks are completed and review threads are resolved before declaring a PR as done.

Guidance

  • Introduce a minimum 3-minute wait period after the last push to allow bot reviewers to process their findings.
  • Utilize the GitHub API to check the status of required checks (gh pr checks) and verify that all checks are completed.
  • Use GraphQL to query review threads and confirm that there are 0 open threads before declaring a PR as done.
  • If either of the above checks fails, restart the wait loop after fixing and pushing the changes.

Example

import time
import requests

def wait_and_verify(pr_number):
    # Wait for 3 minutes
    time.sleep(180)
    
    # Check required checks via API
    checks_response = requests.get(f'https://api.github.com/repos/{repo_owner}/{repo_name}/pulls/{pr_number}/checks')
    if not checks_response.json()['checks'][0]['conclusion'] == 'success':
        # Restart wait loop if checks are not completed
        return False
    
    # Query review threads via GraphQL
    review_threads_response = requests.post('https://api.github.com/graphql', json={
        'query': 'query { repository(owner: "%s", name: "%s") { pullRequest(number: %d) { reviewThreads { nodes { state } } } } }' % (repo_owner, repo_name, pr_number)
    })
    if not all(thread['state'] == 'RESOLVED' for thread in review_threads_response.json()['data']['repository']['pullRequest']['reviewThreads']['nodes']):
        # Restart wait loop if review threads are not resolved
        return False
    
    return True

Notes

This solution assumes that the GitHub API and GraphQL queries are properly authenticated and authorized. Additionally, the repo_owner, repo_name, and pr_number variables should be replaced with the actual values for the repository and PR being processed.

Recommendation

Apply the proposed workaround by implementing the CI-wait loop to ensure accurate declaration of PR completion. This approach provides a more reliable and automated way to verify the status of required checks and review threads.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING