MultiAgentV2: child stalls after task_started and Windows TUI exits during wait_agent
Summary
On Codex CLI 0.146.0 for Windows, MultiAgentV2 can report a successful spawn_agent, create one durable parent→child edge, and emit Started, but the child records only session_meta + task_started and performs no model work. When the parent immediately calls wait_agent, the Codex TUI exits back to the PowerShell prompt without a tool result or error.
This reproduced twice. In both reproductions the UI also printed the same Started <agent_path> line twice, even though the parent rollout and SQLite state prove there was only one spawn call and one child.
Environment
- Codex CLI: 0.146.0
- Model:
gpt-5.6-sol - Multi-agent: V2 native
collaboration.spawn_agent/wait_agent - OS: Windows
- Terminal: PowerShell
- Child: registered
lazycodex-gate-reviewerrole, same OpenAI provider - Spawn mode:
fork_turns: "none" - Parent and child use the same unchanged workspace/revision
Reproduction
- Start a fresh Codex CLI parent session.
- As the first and only child, call
spawn_agentwith a non-empty task message, a unique task name, a registered child role, andfork_turns: "none". - Observe that
spawn_agentreturns success with the canonical task name. - Observe that the TUI prints the same
Started /root/<task>line twice. - Immediately call
wait_agent. - The TUI exits to the PowerShell prompt. There is no
wait_agentfunction output.
Reproduction evidence
Two independent failed children:
| Run | Topology | Child durable state | Parent final event |
|---|---|---|---|
| A | second sequential child, after a successful child | edge open; tokens_used=0; rollout contains only session_meta, task_started | wait_agent function call, no output |
| B | first and only child in a fresh parent | edge open; tokens_used=0; rollout contains only session_meta, task_started | wait_agent function call, no output |
Control: the first child in Run A used the same registered role/provider and completed normally with multiple wait_agent results and a final task_complete.
For Run B:
- Parent rollout has exactly one
spawn_agentfunction call. thread_spawn_edgeshas exactly one row for the parent and child.- Child rollout has exactly two records:
session_metaandevent_msg.task_started. - Parent rollout ends at the
wait_agentfunction call; nofunction_call_output,turn_aborted, or surfaced error follows. - UI showed
Started /root/<task>twice.
This rules out duplicate model/tool invocation as the reason for the duplicated line.
Expected behavior
- The child should consume the non-empty task and start model work.
wait_agentshould return mailbox activity or a timeout; it must not terminate the TUI.- A single spawn activity should render one
Startedline. - If initial child dispatch fails,
spawn_agentshould return an error and should not leave anopendurable edge / zero-token orphan.
Actual behavior
spawn_agentreports success.- The child reaches
task_startedbut never produces any further event. - The durable edge remains
open. - The TUI duplicates the
Startedline. - The parent process exits while
wait_agentis in flight.
Current-source observations
Checked against main commit b2dc8b3:
- V2 spawn awaits
spawn_agent_with_communicationand then emitsSubAgentActivityKind::Started: spawn.rs. - The control path creates/notifies/persists the child before sending initial inter-agent communication, then returns a
LiveAgent: control/spawn.rs. - V2
wait_agentawaits input-queue activity and should convert a closed receiver or timeout to a normal result: wait.rs. - TUI activity handling appends every received subagent activity history cell without an obvious idempotency guard: tool_lifecycle.rs.
Likely investigation points are: initial communication enqueue/turn startup after the durable edge is committed, fatal error propagation while wait_agent is in flight, and TUI deduplication keyed by the activity item id/kind.
Related but not duplicate
- #16900 — parent-visible wait/liveness contract
- #19197 — persistent orphaned subagents and eventual freezes
- #25426 —
close_agentcan hang on non-terminating child - #18335 — leaked spawn slots across turns
I can provide sanitized rollout excerpts or a small SQLite query/result if maintainers want additional evidence.
2 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Closing as a duplicate of #36012. The fresh-parent reproduction, single-spawn/duplicate-Started evidence, and successful same-environment control have been added to #36012.