🤖 Auto-generated by weekly-pattern-learner · ci-fix-loop, coderabbitloop, and qodoloop all exist independently: no skill orchestrates them into a single end-to-end 'drive PR to green' pass
PR to Green
Drive a GitHub PR from first push to fully merge-ready: CI checks green, every active AI review bot addressed, zero unresolved threads.
Inputs
- PR number (optional): detect from current branch if not given.
- Max total iterations (optional, default: 10): across all loops combined.
- Skip bots (optional):
--skip-qodo,--skip-coderabbitto limit which review loops run.
Phase 1: Ensure the PR exists
gh pr view --json number,headRefName,state 2>/dev/null
If no open PR exists, run olko:pr-description-writer first to create one, then continue.
Phase 2: CI fix loop
Run olko:ci-fix-loop until all required checks pass, or a blocker needs a human.
Check current state first:
gh pr checks --json name,state,conclusion \
--jq '.[] | select(.conclusion != "success" and .conclusion != "skipped")'
If all checks already pass, skip to Phase 3. Otherwise run olko:ci-fix-loop.
Stop entirely if ci-fix-loop returns blocked: do not run review loops while CI is red,
as bots may refuse to review a failing branch and their feedback will shift after fixes land.
Phase 3: Detect active review bots
# Check if Qodo has posted on this PR
gh api repos/{owner}/{repo}/pulls/<PR_NUMBER>/reviews \
--jq '[.[] | select(.user.login == "qodo-code-review[bot]")] | length'
# Check if CodeRabbit has posted
gh api repos/{owner}/{repo}/pulls/<PR_NUMBER>/reviews \
--jq '[.[] | select(.user.login == "coderabbitai[bot]")] | length'
If neither has reviewed yet, nudge both and wait:
gh pr comment <PR_NUMBER> --body "@coderabbitai review"
gh pr comment <PR_NUMBER> --body "@qodo-code-review review"
Poll (every ~15s, timeout ~5min) for a review from either bot. If neither responds, proceed without a review-bot loop and note it in the report.
Phase 4: Review bot loops
Run each detected loop to completion before starting the next.
Order: qodoloop first (actionability-first bot, stricter on must-fix findings), then coderabbitloop (thoroughness-first, may surface additional style or security hints after Qodo's fixes change the diff context).
Qodo
If Qodo posted at least one review: run olko:qodoloop.
It handles fetching unresolved threads, reading each Agent Prompt block, applying the fix, replying to the thread, resolving it, pushing, and polling for the next Qodo review.
If qodoloop returns rate-limited, note it and continue to CodeRabbit without stopping.
CodeRabbit
If CodeRabbit posted at least one review: run olko:coderabbitloop.
Same structure: fetch unresolved threads, read 🤖 Prompt for AI Agents blocks, fix, reply,
resolve, push, wait for the next CodeRabbit review.
If coderabbitloop returns rate-limited, record it in the report and stop.
Phase 5: Final verification
Confirm the PR is truly merge-ready before reporting success:
# Required checks all green?
gh pr checks --json name,state,conclusion \
--jq '[.[] | select(.conclusion != "success" and .conclusion != "skipped")] | length'
# Any unresolved review threads?
gh api graphql -f query='
query($owner: String!, $repo: String!, $number: Int!) {
repository(owner: $owner, name: $repo) {
pullRequest(number: $number) {
reviewThreads(first: 100) {
nodes { isResolved }
}
}
}
}
' -f owner="{owner}" -f repo="{repo}" -F number=<PR_NUMBER> \
--jq '.data.repository.pullRequest.reviewThreads.nodes | map(select(.isResolved == false)) | length'
If either count > 0, identify what remains and report specifically: do not claim the PR is green when it is not.
Report
PR-to-green complete.
CI: ✓ all checks green (2 fix iterations)
Qodo: ✓ 4 findings fixed, 0 unresolved
CodeRabbit: ✓ 6 findings fixed, 0 unresolved
Blockers: none
Status: merge-ready ✓
OR
CI: ✓ green
Qodo: ✓ 2 findings fixed
CodeRabbit: ⚠ rate-limited, 1 finding still open (re-run tomorrow)
Status: partial: CodeRabbit quota exhausted, human review needed
Chaining
| Before this skill | After this skill |
|---|---|
olko:git-commit + push |
gh pr merge |
olko:pr-description-writer |
merge or stakeholder review |