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:
Felipe Coury authored and copyberry committed 2026-09-04 12:20:57 +00:00
1 parent 8e85265c39
commit a1294e57f1
32 files changed
+642 -181

No files matched your search

@@ -0,0 +1,7 @@
---
source: tui/src/chatwidget/tests/terminal_title.rs
expression: "render_bottom_popup(&chat, 100)"
---
› Ask Codex to do anything
gpt-5.6-sol default · /tmp/project · renaming... ⠋
@@ -0,0 +1,11 @@
---
source: tui/src/chatwidget/tests/app_server.rs
expression: "format!(\"transcript:\\n{transcript}\\nfooter:\\n{footer}\\ntitle: {title}\")"
---
transcript:
footer:
› Ask Codex to do anything
gpt-5.6-sol default · /tmp/project · review-fix
title: review-fix | project
@@ -14,7 +14,7 @@ expression: terminal_title_popup_snapshot(&mut chat)
[ ] current-dir Current working directory
[ ] activity Spinner while working, action-required message while blocked.
[ ] run-state Compact session run-state text (Ready, Working, Thinking)
[ ] git-branch Current Git branch (omitted when unavailable)
[ ] thread-name Current thread name (omitted when unnamed)
project | Mixed preview thread | Tasks 0/0
Press space to toggle; ←/→ to move; enter to confirm and close; esc to close
@@ -14,7 +14,7 @@ expression: terminal_title_popup_snapshot(&mut chat)
[ ] current-dir Current working directory
[ ] activity Spinner while working, action-required message while blocked.
[ ] run-state Compact session run-state text (Ready, Working, Thinking)
[ ] thread-title Current thread title, or thread identifier when unnamed
[ ] thread-name Current thread name (omitted when unnamed)
monthly 65% left | weekly 50% left
Press space to toggle; ←/→ to move; enter to confirm and close; esc to close
@@ -14,7 +14,7 @@ expression: terminal_title_popup_snapshot(&mut chat)
[ ] current-dir Current working directory
[ ] activity Spinner while working, action-required message while blocked.
[ ] run-state Compact session run-state text (Ready, Working, Thinking)
[ ] thread-title Current thread title, or thread identifier when unnamed
[ ] thread-name Current thread name (omitted when unnamed)
5.2 credits | ~$1.82
Press space to toggle; ←/→ to move; enter to confirm and close; esc to close
@@ -1,5 +0,0 @@
---
source: tui/src/chatwidget/tests/app_server.rs
expression: rendered
---
• Session renamed to review-fix. To resume this session run codex resume, then select review-fix (123e4567-e89b-12d3-a456-426614174000)