Generate automatic and manual conversation recaps (#40705)

## Why

Users returning to a conversation need a short summary of its recent progress and next steps.

## What changed

- Generate a recap for eligible idle, unfocused conversations and add it to the transcript.
- Add `/recap` to request the same summary on demand, with visible progress and actionable errors.
- Keep recap requests bounded and isolated, reject stale results, and retry only automatic failures.

## Testing

- Cover automatic and manual generation, request eligibility, failure handling, loading-state cleanup, and temporary-thread configuration.

GitOrigin-RevId: 926a88d6996d67a42809ce2c4091b13fca882b52
This commit is contained in:
Felipe Coury authored and copyberry committed 2026-08-25 21:03:11 +00:00
1 parent 40ba7da7b4
commit 6988d390b3
17 files changed
+831 -38

No files matched your search

+15 -3
View File
@@ -204,6 +204,13 @@ pub(crate) enum ThreadTitleDestination {
RenameSuggestion { request_id: Uuid },
}
/// Identifies the policy that initiated a recap request.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum RecapTrigger {
Automatic,
Manual,
}
#[allow(clippy::large_enum_variant)]
#[derive(Debug, IntoStaticStr)]
pub(crate) enum AppEvent {
@@ -1326,16 +1333,21 @@ pub(crate) enum AppEvent {
action: String,
},
/// Generate a recap for the displayed idle thread at the user's request.
GenerateRecap {
thread_id: ThreadId,
},
/// 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)]
/// Deliver the result of starting a recap's temporary thread.
RecapStarted {
thread_id: ThreadId,
request_id: Uuid,
trigger: RecapTrigger,
completed_turn_count: usize,
turn_revision: usize,
history: String,
@@ -1343,10 +1355,10 @@ pub(crate) enum AppEvent {
},
/// Deliver the generated recap from a temporary structured turn.
#[allow(dead_code)]
RecapGenerated {
thread_id: ThreadId,
request_id: Uuid,
trigger: RecapTrigger,
temporary_thread_id: ThreadId,
completed_turn_count: usize,
turn_revision: usize,