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
@@ -158,7 +158,6 @@ use codex_terminal_detection::TerminalInfo;
|
||||
use codex_terminal_detection::TerminalName;
|
||||
use codex_terminal_detection::terminal_info;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use codex_utils_cli::resume_hint;
|
||||
use codex_utils_path_uri::PathUri;
|
||||
use crossterm::event::KeyCode;
|
||||
use crossterm::event::KeyEvent;
|
||||
@@ -434,6 +433,7 @@ mod status_controls;
|
||||
mod status_surfaces;
|
||||
mod streaming;
|
||||
use self::status_surfaces::CachedProjectRootName;
|
||||
mod thread_title_status;
|
||||
mod thread_usage;
|
||||
pub(crate) use self::thread_usage::ThreadUsageOutcome;
|
||||
mod tokens;
|
||||
@@ -504,7 +504,7 @@ const ASK_FOR_APPROVAL_LABEL: &str = "Ask for approval";
|
||||
const APPROVE_FOR_ME_LABEL: &str = "Approve for me";
|
||||
const AUTO_REVIEW_DESCRIPTION: &str = "Only ask for actions detected as potentially unsafe.";
|
||||
const DEFAULT_OPENAI_BASE_URL: &str = "https://api.openai.com/v1";
|
||||
const DEFAULT_STATUS_LINE_ITEMS: [&str; 2] = ["model-with-reasoning", "current-dir"];
|
||||
const DEFAULT_STATUS_LINE_ITEMS: [&str; 3] = ["model-with-reasoning", "current-dir", "thread-name"];
|
||||
|
||||
/// Common initialization parameters shared by all `ChatWidget` constructors.
|
||||
pub(crate) struct ChatWidgetInit {
|
||||
@@ -691,7 +691,6 @@ pub(crate) struct ChatWidget {
|
||||
pet_image_support_override: Option<crate::pets::PetImageSupport>,
|
||||
thread_id: Option<ThreadId>,
|
||||
thread_name: Option<String>,
|
||||
pending_automatic_thread_names: HashSet<String>,
|
||||
thread_rename_block_message: Option<String>,
|
||||
active_side_conversation: bool,
|
||||
blocks_direct_input: bool,
|
||||
@@ -1578,18 +1577,6 @@ impl ChatWidget {
|
||||
self.add_error_message(format!("{feature}: {TUI_STUB_MESSAGE}"));
|
||||
}
|
||||
|
||||
fn rename_confirmation_cell(name: &str, thread_id: Option<ThreadId>) -> PlainHistoryCell {
|
||||
let mut line = vec![
|
||||
"• ".into(),
|
||||
"Session renamed to ".into(),
|
||||
name.to_string().cyan(),
|
||||
];
|
||||
if let Some(hint) = resume_hint(Some(name), thread_id) {
|
||||
line.extend([". To resume this session run ".into(), hint.cyan()]);
|
||||
}
|
||||
PlainHistoryCell::new(vec![line.into()])
|
||||
}
|
||||
|
||||
/// Begin the asynchronous MCP inventory flow: show a loading spinner and
|
||||
/// request the app-server fetch via `AppEvent::FetchMcpInventory`.
|
||||
///
|
||||
|
||||
Reference in new issue
Block a user