TMUX Bug: Composer/user-message background pill missing inside tmux (OSC 11 query blocked)
What version of Codex CLI is running?
.125
What subscription do you have?
pro
Which model were you using?
5.4
What platform is your computer?
MacOS
What terminal emulator and version are you using (if applicable)?
VS Code, TMUX
What issue are you seeing?
Summary
When Codex runs inside a tmux session, the input composer and user-message backgrounds render with no fill. Outside tmux they render with the expected adaptive grey/light pill. Reproducible on macOS with Codex 0.125.0 and tmux 3.6a.
Root cause
codex-rs/tui/src/style.rs computes the pill background by blending against the terminal's actual bg:
pub fn user_message_style_for(terminal_bg: Option<(u8, u8, u8)>) -> Style {
match terminal_bg {
Some(bg) => Style::default().bg(user_message_bg(bg)),
None => Style::default(), // ← no pill
}
}
terminal_bg comes from default_bg() in terminal_palette.rs, which sends a plain OSC 11 query via crossterm::style::query_background_color. Tmux does not forward plain OSC 11 to the outer terminal and does not reliably reply itself, so the query times out and default_bg() returns None. The None arm has no fallback, so the pill disappears entirely.
Codex already wraps OSC 52 (clipboard) in tmux DCS passthrough at clipboard_copy.rs:324. The same treatment isn't applied to OSC 11.
What steps can reproduce the bug?
Outside tmux — pill renders
codex
Inside tmux — no pill, even with allow-passthrough on
tmux new-session 'codex'
In both cases the host terminal (VS Code integrated terminal, iTerm2, etc.) responds to OSC 11; tmux is the only differentiator.
What is the expected behavior?
Suggested fixes (any one would resolve)
When terminal_info().multiplexer == Some(Multiplexer::Tmux { .. }), wrap the OSC 11 query in tmux DCS passthrough (\ePtmux;\e\e]11;?\e\\\e\\) and parse the unwrapped reply — same pattern already used for OSC 52.
Add a config-level explicit fallback, e.g. [tui] background_rgb = [r, g, b], so users on multiplexers can pin a sensible value.
Add a sane default constant for the None arm of user_message_style_for (e.g. (30, 30, 30) for dark / (245, 245, 245) for light, picked by some other heuristic).
Workaround
None known at the user level. tmux set -g allow-passthrough on enables DCS-wrapped escapes through tmux, but Codex sends OSC 11 plain, so the option doesn't take effect.
Comparison
Gemini CLI hardcodes its TUI colors (no OSC 11 query) and renders correctly inside tmux on the same host. Claude Code TUI does the same. Codex is the only one of the three that depends on the runtime query.
Environment
Codex CLI 0.125.0 (npm @openai/codex)
macOS Darwin 25.4.0 (arm64)
tmux 3.6a
VS Code integrated terminal (also reproduces in iTerm2 + Terminal.app)
Additional information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗