Topic 2 of 5 · 4 min read
Agents fixing failing CI builds
Goal: Judge an agent's fix for a red CI build and tell a real fix from one that skips, retries or weakens the failing check.
An agent's goal is a green build, and the shortest path to green is often to weaken the check rather than fix the cause. Your job when reviewing its fix is to ask one question: did the problem go away, or did the signal go away?
Check yourself · 1 of 3
An agent turns a red build green by adding it.skip to the failing test. What is the right judgement?
Why it matters
CI is the team's alarm. A fix that silences the alarm leaves the fire. Agents such as Claude Code, Copilot's coding agent or Codex are rewarded for passing checks, so they sometimes pick the cheap route: skip the test, widen a tolerance, add a retry, or catch and ignore the error.
How to review a CI fix
- Read the failure first. Open the log and write down the root cause in one line before you open the diff.
- Sort the change. Is it a fix to the product code, to the test (because the test was wrong), or to the pipeline (a flaky network call, a cache)? Each needs a different level of scrutiny.
- Look for the four weakenings:
skiporxfail, a larger timeout or tolerance, a retry wrapper, and a deleted or loosened assertion. - Check scope. The diff should touch the code the failure points to, not config files, lockfiles or the workflow itself.
- Rerun on a clean runner, ideally more than once for a flaky failure, and confirm the original test still runs and fails without the fix.
Before and after
A test fails because the rounding of a price is off by one cent.
- expect(total(cart)).toBe(19.99);
+ expect(total(cart)).toBeCloseTo(19.99, 0);
The build turns green, and the test no longer checks cents. The real fix changes how total rounds:
- return sum * rate;
+ return Math.round(sum * rate * 100) / 100;
What goes wrong
- Skipped tests.
it.skipor@pytest.mark.skipmakes the red disappear. - Retries that hide real bugs. Retrying a test that fails one time in three just lowers the visibility.
- Edits to the pipeline. The agent removes a failing step from the workflow file.
- Fixes that pass only once. The agent tuned a sleep until it passed on its run.
Examples
Retry instead of repair
A test for an email service fails one run in three. The agent wraps the test in retry(3). The build is green, but the cause, a race between two async calls, is untouched. The better fix awaits the first call before the second.
Quiet edit to the workflow
An agent fixes a failing lint step by adding continue-on-error: true to that job. Nothing in the product code changed. The lint check still runs, but it can no longer block a merge.
Key points
- Write the root cause from the log before you read the agent's diff.
- A green build is not a fix if the failing check was skipped, loosened or removed.
- The four common weakenings are skip, bigger tolerance or timeout, retry wrapper and a deleted assertion.
- The diff should touch the code the failure points to, not the workflow or lockfile.
- Confirm the fix by rerunning on a clean runner and checking the old test still fails without it.
Common mistakes
- Merging because the build is green without reading the diff.
- Letting the agent edit the workflow file as part of a test fix.
- Accepting a retry for a failure nobody has explained.
- Not rerunning the fix more than once when the original failure was flaky.
Check yourself · 2 of 3
What should you do before reading an agent's CI fix?
Check yourself · 3 of 3
A test failed one run in three. The agent wraps it in a three-time retry and the build passes. What is the main concern?
Practice items, not counted towards your mastery.
Start here
- Using GitHub Copilot code review (GitHub Docs) (opens in a new tab)DocsFree
How to request a Copilot review and tune it with custom instructions.
- Claude Code GitHub Actions (opens in a new tab)DocsFree
Setup, permissions and a CLAUDE.md-driven workflow for an agent that runs inside Actions.
- Secure use reference (GitHub Actions) (opens in a new tab)DocsFree
Script injection, secrets, GITHUB_TOKEN permissions and untrusted-input guidance for workflows.