Blog · Insights · 2026-08-18

How AI Reproduces Bugs Automatically (and Where It Fails)

Klavity
TL;DRAI reproduces a bug by replaying the captured state of a report — the exact steps, a DOM snapshot, console errors, network calls, and the environment — against a fresh session of your app. It succeeds when the report carries that state, and fails when the bug depends on hidden inputs the report never captured: server-side data, timing, or third-party services.

AI reproduces a bug by replaying the captured state of a report — the exact steps, a DOM snapshot, the console output, the network requests, and the environment — against a fresh session of your application. When the report carries that state, an agent can re-run the sequence in a real browser and watch the same failure happen. When the trigger lives outside that captured state — in a specific database row, a race between requests, or a third-party service — replaying the front-end steps won't recreate it, and the bug stays a mystery until someone captures more.

How does AI reproduce a bug from a report?

The mechanism is replay, not guesswork. An AI agent takes the structured evidence in a report and drives a browser to re-create the moment the bug occurred. Three things have to line up for that to work:

  1. A deterministic path. The report has to say what was clicked and typed, in order, ending at the failure. Vague reports ("checkout is broken") give the agent nothing to replay; a concrete sequence ("add item, apply code SAVE10, click Pay") gives it a script.
  2. A snapshot of the moment. A DOM snapshot plus the console and network state at the point of failure lets the agent verify it reached the same place — the same error in the console, the same 500 on the same request — rather than a superficially similar screen.
  3. A matching environment. Browser, viewport, OS, logged-in role, and feature flags shape behavior. The agent recreates that context so it isn't testing a different app than the reporter saw.

With those in place, reproduction becomes a checked replay: the agent runs the steps and asserts that the captured failure recurs. That is the same loop a self-healing test runs, which is why a reproduced bug converts so cleanly into an automated regression test.

What state does AI need to reproduce a bug?

Reproduction depends entirely on how much of the failing moment the report preserved. There are four layers of state, and a good report captures all of them at the instant the bug is flagged:

  • Interaction state — the ordered steps and the inputs used to reach the failure.
  • Runtime state — console errors and warnings, plus the network requests and responses (status, payload, timing) around the failure.
  • Page state — the URL and a DOM snapshot, so the agent knows the exact screen and element in play.
  • Environment state — browser, version, viewport, OS, and the user's role or account tier.

Miss a layer and the agent has to guess to fill the gap — and every guess is a chance to diverge from the real conditions. This is the core reason "cannot reproduce" tickets pile up: the reporter saw all four layers, but only one or two survived into the ticket. Capturing state at the source, rather than reconstructing it later, is what makes reports reliably reproducible.

Where AI bug reproduction still fails

Replay is powerful for front-end and deterministic bugs, and honest about its limits. It struggles — for AI and humans alike — when the trigger is not in the captured state:

  • Hidden server-side data. A bug that only fires for one corrupted record or a specific account won't reproduce from front-end steps. The agent needs that data seeded, not just the clicks.
  • Timing and race conditions. Two requests resolving in an unlucky order, a debounce that occasionally loses, a token expiring mid-flow — replaying at normal speed often lands on the lucky path and shows nothing.
  • Time and state that move on. A bug tied to a date rollover, a cache that has since expired, or a queue that has drained can be impossible to recreate after the fact.
  • Third-party dependencies. If a payment gateway or external API misbehaved during a narrow window, the replay hits a healthy service and passes.

The lesson is not that reproduction is unreliable — it is that reproduction is only as good as the state you captured. When an agent can't reproduce a bug, the productive next step is to capture more at report time, not to replay the same thin report harder.

How to write bug reports AI can reproduce

You get reproducible reports by capturing state at the moment of the bug instead of asking people to remember it later. Practical steps:

  1. File from inside the app. A report started where the bug happened can attach the live URL, DOM, console, and network automatically. A report typed into a separate tracker an hour later cannot. In-app, right-click reporting exists precisely to freeze that runtime state at the click.
  2. Write steps as an executable list. Each step should be one concrete action an agent — or a person — can perform without interpretation. Number them, and end at the exact failure.
  3. Attach the console and the failing request. Not a summary — the actual error text and the request's method, URL, status, and response. These are what an agent asserts against to confirm it reproduced the right bug.
  4. Record the environment. Browser and version, viewport, OS, and the account role. For role-specific bugs, note the role explicitly; it is the most commonly omitted variable.
  5. Flag non-determinism honestly. If it happened 1 in 5 tries, say so. That tells whoever reproduces it — human or AI — to look for a race or timing issue rather than assume a clean, repeatable path.

From reproduction to a test that sticks

Reproduction is not the finish line; it is the setup for one. Once an agent can reliably re-create a bug, that same replay is nearly a regression test already — it drives the app to the failing state and knows what "failed" looks like. Promoting it into your suite means the bug fails the build if it ever returns, instead of quietly reappearing three releases later. That is the real payoff of machine-reproducible reports: they shorten the distance from a user hit this to this can never ship again. Explore how Klavity turns captured evidence into replayable checks on the Klavity blog.

Key takeaways

  • Capture state, not just a screenshot — steps, DOM, console, network, and environment
  • Replay reproduces front-end bugs reliably; hidden server or timing state is where it breaks
  • File bugs from inside the app so the exact runtime state ships with the report
  • Turn a reproduced bug straight into a regression test so it can't silently return

FAQ

Can AI reproduce a bug from a screenshot alone?

Rarely. A screenshot proves a bug existed but omits the steps, DOM state, console errors, and network calls needed to trigger it again. AI reproduction works best when the report bundles a screenshot with the runtime state that produced it — the console log, the failing request, the URL, and the environment.

Does AI bug reproduction replace manual QA?

No. It collapses the slow, mechanical part — re-creating the exact conditions of a report — so engineers skip the back-and-forth and start at the fix. Manual QA still owns judgment: deciding what to test, spotting bugs no one filed, and confirming a fix feels right to a real user.

Why does AI fail to reproduce some bugs?

Because the trigger lives outside the captured state. If the bug depends on a specific database row, a race between two requests, a clock rollover, or a third-party outage, replaying the front-end steps won't recreate it. The fix is to capture more state at report time, not to replay harder.

Catch bugs the moment a human sees them

Klavity: right-click bug reports, AI personas that review your product, and self-healing tests.

Get started free