Input color becomes black in tmux control mode (tmux -CC) when SSH
What version of Codex is running?
codex-cli 0.46.0
Which model were you using?
gpt-5-codex high
What platform is your computer?
Linux 6.6.94 x86_64 x86_64
Ubuntu 22.04
tmux 3.4
Darwin 25.0.0 arm64 arm
macOS 26.0.1
tmux 3.5a
iTerm2 Build 3.6.2
What steps can reproduce the bug?
The input becomes black when using tmux control mode (tmux -CC) in ssh, it works fine in local's tmux control mode and common tmux (no control mode)
- SSH, no tmux
<img width="676" height="397" alt="Image" src="https://github.com/user-attachments/assets/3c9826bb-544c-4913-889d-439466a3f5c9" />
- SSH, normal tmux
<img width="567" height="652" alt="Image" src="https://github.com/user-attachments/assets/2f18e2eb-81b4-40bc-9903-da782b4f393f" />
- localhost, no tmux
<img width="637" height="463" alt="Image" src="https://github.com/user-attachments/assets/e6842d43-34ad-45a9-942b-76095a9d8cb8" />
- localhost, normal tmux
<img width="692" height="656" alt="Image" src="https://github.com/user-attachments/assets/d867cac7-816b-477a-87ec-e0c89bfda802" />
- localhost, tmux control mode
<img width="639" height="480" alt="Image" src="https://github.com/user-attachments/assets/bed4b96d-543e-4e62-b422-6950c9863deb" />
- SSH, tmux control mode
<img width="561" height="441" alt="Image" src="https://github.com/user-attachments/assets/d4225164-e3f2-4fec-ac26-7410be654312" />
What is the expected behavior?
_No response_
What do you see instead?
_No response_
Additional information
_No response_
9 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
are all the relevant tmux installs >= 3.4? this looks like possibly related to https://github.com/openai/codex/issues/4744#issuecomment-3386362145
not super familiar with tmux, but i'm not sure at first brush why control mode would prevent background color querying from working.
I have exactly the same situation with zellij. This wasn't the case in earlier versions of Codex
@nornagon-openai I use tmux 3.4 and 3.5a, more specific environment version has been updated in the original issue
different 0.46.0 alpha behave quite differently, specifically, alpha 4, 5, 6 has a lot of change I think.
By the way, on the version before alpha-4, even I use tmux >= 3.4, I still experienced the issue mentioned in https://github.com/openai/codex/issues/4744
Two related commit are: https://github.com/openai/codex/pull/4957 (in alpha 5) and https://github.com/openai/codex/commit/f4bc03d7c049aaec020d431498949dfb6523f32e (in alpha 6)
0.46.0-alpha.4
<img width="797" height="323" alt="Image" src="https://github.com/user-attachments/assets/beff9d2a-e396-4936-acbc-20ca29a0a176" />
<img width="616" height="303" alt="Image" src="https://github.com/user-attachments/assets/d78a8590-2870-47d3-893b-4eed0595333b" />
<img width="562" height="327" alt="Image" src="https://github.com/user-attachments/assets/54e36756-7e01-4822-be5a-0b13238fb18f" />
0.46.0-alpha.5
<img width="863" height="310" alt="Image" src="https://github.com/user-attachments/assets/c4b90cb4-c027-4686-ba12-03cebf67b751" />
<img width="852" height="315" alt="Image" src="https://github.com/user-attachments/assets/ca343454-f730-4827-9c8c-7b511dc14132" />
<img width="856" height="312" alt="Image" src="https://github.com/user-attachments/assets/cacc7871-c0ec-4877-ab4c-0b2ea12b84eb" />
0.46.0-alpha.6
<img width="847" height="305" alt="Image" src="https://github.com/user-attachments/assets/725e93a1-d6fe-42f8-b30b-cba4d4b35023" />
<img width="857" height="332" alt="Image" src="https://github.com/user-attachments/assets/a071649d-71dc-4053-9073-5ed78eaabd75" />
<img width="803" height="332" alt="Image" src="https://github.com/user-attachments/assets/616065e6-1b56-42c2-9bb9-89146db36f5c" />
I found that, it is due to the wrong bg readout
https://github.com/openai/codex/blob/26f7c46856060f440615645bdf2faf9e62c74e72/codex-rs/tui/src/terminal_palette.rs#L143-L152
So it failed to give a correct input for
https://github.com/openai/codex/blob/26f7c46856060f440615645bdf2faf9e62c74e72/codex-rs/tui/src/style.rs#L21-L28
In the parent commit of https://github.com/openai/codex/commit/e896db1180cc1e893f6d3d878bafe909c518c24e (that is https://github.com/openai/codex/commit/96acb8a74e14897faa36d66cd50768c0b0978e59)
the
query_default_colorsfunction is also broken, but theuser_message_bgis also broken eitherOnly the last one works fine, it is due to in the old version of codex,
terminal_palette()returnsNonewhen using under tmux, but now,terminal_palette()no longer exists, so just let it go.Now the problem becomes that
query_default_colorsis broken all the timeA minimal repro
In normal tmux, it will print
we will get 0,0,0 as fg and 255,255,255 as bg
But in tmux control mode, it will print
that is, we get 0,0,0 as fg and bg both
Edit: well, it seems that it is fixed in a later tmux verison, but it is too new for a lts ubuntu, tmux 3.5a works, so maybe that why my local tmux works but the ssh's tmux doesn't.
Thanks for the detailed investigation. It seems like this is a tmux bug which is fixed in 3.5a (or possibly earlier?), so I'm going to close this out.
@Artawower I would suggest to try the previous minimal repo in zellij to determine whether it is the same issue