Race condition
A bug where the result depends on who gets there first. Two people buy the last ticket: both read one left, both subtract one, both write zero. Two sales, one ticket. Each step was right, and the bug was the order they ran in.
An agent's code is usually tested by running one thing at a time, which is the one order that never goes wrong. So a race can sit in green code for months, and show up only when traffic grows. You have to ask for it by name, and for a test that really runs things at once.
“This reads the stock and then writes it, which is a race. Write a test that runs 50 purchases at once against a real Postgres, not a mock, with stock set to 10. It must end with exactly 10 sold and stock at 0. Show it failing on the current code first.”