sub agent causing improper turn end
Resolved 💬 3 comments Opened Mar 26, 2026 by iharc-jordan Closed Mar 27, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor)
responded on this thread — see the highlighted reply below.
What version of Codex CLI is running?
117
What subscription do you have?
pro
Which model were you using?
5.4
What platform is your computer?
windows (wsl)
What terminal emulator and version are you using (if applicable)?
wsl
What issue are you seeing?
When multi-agent v2 is enabled, a sub-agent completion causes the main session to end its turn. This is despite the end turn flag being false in the reply from the sub agent.
What steps can reproduce the bug?
Conduct a session with ma v2 enabled and have sub agents spawn.
What is the expected behavior?
Sub agent completions should not trigger an end of turn for the main agent.
Additional information
_No response_
3 Comments
Can you provide
/feedbackand post your thread ID here?Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
This is a subtle but important lifecycle bug. When a sub-agent signals completion, the parent should have the autonomy to decide whether that constitutes a turn boundary — not have the decision forced on it by the transport layer.
The underlying issue is a signal semantics confusion: the sub-agent'\''s "end turn" flag is being interpreted by the orchestrator as "end parent turn" rather than "sub-task complete, return control." These are fundamentally different events.
We see a structurally similar problem in multi-session AI code generation: when an AI agent generates code across multiple sessions, each session treats its output as final. The cross-session boundary causes:
The fix here should decouple the two signal paths: sub-agent completion (data plane) from turn management (control plane). The parent orchestrator should be the sole authority on turn boundaries.
In a CI context, we handle the multi-session inconsistency problem by running cross-file reference validation at merge time — checking that all imports, type references, and function signatures are consistent across the full changeset, not just within each individual session'\''s output.
npx @opencodereview/cli scan . --sla L1 if you want to try catching these cross-session inconsistencies in your own pipeline.