Summary
Subagent turns can be omitted from exported Langfuse traces when Codex rollouts use the newer sub_agent_activity lifecycle event.
The current parser only extracts child thread IDs from:
{
"type": "collab_agent_spawn_end",
"new_thread_id": "thread-child"
}
Newer rollouts may represent the same lifecycle transition as:
{
"type": "sub_agent_activity",
"kind": "started",
"agent_thread_id": "thread-child"
}
Because plugins/tracing/src/parse.ts does not recognize the latter shape, turn.subagentThreadIds remains empty and the existing child rollout is not nested as a Codex Subagent Turn.
Expected behavior
Support both formats and deduplicate child thread IDs:
if (et === "collab_agent_spawn_end" && typeof p.new_thread_id === "string") {
turn.subagentThreadIds.push(p.new_thread_id);
}
if (
et === "sub_agent_activity" &&
p.kind === "started" &&
typeof p.agent_thread_id === "string"
) {
turn.subagentThreadIds.push(p.agent_thread_id);
}
Suggested test coverage
Add a rollout fixture using sub_agent_activity/agent_thread_id and assert that:
- the child thread ID is captured exactly once;
- its rollout is resolved;
Codex Subagent Turn is nested under the parent turn;
- the child generations are emitted as
LLM Subagent.
This differs from #12: the parent turn export can succeed while only subagent resolution is missing.
Summary
Subagent turns can be omitted from exported Langfuse traces when Codex rollouts use the newer
sub_agent_activitylifecycle event.The current parser only extracts child thread IDs from:
{ "type": "collab_agent_spawn_end", "new_thread_id": "thread-child" }Newer rollouts may represent the same lifecycle transition as:
{ "type": "sub_agent_activity", "kind": "started", "agent_thread_id": "thread-child" }Because
plugins/tracing/src/parse.tsdoes not recognize the latter shape,turn.subagentThreadIdsremains empty and the existing child rollout is not nested as aCodex Subagent Turn.Expected behavior
Support both formats and deduplicate child thread IDs:
Suggested test coverage
Add a rollout fixture using
sub_agent_activity/agent_thread_idand assert that:Codex Subagent Turnis nested under the parent turn;LLM Subagent.This differs from #12: the parent turn export can succeed while only subagent resolution is missing.