mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Generate descriptive TUI thread titles (#40492)
## What changed - Give unnamed TUI threads an immediate provisional title from the first user message, then replace it asynchronously with a normalized generated title. - Preserve manual renames by applying a generated title only while the provisional title is still current, and keep automatic rename notifications out of the transcript. - Run title generation in a bounded ephemeral structured request that preserves custom permission profiles, otherwise uses read-only access, and disables tools and MCP servers. ## Testing - Cover prompt and response bounds, Unicode-safe truncation, title normalization, manual-rename races, silent automatic updates, permission preservation, and structured-response failures. GitOrigin-RevId: 7ed73522f4f6c65a005f65f3a903974d8419e312
This commit is contained in:
1 parent
c941572917
commit
b3c7e1a47f
18 files changed
+1032
-12
No files matched your search
@@ -40,6 +40,7 @@ use codex_file_search::FileMatch;
|
||||
use codex_message_history::HistoryBatchCursor;
|
||||
use codex_protocol::ThreadId;
|
||||
use codex_protocol::openai_models::ModelPreset;
|
||||
use codex_protocol::openai_models::ReasoningEffort;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use codex_utils_approval_presets::ApprovalPreset;
|
||||
use strum_macros::IntoStaticStr;
|
||||
@@ -61,7 +62,6 @@ use codex_plugin::PluginCapabilitySummary;
|
||||
use codex_protocol::config_types::CollaborationModeMask;
|
||||
use codex_protocol::config_types::Personality;
|
||||
use codex_protocol::models::ActivePermissionProfile;
|
||||
use codex_protocol::openai_models::ReasoningEffort;
|
||||
|
||||
use crate::history_cell::HistoryCell;
|
||||
|
||||
@@ -195,6 +195,13 @@ pub(crate) enum TranscriptExportDestination {
|
||||
File(PathBuf),
|
||||
}
|
||||
|
||||
/// Deliver a generated title to its originating automatic rename.
|
||||
#[derive(Debug)]
|
||||
pub(crate) enum ThreadTitleDestination {
|
||||
/// Replace the provisional name only if the user has not renamed the thread.
|
||||
Automatic { expected_title: String },
|
||||
}
|
||||
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
#[derive(Debug, IntoStaticStr)]
|
||||
pub(crate) enum AppEvent {
|
||||
@@ -219,6 +226,21 @@ pub(crate) enum AppEvent {
|
||||
thread_id: ThreadId,
|
||||
name: String,
|
||||
},
|
||||
/// Register a hidden title-generation thread started in the background.
|
||||
ThreadTitleStarted {
|
||||
thread_id: ThreadId,
|
||||
destination: ThreadTitleDestination,
|
||||
prompt: String,
|
||||
effort: Option<ReasoningEffort>,
|
||||
result: Result<String, String>,
|
||||
},
|
||||
/// Route a hidden title request to its automatic rename or editable prompt.
|
||||
GeneratedThreadTitle {
|
||||
thread_id: ThreadId,
|
||||
temporary_thread_id: ThreadId,
|
||||
destination: ThreadTitleDestination,
|
||||
result: Result<String, String>,
|
||||
},
|
||||
/// Interrupt a task directly from the shared dashboard.
|
||||
StopAgentsOverviewThread {
|
||||
thread_id: ThreadId,
|
||||
|
||||
Reference in new issue
Block a user