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

+27
View File
@@ -1325,6 +1325,33 @@ pub(crate) enum AppEvent {
context: String,
action: String,
},
/// Recheck whether an unfocused thread is ready for an automatic recap.
CheckRecap {
thread_id: ThreadId,
},
/// Deliver the result of starting an automatic recap's temporary thread.
#[allow(dead_code)]
RecapStarted {
thread_id: ThreadId,
request_id: Uuid,
completed_turn_count: usize,
turn_revision: usize,
history: String,
result: Result<String, String>,
},
/// Deliver the generated recap from a temporary structured turn.
#[allow(dead_code)]
RecapGenerated {
thread_id: ThreadId,
request_id: Uuid,
temporary_thread_id: ThreadId,
completed_turn_count: usize,
turn_revision: usize,
result: Result<String, String>,
},
}
/// Named profile selection to apply after any required UI guardrails complete.