feat(tui): add /title terminal title configuration#12334
Conversation
|
@codex review |
|
@codex review |
|
@codex review security in codex-rs/tui/src/terminal_title.rs |
|
Codex Review: Didn't find any major issues. Bravo. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
There was a problem hiding this comment.
Pull request overview
Adds a first-class /title configuration flow to the TUI so terminal tabs/windows can be distinguished across concurrent Codex sessions, including secure OSC 0 title rendering and persisted ordering of title “items”. Also includes an app-server fix to make running-thread resume status reporting consistent.
Changes:
- Introduces terminal-title OSC writer with sanitization + tests, and wires dynamic title refresh into
ChatWidget. - Adds
/titleslash command + bottom-pane picker UI (with live preview + rollback on cancel) and persists config viatui.terminal_title. - Fixes a thread resume race in app-server so a running thread reliably reports
Activewhen an active turn snapshot exists.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| codex-rs/tui/src/terminal_title.rs | Implements OSC 0 title writing with sanitization and unit tests. |
| codex-rs/tui/src/slash_command.rs | Adds /title to the slash-command set and help text. |
| codex-rs/tui/src/lib.rs | Registers the new terminal_title module. |
| codex-rs/tui/src/chatwidget.rs | Adds terminal title config/defaults, live rendering, preview/rollback mechanics, and refresh hooks. |
| codex-rs/tui/src/chatwidget/tests.rs | Adds tests for preview rollback and status text mapping for title rendering. |
| codex-rs/tui/src/bottom_pane/title_setup.rs | Adds the terminal title picker UI (multi-select + ordering + live preview events). |
| codex-rs/tui/src/bottom_pane/mod.rs | Exposes terminal title picker view + item enum. |
| codex-rs/tui/src/bottom_pane/snapshots/...terminal_title_setup_basic.snap | Adds snapshot coverage for the new picker UI. |
| codex-rs/tui/src/app_event.rs | Adds events for terminal title setup/preview/cancel. |
| codex-rs/tui/src/app.rs | Handles new events and persists tui.terminal_title edits. |
| codex-rs/core/src/config/types.rs | Adds tui.terminal_title to typed config. |
| codex-rs/core/src/config/mod.rs | Plumbs config field into runtime Config and defaults/tests. |
| codex-rs/core/src/config/edit.rs | Adds a config edit helper to persist terminal title items. |
| codex-rs/core/config.schema.json | Adds schema documentation for tui.terminal_title. |
| codex-rs/app-server/src/codex_message_processor.rs | Fixes resume-status race by preferring active turn snapshot over idle watch status. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
codex/codex-rs/tui/src/chatwidget.rs
Lines 1135 to 1137 in 4082887
Update request_status_line_branch_refresh to consider terminal-title config too. It currently returns unless the status line includes git-branch, but terminal titles now also use the same cached branch value. If a user enables git-branch in /title only, branch lookup is never re-triggered after turn completion, so the title can show a stale branch after git checkout/branch-changing commands.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
codex/codex-rs/tui/src/chatwidget.rs
Lines 1135 to 1137 in 4082887
Refresh git-branch title when only /title enables it
Updaterequest_status_line_branch_refreshto consider terminal-title config too. It currently returns unless the status line includesgit-branch, but terminal titles now also use the same cached branch value. If a user enablesgit-branchin/titleonly, branch lookup is never re-triggered after turn completion, so the title can show a stale branch aftergit checkout/branch-changing commands.
Addressed it in 2cf7abd05.
What changed:
request_status_line_branch_refresh()now refreshes whengit-branchis configured in either/statuslineor/title- added a regression test for the title-only
git-branchcase afterTurnComplete
|
@codex review |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2cf7abd055
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
800268f to
9f62b39
Compare
|
@yvolovich-cyber really great to see the I just took this branch for a test drive and it worked beautifully with tmux. I use a configuration where I explicitly show the pane titles and it's so much easier to spot what's happening with this feature in place:
Specially for someone who has ten thousand codex worktrees like myself, and I'm pretty sure I'm not the only one 😄 I also did a pass on the code changes and they look good to me 👍 |
jif-oai
left a comment
There was a problem hiding this comment.
I don't see anything that reset the title after a CMD + C. Can you make sure the title always get reset when we exit Codex?
Handled. Terminal-title cleanup now happens in |
be6d8f3 to
c81ce88
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6969c2d5a2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
f6b501d to
fc92e90
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
fc92e90 to
a5ea7ff
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@joshka-oai CI is green and |
|
Codex Review: Didn't find any major issues. Chef's kiss. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
c436c7d to
5c55e56
Compare
5c55e56 to
5d24272
Compare

Problem
When multiple Codex sessions are open at once, terminal tabs and windows are hard to distinguish from each other. The existing status line only helps once the TUI is already focused, so it does not solve the "which tab is this?" problem.
This PR adds a first-class
/titlecommand so the terminal window or tab title can carry a short, configurable summary of the current session.Screenshot
Mental model
/statuslineand/titleare separate status surfaces with different constraints. The status line is an in-app footer that can be denser and more detailed. The terminal title is external terminal metadata, so it needs short, stable segments that still make multiple sessions easy to tell apart.The
/titleconfiguration is an ordered list of compact items. By default it rendersspinner,project, so active sessions show lightweight progress first while idle sessions still stay easy to disambiguate. Each configured item is omitted when its value is not currently available rather than forcing a placeholder.Non-goals
This does not merge
/titleinto/statusline, and it does not add an arbitrary free-form title string. The feature is intentionally limited to a small set of structured items so the title stays short and reviewable.This also does not attempt to restore whatever title the terminal or shell had before Codex started. When Codex clears the title, it clears the title Codex last wrote.
Tradeoffs
A separate
/titlecommand adds some conceptual overlap with/statusline, but it keeps title-specific constraints explicit instead of forcing the status line model to cover two different surfaces.Title refresh can happen frequently, so the implementation now shares parsing and git-branch orchestration between the status line and title paths, and caches the derived project-root name by cwd. That keeps the hot path cheap without introducing background polling.
Architecture
The TUI gets a new
/titleslash command and a dedicated picker UI for selecting and ordering terminal-title items. The chosen ids are persisted intui.terminal_title, withspinnerandprojectas the default when the config is unset.statusremains available as a separate text item, so configurations likespinner,statusrender compact progress like⠋ Working.ChatWidgetnow refreshes both status surfaces through a sharedrefresh_status_surfaces()path. That shared path parses configured items once, warns on invalid ids once, synchronizes shared cached state such as git-branch lookup, then renders the footer status line and terminal title from the same snapshot.Low-level OSC title writes live in
codex-rs/tui/src/terminal_title.rs, which owns the terminal write path and last-mile sanitization before emitting OSC 0.Security
Terminal-title text is treated as untrusted display content before Codex emits it. The write path strips control characters, removes invisible and bidi formatting characters that can make the title visually misleading, normalizes whitespace, and caps the emitted length.
References used while implementing this:
Observability
Unknown configured title item ids are warned about once instead of repeatedly spamming the transcript. Live preview applies immediately while the
/titlepicker is open, and cancel rolls the in-memory title selection back to the pre-picker value.If terminal title writes fail, the TUI emits debug logs around set and clear attempts. The rendered status label intentionally collapses richer internal states into compact title text such as
Starting...,Ready,Thinking...,Working...,Waiting..., andUndoing...whenstatusis configured.Tests
Ran:
just fmtcargo test -p codex-tuiAt the moment, the red Windows
rust-cifailures are due to existingcodex-coreapply_patch_clistack-overflow tests that also reproduce onmain. The/title-specificcodex-tuisuite is green.