A bug report says the dashboard shows the wrong results.
The coding assistant finds a suspicious function, changes it and reports success. The application still builds. The visible symptom disappears during one quick check.
That does not establish what caused the bug.
The change may have corrected the problem. It may also have hidden it, changed the timing or replaced one failure with another.
AI-assisted debugging works better when each step produces evidence: a reproducible failure, an explanation supported by observation and a check that distinguishes the corrected behavior from the original defect.
Give the assistant a failure it can investigate
“The search is broken” names a problem area. It leaves the investigation almost entirely open.
A useful report separates the expected behavior from what actually happened:
Expected
After changing the status filter to Archived, the list shows
only archived projects.
Observed
The filter displays Archived, but active projects sometimes
reappear in the results.
Steps
1. Open the project list.
2. Select Active.
3. Immediately select Archived.
4. Wait for both requests to finish.
Conditions
Observed with a slow connection.
Not reproduced when waiting between filter changes.
This report does not claim that the cause is a race condition. It supplies evidence that makes request timing worth investigating.
Include the relevant route, application revision, account role and environment when those details affect reproduction. Use sanitized test data where possible.
A screenshot can establish what appeared on screen. It usually cannot establish which request produced it or which state transition allowed it.
Reproduce before editing
The first objective is to observe the reported failure under controlled conditions.
For the filter example, the assistant should establish:
- Whether two requests are sent.
- Which filter each request represents.
- Which response arrives first.
- Which response updates the visible list.
- Whether the issue occurs in the current revision.
If the failure cannot be reproduced, record that limitation. Investigating a plausible cause is still useful, but it should not be reported as a confirmed diagnosis.
Avoid changing code merely to create visible progress. A patch introduced before reproduction can erase useful evidence and make it harder to tell whether the original issue was understood.
A small reproduction is often enough. It might be a browser flow, a failing API request or a focused test using controlled data.
Keep observations separate from explanations
An AI assistant can produce a convincing explanation from a small amount of evidence. Treat that explanation as a hypothesis until the system supports it.
For example:
| Type | Statement |
|---|---|
| Observation | The Archived request finishes before the earlier Active request |
| Observation | Active results appear after the Active response arrives |
| Hypothesis | The application applies every response without checking whether it still matches the selected filter |
| Alternative | The server returns the wrong records |
| Alternative | A cache key omits the selected filter |
These explanations require different fixes.
Ask the assistant to identify an observation that would distinguish them. If the network response contains the correct archived records but the interface later displays active records, the investigation moves toward client state handling. If the server response itself is wrong, changing rendering code is unlikely to address the cause.
This keeps the conversation tied to evidence instead of accumulating increasingly elaborate guesses.
Instrument the point where behavior diverges
Logging everything can make the relevant event harder to find.
For overlapping requests, a small record may be enough:
requestId: 41
filter: active
event: started
requestId: 42
filter: archived
event: started
requestId: 42
filter: archived
event: applied
requestId: 41
filter: active
event: applied
This is an illustrative diagnostic sequence, not output from a real project.
The useful evidence is that request 41 was applied after request 42 even though the selected filter had changed.
Breakpoints can help inspect the state at that moment. Chrome DevTools supports conditional breakpoints, logpoints, exception breakpoints and other ways to pause or observe execution. A conditional breakpoint can narrow an investigation to the state that matters instead of stopping on every call. developer.chrome.com
Use instrumentation that answers a specific question. Remove temporary logging when it has served its purpose, and avoid recording credentials or unnecessary customer data.
Capture the sequence when a screenshot is insufficient
Some failures depend on several actions and responses. The final screen alone loses that sequence.
For browser tests, Playwright’s Trace Viewer can expose recorded actions, page snapshots and network information, helping connect a failure to what happened before it. The available evidence depends on how the trace was recorded. Playwright
A useful handoff to an AI assistant might include:
The failure occurs after the second filter change.
Inspect:
- The selected filter at each action
- The two outgoing request parameters
- Response completion order
- The snapshot after each response
Determine which response produced the final rows.
Do not infer the cause from the final screenshot alone.
Traces can contain application content and request details. Use an appropriate test environment and review what is included before sharing them.
Use history when the behavior is a regression
If the feature worked previously, repository history provides another source of evidence.
Start with the last revision known to behave correctly and the first revision known to fail. Do not assume the latest commit caused the problem merely because it is recent.
Git’s bisect command searches between good and bad revisions to narrow down the change that introduced a regression. It can also run a repeatable test through git bisect run. git-bisect Documentation
This is most useful when the pass/fail check is reliable. If the outcome depends on changing external data or an intermittent service, an inconsistent check can misclassify revisions.
Finding the first failing commit also does not automatically identify the full cause. A change may expose a pre-existing assumption elsewhere in the system. Inspect the interaction before deciding what to revert or repair.
Build a test that fails for the reported reason
For the filter bug, a test that sends one request and checks its results misses the important condition.
The regression test needs overlapping requests with controlled completion order:
1. Select Active and hold its response.
2. Select Archived.
3. Complete the Archived response.
4. Confirm archived projects are displayed.
5. Complete the older Active response.
6. Confirm archived projects remain displayed.
The assertion concerns visible behavior. It does not require a particular internal implementation.
Avoid relying on arbitrary delays such as “wait two seconds.” Where the test framework allows it, explicitly control the relevant request or asynchronous boundary. That makes the failure condition easier to repeat.
Run the test against the uncorrected behavior when practical. It should fail because stale results overwrite the current selection, not because a fixture is missing or the test environment cannot start.
Make the correction fit the cause
Once the diagnosis is supported, choose a correction appropriate to the application.
For the illustrative request-order problem, possible approaches include cancelling obsolete work, checking request identity before applying results or using an existing data-fetching mechanism that already handles the requirement.
The right choice depends on the surrounding code.
The assistant should inspect how similar requests are managed elsewhere before introducing another pattern. A local fix that duplicates existing infrastructure can create maintenance problems even if it resolves the immediate symptom.
Also keep the success condition explicit:
A response for an obsolete filter must not replace the results for the current filter.
That condition is stronger than:
Add request cancellation.
The first describes the required behavior. The second names one possible mechanism whose effectiveness still needs verification.
Verify the original path and nearby behavior
After the focused regression check passes, repeat the original reproduction.
Then inspect the neighboring cases affected by the change:
| Case | Behavior to verify |
|---|---|
| One ordinary request | Results load normally |
| Rapid filter changes | Current results remain authoritative |
| Clearing the filter | The unfiltered list appears |
| Latest request fails | An appropriate error appears |
| Older request fails later | Its error does not overwrite the current state |
| Leaving the page during loading | No inappropriate update affects the departed view |
These are examples for this particular bug. They are not a universal test checklist.
Run the repository’s relevant existing checks as well. A focused regression test establishes one important fact, but it does not cover every caller or shared behavior affected by the patch.
Avoid broad cleanup during diagnosis. If the repair reveals a larger refactoring need, record it separately unless the refactor is necessary to make the fix correct.
Require a completion report that exposes its limits
A useful debugging report states what was observed and what remains unverified.
Reproduced
An older Active response replaced Archived results after
two rapid filter changes.
Cause
The response handler applied results without checking
whether the request still matched the current selection.
Changed
Obsolete responses can no longer replace the current
results or error state.
Verified
The regression test failed before the fix and passed after it.
The original browser sequence was repeated successfully.
Relevant existing tests passed.
Not verified
Production behavior under real traffic.
This report is an example format, not a claim about work performed.
If the assistant did not reproduce the bug, the report should say so. If it could not run a browser check, it should distinguish a code-level test from an observed interaction.
“Fixed” should summarize evidence, not replace it.
Keep the debugging loop small
A practical AI-assisted debugging loop is:
- Describe the failure precisely.
- Reproduce it.
- Form competing explanations.
- Collect evidence that separates them.
- Make a focused correction.
- Verify the original failure and affected neighboring behavior.
AI can help read unfamiliar code, propose experiments and build a regression test. The value depends on whether those steps reduce uncertainty.
When the evidence does not support the first explanation, change the explanation. Do not keep expanding the patch until the symptom becomes difficult to reproduce.
The finished result should leave both working behavior and a clear account of why the change was needed.
Sources
- Chrome DevTools: Pause your code with breakpoints
- Playwright: Trace Viewer
- Git: git-bisect documentation
Sources checked on November 9, 2026. The filter defect, diagnostic output and completion report are hypothetical examples. The workflow is an editorial recommendation, not a claim of measured productivity improvement.
Conversation
Discussion
Loading comments…