openai / openai/codex

codex exec --json omits spawn_agent function calls from the event stream

Open
#41,590 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug CLI exec subagent tool-calls
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.


🤖 Created by Jarvis via Realmroot

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.