Skip to content

Remove Zellij TUI workarounds#22214

Open
fcoury-oai wants to merge 3 commits into
mainfrom
fcoury/remove-zellij-workaround
Open

Remove Zellij TUI workarounds#22214
fcoury-oai wants to merge 3 commits into
mainfrom
fcoury/remove-zellij-workaround

Conversation

@fcoury-oai
Copy link
Copy Markdown
Contributor

@fcoury-oai fcoury-oai commented May 11, 2026

Why

We added Zellij-specific TUI workarounds because older Zellij behavior did not work with Codex's normal terminal model:

This PR removes both workarounds because the latest Zellij release tested locally (zellij 0.44.1) works correctly with Codex's standard TUI behavior: normal alternate-screen handling, redraw, and history insertion.

What Changed

  • Removed the InsertHistoryMode::Zellij path and the Zellij-only newline scrollback insertion behavior.
  • Removed cached is_zellij state from the TUI and composer.
  • Removed Zellij-specific composer styling, the helper snapshot, and the TerminalInfo::is_zellij() convenience method that only served this workaround.
  • Changed tui.alternate_screen = "auto" to use alternate screen for Zellij too; --no-alt-screen and tui.alternate_screen = "never" still preserve the inline mode escape hatch.
  • Updated the generated config schema description for tui.alternate_screen.

How to Test

Manual smoke path used with zellij 0.44.1:

  1. Build and run this branch inside a Zellij 0.44.1 session with default config.
  2. Start Codex normally and produce enough assistant/tool output to create scrollback.
  3. Confirm the transcript remains readable, the composer renders normally, and scrolling through terminal history works.
  4. Resize the Zellij pane while output exists and confirm the TUI redraws without duplicated, missing, or stale rows.
  5. Compare with --no-alt-screen or -c tui.alternate_screen=never if you want to verify the inline fallback still works.

Targeted tests:

  • just write-config-schema
  • just fmt
  • just fix -p codex-tui
  • cargo test -p codex-terminal-detection
  • cargo test -p codex-tui alternate_screen_auto_uses_alt_screen

Attempted but did not complete locally:

  • cargo test -p codex-tui built and ran the new test successfully, then failed later on unrelated local failures in status_permissions_full_disk_managed_* and a stack overflow in tests::fork_last_filters_latest_session_by_cwd_unless_show_all.

Documentation

No developers.openai.com Codex documentation update is needed for this revert.

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8ed2541bce

ℹ️ 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".

Comment thread codex-rs/tui/src/insert_history.rs
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review


P2 Badge Preserve the public Zellij detection helper

Removing this public method is a breaking API change for users of codex-terminal-detection: existing callers that rely on TerminalInfo::is_zellij() now fail to compile even though the underlying multiplexer data still exists. If the workaround is gone, keeping this helper as a stable convenience avoids breaking downstream code.


/// Formats the terminal info as a User-Agent token.

P2 Badge Preserve the public Zellij detection helper

Removing this public method is a breaking API change for users of codex-terminal-detection: existing callers that rely on TerminalInfo::is_zellij() now fail to compile even though the underlying multiplexer data still exists. If the workaround is gone, keeping this helper as a stable convenience avoids breaking downstream code.

ℹ️ 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".

Comment thread codex-rs/tui/src/tui.rs
}
if area != terminal.viewport_area {
// TODO(nornagon): probably this could be collapsed with the clear + set_viewport_area above.
terminal.clear()?;
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.

P2 Badge Restore clearing when the initial viewport is empty

Calling terminal.clear() before set_viewport_area(area) regresses the startup/first-resize case where the old viewport is empty: Terminal::clear() returns immediately for an empty viewport, so stale shell cells inside the newly created inline viewport are not cleared. The removed clear_for_viewport_change test covered this exact scenario.

Useful? React with 👍 / 👎.

Comment on lines +55 to 59
pub fn insert_history_lines_with_wrap_policy<B>(
terminal: &mut crate::custom_terminal::Terminal<B>,
lines: Vec<Line>,
mode: InsertHistoryMode,
wrap_policy: HistoryLineWrapPolicy,
) -> io::Result<()>
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.

P2 Badge Gate standard insertion on Zellij version

The change routes every Zellij session through the standard DECSTBM history path. The commit rationale only establishes that Zellij 0.44.1 works and says older Zellij broke on these sequences; without detecting or gating by Zellij version, users on older Zellij lose the scrollback/composer correctness the workaround was added for.

Useful? React with 👍 / 👎.

@fcoury-oai fcoury-oai requested a review from a team as a code owner May 11, 2026 21:32
@fcoury-oai fcoury-oai changed the title Remove Zellij redraw workaround Remove Zellij TUI workarounds May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant