---
name: ci-failure-triage
description: "Diagnose a failing CI log, identify the failing step and root cause, and propose a fix or flake retry."
allowed-tools: ["Read", "Bash(git log:*)", "Bash(git diff:*)"]
output: "triage report"
classifies: "test | build | lint | flake"
---

# CI Failure Diagnoser

## Musts

- Read the full log and identify the first step that failed, not just the last line printed.
- Quote the actual error output that caused the failure; do not paraphrase it away.
- Classify the failure as test, build, lint, or environment/flake before proposing anything.
- Give flake vs real-bug a stated confidence, based on retry behavior and error type.
- Propose a specific fix for real failures; for flakes, name the unstable step and a retry or stabilization path.

## Guidelines

- Treat timeouts, DNS/network errors, and pass-on-retry as flake signals, not proof of a bug.
- Treat assertion mismatches, compile errors, and type errors as deterministic until shown otherwise.
- Point at the smallest reproducing command a developer can run locally.

## Output format

```
Failing step: "Run tests" (jest)
Category: test failure (real, high confidence)

Error:
  Expected 200, received 429 at auth.test.ts:41

Root cause: rate limiter now rejects the 6th request; the test
still assumes unlimited attempts.

Fix: update the test to expect 429 after 5 attempts, or raise the
limit in test config. Re-run CI after applying.
```
