Repository navigation
Description
What version of Codex CLI is running?
0.144.5 (installed via @openai/codex-sdk / @openai/codex npm packages)
Which model were you using?
gpt-5.6-sol
What platform is your computer?
Linux (Ubuntu 20.04 focal), invoked via @openai/codex-sdk's Codex.startThread().runStreamed(), which shells out to codex exec --experimental-json (see node_modules/@openai/codex-sdk/src/exec.ts).
What happened?
Using native subagent support ([features] multi_agent = true, a custom
agent defined at <CODEX_HOME>/agents/<name>.toml), I asked the root agent
to spawn a named custom agent and relay its exact reply. The
--experimental-json event stream only ever shows:
{"type":"item.started","item":{"id":"item_1","type":"collab_tool_call","tool":"wait","sender_thread_id":"...","receiver_thread_ids":[],"prompt":null,"agents_states":{},"status":"in_progress"}}
{"type":"item.completed","item":{"id":"item_1","type":"collab_tool_call","tool":"wait","sender_thread_id":"...","receiver_thread_ids":[],"prompt":null,"agents_states":{},"status":"completed"}}
{"type":"item.completed","item":{"id":"item_2","type":"agent_message","text":"SPECIALIST SAID: PONG"}}Note: no collab_tool_call with tool: "spawn_agent" (or similar) ever
appears in this stream, and the wait item's receiver_thread_ids is
always [], even though the final agent_message content is correct.
This reproduced identically across 6 separate runs, with and without
[features.multi_agent_v2].
Reading the FULL session rollout (~/.codex/sessions/**/*.jsonl) for the
same turn tells a different, complete story — it contains the actual
function_call/function_call_output pair for the spawn, a
sub_agent_activity event ("kind": "started"), the child thread's own
rollout file (session_meta subagent.thread_spawn with the correct
agent_path/agent_nickname), and the real agent_message reply routed
back from the child. state_5.sqlite's thread_spawn_edges table also
correctly records the parent→child edge for every one of the 6 runs.
So: delegation genuinely works end-to-end. The bug is that the
--experimental-json stream — the one @openai/codex-sdk consumes and
exposes to SDK users — is missing the spawn_agent collab_tool_call event
entirely, and the wait item it does emit never reflects the real
receiver thread. This is different from #28318 (missing TypeScript type for
collab_tool_call — that reporter's runtime JSON did include a populated
spawn_agent item with real receiver_thread_ids); here the data itself
is missing from this event source, not just its type.
Expected behavior
exec --experimental-json (and therefore @openai/codex-sdk's public
event stream) should include the spawn_agent collab_tool_call item, and
wait's receiver_thread_ids should reflect the actual spawned child
thread(s) — matching what the full session rollout already records
correctly.
Why this matters
Any SDK consumer trying to observe or verify subagent delegation
(logging, tracing, debugging, deciding whether to trust a delegated
result) via the public event stream currently gets a false negative —
delegation looks like a silent no-op even when it succeeded. We only
caught this by cross-referencing the full rollout JSONL and
state_5.sqlite directly, which isn't part of the SDK's public surface.
Activity
drewmt commentedon Jul 24, 2026
Confirmed on
codex-cli 0.145.0-alpha.18withcodex exec --jsonusing one v2 spawn, one wait, and an exactPONG-34919relay. The public JSONL still emitted only awaititem withreceiver_thread_ids: []; the matching rollout contained thespawn_agentfunction call, asub_agent_activitystartedevent with the child thread ID, and the child reply. The turn context confirmedmulti_agent_version: "v2".On current
main(99744cf), this appears to be the v2 event-shape boundary rather than the JSON serializer itself:multi_agents_v2/spawn.rsemits onlyTurnItem::SubAgentActivityafter a successful spawn.event_processor_with_jsonl_output.rsmapsCollabAgentToolCallbut has noSubAgentActivitymapping, so that observable child ID is dropped from exec JSONL.multi_agents_v2/wait.rsexplicitly emits both wait lifecycle items with empty receiver IDs.multi_agent_version_for_modelcan still select the model-provided v2 version.A focused regression would ideally exercise the v2 spawn/wait flow through the exec/app-server boundary and assert that the public JSONL exposes the spawned child ID, rather than only testing the synthetic
CollabAgentToolCallmapper. Happy to prepare that patch if the maintainers would like an external PR.coygeek commentedon Nov 5, 2026
Summary
The missing-spawn behavior remains reproducible on the latest stable CLI with a standalone loopback Responses fixture. A real V2 child request reaches the fixture and the parent receives a successful spawn result, but
codex exec --jsonemits no spawn item. A V1 control emits both spawn lifecycle items. This adds a model-free reproduction and a current release check to this issue; it does not test the separate empty-wait-receiver symptom.Runtime or environment
@openai/codex, reportingcodex-cli 0.166.0, on macOS Apple Silicon (Darwin 27.2.0 arm64); npmlatestand the latest non-prerelease GitHub release matched.mainat9a7213ca37c6aa19127100027f041599d2d28eb9; I did not build or execute this checkout.gpt-6-sol(bundled V2 hint),gpt-5.6-luna(V1 hint), andgpt-5.5(no multi-agent version hint). There is no real model inference, subscription, authentication, terminal emulator, or copied user configuration in the reproduction.Steps to reproduce
Save the following as
repro.pyand runpython3 repro.py /absolute/path/to/codex. It uses Python's standard library, a fresh HOME, CODEX_HOME and working directory per case,--ignore-user-config, and an unauthenticated loopback custom provider. It scripts one spawn call, completes the child locally if one starts, and prints event types and the tool result. All test tasks are synthetic.Expected behavior
A successful V2 spawn should be observable through the public exec JSONL stream, with enough identity to correlate the spawn and child. The same binary already exposes successful V1 spawns as
collab_tool_calllifecycle items. A disabled-spawn control should remain rejected; it must not count as restored event visibility.Actual behavior
All four standalone cases exited zero. In the V2 case the fixture observed a child request and received
{"task_name":"/root/probe"}as the parent-visible spawn output, but the entire stdout event sequence was:The V1 control observed a child request and additionally emitted
item.started:collab_tool_call:spawn_agentanditem.completed:collab_tool_call:spawn_agent. The control withagents.enabled=falseexposed no collaboration declarations and returnedunsupported call: collaborationspawn_agent, with no child request. The no-version-hint model control also rejected that call. These controls distinguish successful-but-unreported spawning from disabled or rejected calls.Both feature flags are false in all four cases. That does not by itself mean subagents are disabled: the model's catalog hint can select V2.
-c 'agents.enabled=false'is the tested control for disabling the collaboration declarations and execution while the V2 feature override is false. It is not a replacement for observing spawns when delegation is intentionally enabled. This report does not assert a common cause between configuration precedence and the JSONL omission.Evidence
CollabTool::SpawnAgentevent representation and the directly executed V1 control above establish the spawn observability contract; the non-interactive output documentation describes the JSONL event stream.The inspected source remains consistent with the runtime distinction:
core/src/tools/handlers/multi_agents_v2/spawn.rsemitsSubAgentActivityKind::Startedand records private collaboration analytics, whileexec/src/event_processor_with_jsonl_output.rsmapsCollabAgentToolCalland falls through for the activity shape. The V1 spawn handler emits the mapped collaboration item. This is a source-level explanation, not a claim that I executed main.The fixture uses no login and the bundled catalog metadata for the named models. Logged-in requests were not tested here; earlier local capture attempts could not read their zstd-compressed bodies. The reproduced claim is bounded to the unauthenticated custom Responses provider path. No sandbox or approval boundary crossing is claimed.
Restoration check
Run the V2 case with the same scripted successful spawn. Require an observable spawn event correlated with the child that actually starts, while preserving the V1 lifecycle events. Keep the
agents.enabled=falsecase rejected with no child request. A final assistant message saying a spawn occurred does not replace an event emitted by the runtime.Triage assessment