ci-failures
Skill7 starsChanged 14 days agoMITView on GitHub
Find out why Deventry's CI failed or why a test is flaky, and fix the cause rather than the symptom. Use when CI is red, a test fails only sometimes or on only one system, or when asked about failing or flaky tests.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- jpoindexter/theft-kittheir own version, first seen May 20, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- jpoindexter/theft-kit★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
Files
Fix a failing or flaky test
A test that fails only sometimes has a cause: a race, a wait on the wrong thing, a ceiling a slow runner outran, or a difference between systems. Find which before changing anything. Never retry, skip or quarantine a test, and never add a fixed delay (CLAUDE.md, "Tests").
1. Collect the failures
- List the CI workflow's failed runs (
ci.yml;package.ymlruns it too before a release). Cloud sessions use the GitHub tools; locally, whereghisn't installed, GitHub's REST API:curl -s "https://api.github.com/repos/dotBunny/Deventry/actions/workflows/ci.yml/runs?status=failure&per_page=20", and a run's jobs at.../actions/runs/<id>/jobs. Logs and artifacts need a sign-in, so ask the user for them. - A failed leg uploads
test-results-<os>: its.trxfiles and any*.received.txt, kept for 7 days. Download and unzip each into a folder of its own and summarize it withnode .github/scripts/test-summary.mjs <folder>. - Older runs have only their logs. Ask for the failed jobs' logs alone, save them rather than reading them whole, and
search them for
[FAIL]and theError Message:after it. - Group the failures by test, with the system, the message and how long the test took (its
UnitTestResult'sduration).
2. Rule out what isn't a flake
git logthe test and the code it covers since the failing commit: a later commit may already have fixed it.- A test failing on all three systems at once is rarely a flake: a stale snapshot (the artifact has its
*.received.txt) or a real regression. Fix it as one. - A RealCli test that fails only inside a Claude Code session isn't CI's failure: there the real
claudeis the session's own, not the versioncompat/surface.yamlnames (lastTested), and the session'sCLAUDE_*variables pass through to it as user configuration.
3. Tell which kind it is
About fifty failures have been fixed since September, and nearly all were one of these. Each kind's rule is in CLAUDE.md, "Tests" and "Rules that keep the code testable".
- A wait for the wrong state, half of them: the assertion fails straight after a wait that passed. The wait was for something that comes first (stored before applied, Idle before the turn), stands in for the thing checked, or was still true from the step before. Read the code between the wait and the assertion, and what sets each.
- Work on the wrong thread: Collection was modified, a list or event caught half filled, a test's own command resuming outside the harness's UI lock. Look for work the test started off the UI thread, and fakes written to from sessions' threads.
- A race in the app, a fifth of them: a missing key or a wrong value with nothing slow about the run. Look for state set after the work that reads it can start, a check and its record in two steps, an older result landing after a newer one, a lock held while starting a callback.
- One system's difference: it fails on one system every time, or nearly, and passes on the others. Check the list under "Write each test for all three systems".
- A runner that stalled: a ceiling ran out. Each
UnitTestResulthas astartTimeand aduration: sort a run's results bystartTimeand compare what ran alongside the failure with the same tests in another run. When unrelated tests in the same minutes took 10 to 100 times as long too, the runner stalled; when only the tests that write to disk (SQLite, git, the library, atomic writes) slowed and the ones that only compute didn't, it was the disk. The fix is the ceiling: the wait usesWaiting.Timeout.
4. Reproduce it
- Build Release, then run the one test in a loop from its xunit v3 executable, which starts faster than
dotnet test:tests/<Project>/bin/Release/net10.0/<Project> -method "<Namespace.Class.Method>" -noLogo, counting the runs whose summary saysFailed: 0. - Load the machine as a busy runner is, with a busy loop per core (
sh -c 'while :; do :; done') started and stopped by a script of its own. Don't stop them withpkill -fon a pattern your own shell's command line also contains. - A race that won't show can be proven by widening its window: a temporary
Thread.Sleepwhere the gap is, with#pragma warning disable RS0030around it. Show the old code failing with it and the fix passing with the same sleep, then take the sleep out.
5. Fix the cause
In this order of preference:
- The order of the code. Set what asynchronous work reads before anything can start that work, rather than counting on the UI thread to queue it (CLAUDE.md, "Rules that keep the code testable"). Read the app's code before the test's: a race the tests see can be one people hit on a slow machine, as a fifth of these were.
- What the test waits for. The state the next step reads, not one that comes before it or is already true.
- The ceiling. Real work is bounded by
Waiting.Timeout, not a shorter time picked for the case.
A bug people could have run into, such as an error that hides the real one, gets its entry under Fixed in CHANGELOG.md.
6. Prove it
- The new or fixed test fails without the fix and passes with it.
- The free suite passes several times in a row under load:
dotnet test Deventry.slnx -c Release --no-build --filter "Category!=Live&Category!=RealCli". - The pull request says, for each failure, what it was, how it was reproduced and what shows it fixed.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

