Skip to content

feat: add /ddev:ci-failure to diagnose and fix failing CI jobs - #7

Merged
stasadev merged 1 commit into
mainfrom
20261029_stasadev_ci_failure_skill
Oct 29, 2026
Merged

stasadev merged 1 commit into
mainfrom
20261029_stasadev_ci_failure_skill

Conversation

@stasadev

Copy link
Copy Markdown
Member

Short Summary (TL;DR)

/ddev:ci-failure finds why a DDEV CI job failed and whether it will fail again, then fixes the cause. A new script fetches the failed job's log and the same job's recent history, which is the evidence for "intermittent or not?".

The Issue

About 12 local sessions start with a failing run in ddev/ddev, ddev-gitlab-ci, github-action-add-on-test, or an add-on, and about 10 more reach one later. Each time, the agent had to find the log and the first real error, and then tell a broken branch from a flaky test or an upstream outage. Corrections repeat across these sessions: fix it "once and for all" rather than with a longer timeout, show the error that a bare exit code hides, run only the failing test, and don't write workarounds for an upstream bug.

How This PR Solves The Issue

failed-job.sh <URL> takes a GitHub Actions run or job URL, or a Buildkite build or job URL. It saves each failed job's log under ~/tmp, without ANSI codes, timestamps or Buildkite's _bk;t= markers, and prints the first error lines with line numbers. Then it shows the job's history:

  • GitHub Actions: the same job in the workflow's last 15 runs on any branch. A success that needed a rerun shows as "success, attempt N", because the API reports only a run's latest attempt.
  • Buildkite: the buildkite/<pipeline> commit status on the last 15 commits of the default branch, because Buildkite has no public build list. DDEV's pipelines are public, so the build, its jobs and their logs need no Buildkite token. This path needs jq. For a private pipeline, the script prints the bk commands to use after bk auth login.

The skill then:

Step What it does
Get the log GitHub Actions and Buildkite through the script, or a downloaded log

/ddev:review now fetches a failed check with this script, and its lock script's comment names the other skills that take the lock.

It loads in a DDEV repository, and also for a github.com/ddev/ run URL given from another directory.

Manual Testing Instructions

gh pr checkout 7
plugins/ddev/skills/ci-failure/failed-job.sh https://github.com/ddev/ddev-sqlsrv/actions/runs/39749542900/job/119726333430
# Expect 4 "not ok" bats lines, and runs 39749542900 and 39570967182 shown as "success, attempt N"
plugins/ddev/skills/ci-failure/failed-job.sh https://buildkite.com/ddev/macos-lima/builds/7770
# Expect the job on tb-macos-arm64-5, "FAIL: dockerutils_test" lines, and the macos-lima status on recent main commits

Automated Testing Overview

claude plugin validate . and shellcheck pass, and the frontmatter parses with Ruby's YAML parser. Claude Code ran failed-job.sh on Linux with a job URL from ddev/ddev-sqlsrv, with a run URL without a job from ddev/ddev, and with ddev's public Buildkite build macos-lima 7770, with and without a job UUID. Claude Code ran the routing check with Opus 5.5:

Repository Prompt Loaded
github.com/ddev/ remote run URL, "is it all intermittent or not?" 2 of 2
other remote "tests fail periodically, works locally but fails in CI" 0 of 2

Not tested: the script on macOS, a private Buildkite pipeline through bk, and a full session through the skill.

🤖 Developed with assistance from Claude Code

## Short Summary (TL;DR)

`/ddev:ci-failure` finds why a DDEV CI job failed and whether it will fail again, then fixes the cause. A new script fetches the failed job's log and the same job's recent history, which is the evidence for "intermittent or not?".

## The Issue

About 12 local sessions start with a failing run in ddev/ddev, ddev-gitlab-ci, github-action-add-on-test, or an add-on, and about 10 more reach one later. Each time, the agent had to find the log and the first real error, and then tell a broken branch from a flaky test or an upstream outage. Corrections repeat across these sessions: fix it "once and for all" rather than with a longer timeout, show the error that a bare exit code hides, run only the failing test, and don't write workarounds for an upstream bug.

## How This PR Solves The Issue

`failed-job.sh <URL>` takes a GitHub Actions run or job URL, or a Buildkite build or job URL. It saves each failed job's log under `~/tmp`, without ANSI codes, timestamps or Buildkite's `_bk;t=` markers, and prints the first error lines with line numbers. Then it shows the job's history:

- GitHub Actions: the same job in the workflow's last 15 runs on any branch. A success that needed a rerun shows as "success, attempt N", because the API reports only a run's latest attempt.
- Buildkite: the `buildkite/<pipeline>` commit status on the last 15 commits of the default branch, because Buildkite has no public build list. DDEV's pipelines are public, so the build, its jobs and their logs need no Buildkite token. This path needs `jq`. For a private pipeline, the script prints the `bk` commands to use after `bk auth login`.

The skill then:

| Step | What it does |
| --- | --- |
| Get the log | GitHub Actions and Buildkite through the script, or a downloaded log |
| First error | Quotes the failing test and error. When the log hides the cause, making it visible is part of the fix |
| Classify | Caused by the branch, regression, intermittent, platform-specific, or upstream, with the history lines that decided it |
| Fix | Runs only the failing test the way CI does, on the same engine, under `/ddev:review`'s Docker lock, and reuses existing helpers. An outside contributor's PR is read for risky changes before it runs. An upstream bug gets a note to the maintainers, not a workaround |
| Clean up | Removes the test projects and the saved logs |

`/ddev:review` now fetches a failed check with this script, and its lock script's comment names the other skills that take the lock.

It loads in a DDEV repository, and also for a `github.com/ddev/` run URL given from another directory.

## Manual Testing Instructions

```bash
gh pr checkout 7
plugins/ddev/skills/ci-failure/failed-job.sh https://github.com/ddev/ddev-sqlsrv/actions/runs/39749542900/job/119726333430
# Expect 4 "not ok" bats lines, and runs 39749542900 and 39570967182 shown as "success, attempt N"
plugins/ddev/skills/ci-failure/failed-job.sh https://buildkite.com/ddev/macos-lima/builds/7770
# Expect the job on tb-macos-arm64-5, "FAIL: dockerutils_test" lines, and the macos-lima status on recent main commits
```

## Automated Testing Overview

`claude plugin validate .` and shellcheck pass, and the frontmatter parses with Ruby's YAML parser. Claude Code ran `failed-job.sh` on Linux with a job URL from ddev/ddev-sqlsrv, with a run URL without a job from ddev/ddev, and with ddev's public Buildkite build macos-lima 7770, with and without a job UUID. Claude Code ran the routing check with Opus 5.5:

| Repository | Prompt | Loaded |
| --- | --- | --- |
| `github.com/ddev/` remote | run URL, "is it all intermittent or not?" | 2 of 2 |
| `github.com/ddev/` remote | "tests fail periodically, works locally but fails in CI" | 2 of 2 |
| other remote | the same run URL | 2 of 2 |
| other remote | "tests fail periodically, works locally but fails in CI" | 0 of 2 |

Not tested: the script on macOS, a private Buildkite pipeline through `bk`, and a full session through the skill.

🤖 Developed with assistance from [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@stasadev
stasadev merged commit 7762070 into main Oct 29, 2026
1 check passed
@stasadev
stasadev deleted the 20261029_stasadev_ci_failure_skill branch October 29, 2026 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant