Suggest conversation-based thread titles in /rename (#40495)

## What changed

- Generate a title suggestion from the latest substantive user and assistant messages when the TUI `/rename` prompt opens.
- Prefill the prompt with the result while keeping it editable and preserving any text the user enters before generation finishes.
- Bound and escape the conversation context, omit commentary and IDE context, and correlate responses with the active thread and prompt so stale suggestions are ignored.

## Testing

- Cover conversation selection and prompt construction, generated-title delivery through the embedded app server, loading and prefilled prompt states, stale responses, and preservation of manual edits.

GitOrigin-RevId: 1e7f1d5d4f6503ff9da0548388f610c446c130ca
This commit is contained in:
Felipe Coury authored and copyberry committed 2026-08-24 23:15:04 +00:00
1 parent 0c992c305d
commit 5a51caf04d
13 files changed
+877 -2

No files matched your search

+8 -1
View File
@@ -195,11 +195,13 @@ pub(crate) enum TranscriptExportDestination {
File(PathBuf),
}
/// Deliver a generated title to its originating automatic rename.
/// Deliver a generated title to its originating automatic rename or editable prompt.
#[derive(Debug)]
pub(crate) enum ThreadTitleDestination {
/// Replace the provisional name only if the user has not renamed the thread.
Automatic { expected_title: String },
/// Prefill only the still-active rename prompt with the matching request ID.
RenameSuggestion { request_id: Uuid },
}
#[allow(clippy::large_enum_variant)]
@@ -226,6 +228,11 @@ pub(crate) enum AppEvent {
thread_id: ThreadId,
name: String,
},
/// Generate an editable title suggestion for the active rename prompt.
SuggestThreadName {
thread_id: ThreadId,
request_id: Uuid,
},
/// Register a hidden title-generation thread started in the background.
ThreadTitleStarted {
thread_id: ThreadId,