openai / openai/codex

TUI renders duplicate sub-agent activity cells (Started/Interacted/Interrupted) for every multi-agent v2 tool call since 0.146.0

Open Beginner friendly
#37,831 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug CLI subagent TUI
Dominant language
Rust
Stars
125k
Forks
19.5k
PR merge metrics
PR metrics pending

Description

Note: I understand code contributions are by invitation per docs/contributing.md. I'm filing this bug report with full root-cause analysis and a tested fix on my fork — happy to open a PR if invited, or the analysis above should make an internal fix trivial.

What version of Codex CLI is running?

Reproduced against current openai/codex main / 0.146.x+. Bug present in 0.146.0, 0.146.1, and the 0.148.0-alpha line per source analysis below. Run codex --version locally if needed.

What subscription do you have?

N/A — protocol-level bug, not plan-specific.

Which model were you using?

Any model using multi-agent v2 sub-agent tools (protocol-level, not model-specific). Observed with GPT-5.6 Sol / Sol Ultra.

What platform is your computer?

Linux 6.8.0-137-generic x86_64 x86_64

What terminal emulator and version are you using (if applicable)?

Ghostty; also reproduced in other terminals.

Codex doctor report
not available
What issue are you seeing?

Whenever a session uses multi-agent v2 sub-agent tools (spawn_agent, send_message, followup_task, interrupt_agent), the TUI transcript renders each sub-agent activity cell twice, back to back. Example:

  • Started `/root/bundle_c_gate_patch_review`
  • Started `/root/bundle_c_gate_patch_review`

The same duplication affects "Interacted with path" and "Interrupted path" cells.

Root cause (from source analysis of this repo):

  1. PR #35363 ("Include item start times in completion events", merged 2026-07-25) changed emit_sub_agent_activity in codex-rs/core/src/tools/handlers/multi_agents_v2.rs from emitting only an item-completed notification to emitting both emit_turn_item_started and emit_turn_item_completed for the same SubAgentActivity item (so the completion can carry started_at_ms).

  2. The TUI has rendered a SubAgentActivity history cell on both notification paths since PR #27007: the ItemStarted handler in codex-rs/tui/src/chatwidget/protocol.rs and the ItemCompleted path via handle_thread_item in codex-rs/tui/src/chatwidget/replay.rs. Unlike CommandExecution/McpToolCall/CollabAgentToolCall, SubAgentActivity has no status field to branch on, so both paths print identical cells. The ItemStarted arm was dead code while the item was completion-only (as designed in #27007) — #35363 made it live and created the collision.

First shipped in rust-v0.146.0 (2026-07-29); still present in 0.146.1, in 0.148.0-alpha.6, and on main as of 2026-08-10. The /agent status feed is not affected (it dedupes by item id), and codex exec human output never rendered these items on ItemStarted — the TUI transcript is the only affected surface.

What steps can reproduce the bug?
  1. Run the codex TUI (0.146.0 or later) with a model/config where multi-agent v2 sub-agent tools are available.
  2. Give the agent any task that causes it to spawn a sub-agent (spawn_agent), or send input to / interrupt one.
  3. Observe the transcript: every "Started agent_path" (and Interacted with / Interrupted) cell appears twice consecutively.
What is the expected behavior?

Exactly one transcript cell per sub-agent activity, matching pre-0.146.0 behavior and matching session replay (which reconstructs from completed items only).

Additional information

Fix ready on fork — rebased on latest openai/codex main, can open PR immediately if invited.

  • Branch: BenItBuhner/codex:fix/duplicate-subagent-activity-cells (rebased onto openai/codex main as of d10939327, 2026-08-10)
  • Change: one-arm fix in codex-rs/tui/src/chatwidget/protocol.rs — stop rendering SubAgentActivity on ItemStarted; keep rendering on ItemCompleted via replay.rs. Core's dual emission left intact (#35363 added it deliberately for started_at_ms).
  • Regression test: sub_agent_activity_started_and_completed_renders_one_cell in codex-rs/tui/src/chatwidget/tests/app_server.rs — feeds ItemStarted + ItemCompleted for one item, asserts a single cell. Fails without the fix, passes with it.
  • Verified: just test -p codex-tui green (3354 passed); just fix -p codex-tui clean.

I understand code contributions are by invitation per docs/contributing.md — happy to open a PR with this if invited, or the analysis above should make an internal fix trivial.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in codex-rs/tui/src/chatwidget/protocol.rs and compare the SubAgentActivity handling with the completion path in codex-rs/tui/src/chatwidget/replay.rs. Run the sub-agent activity scenario in codex-rs/tui/src/chatwidget/tests/app_server.rs, especially sub_agent_activity_started_and_completed_renders_one_cell. Done means one transcript cell is rendered for each activity while replay and the codex-tui test suite remain passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.