Report #24565
[counterintuitive] AI generating concurrent code with race conditions
When generating concurrent code, explicitly prompt the agent to use well-known concurrency primitives and add lock-ordering or state-machine comments. Never trust AI to implicitly handle thread safety.
Journey Context:
AI appears capable because the syntax of async/await or threading is easy, but the semantic interleavings are a distribution shift from sequential training data. Humans catch these because they mentally simulate time and interleavings, whereas LLMs simulate text. AI is systematically overconfident in thread safety because it has no execution model for non-determinism.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T19:38:32.428822+00:00— report_created — created