Skip to content

fix(tui): use BEL for terminal title updates - #18261

Merged
etraut-openai merged 1 commit into
mainfrom
etraut/title-crossterm-bug
Apr 17, 2026
Merged

etraut-openai merged 1 commit into
mainfrom
etraut/title-crossterm-bug

Conversation

@etraut-openai

Copy link
Copy Markdown
Contributor

Summary

Fixes #18160.

iTerm2 can append the current foreground process to tab titles, and Codex's terminal-title updates were causing that decoration to appear as (codex") with a stray trailing quote. Codex was writing OSC 0 title sequences terminated with ST (ESC \). Some terminal title integrations appear to accept that title update but still expose the ST terminator in their own process/title decoration.

Changes

  • Update codex-rs/tui/src/terminal_title.rs to terminate OSC 0 title updates with BEL instead of ST.
  • Update the focused terminal-title encoding test to assert the BEL-terminated sequence.

Compatibility

This should be low risk: the title payload and update timing are unchanged, and BEL is the form already emitted by crossterm::terminal::SetTitle in the crossterm version used by this repository. BEL is also the widely supported xterm-family title terminator used by common terminals and multiplexers. The main theoretical risk would be a very old or unusual terminal that accepted only ST and not BEL for OSC title termination, but that is unlikely compared with the observed iTerm2 issue.

Verification

  • cargo test -p codex-tui terminal_title
  • cargo test -p codex-tui

@fcoury-oai fcoury-oai self-assigned this Apr 17, 2026

@fcoury-oai fcoury-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replicated the issue by unselecting all items on the title picker and was able to also confirm the fix.

@etraut-openai
etraut-openai merged commit 2dd6734 into main Apr 17, 2026
25 checks passed
@etraut-openai
etraut-openai deleted the etraut/title-crossterm-bug branch April 17, 2026 15:39
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Terminal/tab suffix shows codex" (stray quote in process/app name)

2 participants