Clear stale Guardian reviews when turns end (#34371)

## Why

Pending Guardian review state could outlive an interrupted or completed turn,
leaving stale review details visible during a following goal turn.

## What changed

- Clear pending Guardian reviews during both turn completion and finalization.
- Restore an active MCP startup header after cleanup, falling back to `Working`
  when no MCP server is starting.

## Testing

Added coverage for interrupted and completed turns, including goal continuation
and overlapping MCP startup status.

GitOrigin-RevId: a15ed81a5d6005e9294089f4424a8dedbc6e9cb5
This commit is contained in:
Eric Traut authored and copyberry committed 2026-07-20 16:05:14 +00:00
1 parent b6de5b524c
commit 5c18cc0acc
5 files changed
+163 -104

No files matched your search

@@ -16,6 +16,16 @@ fn is_safety_access_block_message(message: &str) -> bool {
}
impl ChatWidget {
fn clear_guardian_review_status(&mut self) {
self.status_state.pending_guardian_review_status.clear();
if self.status_state.current_status.is_guardian_review() {
let header = self
.mcp_startup_status_header()
.unwrap_or_else(|| String::from("Working"));
self.set_status_header(header);
}
}
/// Synchronize the bottom-pane "task running" indicator with the current lifecycles.
///
/// The bottom pane only has one running flag, but this module treats it as a derived state of
@@ -177,6 +187,7 @@ impl ChatWidget {
self.status_state.pending_status_indicator_restore = false;
self.input_queue.user_turn_pending_start = false;
self.clear_active_hook_cell();
self.clear_guardian_review_status();
self.turn_lifecycle.finish();
self.clear_safety_buffering();
self.update_task_running_state();
@@ -322,6 +333,7 @@ impl ChatWidget {
self.clear_active_hook_cell();
// Reset running state and clear streaming buffers.
self.input_queue.user_turn_pending_start = false;
self.clear_guardian_review_status();
self.turn_lifecycle.finish();
self.update_task_running_state();
self.running_commands.clear();