Prepare automatic TUI recap generation (#40697)

## What changed

- Schedule recap eligibility checks when an unfocused thread changes, and cancel them when focus returns or recap state is replaced.
- Add bounded structured recap requests with stale-result rejection, normalized output, and one retry per turn revision.
- Harden temporary structured threads by reading the effective configuration and disabling all discovered MCP servers, tools, skills, and environment access.

## Testing

- Cover recap timers, focus changes, failed turns, output bounds, stale results, and retry behavior.

GitOrigin-RevId: eebf50059763928e9a2444b14d51648e0bdff4a8
This commit is contained in:
Felipe Coury authored and copyberry committed 2026-08-25 20:56:03 +00:00
1 parent 7c1e36c23f
commit 40ba7da7b4
8 files changed
+788 -80

No files matched your search

+12 -3
View File
@@ -963,9 +963,13 @@ impl App {
}
if self.current_displayed_thread_id() == Some(thread_id)
&& let ServerNotification::TurnCompleted(notification) = &notification
&& matches!(notification.turn.status, TurnStatus::Completed)
{
self.recap.note_turn_completed(Instant::now());
let now = Instant::now();
let app_event_tx = self.app_event_tx.clone();
self.recap
.note_turn_finished(&notification.turn.status, now);
self.recap.schedule_check(thread_id, app_event_tx, now);
}
let misalignment_policy_violation =
match &notification {
@@ -1327,7 +1331,12 @@ impl App {
self.app_event_tx
.send(AppEvent::BeginInitialHistoryReplayBuffer);
}
self.recap.seed_from_turns(&turns, Instant::now());
let now = Instant::now();
let app_event_tx = self.app_event_tx.clone();
self.recap.seed_from_turns(&turns, now);
self.recap.schedule_check(thread_id, app_event_tx, now);
self.chat_widget
.replay_thread_turns(turns, ReplayKind::ResumeInitialMessages);
if should_buffer_initial_replay {