TUI renders duplicate sub-agent activity cells (Started/Interacted/Interrupted) for every multi-agent v2 tool call since 0.146.0
Nobody has claimed this yet.
- 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):
-
PR #35363 ("Include item start times in completion events", merged 2026-07-25) changed
emit_sub_agent_activityincodex-rs/core/src/tools/handlers/multi_agents_v2.rsfrom emitting only an item-completed notification to emitting bothemit_turn_item_startedandemit_turn_item_completedfor the sameSubAgentActivityitem (so the completion can carrystarted_at_ms). -
The TUI has rendered a
SubAgentActivityhistory cell on both notification paths since PR #27007: theItemStartedhandler incodex-rs/tui/src/chatwidget/protocol.rsand theItemCompletedpath viahandle_thread_itemincodex-rs/tui/src/chatwidget/replay.rs. UnlikeCommandExecution/McpToolCall/CollabAgentToolCall,SubAgentActivityhas nostatusfield to branch on, so both paths print identical cells. TheItemStartedarm 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?
- Run the codex TUI (0.146.0 or later) with a model/config where multi-agent v2 sub-agent tools are available.
- Give the agent any task that causes it to spawn a sub-agent (
spawn_agent), or send input to / interrupt one. - 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 ontoopenai/codexmain as ofd10939327, 2026-08-10) - Change: one-arm fix in
codex-rs/tui/src/chatwidget/protocol.rs— stop renderingSubAgentActivityonItemStarted; keep rendering onItemCompletedviareplay.rs. Core's dual emission left intact (#35363 added it deliberately forstarted_at_ms). - Regression test:
sub_agent_activity_started_and_completed_renders_one_cellincodex-rs/tui/src/chatwidget/tests/app_server.rs— feedsItemStarted+ItemCompletedfor one item, asserts a single cell. Fails without the fix, passes with it. - Verified:
just test -p codex-tuigreen (3354 passed);just fix -p codex-tuiclean.
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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