Agent fix:ci
Follow the CI source of truth
- •Discover the CI steps by reading
.github/workflows/ci.yml. - •Run the exact
run:commands in order, excluding setup/install-only steps. - •Use the same working directory specified by CI.
Deterministic fix loop
- •Run a CI-equivalent step.
- •If it fails, classify the failure:
- •Auto-fixable: only formatting check failures.
- •Manual: anything else (lint, type check, tests, audits, build, docs guard).
- •For auto-fixable failures, apply the minimal fix (
make format) then re-run the failed step. - •Stop when:
- •All checks pass, or
- •A manual failure is detected, or
- •An auto-fix attempt fails.
Safety guardrails
- •Never modify CI config or weaken checks.
- •Never delete tests or change business logic to satisfy checks.
- •Do not commit changes automatically.
- •Prefer minimal, reviewable diffs.
Use the bundled scripts
- •Run
node skills/agent-fix-ci/agent-fix-ci.mjsto execute the fix loop. - •Run
node skills/agent-fix-ci/agent-fix-ci.mjs --codexto emit a Codex repair capsule on non-fixable failures. - •Reuse
skills/agent-fix-ci/scripts/*for workflow parsing and loop orchestration. - •Reuse
skills/agent-utils/common/*for shared helpers.
Codex repair mode contract
- •When
--codexis provided and a step is not auto-fixable, the agent emits:- •
CODEX_REPAIR_REQUIRED - •A single-line JSON capsule describing the failure.
- •
- •The capsule contains the failing step, failure reason, output tail, guardrails, allowed actions, and a rerun command.
Codex guardrails (automated)
- •The
--codexrunner tracks progress across iterations in.codex/agent-fix-ci.json. - •Guardrails enforced between runs:
- •Max iterations: 7
- •Max files changed per iteration: 10
- •Max total lines changed per iteration: 300
- •Stop if
.github/workflows/**is modified - •Stop if the same failing step + reason repeats twice
How to use with Codex
- •Run
node skills/agent-fix-ci/agent-fix-ci.mjs --codex. - •When the capsule prints, Codex should propose and apply the minimal patch.
- •Re-run the same command until all checks pass or manual intervention is required.
Expected output
- •Print each step name, command, and working directory.
- •Summarize what failed, what was fixed, and why it stopped (if it did).
- •End with:
- •
PhotoPrune CI checks green — ready to commit, or - •
Stopped: manual intervention required (reason).
- •