Iterate PR Until CI Passes and Feedback Addressed
Iterates on a PR branch until CI passes, auto-fixing high/medium review feedback using the LOGAF scale and looped CI polling.
Why it matters
Automate the process of iterating on a GitHub Pull Request until all Continuous Integration checks pass and all review feedback is addressed.
Outcomes
What it gets done
Fetch and categorize PR review feedback using the LOGAF scale.
Automatically address high and medium priority feedback, prompting for low priority items.
Fetch CI check status and identify specific failure snippets from logs.
Fix CI failures by analyzing logs, understanding root causes, and making targeted code changes.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/ag-iterate-pr | bash Overview
Iterate on PR Until CI Passes
Iterates on an open PR branch until CI passes and review feedback is resolved, using LOGAF-scale-categorized feedback, root-cause CI failure fixes, local verification before push, and looped CI/feedback polling with review-bot-aware reply handling. Use when an open PR needs its CI failures fixed and review feedback triaged and resolved until it's mergeable; requires an authenticated gh CLI.
What it does
Continuously iterates on the current branch until all CI checks pass and review feedback is addressed, using the GitHub CLI (gh, must be authenticated). It fetches structured CI check status and categorized PR review feedback, fixes root causes rather than symptoms, verifies locally, then commits, pushes, and polls CI in a loop until everything is clean.
When to use - and when NOT to
Use this skill when the task is to get an open PR's CI checks passing and its review feedback resolved. All bundled scripts must be run from the repository root (where .git lives), not the skill directory, using the full path via ${CLAUDE_SKILL_ROOT}.
Inputs and outputs
Two bundled scripts:
uv run ${CLAUDE_SKILL_ROOT}/scripts/fetch_pr_checks.py [--pr NUMBER]
uv run ${CLAUDE_SKILL_ROOT}/scripts/fetch_pr_feedback.py [--pr NUMBER]
fetch_pr_checks.py returns JSON with a pass/fail/pending summary and per-check log snippets. fetch_pr_feedback.py categorizes review feedback using the LOGAF scale into high (blockers, changes requested), medium (standard feedback), low (nits/style/suggestions), bot (informational, e.g. Codecov/Dependabot), and resolved - review-bot findings (Sentry, Warden, Cursor, Bugbot, CodeQL) are classified into high/medium/low with review_bot: true, never dumped into the informational bot bucket.
The eight-step workflow: (1) identify the PR via gh pr view, stopping if none exists; (2) gather feedback; (3) auto-fix high and medium items without prompting (understanding root cause, checking for similar issues elsewhere, never silently ignoring review-bot findings), while low items are presented as a numbered list for the user to select from, and resolved/bot items are skipped silently; (4) check CI status, waiting for actionable review-bot checks (sentry, warden, cursor, bugbot, seer, codeql) but not informational ones like codecov; (5) fix CI failures by reading log snippets and tracing root cause rather than guessing from the check name, extending existing tests rather than creating new files; (6) verify fixes locally (re-run the specific failing test or linter) before committing and pushing; (7) poll CI and feedback in a loop - sleeping 30 seconds between checks, addressing any new high/medium feedback immediately, and doing a final post-CI feedback re-check before declaring success; (8) repeat the cycle if new feedback after a passing CI run requires more changes.
Replying to inline review comments uses the addPullRequestReviewThreadReply GraphQL mutation, checking first for an existing reply ending in "- Claude Code" to avoid duplicates on re-loops, and always signing off with "\n\n*-- Claude Code*".
Exit conditions: success requires all checks passing and a clean post-CI feedback re-check with user decisions made on low-priority items; the workflow asks for help after the same failure repeats twice or feedback needs clarification; it stops entirely if no PR exists or the branch needs a rebase.
Fallback if scripts fail: gh pr checks, gh run view <run-id> --log-failed, and gh api repos/{owner}/{repo}/pulls/{number}/comments directly.
Integrations
Built entirely on the GitHub CLI (gh) and GitHub's GraphQL API (addPullRequestReviewThreadReply), reading CI check runs and PR review threads including third-party review bots like Sentry, Warden, Cursor, Bugbot, and CodeQL.
Who it's for
Engineers who want an open PR driven to a mergeable state automatically - CI failures diagnosed and fixed at the root cause, review feedback triaged by priority and replied to, looping until everything is green - instead of manually babysitting CI and review threads.
FAQ
Common questions
Discussion
Questions & comments ยท 0
Sign In Sign in to leave a comment.