Fix CI Until Green
Fetch the latest failed CI run, reproduce the failure locally, fix it, and repeat until checks pass.
Kickoff prompt
Start the "Fix CI Until Green" loop.
Goal: latest CI run on this branch passes
Max iterations: 8
Between iterations run: gh run list --branch $(git branch --show-current) --limit 1 --json conclusion -q '.[0].conclusion'
Exit when: latest run conclusion is success
Step 1: Find the latest failed CI run, read logs, reproduce locally, fix root cause, push, and verify.
Self-pace this loop. After each iteration, run the check command, read the output, and only continue if the exit condition is not met. Stop when the exit condition passes or max iterations is reached. Give a short status update each pass.Basic information
Category
CI
Goal
latest CI run on this branch passes
Max iterations
8
Check command
gh run list --branch $(git branch --show-current) --limit 1 --json conclusion -q '.[0].conclusion'
Exit when
latest run conclusion is success
Supported agents
Cursor, Claude Code
Steps
- 1
Fetch failed run
Use gh to find the latest failed CI run on this branch. Pull logs for the failing job.
gh run list --branch $(git branch --show-current) --status failure --limit 1 - 2
Reproduce locally
Run the failing CI step locally (test, lint, build). Confirm you can reproduce the error.
- 3
Apply fix
Fix the root cause with a minimal diff. Avoid unrelated refactors.
- 4
Push and verify
Push the fix and wait for CI. Re-check status before the next iteration.
gh run list --branch $(git branch --show-current) --limit 1 --json conclusion -q '.[0].conclusion'
More CI loops
CI Failure Watcher
Poll CI on an interval, investigate failures when checks go red, and push fixes until green.
PR Babysitter
Every 15 minutes, inspect open PRs with a watch label: nudge reviewers, fix CI, rebase if behind main.
PR Watch Loop
Poll open PRs labeled codex-watch every 15 minutes, review activity, and flag regressions or stale threads.
Ship PR Until Green
Implement on a branch, run tests, push, open a PR, wait for CI, and loop until checks pass and the PR is ready to merge.