mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Improve automatic thread naming in the TUI (#42749)
## Why Automatic title generation used a provisional thread name and only applied the generated result while its thread remained active. Switching threads could therefore leave the originating thread without its generated name. ## What changed - Track title-generation requests by thread so results are persisted for the originating thread, while preserving any name set before generation finishes. - Show a `renaming...` spinner instead of a provisional name, including across thread switches and failure paths. - Add `thread-name` items to the status line and terminal title, and include the generated thread name in both default layouts. ## Testing - Cover automatic naming, manual-name precedence, thread switching, failed requests, deduplication, and status-surface rendering and animation. GitOrigin-RevId: a03ae4849bedec9f62f256fadad72c1685ce46e0
This commit is contained in:
1 parent
8e85265c39
commit
a1294e57f1
32 files changed
+642
-181
No files matched your search
@@ -1883,37 +1883,16 @@ impl App {
|
||||
let had_active_view = self.chat_widget.has_active_view();
|
||||
self.handle_thread_event_now_recovering_file_changes(event)
|
||||
.await;
|
||||
if let Some(user_message) = automatic_title_user_message {
|
||||
let expected_title = user_message
|
||||
.split_whitespace()
|
||||
.collect::<Vec<_>>()
|
||||
.join(" ")
|
||||
.chars()
|
||||
.take(super::thread_title::THREAD_TITLE_MAX_CHARS)
|
||||
.collect::<String>();
|
||||
|
||||
if !expected_title.is_empty()
|
||||
&& let Some(thread_id) = self.active_thread_id
|
||||
{
|
||||
match app_server
|
||||
.thread_set_name(thread_id, expected_title.clone())
|
||||
.await
|
||||
{
|
||||
Ok(()) => {
|
||||
self.chat_widget
|
||||
.expect_automatic_thread_name(expected_title.clone());
|
||||
self.generate_thread_title(
|
||||
app_server,
|
||||
thread_id,
|
||||
ThreadTitleDestination::Automatic { expected_title },
|
||||
super::thread_title::thread_title_prompt(&user_message),
|
||||
);
|
||||
}
|
||||
Err(error) => {
|
||||
tracing::debug!(%error, "failed to set provisional thread title");
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(user_message) = automatic_title_user_message
|
||||
&& !user_message.trim().is_empty()
|
||||
&& let Some(thread_id) = self.active_thread_id
|
||||
{
|
||||
self.generate_thread_title(
|
||||
app_server,
|
||||
thread_id,
|
||||
ThreadTitleDestination::Automatic,
|
||||
super::thread_title::thread_title_prompt(&user_message),
|
||||
);
|
||||
}
|
||||
if !had_active_view
|
||||
&& self.chat_widget.has_active_view()
|
||||
|
||||
Reference in new issue
Block a user