ignore stale ai replies from older requests#116
ignore stale ai replies from older requests#1167se7en72025 wants to merge 1 commit intosugarlabs:mainfrom
Conversation
|
Hi @chimosky, I’ve been looking over this PR. While it tries to solve the issue of stale replies, I'm concerned that the added complexity of thread locks and request IDs might not be necessary for our current needs. Please recheck this and let me know whether we should move forward or if there's a simpler way to handle asynchronous responses, such as using standard async timeouts or clearing the speech queue. Thanks! |
I agree with you re it being unnecessary for our current needs, we don't have that much usage that we need to worry about this problem, locks might introduce unintended consequences. One thing we can do is have the bot say something if a response is taking longer than expected. That's a better tradeoff to make than introducing potential issues. |
issue
Chatbot responses are fetched asynchronously. If a user sends another prompt before the previous one returns, stale/older replies can still be spoken, causing out-of-order conversation.
fix
face.say(...)so only the latest request is spokenimpact
Prevents stale responses from talking over newer context, so chat flow stays correct and predictable under fast input or slow network.