DEV Community

Cover image for Your CI Is Not Flaky. Your Failure Triage Is.
Markus Gasser
Markus Gasser

Posted on

Your CI Is Not Flaky. Your Failure Triage Is.

A red CI build is not a diagnosis.

It is a notification that something happened. That “something” could be a product regression, an unreliable test, a broken test environment, a stale fixture, a browser update, a third-party outage, or a timing issue that only exists under shared infrastructure.

Yet many teams still react to every failure in exactly the same way:

  1. Open the failed job.
  2. Re-run it.
  3. Hope it turns green.
  4. Merge when it does.

That workflow feels fast because it avoids investigation. In reality, it transfers the cost downstream. The same failure returns later, confidence in the suite declines, and people eventually stop treating red builds as meaningful.

The real problem is rarely “too many flaky tests.” It is usually the absence of a dependable failure-triage system.

The three buckets every failure should enter

A useful CI process starts by classifying failures into three broad categories.

1. Product failures

These are the failures you actually want the suite to find:

  • A button no longer submits a form.
  • A permission rule exposes the wrong action.
  • A search result is missing.
  • A checkout flow breaks after a backend change.
  • A UI component renders but cannot be interacted with.

The key signal is repeatability. The failure normally appears under the same product state and can be reproduced outside the original CI job.

2. Test failures

These happen when the application is working but the test is not:

  • A locator depends on brittle DOM structure.
  • An assertion checks an intermediate state.
  • A fixed wait is shorter than the real loading time.
  • A test leaks state into the next test.
  • A screenshot baseline includes unstable content.

A good starting point is this CI failure triage checklist, which treats product bugs, test noise, and environment drift as separate operational problems instead of one generic “automation failure.”

3. Environment failures

These are often the hardest to identify because they imitate product and test failures:

  • The test environment was partially deployed.
  • Seed data was missing.
  • A shared account was locked.
  • DNS, storage, email, or a third-party API responded slowly.
  • The browser version changed underneath the suite.
  • A worker ran out of memory or disk space.

Environment failures are especially common when browser tests run on shared CI infrastructure. A practical evaluation of Endtest for shared CI browser testing explores the connection between infrastructure stability, coverage, and triage speed.

Stop using retries as your first diagnostic tool

Retries are useful, but only when they generate evidence.

A blind retry answers one question: did the test pass the second time?

It does not tell you why the first run failed.

A better retry captures a comparison set:

  • First-run screenshot and retry screenshot
  • Browser console output
  • Network failures
  • DOM snapshot or trace
  • Test data identifiers
  • Browser and operating system versions
  • Deployment version
  • Exact step where timing diverged

This turns a retry from an eraser into an experiment.

When the original and retry runs fail in different places, the problem is likely broader than one selector. When both fail at the same step with the same application state, the odds of a product issue rise. When the retry passes after a much longer load time, the environment or synchronization strategy deserves attention.

Build a CI gate around risk, not perfection

Many teams want a strict rule: one failed test blocks the deployment.

That sounds disciplined. It becomes counterproductive when the suite contains known instability.

The opposite rule—ignore failures and investigate later—is worse.

The useful middle ground is a risk-based gate. This article on building a CI gate for flaky tests without slowing every deployment describes the kind of tradeoff teams need to make.

A practical gate can treat failures differently:

  • A repeatable failure in a critical checkout or authentication flow blocks immediately.
  • A first-time failure in a low-risk area triggers one diagnostic retry.
  • A known flaky test does not silently pass; it creates a tracked reliability event.
  • Multiple unrelated failures in the same worker flag an environment problem.
  • A sudden increase in suite-wide duration triggers investigation even if tests pass.

The goal is not to make CI green. The goal is to make CI trustworthy.

Reliability needs a benchmark

Teams often say a suite is “mostly stable,” but that description is too vague to operate.

Start with a few numbers:

  • First-run pass rate
  • Retry recovery rate
  • Failures per 100 executions
  • Median time to classify a failure
  • Percentage of failures with enough evidence to diagnose
  • Failure concentration by test, environment, browser, and application area
  • Number of quarantined tests and average time spent in quarantine

Modern frontends make these metrics more important. Lazy loading, Suspense boundaries, and route-level code splitting create legitimate intermediate states that tests can easily misread. This guide to benchmarking browser test reliability on lazy-loaded applications is useful because it focuses on repeatable measurement rather than intuition.

A 98% pass rate may sound strong. If you run 2,000 tests per day, it still produces 40 failures. If most of those require manual inspection, the suite is expensive even when its percentage looks impressive.

Flaky-test triage should reduce future work

A flaky-test process fails when it becomes a place to store unresolved failures.

The output of triage should be one of four actions:

  1. Fix the product.
  2. Fix the test.
  3. Fix the environment.
  4. Remove or redesign a test that provides less value than it costs.

The workflow described in this flaky-test triage guide is centered on reducing recurring noise, which is the right objective. Counting flaky tests is not progress. Preventing the same failure pattern from returning is progress.

A useful triage record should include:

  • Failure category
  • Evidence
  • Owner
  • Temporary containment
  • Permanent corrective action
  • Deadline
  • Similar tests that may share the same weakness

That last field matters. A brittle locator found in one test is often present in twenty others.

AI failures need additional context

AI-assisted workflows add another layer to failure analysis. The UI may be unchanged while a prompt, model response, citation order, or streaming sequence has changed.

For those systems, capture:

  • Prompt version
  • Model configuration
  • Input data
  • Retrieved context
  • Response chunks in arrival order
  • Final assembled response
  • Screenshots and traces
  • Human-review decision

This AI test failure triage workflow shows why screenshots alone are insufficient when the behavior depends on prompts and generated output.

The economics are easy to ignore

Teams tend to compare test tools by license price while ignoring the cost of investigation, maintenance, infrastructure, and engineering attention.

That is why the more useful comparison is return on investment, not syntax. The argument is developed in Playwright vs Selenium in 2026: The Real Question Is ROI, Not Syntax.

The same principle applies to CI reliability. A free framework can still support an expensive testing operation. A paid platform can still be poor value. What matters is the total effort required to produce dependable release information.

For another perspective on browser automation strategy, this video discussion is worth adding to your research list.

A red build should create knowledge

The best CI systems do more than approve or reject a commit.

They teach the team:

  • Which product areas are fragile
  • Which tests are expensive to maintain
  • Which environments drift most often
  • Which failures lack evidence
  • Which types of regressions escape until production
  • Where engineering effort will improve confidence fastest

A red build is valuable when it creates a clear decision.

Without classification, evidence, ownership, and follow-through, it is just another notification everyone learns to ignore.

Top comments (0)