Back to loops
CIscheduled triggerhook-bundle-ready Hardened

CI Failure Watcher

A loop for agents that monitor failing PR checks and convert remote CI output into local repair actions.

Use loop copies the kickoff prompt. Copy Markdown and Download loop include the complete Markdown page with context, source attribution, anchors, and guardrails. Cursor / Claude Code buttons prepare the shorter kickoff prompt only.

Run shape

Supported agents

Claude CodeCodexGemini CLIOpenCode

Goal

Turn failing CI logs into a verified fix or clear blocker report.

Feedback gate

gh pr checks --watch

Stop condition

The failing CI check is fixed, or a blocker is documented with log evidence.

Do not weaken, skip, delete, or rewrite the validation command to force success.
Do not claim completion until the stated exit condition is actually satisfied.
If blocked, report the blocker, evidence, and next safest action instead of gaming the metric.
Required context

Give the agent these inputs before it starts the loop. This keeps discovery bounded and prevents vague retries.

PR number or branch.
CI provider.
Permission to inspect logs.
Required tools

The loop assumes these commands or integrations are available. Missing tools should be reported as blockers, not ignored.

gh
git
How to run

Two separate pieces: the kickoff prompt starts the loop, while the downloaded Markdown carries the complete reference page.

1. Copy or download

Use the kickoff for a fast agent run. Download the full Markdown when you need source, context, and attribution in one file.

2. Paste into the agent

Start a fresh agent session in the target repo and provide the requested project context if the loop asks for it.

3. Let it self-pace

The agent should act, check evidence, retry only when the gate fails, and stop at the stated exit condition.

scheduledCI Step flow
Scheduled
Watch checks
Fetch logs
Patch locally
Push and monitor
Feedback gate
The failing CI check is fixed, or a blocker is documented with log evidence.
not done → return to next actiondone → exit condition met
ScheduledWatch checksFetch logsPatch locallyPush and monitorFeedback gatedoneThe failing CI check is fixed, or a blocker is documented with log evidence.not done
Action checklist

The diagram shows the order. This checklist keeps only the action, command, and failure handling needed during a real pass.

1. Watch checks

Read the current PR check state.

gh pr checks --watch

2. Fetch logs

Open failing job logs and extract the first meaningful root-cause error.

3. Patch locally

Reproduce or reason from logs, then make the smallest fix.

4. Push and monitor

Push the fix and watch CI again.

gh pr checks --watch
Kickoff prompt

This is the text copied by Use loop. It is intentionally shorter than the Markdown export.

Monitor the PR checks, inspect failing logs, fix the smallest root cause, push, and continue until CI passes or a real blocker is reported.
Goal: Turn failing CI logs into a verified fix or clear blocker report.
Check command: gh pr checks --watch
Exit condition: The failing CI check is fixed, or a blocker is documented with log evidence.
Max iterations: 6
Guardrails:
- Do not weaken, skip, delete, or rewrite the validation command to force success.
- Do not claim completion until the stated exit condition is actually satisfied.
- If blocked, report the blocker, evidence, and next safest action instead of gaming the metric.
- Do not paste secret-bearing logs into public output. Redact tokens and credentials.

Quality

86/100

Safety

87/100

Expected output

CI failure summary, root-cause hypothesis, and either a patch or safe next step.

Related loops

Browse all
CImanual trigger Hardened

Ship PR Until Green

Implement a scoped change, open or update a pull request, inspect CI, and continue until all required PR checks pass.

CursorClaude CodeCodex
pull-requestcigithub-actionsverification

Kickoff preview

Take this branch to a green pull request. Implement the requested change, run local verification, open or update the PR, run `gh pr checks`, inspect failures, fix root causes, and repeat until every required check passes or you hit the iteration cap.
Goal: Open or update a pull request and stop only when all required PR checks are green.
Check command: gh pr checks
Exit condition: All required pull request checks are successful and the PR is ready for review or merge.
Max iterations: 10
Guardrails:
- Do not weaken, skip, delete, or rewrite the validation command to force success.
- Do not claim completion until the stated exit condition is actually satisfied.
- If blocked, report the blocker, evidence, and next safest action instead of gaming the metric.
- Do not disable required checks, edit loops to skip jobs, or remove tests to make CI green.
- Do not merge the PR unless the user explicitly asked for merge authority.
View
DevOpsmanual trigger Hardened

Deploy Verification Loop

After deployment, check production URL, health routes, metadata, and key user paths before declaring release success.

Claude CodeCodexGemini CLIOpenCode
deploysmoke-testrelease

Kickoff preview

Verify the deployed URL, critical pages, sitemap, robots, and metadata. Fix or report exact failures before declaring the release successful.
Goal: Confirm the deployed site responds correctly and key pages are usable.
Check command: curl -I $DEPLOY_URL
Exit condition: Critical deployed pages return expected status and visible content/metadata.
Max iterations: 4
Guardrails:
- Do not weaken, skip, delete, or rewrite the validation command to force success.
- Do not claim completion until the stated exit condition is actually satisfied.
- If blocked, report the blocker, evidence, and next safest action instead of gaming the metric.
- Do not claim deployment success based only on build success. Verify the deployed URL.
View
Testingmanual trigger Hardened

Flaky Test Triage

Re-run failing tests, identify nondeterminism, isolate likely causes, and avoid masking flaky behavior.

Claude CodeCodexGemini CLIOpenCode
flaky-teststestingtriage

Kickoff preview

Triage the flaky test: re-run narrowly, estimate reproduction, inspect nondeterminism sources, patch or document quarantine, and verify repeatedly.
Goal: Diagnose flaky behavior without hiding it.
Check command: pnpm test -- --runInBand
Exit condition: The flake has a likely cause, a verified fix, or a documented quarantine recommendation.
Max iterations: 6
Guardrails:
- Do not weaken, skip, delete, or rewrite the validation command to force success.
- Do not claim completion until the stated exit condition is actually satisfied.
- If blocked, report the blocker, evidence, and next safest action instead of gaming the metric.
- Do not delete or skip flaky tests just to make CI pass without documenting risk.
View
Reviewmanual trigger Hardened

Independent Verifier Pass

Review an agent-produced change as a skeptical verifier before it is marked done.

CursorClaude CodeCodex
reviewverificationquality

Kickoff preview

Act as an independent verifier. Restate the requirements, inspect the diff, run relevant checks, and return a pass/fail/blocker verdict with evidence.
Goal: Prove the implementation satisfies the request without relying on the implementer’s claim.
Check command: git diff --stat && git diff --check
Exit condition: The verifier can map each requirement to code and verification evidence.
Max iterations: 3
Guardrails:
- Do not weaken, skip, delete, or rewrite the validation command to force success.
- Do not claim completion until the stated exit condition is actually satisfied.
- If blocked, report the blocker, evidence, and next safest action instead of gaming the metric.
- Do not rubber-stamp. Find at least one plausible failure mode and check it.
View