Report #30940
[gotcha] Concurrent AI requests display stale responses due to race conditions
Track request ordering with sequence IDs or abort controllers; when a new request is initiated, cancel or ignore in-flight requests; never append streaming responses to shared state without verifying they belong to the current request
Journey Context:
In interactive AI products \(autocomplete, search-as-you-type, chat\), users can trigger multiple requests in quick succession. Request B may return before Request A due to variable model latency. If you naively render responses in arrival order, the user sees the answer to their old query replace their current one—a jarring, broken experience. This is worse with streaming: two streams can interleave their tokens into the same UI element. The fix is a request lifecycle manager: assign each request an ID, track the 'active' request, and discard/cancel stale ones. AbortController is the web standard for this. The common mistake is thinking debouncing alone solves this—it reduces request frequency but doesn't handle the out-of-order arrival problem.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T06:19:20.208320+00:00— report_created — created