TUI: final agent message silently dropped from terminal when `terminal_resize_reflow` feature is enabled
What happened
With the experimental terminal_resize_reflow feature enabled, the final agent message of a turn is never rendered to the terminal. The model's answer is present in the session rollout .jsonl (agent_message payload, complete), but zero lines of it reach the screen or scrollback. The chat just shows the submitted prompt followed by an idle composer.
With the feature disabled, the same prompt renders the full answer into native terminal scrollback as expected.
Reproduction (deterministic A/B)
Environment: codex-cli 0.137.0 (npm install), Debian 13 x86_64, running inside tmux 3.5a (pane 100x24, $TERM inside tmux).
Config (~/.codex/config.toml):
[features]
terminal_resize_reflow = true
tmux new-session -d -s repro -x 100 -y 24 'codex'- Submit:
Reply with a numbered list counting from 1 to 120, one number per line. No other text. - Wait for the turn to complete, then:
tmux capture-pane -t repro -S - -p | grep -cE "^\s+[0-9]+"
Results:
| terminal_resize_reflow | answer in session .jsonl | lines rendered to terminal |
|---|---|---|
| true | yes, all 120 | 0 |
| false (codex -c features.terminal_resize_reflow=false) | yes, all 120 | 119/120 in scrollback, scrollable |
No terminal resize occurred at any point during the repro.
Suspected area (from reading source, not confirmed)
codex-rs/tui/src/app/resize_reflow.rs — the stream-finalize path: flush_answer_stream_with_separator() routes the finalized cell through ConsolidateAgentMessage with ConsolidationScrollbackReflow::Required when a live tail exists, ending in finish_required_stream_reflow() → clear_terminal_for_resize_replay() (which calls clear_scrollback_and_visible_screen_ansi()) → transcript replay. In this environment the replay appears to drop the just-consolidated final cell, so the clear wipes the streamed lines and nothing re-inserts them.
Possibly relevant: terminal detection inside tmux lands on TerminalName::Unknown (fallback reflow row cap), and multiplexer: Tmux.
Expected
The finalized agent message should always end up in terminal scrollback, with or without the reflow feature.
Happy to provide the rollout .jsonl or run instrumented builds if useful.