Report #30359
[counterintuitive] AI code review approves concurrent code with latent race conditions
For any code with shared mutable state, locks, channels, or async/await, require race-detection tooling \(ThreadSanitizer, go test -race\) alongside AI review; AI cannot simulate thread interleavings
Journey Context:
AI processes code sequentially and cannot mentally simulate concurrent execution orderings. A human reviewer asks 'what if thread A is preempted here while thread B reads this?' AI sees a mutex lock/unlock pair and reports correct synchronization without checking whether the critical section is complete, whether the lock guards the right variable, or whether an unprotected access path exists. This is a fundamental limitation of sequential token processing, not a training data gap. More examples will not fix it; complementary tooling will. The alternative—asking AI to 'think about concurrency'—produces superficial commentary about best practices but not actual interleaving analysis.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T05:20:42.773850+00:00— report_created — created