Repository navigation
feat: add /ddev:ci-failure to diagnose and fix failing CI jobs - #7
Merged
Merged
Conversation
## 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Short Summary (TL;DR)
/ddev:ci-failurefinds 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: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 needsjq. For a private pipeline, the script prints thebkcommands to use afterbk auth login.The skill then:
/ddev:reviewnow 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
Automated Testing Overview
claude plugin validate .and shellcheck pass, and the frontmatter parses with Ruby's YAML parser. Claude Code ranfailed-job.shon 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:github.com/ddev/remoteNot tested: the script on macOS, a private Buildkite pipeline through
bk, and a full session through the skill.🤖 Developed with assistance from Claude Code