Clarify resume hints for renamed threads (#23234)

Addresses #23181

## Why
Renamed threads can share names, so hints that suggest resuming directly
by name are ambiguous. Issue #23181 asks for the picker hint to include
the thread name and thread ID in parens so users can disambiguate
safely.

## What
- Adds a shared resume hint formatter for named threads: run `codex
resume`, then select `<name> (<thread-id>)`.
- Uses that hint for /rename confirmations, TUI session summaries, and
CLI/TUI exit messages.
- Keeps direct `codex resume <thread-id>` guidance for unnamed threads.

## Verification
Manually verified that message after `/rename` and after `/exit` include
session ID in parens.

---------

Co-authored-by: Felipe Coury <felipe.coury@openai.com>
This commit is contained in:
Eric Traut
2026-05-18 11:32:02 -07:00
committed by GitHub
Unverified
parent 0d344aca9b
commit 4ac3ea20a2
12 changed files with 88 additions and 38 deletions
+1
View File
@@ -10,5 +10,6 @@ pub use codex_protocol::config_types::ProfileV2Name;
pub use config_override::CliConfigOverrides;
pub use format_env_display::format_env_display;
pub use resume_command::resume_command;
pub use resume_command::resume_hint;
pub use sandbox_mode_cli_arg::SandboxModeCliArg;
pub use shared_options::SharedCliOptions;
+39
View File
@@ -19,6 +19,16 @@ pub fn resume_command(thread_name: Option<&str>, thread_id: Option<ThreadId>) ->
})
}
pub fn resume_hint(thread_name: Option<&str>, thread_id: Option<ThreadId>) -> Option<String> {
let thread_id = thread_id?;
match thread_name.filter(|name| !name.is_empty()) {
Some(thread_name) => Some(format!(
"codex resume, then select {thread_name} ({thread_id})"
)),
None => resume_command(/*thread_name*/ None, Some(thread_id)),
}
}
#[cfg(test)]
mod tests {
use super::*;
@@ -61,4 +71,33 @@ mod tests {
let command = resume_command(Some("quote'case"), /*thread_id*/ None);
assert_eq!(command, Some("codex resume \"quote'case\"".to_string()));
}
#[test]
fn resume_hint_names_picker_item_with_id() {
let thread_id = ThreadId::from_string("123e4567-e89b-12d3-a456-426614174000").unwrap();
let hint = resume_hint(Some("my-thread"), Some(thread_id));
assert_eq!(
hint,
Some(
"codex resume, then select my-thread (123e4567-e89b-12d3-a456-426614174000)"
.to_string()
)
);
}
#[test]
fn resume_hint_uses_direct_id_command_without_name() {
let thread_id = ThreadId::from_string("123e4567-e89b-12d3-a456-426614174000").unwrap();
let hint = resume_hint(/*thread_name*/ None, Some(thread_id));
assert_eq!(
hint,
Some("codex resume 123e4567-e89b-12d3-a456-426614174000".to_string())
);
}
#[test]
fn resume_hint_requires_thread_id() {
let hint = resume_hint(Some("my-thread"), /*thread_id*/ None);
assert_eq!(hint, None);
}
}