TUI renders the same assistant reply twice when identical content is emitted as `commentary` and `final_answer`
What version of Codex CLI is running?
codex-cli 0.116.0
What subscription do you have?
Not specified
Which model were you using?
gpt-5.4
What platform is your computer?
Linux DESKTOP-ULILLCA 6.6.87.2-microsoft-standard-WSL2 x86_64 GNU/Linux
What terminal emulator and version are you using (if applicable)?
Not identified. Observed TERM=xterm-256color.
What issue are you seeing?
In the interactive Codex CLI/TUI, a single assistant reply can be rendered twice with identical text.
What I observed:
- I sent one user message:
start - Codex produced the same assistant text twice
- The terminal displayed both copies back-to-back
I checked the local raw session transcript afterward and confirmed this was not a duplicate user submission. The same assistant text was emitted once as commentary and then again as final_answer for the same turn.
So the symptom is either:
- the client/runtime should not emit identical content in both phases for one turn, or
- the TUI should deduplicate/suppress the repeated
final_answerwhen it is identical to the immediately precedingcommentary
What steps can reproduce the bug?
I do not yet have a minimal deterministic repro.
What happened in the observed case:
- Open Codex CLI interactive TUI
- Work in a normal session
- Send a short message:
start - Codex asks a clarifying/design question
- The exact same assistant message is shown twice in a row
This happened on 2026-03-24.
What is the expected behavior?
Only one visible copy of the assistant message should be rendered for that turn.
If both commentary and final_answer are intentionally emitted internally, the UI should not show two identical copies back-to-back.
Additional information
I verified the duplicate from the local session JSONL rather than only from the screen.
Observed ids:
- thread/session id:
019d1eaa-bc32-7e71-bcb6-00ae694062f8 - turn id:
019d200e-74df-7440-933c-bd402b1147f1
Sanitized evidence from the local transcript for that single turn:
{"type":"event_msg","payload":{"type":"agent_message","phase":"commentary","message":"I’m using the `brainstorming` workflow here because phase 2 is a new AO subsystem and needs a real design before we touch code.\n\nFirst scope question for phase 2: should `ao doctor` in this repo be `diagnose-only`, or should it also be allowed to perform a small set of safe local repairs automatically..."}}
{"type":"response_item","payload":{"type":"message","role":"assistant","phase":"commentary"}}
{"type":"event_msg","payload":{"type":"agent_message","phase":"final_answer","message":"I’m using the `brainstorming` workflow here because phase 2 is a new AO subsystem and needs a real design before we touch code.\n\nFirst scope question for phase 2: should `ao doctor` in this repo be `diagnose-only`, or should it also be allowed to perform a small set of safe local repairs automatically..."}}
{"type":"response_item","payload":{"type":"message","role":"assistant","phase":"final_answer"}}
Important detail:
- I found only one user message for that turn
- this does not look like pressing Enter twice
- this does not look like an external orchestrator resending input
- it looks like one turn producing identical
commentaryandfinal_answer, both rendered visibly
2 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I can reproduce the same symptom on
codex-cli 0.118.0on Windows (Microsoft Windows NT 10.0.26200.0 x64, PowerShell7.6.0).A couple of additional findings that may help narrow this down:
commentary, then again asfinal_answer.codex-rs/models-manager/prompt.mdexplicitly instructs the model to:commentaryfinalfinal, or both incommentaryandfinal? In practice it can choose both, and the TUI then renders both visibly.So this may be a prompt-contract problem as much as a TUI rendering problem.
Two possible fixes:
commentarystatus-only and explicitly forbid repeating any user-actionable question / decision request that will appear infinal.final_answerwhen it is identical (or near-identical) to the immediately preceding visiblecommentaryfor the same turn.I only dug far enough to confirm the prompt-side ambiguity, so I am not claiming this is the sole root cause. But it does look like a concrete path to reproduction and a likely reason this happens especially often around "I need to ask a clarifying question before I can continue" turns.