fix: eliminate thinking message flash before reclassification

The optimistic fold previously required prior thinking messages in the
pending group (pendingThinking.length > 0) before it would absorb an
unclassified pending assistant message. When the first assistant message
in a turn arrived before any thinking messages were classified, it
briefly rendered as a full chat message, then snapped into the
collapsible panel once the message-reclassified event arrived.

Remove the pendingThinking.length guard so any trailing pending,
unclassified assistant message during an active turn is folded into
the turn-activity panel immediately, regardless of whether prior
thinking messages exist.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David Kaya
2026-04-07 10:25:09 +02:00
co-authored by Copilot
parent cbc05c8f08
commit 366200b29d
+5 -6
View File
@@ -157,15 +157,14 @@ export function ChatPane({
}
// Optimistic thinking classification: fold a pending assistant
// message into the current thinking group when it immediately follows
// thinking messages during an active turn. This prevents the brief
// flash of content that occurs before a message-reclassified event
// arrives. Only the very last message qualifies — earlier messages
// have already been classified definitively.
// message into the current activity group when it immediately follows
// thinking messages during an active turn, OR when it's the very last
// message and no kind has been assigned yet. This prevents the brief
// flash where content renders as a full chat message before the
// message-reclassified event arrives.
if (
busy
&& isLast
&& pendingThinking.length > 0
&& message.role === 'assistant'
&& message.pending
&& !message.messageKind