Reset app-server turn summaries when a turn starts (#60434)

## Why

An error recorded before a turn starts can cause a successful turn to be reported as failed.

## What changed

Reset `TurnSummary` on `TurnStarted`, preserving the new turn's `started_at` timestamp while clearing accumulated errors, command start times, and the last agent message.

## Testing

Extend turn completion tests to cover clearing an error recorded before turn start and retaining an error recorded during the turn.

GitOrigin-RevId: 19989b55d20df7b9a265bd0a1dfb3f00b6e8a9c5
This commit is contained in:
cooper-oai
2026-11-09 19:28:34 +00:00
committed by copyberry
parent 3ff5d6223b
commit ac37f98c73
2 changed files with 27 additions and 1 deletions
+4 -1
View File
@@ -235,7 +235,10 @@ impl ThreadState {
pub(crate) fn track_current_turn_event(&mut self, event_turn_id: &str, event: &EventMsg) {
if let EventMsg::TurnStarted(payload) = event {
self.turn_summary.started_at = payload.started_at;
self.turn_summary = TurnSummary {
started_at: payload.started_at,
..Default::default()
};
}
if let EventMsg::ItemCompleted(payload) = event
&& let CoreTurnItem::AgentMessage(item) = &payload.item