codex exec --json omits spawn_agent function calls from the event stream
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
Codex version
codex-cli 0.147.0
Problem
codex exec --json omits the spawn_agent function call and its result from stdout even though both records are persisted in the session rollout JSONL. The stream may later emit a collab_tool_call for wait, but consumers never receive the matching spawn event, target, prompt, or result.
The same gap affects unified custom tool calls: with features.unified_exec=true, calls such as the unified exec tool are persisted in the rollout but omitted from --json. Setting features.unified_exec=false makes standard command_execution events visible, but does not make spawn_agent visible.
Reproduction
codex exec --json \
--skip-git-repo-check \
--sandbox danger-full-access \
-c 'features.multi_agent=true' \
-c 'features.unified_exec=false' \
'Call spawn_agent exactly once with fork_turns none, wait for it, then reply only DONE.'
Observed stdout contains thread.started, turn.started, sometimes collab_tool_call for wait, the final agent_message, and turn.completed, but no spawn call/result. The matching rollout JSONL contains a namespaced function_call with name: "spawn_agent" and its function_call_output.
Expected behavior
--json should expose all tool calls needed by API/SDK consumers to reconstruct the turn, including namespaced collaboration calls and their results. At minimum, a successful spawn should emit a correlated event containing its call ID, target agent type/name, prompt/task metadata, and spawned agent/thread ID.
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 with the codex exec --json event stream and compare its output with the persisted session rollout JSONL. Reproduce the issue using the command shown, including spawn_agent and unified tool calls, then trace how those records are converted into stdout events. Done means consumers receive correlated spawn and custom-tool call and result events with the required metadata.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100