Main turn can complete before collecting required subagent results; results surface only after the next user prompt
What version of Codex CLI is running?
OpenAI Codex (v0.149.1)
What subscription do you have?
Pro
Which model were you using?
gpt-5.6-sol (reasoning high, summaries auto)
What platform is your computer?
macOS 15.7.3 (24G419)
What terminal emulator and version are you using (if applicable)?
Ghostty
Codex doctor report
liuyang ~ v1.96.0 v3.11.9 01:29 ❯ Codex doctor
Codex Doctor v0.149.1 · macos-aarch64
Notes
⚠ rollouts 306 active files · 1.48 GB on disk
⚠ updates update configuration is locally consistent
⚠ threads state DB rows point at missing or unusable rollout files
─────────────────────────────────────────────────────────────
Environment
✓ system zh-Hans-SG
os Mac OS 15.7.3 [64-bit]
OS language zh-Hans-SG
LANG en_SG.UTF-8
VISUAL not set
EDITOR not set
✓ disk sufficient free disk space (630.5 GiB)
warning threshold 5.0 GiB
failure threshold 1.0 GiB
CODEX_HOME available 630.5 GiB
worktree available 630.5 GiB
✓ security no supported endpoint protection detected
endpoint products none detected
✓ runtime standalone (unix, package /Users/liuyang/.codex/packages/standalone/releases/0.149.1-aarch64-apple-darwin, bin /Users/liuyang/.codex/packages/standalone/releases/0.149.1-aarch64-apple-darwin/bin, resources /Users/liuyang/.codex/packages/standalone/releases/0.149.1-aarch64-apple-darwin/codex-resources, path /Users/liuyang/.codex/packages/standalone/releases/0.149.1-aarch64-apple-darwin/codex-path)
version 0.149.1
install method standalone (unix, package /Users/liuyang/.codex/packages/standalone/releases/0.149.1-aarch64-apple-darwin, bin /Users/liuyang/.codex/packages/standalone/releases/0.149.1-aarch64-apple-darwin/bin, resources /Users/liuyang/.codex/packages/standalone/releases/0.149.1-aarch64-apple-darwin/codex-resources, path /Users/liuyang/.codex/packages/standalone/releases/0.149.1-aarch64-apple-darwin/codex-path)
commit unknown
executable ~/.local/bin/Codex
✓ install consistent
context standalone (unix, package /Users/liuyang/.codex/packages/standalone/releases/0.149.1-aarch64-apple-darwin, bin /Users/liuyang/.codex/packages/standalone/releases/0.149.1-aarch64-apple-darwin/bin, resources /Users/liuyang/.codex/packages/standalone/releases/0.149.1-aarch64-apple-darwin/codex-resources, path /Users/liuyang/.codex/packages/standalone/releases/0.149.1-aarch64-apple-darwin/codex-path)
managed by npm: no · bun: no · pnpm: no · package root —
PATH entries (2) ~/.local/bin/codex
/opt/homebrew/bin/codex
✓ search file exists (bundled, /Users/liuyang/.codex/packages/standalone/releases/0.149.1-aarch64-apple-darwin/codex-path/rg)
search command ~/.codex/packages/standa…le-darwin/codex-path/rg
search provider bundled
search command readiness file exists
✓ git git version 2.50.1 (Apple Git-155)
selected git /usr/bin/git
version git version 2.50.1 (Apple Git-155)
exec path /Library/Developer/Comma…ls/usr/libexec/git-core
repo detected false
PATH entries (2) /usr/bin/git
/opt/homebrew/bin/git
✓ terminal Ghostty 1.3.1
terminal Ghostty
TERM_PROGRAM ghostty
terminal version 1.3.1
stdin is terminal true
stdout is terminal true
stderr is terminal true
terminal size 225x53
color output enabled
COLORTERM truecolor
TERMINFO /Applications/Ghostty.ap…ents/Resources/terminfo (dir)
effective locale en_SG.UTF-8
✓ title default · project liuyang
title source default
title items activity, project-name
activity item true
project source cwd
project value liuyang
✓ state databases healthy
CODEX_HOME ~/.codex (dir)
log dir ~/.codex/log (dir)
sqlite home ~/.codex (dir)
state DB ~/.codex/state_5.sqlite (file) · integrity ok
log DB ~/.codex/logs_2.sqlite (file) · integrity ok
goals DB ~/.codex/goals_1.sqlite (file) · integrity ok
memories DB ~/.codex/memories_1.sqlite (file) · integrity ok
active rollouts 306 files · 1.48 GB (avg 4.95 MB)
archived rollouts 0 files · 0 B (avg 0 B)
queue DB ~/.codex/queue_1.sqlite (file)
queue DB integrity ok
thread history DB ~/.codex/thread_history_1.sqlite (file)
thread history DB integrity ok
standalone release cache 13 entries in /Users/liuyang/.codex/packages/standalone/releases
⚠ threads state DB rows point at missing or unusable rollout files
default model provider openai
rollout DB active files 306
rollout DB archived files 0
rollout DB scan errors 0
rollout DB malformed file names 0
rollout DB scan cap reached false
rollout DB rows 718
rollout DB active rows 669
rollout DB archived rows 49
rollout DB missing active rows 0
rollout DB missing archived rows 0
rollout DB stale rows 412
rollout DB archive mismatches 0
rollout DB duplicate rollout thread ids 0
rollout DB duplicate DB paths 0
rollout DB model providers openai=718
rollout DB sources subagent:thread_spawn=539, vscode=100, cli=76, subagent:other=2, exec=1
rollout DB stale row sample ~/.codex/archived_sessio…a579-355a52717b96.jsonl
rollout DB stale row sample ~/.codex/sessions/2026/0…a099-25e886ee13df.jsonl
rollout DB stale row sample ~/.codex/archived_sessio…86a5-b11e5226f87b.jsonl
rollout DB stale row sample ~/.codex/archived_sessio…881b-d6d27a2077fd.jsonl
rollout DB stale row sample ~/.codex/archived_sessio…9080-6c2e6c7c1572.jsonl
Configuration
✓ config loaded
model gpt-5.6-sol · openai
cwd ~
config.toml ~/.codex/config.toml
config.toml parse ok
MCP servers 5
feature flags 42 enabled · 0 overridden (full list with --all)
✓ auth auth is configured
auth storage mode File
auth file ~/.codex/auth.json
stored auth mode chatgpt
stored API key false
stored ChatGPT tokens true
stored agent identity false
✓ mcp 5 server (4 stdio, 1 streamable_http) · 1 disabled
configured servers 5
disabled servers 1
stdio servers 4
streamable_http servers 1
✓ sandbox restricted fs + restricted network · approval OnRequest
approval policy OnRequest
filesystem sandbox restricted
network sandbox restricted
linux helper none
execve wrapper helper ~/.codex/tmp/arg0/codex-…yQ/codex-execve-wrapper
Desktop App
✓ desktop the desktop application is installed
version 26.818.31338
running false
log directory $HOME/Library/Logs/com.openai.codex
✓ desktop the desktop application is not running
✓ desktop the desktop application passed available macos security assessments
gatekeeper accepted
Updates
⚠ updates update configuration is locally consistent
startup update check true
update action standalone installer
version cache ~/.codex/version.json
cached latest version 0.149.1
last checked at 2026-08-26 10:48 UTC
latest version probe curl: (56) The requested URL returned error: 403
Connectivity
✓ network network-related environment looks readable
proxy env vars present HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, NO_PROXY, http_proxy, https_proxy, all_proxy, no_proxy
system proxy manual
respect system proxy disabled
managed proxy not configured
✓ websocket connected (HTTP 101 Switching Protocols) · 15s timeout
model provider openai
provider name OpenAI
wire API responses
supports websockets true
proxy env vars present HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, NO_PROXY, http_proxy, https_proxy, all_proxy, no_proxy
connect timeout 15000 ms
auth mode chatgpt
endpoint wss://chatgpt.com/backend-api/<redacted>
DNS 1 IPv4, 0 IPv6, first IPv4
handshake result HTTP 101 Switching Protocols
reasoning header false
server model present false
✓ reachability active provider endpoints are reachable over HTTP
reachability mode ChatGPT auth
ChatGPT inference URL https://chatgpt.com/backend-api/<redacted> reachable (HTTP 405)
desktop assets CDN https://chatgpt.com/backend-api/<redacted> reachable (HTTP 200)
Background Server
○ app-server not running (ephemeral mode)
daemon state dir ~/.codex/app-server-daemon
settings ~/.codex/app-server-daemon/settings.json (missing)
pid file ~/.codex/app-server-daemon/app-server.pid (missing)
update-loop pid file ~/.codex/app-server-daem…/app-server-updater.pid (missing)
control socket ~/.codex/app-server-cont…app-server-control.sock
status not running
mode ephemeral
─────────────────────────────────────────────────────────────
20 ok · 1 idle · 3 notes · 2 warn · 0 fail degraded
--summary compact output --all expand truncated lists
--json redacted report
liuyang ~ v1.96.0 v3.11.9 01:41 in 18s78ms ❯
What issue are you seeing?
Summary
In a Codex CLI multi-agent workflow, the main agent emitted final_answer and completed its turn before collecting the results of three required subagents.
The subagents continued working, but their result messages did not reactivate the completed main turn. They were delivered to the main thread only after I sent another user message approximately 32 minutes later.
This appears to be an orchestration/finalization issue rather than a crash or streaming failure.
## Environment
- Codex CLI:
0.149.1 - Surface: Codex CLI
- Model:
gpt-5.6-sol - Reasoning effort:
high - Service tier:
fast - Collaboration mode: Default chat, not
/goal - OS: macOS
<macOS 15.7.3> - Shell: Fish
- In-app feedback session ID:
<01a03158-b4a8-7c10-9f70-142be548c65e>
## Expected behavior
When required subagents are still running or their requested results have not been collected, the main agent should:
- Keep the main turn active.
- Use commentary for intermediate progress.
- Wait for the required subagent results.
- Return
final_answeronly after all required results have been collected, unless the user explicitly asks to detach the work.
The current OpenAI documentation says Codex handles orchestration, including waiting for results, and waits until all requested results are available before returning a consolidated response:
https://learn.chatgpt.com/docs/agent-configuration/subagents
## Actual behavior
The main agent:
- Checked the agent states.
- Observed the main agent and all three subagents as
running. - Sent follow-up instructions to the subagents.
- Did not call
wait_agent. - Emitted
final_answer. - Completed the main turn two seconds later.
The final response itself described the delegated tasks as still in progress and promised future progress updates, even though emitting final_answer made those updates impossible without another user prompt.
## Event timeline
All timestamps below are UTC.
``text``
2026-08-26T15:55:22.247Z event task_started
2026-08-26T15:58:31.630Z assistant commentary
2026-08-26T15:58:33.342Z tool list_agents
2026-08-26T15:58:50.625Z tool send_message
2026-08-26T15:59:05.786Z tool send_message
2026-08-26T15:59:49.139Z tool exec
2026-08-26T15:59:59.361Z tool send_message
2026-08-26T16:00:17.344Z assistant final_answer
2026-08-26T16:00:19.736Z event task_complete
There was no wait_agent call between the last child instruction and final_answer.
There was also no turn_aborted, crash, or missing tool event in this interval.
## Agent-state snapshot
The list_agents result at 2026-08-26T15:58:33.555Z showed:
``text``
2026-08-26T15:58:33.555Z main running
2026-08-26T15:58:33.555Z subagent_1 running
2026-08-26T15:58:33.555Z subagent_2 running
2026-08-26T15:58:33.555Z subagent_3 running
This was the last explicit agent-state check before the main agent finalized. The parent continued sending instructions after this snapshot but did not check again or wait for completion.
## Result delivery after the next user prompt
A new turn began at approximately 2026-08-26T16:32:22Z. The pending subagent messages were then delivered to the main thread:
``text``
2026-08-26T16:32:22.910Z event task_started
2026-08-26T16:32:22.926Z user new_prompt
2026-08-26T16:32:41.203Z assistant commentary
2026-08-26T16:32:41.636Z subagent result_delivered_to_main
2026-08-26T16:32:41.636Z subagent result_delivered_to_main
2026-08-26T16:32:41.637Z subagent result_delivered_to_main
2026-08-26T16:32:41.637Z subagent result_delivered_to_main
2026-08-26T16:32:41.638Z subagent result_delivered_to_main
These five agent_message events contained progress/final messages from the three delegated agents.
## Impact
- The UI makes the workflow appear complete even though required work is still running.
- Promised live progress updates cannot be delivered after the main turn ends.
- Completed subagent results remain invisible until the user sends another message.
- Users may incorrectly assume that development stopped or that subagent results were lost.
- The behavior conflicts with the documented expectation that Codex waits for requested subagent results before returning a consolidated response.
## Suggested safeguards
Any of the following would prevent this failure mode:
- Block
final_answerwhile required child agents are active or have uncollected results. - Convert an attempted final response into commentary when required work remains.
- Show a confirmation such as: “3 subagents are still active. End this turn and detach them?”
- Keep the main controller subscribed to required child-result events until completion or explicit cancellation.
- Clearly surface detached subagents and automatically display their results when they finish.
The most important invariant would be:
``text``
required_active_children > 0 OR uncollected_required_results > 0
→ main turn must not finalize without explicit detach intent
## Reproducibility
Observed in one long-running production session. I have not yet reduced it to a clean minimal repository reproduction.
The full session was submitted through Codex feedback so the OpenAI team can inspect the original transcript using the feedback session ID above. I can provide additional redacted logs privately if needed.
What steps can reproduce the bug?
No repository-specific application code is required. The issue occurs in Codex CLI's parent/subagent orchestration.
### Observed reproduction
- Start Codex CLI in a normal Default chat, not
/goal. - Delegate three required, long-running tasks to subagents.
- Explicitly tell the main agent to continue until all three tasks complete and to provide progress updates.
- While
/agentshows the subagents as active, ask the main agent for a status update and tell it to keep working. - The main agent calls
list_agents, sends follow-up messages to the workers, but does not callwait_agent. - The main agent emits
final_answer, and the main turn becomestask_complete. - The subagents continue working, but their results are not delivered to the completed main turn.
- Send another user message. A new turn starts, and the pending subagent results are immediately delivered to the main thread.
### Minimal synthetic setup
Run Codex in a temporary directory:
``sh``
mkdir -p /tmp/codex-subagent-finalization-repro
cd /tmp/codex-subagent-finalization-repro
git init -q
codex
Send this prompt:
```text
Spawn exactly three subagents. Each subagent must run a read-only command that waits 90 seconds and then returns a unique completion token:
subagent 1: sleep 90; printf 'subagent-1-complete\n'
subagent 2: sleep 90; printf 'subagent-2-complete\n'
subagent 3: sleep 90; printf 'subagent-3-complete\n'
All three results are required. Keep the main turn active, use commentary for progress, and do not send a final response until all three completion tokens have been collected.
```
While /agent shows the three children as active, queue this follow-up:
``text``
Why can't I see live progress? Check all agents, keep the main turn active, continue waiting for all required results, and report milestones. Do not stop after this status update.
The failure occurs if the main agent returns a final response and completes the parent turn before collecting all three required results.
The sleep-based example is a synthetic reproduction intended to exercise the same orchestration path. The event trace below comes from the real observed session.
### Thread information
- Thread/session ID:
01a03158-b4a8-7c10-9f70-142be548c65e - In-app feedback session ID:
<01a03158-b4a8-7c10-9f70-142be548c65e>
### Observed trace
``text``
2026-08-26T15:55:22.247Z event task_started
2026-08-26T15:58:31.630Z assistant commentary
2026-08-26T15:58:33.342Z tool list_agents
2026-08-26T15:58:50.625Z tool send_message
2026-08-26T15:59:05.786Z tool send_message
2026-08-26T15:59:49.139Z tool exec
2026-08-26T15:59:59.361Z tool send_message
2026-08-26T16:00:17.344Z assistant final_answer
2026-08-26T16:00:19.736Z event task_complete
The last explicit agent-state snapshot before finalization showed:
``text``
2026-08-26T15:58:33.555Z main running
2026-08-26T15:58:33.555Z subagent_1 running
2026-08-26T15:58:33.555Z subagent_2 running
2026-08-26T15:58:33.555Z subagent_3 running
There was no wait_agent call between the child instructions and final_answer.
What is the expected behavior?
When the main agent has required subagents whose results have not yet been collected, it should keep the main turn active and wait for those results.
Intermediate status updates should use commentary and must not end the turn. The main agent should emit final_answer only after:
- All required subagent results have been collected;
- The user explicitly cancels the work; or
- The user explicitly asks to detach the subagents and return immediately.
If finalization while children remain active is intentionally supported, Codex should display a warning such as:
> Three required subagents are still active. End the main turn and detach them?
A completed main turn should not silently prevent later child results from reaching the user.
The documented behavior says Codex handles waiting for subagent results and waits until all requested results are available before returning a consolidated response:
https://learn.chatgpt.com/docs/agent-configuration/subagents
### Additional information
### Environment
- Codex CLI:
0.149.1 - Model:
gpt-5.6-sol - Reasoning effort:
high - Service tier:
fast - Mode: Default chat, not
/goal - OS: macOS
<macOS version> - Shell: Fish
### Evidence that results were delayed until the next user turn
The original main turn completed at:
```text
2026-08-26T16:00:19.736Z event task_complete
Approximately 32 minutes later, a new user turn started. Pending subagent messages were then delivered to the main thread:
2026-08-26T16:32:22.910Z event task_started
2026-08-26T16:32:22.926Z user new_prompt
2026-08-26T16:32:41.203Z assistant commentary
2026-08-26T16:32:41.636Z subagent result_delivered_to_main
2026-08-26T16:32:41.636Z subagent result_delivered_to_main
2026-08-26T16:32:41.637Z subagent result_delivered_to_main
2026-08-26T16:32:41.637Z subagent result_delivered_to_main
2026-08-26T16:32:41.638Z subagent result_delivered_to_main
These five agent_message events contained progress/final messages from the three delegated agents.
There was no crash, turn_aborted event, approval wait, or missing tool event. This appears to be a finalization/orchestration issue rather than a transport or rendering failure.
### Impact
- The workflow appears complete while required work is still running.
- Promised progress updates cannot be delivered after the main turn ends.
- Completed subagent results remain invisible until the user sends another message.
- Users may assume that work stopped or that results were lost.
### Suggested invariant
required_active_children > 0 OR uncollected_required_results > 0
→ do not finalize the main turn without explicit detach intent
The full session was submitted through Codex's in-app feedback flow.
Feedback session ID: <01a03158-b4a8-7c10-9f70-142be548c65e>
1 Comment
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action