# Make your coding agent reproduce a bug before it fixes it

- Author: RomanMotion (https://wurk.fun/user/RomanMotion)
- Published: 2026-11-02
- Updated: 2026-11-03
- Canonical (HTML): https://wurk.fun/blog/make-your-coding-agent-reproduce-a-bug-before-it-fixes-it
- Cover image: https://ik.imagekit.io/wurk/browser-uploads/f1c626b5c17e7f0a61dfbbe7a20d85ae7b33a20527243aeec2ee1d0a8b87562a/acc1a84e-6eb6-40e3-be45-8d4a7de39aba/cover-bugrepro.jpg?wurkUpload=v1.5TsmD6d1qyNqdQM44ZPK3ZX44Zang72wo5KKGhDQJnQ

---

You tell your coding agent, “Fix the login bug,” and it changes a handful of files before saying it’s done. If the original problem is still there, you’ve spent gig time reviewing changes without knowing which one mattered. A short bug report and a fail-first test give you a way to check the fix before handing it back to the client.

Ask the agent to reproduce the problem without changing the app, show you the failure, and stop. Once you’ve checked that the failure matches the bug, ask for the smallest fix, then rerun the repro and the full test suite. Keep the test and review the diff before calling the work finished.

## Give the agent a bug report it can use

“Login is broken” leaves the agent to guess which screen, account, or action failed. It might change a loading message while the actual problem is a rejected request. Even if the message disappears, you still need evidence that the user can log in.

Describe what you did and what you saw. Include the exact error text when there is one, plus the environment: device, browser, app version, or relevant configuration. If the problem began after a known change, say what changed. If you don’t know, write “unknown” rather than guessing.

Copy this into your task and fill in what you can:

```text
Bug: [short description]

Steps to reproduce:
1. [starting state]
2. [action]
3. [action that triggers the bug]

Expected: [what should happen]
Actual: [what happens instead]

Exact error or stack trace:
[paste here, or write "none shown"]

Environment:
[device, browser, app version, relevant settings]

Recent changes:
[what changed, or "unknown"]

Frequency:
[every time, sometimes, or unknown]
```

Remove passwords, tokens, personal details, and other sensitive data before sharing logs. If an example account or record is needed, use a safe test account or sanitized sample.

## First, get a failure for the right reason

Send the report to the agent and ask for a minimal reproduction: the smallest set of steps, test, or script that demonstrates the reported behavior. Tell it **not to fix the application yet**.

Ideally, the repro is an automated test that describes the expected behavior and fails against the current code. A script or precise manual steps can still be useful when the bug is difficult to automate. Ask the agent to name the command it ran and show the actual output. A harness that shows you each command and its raw output makes this check easy; if you don't have one, you can [try the zcode agent harness free](https://zcode.z.ai/invite/ALWM9JUA).

Now compare that output with the report. Does the test reach the same behavior you saw? A failed assertion showing that a valid login is rejected may be relevant. A test that fails because a package is missing, a server isn’t running, or the test has a syntax error hasn’t demonstrated the login bug yet.

The error text doesn’t always have to match word for word. A test may expose the same incorrect behavior at a different layer. Ask the agent to explain the connection and show the observed result. If it can’t, don’t treat that failure as proof.

For more on the same fail-first approach, read [test first, then let the agent code and prove it](https://wurk.fun/blog/test-first-then-let-the-agent-code-and-prove-it).

## Then ask for the smallest fix

Once you’ve seen a relevant failure, ask the agent to find its cause and make the smallest change that addresses it. Ask for the root cause in **two sentences**: what went wrong, and how the change addresses it.

The explanation should point to evidence in the code or repro. If the agent has a hypothesis but can’t establish the cause, it should say so. “The auth system was broken” is less useful than an explanation tied to a specific condition or data flow.

Keep the new test intact while the agent changes the app. If it wants to alter the test, ask why and review that change separately. Adjusting a broken setup can be legitimate; removing the assertion that exposed the bug makes a passing result much less convincing.

Read the diff yourself or ask for a file-by-file summary. Look for changes unrelated to the report, new dependencies, disabled checks, and altered tests. If the fix reaches beyond the agreed task, ask the agent to explain the extra scope before accepting it.

A test can show that a particular case works; it doesn’t prove every possible login path is safe. Use the result as evidence alongside the code review.

## Ask for proof, not a victory message

Have the agent rerun the **same repro** after the fix and show the command and output. Then ask it to run the project’s full test suite and report the result, including failures or checks it couldn’t run.

A useful handoff says which test failed before the fix, why that failure matched the report, and what happened when the same test ran afterward. It also names the full-suite command and its outcome. “Everything works now” is not a substitute for those details.

Keep the regression test in the project’s test suite where practical. That gives future changes a way to check this behavior again. If the repro is a standalone script or a manual procedure, save it with clear instructions and ask whether it can be added to the automated suite.

If the repro passes but another test fails, don’t quietly call the whole suite green. Ask the agent to show the failing output and investigate whether the failure is related. If a check requires credentials, services, or access the agent doesn’t have, record it as **not run**.

## If it can’t reproduce, stop and narrow the gap

An agent that can’t reproduce the bug needs better evidence, not permission to make a speculative fix.

Check whether its environment matches yours. Supply sanitized logs, a sample input, the relevant configuration, or a clearer sequence of actions. Note whether the problem happens intermittently and whether it depends on an existing account, network response, or particular data.

If the issue worked in an earlier version and fails now, [Git’s bisect documentation](https://git-scm.com/docs/git-bisect) describes how to search between a known-good commit and a known-bad commit. You test the revisions Git selects and mark each as good or bad; Git narrows the range to help identify the change that introduced the behavior.

Use a clean working copy or separate worktree and preserve your current work before switching revisions. If an old revision can’t be tested, don’t label it good or bad based on a build failure unrelated to the bug. A suspected commit is a lead to investigate, not proof of the root cause.

## Copy this prompt sequence

Send each prompt after reviewing the previous result. Paste your completed bug report before the first one.

```text
REPRODUCE

Using the bug report above, create a minimal failing test
or repro script. Do not change the application code yet.

Run it and show the command and actual output. Explain how
the failure matches the reported behavior. If you cannot
reproduce it, stop and tell me what information you need.

FIX

Using the confirmed repro, make the smallest fix that
addresses the cause. Keep the test's intended assertion.

Explain the root cause and the fix in two sentences.
Show the changed files and flag anything outside the task.

PROVE

Run the same repro again, then run the full test suite.
Show each command and its result. Report failures and checks
you could not run; do not call them passes.

Keep the regression test where practical and summarize the
diff and any remaining uncertainty.
```

Three short prompts instead of one long guessing session also means fewer paid agent runs. If you're choosing a plan for that, this referral link gives [a referral discount on GLM coding plans](https://z.ai/subscribe?ic=R0K78RJKNW) (eligibility and the final price show at checkout). There's [more on our blog](https://jackgross-five.vercel.app) on working with coding agents.

If this helped you verify a fix, a small WURK tip on the post supports more guides like this one.
