Back to loops
CIinterval

CI Failure Watcher

Poll CI on an interval, investigate failures when checks go red, and push fixes until green.

0 views0 usesby solo lemon.

// parameters

Triggerinterval
Max iterations12
Check commandgh run list --branch $(git branch --show-current) --limit 1 --json conclusion -q '.[0].conclusion'
Exit conditionLatest CI run conclusion is success

// run_this_loop

Copy the kickoff into your agent first. The blueprint below explains how the loop evaluates progress and when it should stop.

Open in CursorOpen in Claude

Use loop copies the kickoff prompt. Share copies the loop link. Open in Cursor / Claude only pre-fill that prompt — they do not install hook files. Download loop saves the loop as ci-failure-watcher.md.

/loop 5m Start the "CI Failure Watcher" loop.

Goal: latest CI run on this branch is green.
Max iterations: 12.
Between iterations run: gh run list --branch $(git branch --show-current) --limit 1
Exit when: latest run conclusion is success.

Step 1: Check CI status. If failed, read logs, fix root cause, verify locally, and push if needed.

// blueprint

The loop contract: target outcome, execution sequence, checks, stopping condition, and safety constraints.

Goal

latest CI run on this branch is green.

// loop_sequence

// loop_sequence_diagram.json
closed loop

Trigger

interval event

Actions block

3 steps
1Check CI status
2Investigate failure
3Verify locally

Feedback gate

Evaluate: gh run list --branch $(git branch --show-current) --limit 1 --json conclusion -q '.[0].conclusion'

Run the check, read the output, then decide whether the loop is complete.

Check failed

Repeat actions with the latest feedback.

Success

Latest CI run conclusion is success

Safety capMax 12 iterations

// steps

  1. 1
    Check CI status

    Check the latest CI run for the current branch using gh CLI.

    gh run list --branch $(git branch --show-current) --limit 1
  2. 2
    Investigate failure

    If CI failed, read logs, identify the root cause, and apply the smallest fix.

  3. 3
    Verify locally

    Run the failing CI step locally before pushing again.