mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-06-25 02:37:53 -07:00
88a12098d4
Fixed a logic error in `Turn.getResponseText()` where all individual streaming chunks were being joined with a space. This lead to two issues: 1. Extra spaces between words/chunks in the output. 2. Massive duplication of the entire response text because the final consolidated response (yielded by some content generators or logic) was being joined with the individual chunks. The new implementation uses a robust heuristic: if a chunk's text starts with the accumulated text so far, it is treated as a cumulative update and replaces the current buffer; otherwise, it is treated as a delta and appended. This handles delta chunks, cumulative chunks, and redundant consolidated responses gracefully. Fixes #27030 cc @spencertang @mbleigh