Skip to content

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

Open

Description

@Samsen879

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

Activity

  1. added
    bug
    CLI
    TUI
    on Mar 24, 2026
  2. github-actions commented on Mar 24, 2026

    @github-actions
    Contributor
  3. removed
    CLI
    on Mar 24, 2026
  4. sleepyy-dog commented on Apr 5, 2026

    @sleepyy-dog

    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
    3. 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.

  5. davidxhz commented on Oct 26, 2026

    @davidxhz

    facing same issue, my feedback id is 01a17792-c1ea-7952-881d-f633ac35a307

    Image

    Steps: Send a simple message such as “testing testing.” The assistant’s response appears twice. like below
    testing, testing
    Received—loud and clear.
    Received—loud and clear.
    Expected: One response.
    Actual: Two identical responses. Restarting the app removes duplicates from both recent and older messages.

    my system information and codex version info as below
    Edition Windows 11 Enterprise N
    Version 26H2
    Installed on ‎6/‎16/‎2025
    OS build 26300.9711
    Experience Windows Feature Experience Pack 1000.26100.372.0

    Powered by Codex & OWL
    Version 26.1021.31345

    Released Oct 24, 2026
    © OpenAI

  6. added
    model-behavior
    and removed
    TUI
    on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmodel-behavior

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions