Fix _extract_text including thinking/reasoning blocks as visible text (fixes #1357)

_extract_text() in compaction.py was extracting all ResponseOutputText
chunks regardless of chunk.type, which included reasoning/thinking blocks
(type='reasoning') in the compaction summary. Filter to only include
chunks with type='output_text'.
This commit is contained in:
dajiaohuang 2026-10-07 14:48:12 +08:00
parent f1386cad37
commit 6cf2865eb5

View file

@ -294,7 +294,7 @@ def _extract_text(response: ModelResponse) -> str:
parts.extend(
chunk.text
for chunk in item.content
if isinstance(chunk, ResponseOutputText) and chunk.text
if isinstance(chunk, ResponseOutputText) and chunk.type == "output_text" and chunk.text
)
return "".join(parts)