Discovered during Sprint 4.2b Chrome MCP verification (PR for #23 + #24).
Issue
When the user submits a query, useChat.ts:131-150 pushes BOTH the user message AND an empty assistant message into the conversation array BEFORE streaming starts. If the stream is then aborted (via the in-input stop button, or via switchConversation/deleteConversation), the empty assistant message stays in the conversation array forever.
Visible in production: opening any old chat shows orphan K avatars with no content beside them — one per aborted stream.
Repro
- Open https://kami.rectorspace.com
- Submit any query
- Click the stop button BEFORE the first token arrives (~2s window)
- Observe: the user message stays visible; an orphan K avatar persists alongside it
- Switch to another conversation and back — the orphan stays
Suggested fix (needs brainstorm)
Two reasonable approaches, neither obviously correct without more thought:
- A: Delete the empty assistant message on abort. Simple but loses the breadcrumb that "the user asked X but it was interrupted."
- B: Replace the empty content with a placeholder string (e.g., "Stream interrupted.") so the row remains visually meaningful. Slightly more work; preserves history.
Files
src/hooks/useChat.ts:131-150 (push empty assistant message)
src/hooks/useChat.ts:86-90 (switchConversation aborts)
src/hooks/useChat.ts:100-118 (deleteConversation aborts)
src/hooks/useChat.ts:300-303 (stopStreaming)
Effort
~1-2h once the brainstorm picks an approach.
Tracked by
Not part of the 2026-04-26 QA umbrella (#3) — discovered later. Stand-alone issue.
Discovered during Sprint 4.2b Chrome MCP verification (PR for #23 + #24).
Issue
When the user submits a query,
useChat.ts:131-150pushes BOTH the user message AND an empty assistant message into the conversation array BEFORE streaming starts. If the stream is then aborted (via the in-input stop button, or viaswitchConversation/deleteConversation), the empty assistant message stays in the conversation array forever.Visible in production: opening any old chat shows orphan K avatars with no content beside them — one per aborted stream.
Repro
Suggested fix (needs brainstorm)
Two reasonable approaches, neither obviously correct without more thought:
Files
src/hooks/useChat.ts:131-150(push empty assistant message)src/hooks/useChat.ts:86-90(switchConversation aborts)src/hooks/useChat.ts:100-118(deleteConversation aborts)src/hooks/useChat.ts:300-303(stopStreaming)Effort
~1-2h once the brainstorm picks an approach.
Tracked by
Not part of the 2026-04-26 QA umbrella (#3) — discovered later. Stand-alone issue.