ci-failurelisted
Install: claude install-skill polytheseus/sre-skills
# CI failure diagnosis
The goal is a **verdict** with evidence, followed by a fix:
- **Regression**: the code change broke something. Fix the code (or the test, if the test was wrong).
- **Flaky**: it fails intermittently with no relevant change. Quarantine it and file the flake with evidence.
- **Infra/environment**: runner, network, registry, cache, secret, quota or
dependency drift. Fix the pipeline, not the code.
## 1. Find the failing run
GitHub Actions (adapt the commands for GitLab `glab`, CircleCI, Buildkite and so on):
```bash
gh pr checks # on a PR branch
gh run list --branch <branch> --limit 10
gh run view <run-id> # jobs and steps, with failures marked
gh run view <run-id> --log-failed > /tmp/ci-failed.log
wc -l /tmp/ci-failed.log
```
Logs are long, so don't read them top to bottom. Search for the **first**
error. Later errors are usually cascades of the first one:
```bash
grep -nE '(^|\s)(error|ERROR|Error:|FAIL|FAILED|panic:|Traceback|exit code [1-9]|Exception)' /tmp/ci-failed.log | head -40
```
Then read about 40 lines of context around the first hit.
## 2. Classify
Ask these in order:
1. **Does it fail the same way on a re-run?**
`gh run rerun <run-id> --failed` (this costs CI minutes, so ask first if the pipeline is long or expensive).
If it passes on re-run without any change, it's flaky or infra.
2. **Does it fail on the base branch too?**
`gh run list --branch main --workflow