Keep interrupted partial streams in the transcript

GUI flushes the streaming buffer into a durable item on interrupted/error.
Engine persists partial text on the provider-error path like the stop path.
e2e red-green verified; full suites pass.
This commit is contained in:
Rohit C Prasad
2026-07-22 10:40:01 -07:00
committed by Rohit P
parent f32f75feb2
commit d8903bc927
5 changed files with 104 additions and 3 deletions
+6
View File
@@ -244,6 +244,12 @@ class TurnEngine:
if chunk.turn is not None:
turn = chunk.turn
except Exception as exc: # provider failure
# Same contract as the stop path below: the partial text the user
# watched arrive survives the failure (no tool calls — none finalized).
if streamed:
self.messages.append(
_assistant_message(AssistantTurn(text="".join(streamed)))
)
friendly = friendly_model_error(self.model, exc)
payload = {
"error": friendly or str(exc),