fix(streaming): prevent tool_call_start from splitting mid-sentence content blocks

↗ view on GitHub · Jason Lee · 2026-05-15 · f757bc84

Two bugs caused the tool-use accordion to appear mid-sentence:
1. tool_call_start incorrectly called pushEvent(), which finalized the
   in-flight content block prematurely before the text was complete.
2. finalizeStreamingContent() only checked the last event; after fix 1
   the last event is the tool_call_start placeholder, so the streaming
   content block (second-to-last) was never committed and the drip text
   was lost.

Fix 1: tool_call_start bypasses pushEvent() and appends the placeholder
directly, leaving the content block open.
Fix 2: finalizeStreamingContent() scans backwards through the event array
to find the streaming content block regardless of its position.
Repository dropthejase/louis
Author Jason Lee <12leeejk2@gmail.com>
Authored
Parents 12cafc1b
Stats 1 file changed , +28 , -10
Part of Streaming chat UI: tool cards, reasoning blocks, MessageList refactor

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-f757bc84.md from inside the repo you want the change in.

⬇ Download capture-commit-f757bc84.md