The most reliable way to point an agent at a bug is a failing test. It turns “it seems broken” into a command that exits non-zero, and it gives the agent something to run after every change.
The workflow
- Describe the bug and ask for a test that reproduces it. Do not allow changes to the code yet.
- Run the test and confirm that it fails for the reason you expect.
- Ask for the smallest change that makes it pass.
- Run the whole suite, not only the new test.
- Review the test and the fix as two separate things.
Traps
- A test that fails for the wrong reason, such as a typo or a missing import.
- A test written to match the new code, which proves nothing about the bug.
- A weakened existing test changed so that it passes.
- Tests that mock the very thing that was broken.
How to check a test
Revert the fix and run the test again. If it still passes, the test does not cover the bug. A reviewer can do the same in a minute.
Record the outcome
Save the cause of the bug as a finding with its source, and any approach that failed as a failed attempt. The next person who sees a similar symptom will start with the answer. See failed attempts as documentation.