Interview mode has stale closure bugs in handleSend — can drop or duplicate messages #16

Closed
opened 2026-05-09 05:19:53 +00:00 by Mark · 1 comment
Owner

Severity: Medium

File: src/components/wizard/InterviewMode.tsx

Issue: The handleSend function is wrapped in useCallback with messages in its dependency array. However, within the streaming handler:

  1. It reads messages from closure at call time
  2. Then enters an async streaming loop that can take many seconds
  3. The initial llmMessages array is built from the captured messages value, which may be missing messages added concurrently

Impact: In rapid-fire messaging, messages may be dropped, duplicated, or the conversation history can become desynchronized from what was sent to the LLM.

**Severity:** Medium **File:** `src/components/wizard/InterviewMode.tsx` **Issue:** The `handleSend` function is wrapped in `useCallback` with `messages` in its dependency array. However, within the streaming handler: 1. It reads `messages` from closure at call time 2. Then enters an async streaming loop that can take many seconds 3. The initial `llmMessages` array is built from the captured `messages` value, which may be missing messages added concurrently **Impact:** In rapid-fire messaging, messages may be dropped, duplicated, or the conversation history can become desynchronized from what was sent to the LLM.
Author
Owner

Fixed in commit. Closing.

Fixed in commit. Closing.
Mark closed this issue 2026-05-14 21:34:45 +00:00
Sign in to join this conversation.
No description provided.