Verify the bug before you authorize an AI coding agent to change implementation code. First identify the project’s test framework and normal commands, run the relevant tests to capture a baseline, define the expected behavior from requirements or documented behavior, and add a focused reproduction test without changing production code. The test should fail for the reason described in the report. Only then should the agent propose a fix; after the change, rerun the focused test and the related suite, inspect the diff and assertions, and report every pass, failure, skip, and check that could not run.
This order matters because a red test is evidence, not a verdict. Microsoft’s Visual Studio Code guidance warns that “A failing test can reveal a bug, but it can also reflect faulty test setup or an incorrect expectation” (Test existing code with AI). A disciplined reproduction loop prevents an agent from repairing a symptom, encoding an incorrect assumption, or quietly rewriting the test until it passes.
As an Amazon Associate I earn from qualifying purchases.
What to do before asking an AI agent to fix a bug
Give the agent a verification task before a repair task. The first request should be read-only: inspect the repository, explain how tests are organized, identify the command for one test and the command for the related suite, and run the smallest relevant check without editing files or installing dependencies. Record the exact command and output.
Recommended Free Tools
Once the baseline is known, write down the behavior that should be observed. Use a requirement, product specification, API contract, documented example, or an agreed acceptance criterion. Do not let the current implementation become the only definition of correctness; doing so can turn an existing defect into the expected result.
#1 Best Overall
- Used Book in Good Condition
Then ask for one focused test that captures the report. Keep implementation files unchanged and, where the tooling permits, commit or otherwise protect the new test before the fix begins. Run that test and inspect why it fails. A failure that matches the expected defect is a reproducible bug. A failure caused by missing setup, a bad fixture, or an incorrect assertion is a test problem to correct first.
Only after this evidence exists should the agent edit production code. The repair is complete only when the original reproduction passes, the related tests still pass, and a reviewer can inspect the diff and the actual command output.
Why verification is necessary with AI-generated fixes
A report is a hypothesis, not a diagnosis
Issue reports often mix observed symptoms, assumptions about the cause, and an incomplete expected result. An agent can produce a plausible patch from that text even when the behavior is intentional, the report applies to a different version, or the failure comes from the test environment. Reproduction separates what someone believes is happening from what the current project actually does.
Green does not automatically mean correct
An agent can make a test green by weakening an assertion, changing the expected value, skipping the case, or bypassing the code path. Passing tests are useful only when the test expresses an independently justified requirement and was not altered to accommodate the patch. Review the assertion and the implementation together.
Coverage is not a substitute for a behavioral check
A high coverage percentage can still miss the input, state transition, permission, timing, or error path in the report. A narrow reproduction test gives you a direct, inspectable link between the claimed behavior and the code change. Broader tests are still needed later, but they should not replace the first proof.
Step 1: Discover the project’s test setup without changing it
Your opening prompt should constrain the agent’s actions. Ask it to inspect documentation, configuration, package or build manifests, and existing test directories. It should not edit files, install packages, regenerate snapshots, or “fix” unrelated failures during this phase.
Inspect this repository before making any changes. Identify the test framework, test-file conventions, fixtures, and commands for running one test and the related suite. Run the smallest relevant existing test and then the related suite if practical. Do not edit files, install dependencies, update snapshots, or change configuration. Return the commands, exit codes, pass/fail/skip counts, and any environment or setup error.
Ask the agent to explain how it selected the test command. Projects may expose scripts, make targets, task-runner commands, or framework-specific invocations. Use the project’s documented path rather than assuming a command from another language or repository.
Rank #2
Capture the baseline
Run the existing relevant tests before adding a reproduction. Save the terminal output in the issue, pull request, or review notes. Mark failures that were already present, including flaky or environment-dependent failures. This prevents a pre-existing red test from being misreported as a regression introduced by the agent.
- Record the commit or branch being tested.
- Record the exact command, working directory, and relevant environment selection.
- Record passed, failed, skipped, and deselected tests when the runner reports them.
- Separate product failures from setup errors such as missing services, credentials, databases, browsers, or generated files.
- Do not “clean up” unrelated failures merely to obtain a green baseline.
If the baseline cannot run, stop and describe the blocker. A reproduction that depends on an unrecorded local workaround is not reliable evidence.
Step 2: Define expected behavior independently of the code
Write the expected result before asking the agent to design the test. Include the input or setup, the observable result, and the boundary conditions that matter. Sources can include a requirement, public documentation, an API contract, a user-story acceptance criterion, or a decision agreed by the owner.
Separate facts from assumptions
State what was observed, what should happen, and what remains uncertain. For example, “Submitting an expired token currently returns HTTP 200” is an observation; “The contract requires an authentication error and no protected data” is an expectation. “The parser should accept a trailing comma” is an expectation only if the supported format or product decision says so.
Review edge cases before writing assertions
Ask whether the requirement covers empty input, boundary values, duplicate records, ordering, time zones, retries, permissions, malformed data, and concurrent requests. Do not invent behavior for unspecified cases. If the requirement is silent, label that case as a product decision to resolve rather than encoding a guess in a test.
Keep expected values independent of the function under test. Reusing the same helper, calculation, fixture generator, or implementation constant in both the code and the assertion can make a broken result agree with itself.
Step 3: Have the agent create a focused reproduction test
Ask for the smallest test that demonstrates the reported behavior. It should exercise the public boundary where the problem matters, use the project’s normal fixtures and conventions, and make one clear assertion about the requirement. Production code should remain unchanged at this point.
Using the agreed requirement below, add only a focused reproduction test. Do not change implementation code, test expectations after the fact, configuration, snapshots, or dependencies. Keep the expected value independent of the implementation. Show me the proposed test and explain which requirement each assertion represents before running it.
Review the proposed test before execution. Check that the fixture actually reaches the suspected path, that the assertion would fail if the reported behavior occurred, and that the test is not merely checking an internal detail. If the agent proposes a broad integration test, ask whether a smaller unit or boundary test can prove the same claim; use the broader test when the defect depends on integration.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Protect the reproduction
Anthropic’s guidance states, “For bug fixes, write the failing test first” (Give Claude a feedback loop). In practice, commit the test separately or create a review checkpoint. Tell the agent it may not edit, delete, skip, or weaken that test while implementing the fix. If the test must change because the requirement was clarified, record the decision and review the revised expectation as a separate change.
Step 4: Run the reproduction and diagnose the red result
Run the single reproduction test first. Confirm that it fails before implementation changes and that the failure corresponds to the report. Read the assertion message, stack trace, logs, and any captured request or state. Do not stop at “the command returned nonzero.”
When the failure is a real implementation defect
The test is persuasive when the setup is valid, the expected behavior is documented or agreed, the assertion is independent, and the observed failure points into implementation behavior that violates that expectation. Note the exact failure and preserve it as the baseline for the fix.
When the failure is faulty setup
A missing service, wrong working directory, stale generated artifact, unavailable credential, incompatible runtime, or incorrect fixture can produce a red test without a product defect. Correct the environment or make the prerequisite explicit, then rerun the unchanged test. If the project cannot provide the prerequisite in the current environment, report the test as unexecuted rather than converting the setup error into a bug claim.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsWhen the expectation is wrong
Compare the assertion with the requirement and documentation. A test may assume an ordering that the contract leaves unspecified, treat a warning as an error, or expect a behavior deliberately changed in the current version. Update the requirement decision first; do not ask the agent to change implementation code simply to satisfy an incorrect test.
When the result is intermittent
Repeat only as needed to characterize the behavior, and record each run. Investigate timing, shared state, network dependence, randomness, and cleanup. A flaky reproduction needs a stable test strategy or a clearly documented nondeterministic defect; a single lucky pass is not proof that the issue is fixed.
Rank #4
- Ultimate Gift Mug That Stands Out From the Rest: Do you spend your days debugging code and your nights dreaming about syntax errors? Then you know that debugging is a process that can take you on an emotional rollercoaster. That's why we created the "6 Stages of Debugging" mug - to help you laugh through the pain. Just don't blame us if you start talking to your code like it's a person - we've all been there.
- Premium Ceramic Coffee Mug: This high-quality ceramic mug has a premium hard coat that provides crisp and vibrant color reproduction sure to last for years. Printed on both sides for either left or right-handed person so the awesome message and art will be visible. High-gloss and has a premium finish that can make you enjoy your drink more. Can also be used as pen holders on your office work table, planter for your kitchen herb, jewelry holder, or serving your favorite dessert.
- Relatable Humorous Quote: Why settle for a boring old mug when you can have this one-of-a-kind drinkware on your dining, kitchen, or work table? Bring a smile to your loved ones' faces with this hilarious mug. Featuring a witty and relatable quote, this mug is sure to brighten anyone's day. Whether you're enjoying your morning coffee or taking a well-deserved break at work, this mug is the perfect pick-me-up. A conversation starter, it's also a surefire way to lift anyone's mood.
- Hilarious and Quirky Gift Mug: A great gift for anyone who works in software development or coding, especially those who have a good sense of humor about the ups and downs of debugging. It could also be a fun gift for anyone who enjoys programming or technology-related humor, even if they're not a professional coder.
- Dishwasher and Microwave Safe: These fantastic drinking mugs can go straight in the dishwasher, all day every day, meaning it can save you time, and be more hygienic. Perfect for your favorite hot or cold beverages. Easily reheat that coffee or tea you forgot to drink right away because it is microwave safe. Saves you time, is very convenient, and is perfect for your busy lifestyle.
Step 5: Ask for the implementation fix without surrendering the test
Once the reproduction is confirmed, give the agent a narrowly scoped repair request. Include the requirement, the protected test path, the baseline failure, and boundaries such as “do not alter the assertion.” Ask it to explain the proposed cause and changes before applying them when the risk is high.
The reproduction test at <test path> fails with <observed failure> because the expected behavior is <requirement>. Fix the implementation only. Do not edit, skip, delete, or weaken the reproduction test, and do not modify unrelated tests or configuration. After editing, run the reproduction test first, then the related suite. Return the exact commands, output summary, skipped tests, and any checks you could not run.
Inspect the patch for scope. A good fix changes the smallest necessary implementation surface, preserves existing contracts, and adds defensive handling only where the requirement calls for it. Be cautious when the agent proposes changing many callers, updating snapshots, broadening a schema, or rewriting the test framework to make one case pass.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWatch for test manipulation
- An assertion value changes to match the observed output without a requirement change.
- The reproduction is marked skipped, filtered out, or moved so the default command no longer runs it.
- A fixture is altered so the problematic input never reaches the code.
- Snapshot files are regenerated without reviewing the changed behavior.
- Failure handling is replaced with a generic fallback that hides the original error.
- Unrelated files are modified to suppress warnings or stabilize the run.
Any of these may be legitimate in a separately justified change, but they are not evidence of a verified fix by themselves.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Step 6: Verify the fix in layers
Run the focused test first
Use the same command that demonstrated the bug. The test should now pass for the intended reason, not because the input was bypassed or the assertion changed. Compare the new output with the original failure.
Run the related suite
Run the module, package, or feature suite that shares the changed code. This catches regressions in neighboring behavior while keeping diagnosis manageable. If the suite is too expensive or depends on unavailable infrastructure, state exactly what was omitted and why.
Review the complete diff
Inspect implementation files, tests, configuration, generated artifacts, and lockfiles. Confirm that the protected reproduction remains present and meaningful. Review additions as well as deletions; removing a failing case can make a report disappear without fixing it.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Check skips, xfails, and coverage claims
Read the runner’s skip, expected-failure, deselection, and timeout output. A green exit code can coexist with a skipped reproduction. Coverage can reveal untested branches, but it cannot establish that the requirement is correct or that the reported path was exercised.
Best Value
- Programmer present idea with funny saying for developer, or coder who loves programming, coding. Cool geek apparel in nerd themed clothes for those who study information technology, and science.
- Get this funny computer science clothing for birthday & Christmas for best software engineer. Funny gag present for men, women, mom, dad, grandma, grandpa, sister, brother, or kids.
- Lightweight, Classic fit, Double-needle sleeve and bottom hem
OpenAI’s guidance for cloud coding work emphasizes reviewing actual outcomes rather than relying on an agent’s completion claim; its documentation is available at Using Codex Cloud. Treat “fixed” as a statement to verify with commands and artifacts.
A practical evidence record for every bug-fix attempt
| Stage | Agent permission | Evidence to retain | Decision |
|---|---|---|---|
| Repository inspection | Read files and run existing checks; no edits or installs | Framework, test locations, commands, environment notes | Can the project run the relevant test? |
| Baseline | Run unchanged tests | Commit, command, output, pass/fail/skip counts, pre-existing failures | What was already broken? |
| Requirement | Discuss and propose assertions | Requirement source, expected observable result, boundaries | What counts as correct? |
| Reproduction | Add only the focused test | Test diff and first failing output | Does the report reproduce for the expected reason? |
| Implementation | Edit production code; preserve the test | Implementation diff and explanation of the cause | Does the patch address the requirement without test manipulation? |
| Verification | Run focused test and related suite | Exact commands, output, skips, failures, unrun checks | Is the fix supported by inspectable evidence? |
This record makes review faster because a maintainer can distinguish a product regression, a test defect, and an environmental limitation without reconstructing the agent’s session.
What to do when the agent cannot reproduce the bug
Compare versions and inputs
Confirm the commit, dependency lockfile, runtime, operating system, feature flags, locale, time zone, and data shape used by the report. A behavior can differ between versions or configurations without either observation being fabricated.
Request a minimal artifact
Ask for the smallest input, request, fixture, or sequence that triggers the issue, with secrets removed. If the report depends on production data, create a sanitized fixture that preserves the relevant characteristics.
Do not force a failure
If the agent cannot reproduce the report after reasonable setup checks, record “not reproduced in this environment” with the commands and conditions tested. You can still inspect the suspected code, but a speculative patch should be labeled as such and reviewed more cautiously than a test-backed fix.
Security reports need the same discipline, with an important qualification
For a suspected vulnerability, isolate the behavior and attempt a controlled reproduction before presenting it as a confirmed finding. OpenAI describes this validation step in Codex Security as trying “to reproduce a potential vulnerability in an isolated environment before surfacing it.” That is product-specific security guidance, not a guarantee that every coding agent will validate every bug automatically.
Use safe, non-production fixtures and avoid exposing credentials or personal data. Preserve the original report, the isolated reproduction, and the conditions under which the behavior was or was not observed.
Free tools Windows power users keep installed
One-click scans. No signup required.
How to report the result to a reviewer
A useful completion note is factual and compact:
- Requirement: quote or link the behavior that defines correctness.
- Baseline: identify the commit and pre-existing failures.
- Reproduction: give the test path and the original failure.
- Change: summarize implementation files and why they address the cause.
- Verification: list the focused command, related-suite command, results, skips, and failures.
- Limits: identify checks that required unavailable services or were not run.
Do not report a passing targeted test as proof that the entire system is correct. State the scope of what was executed and leave unresolved questions visible.
Decision checklist before you approve an AI-generated fix
- Is the project’s test framework and normal command known?
- Was an unchanged baseline run and recorded?
- Is expected behavior supported by a requirement or documented decision?
- Does a focused test reproduce the reported behavior?
- Did the test fail for the expected reason rather than setup or assertion error?
- Was the reproduction protected from edits during implementation?
- Does the diff change only what the fix requires?
- Does the original test pass after the change?
- Did the related suite run, and are skips and failures explained?
- Can another reviewer inspect the commands, output, assertions, and diff?
If any answer is no, the next action is usually more diagnosis, not another speculative prompt to “try a different fix.” Verification turns an AI agent from an unreviewed code generator into a participant in an evidence-based debugging loop.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

