TUI renders the same assistant reply twice when identical content is emitted as `commentary` and `final_answer`

Open 💬 2 comments Opened Mar 24, 2026 by Samsen879
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

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_answer when it is identical to the immediately preceding commentary

What steps can reproduce the bug?

I do not yet have a minimal deterministic repro.

What happened in the observed case:

  1. Open Codex CLI interactive TUI
  2. Work in a normal session
  3. Send a short message: start
  4. Codex asks a clarifying/design question
  5. 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 commentary and final_answer, both rendered visibly

View original on GitHub ↗

2 Comments

github-actions[bot] contributor · 5 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #14805
  • #15318

Powered by Codex Action

sleepyy-dog · 4 months ago

I can reproduce the same symptom on codex-cli 0.118.0 on Windows (Microsoft Windows NT 10.0.26200.0 x64, PowerShell 7.6.0).

A couple of additional findings that may help narrow this down:

  1. In my case this was not duplicate user input. The local session transcript showed one user turn, then the assistant emitted the same user-facing clarification/question twice for that turn: first as commentary, then again as final_answer.
  2. I traced one likely contributing source in the current prompt stack. In the upstream repo, codex-rs/models-manager/prompt.md explicitly instructs the model to:
  • send intermediary progress updates via commentary
  • send a user update before exploring / doing substantial work
  • send the final response via final
  1. That seems to leave an ambiguity when the model decides it needs user input before proceeding: should the clarification/question live only in final, or both in commentary and final? 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:

  • Prompt-level: make commentary status-only and explicitly forbid repeating any user-actionable question / decision request that will appear in final.
  • UI-level: suppress or dedupe a final_answer when it is identical (or near-identical) to the immediately preceding visible commentary for 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.