Include terminal errors in turn completion events (#32280)

## What changed

- Add an optional `error` payload to `TurnCompleteEvent` and omit it when a turn completes without an error.
- Preserve the full terminal `ErrorEvent` through the turn lifecycle so the completion event includes the same error details emitted separately by `EventMsg::Error`.

## Testing

- Extend the stream-error integration test to verify that `TurnCompleteEvent` contains the emitted error and that the next turn can still proceed.

GitOrigin-RevId: 8d32942a44132763076130102d8b89ab356d59d0
This commit is contained in:
Owen Lin authored and copyberry committed 2026-07-10 22:04:03 +00:00
1 parent 09ccae2c07
commit c4318c386d
19 files changed
+92 -6

No files matched your search

+1
View File
@@ -540,6 +540,7 @@ mod tests {
turn_id: "turn-1".to_string(),
started_at: None,
last_agent_message: None,
error: None,
completed_at: None,
duration_ms: None,
time_to_first_token_ms: None,