From d6cbaea434d8a8fb2c604a4fbc65d083eded5098 Mon Sep 17 00:00:00 2001 From: AI Assistant Date: Thu, 26 Feb 2026 23:57:31 +0800 Subject: [PATCH] fix(tui): preserve streamed text during tool call transitions Fixes #27674 The TUI was erasing already-streamed assistant text when tool calls were triggered. This happened because the finalize() method in TuiStreamAssembler was not using the protectBoundaryDrops option when updating run state. Now finalize() applies the same boundary drop protection as ingestDelta(), ensuring that streamed text before tool calls is preserved when the final payload drops earlier content blocks. --- src/tui/tui-stream-assembler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tui/tui-stream-assembler.ts b/src/tui/tui-stream-assembler.ts index 302cc7acc1c..4c2fa5a7235 100644 --- a/src/tui/tui-stream-assembler.ts +++ b/src/tui/tui-stream-assembler.ts @@ -151,7 +151,7 @@ export class TuiStreamAssembler { const streamedDisplayText = state.displayText; const streamedTextBlocks = [...state.contentBlocks]; const streamedSawNonTextContentBlocks = state.sawNonTextContentBlocks; - this.updateRunState(state, message, showThinking); + this.updateRunState(state, message, showThinking, { protectBoundaryDrops: true }); const finalComposed = state.displayText; const shouldKeepStreamedText = streamedSawNonTextContentBlocks &&