feat: show Codex subagent activity in conversations - #3449
Conversation
Generated-By: PostHog Code Task-Id: 76a928b2-1000-4c64-aae1-98bd85c2fa4b
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
|
Reviews (1): Last reviewed commit: "feat: render Codex subagent activity" | Re-trigger Greptile |
| status: mapStatus(item.status), | ||
| ...(tool.rawInput !== undefined ? { rawInput: tool.rawInput } : {}), |
There was a problem hiding this comment.
Replay Marks Running Spawns Complete
When a session is rebuilt from history while a spawned child is still pendingInit or running, this path uses the raw collab item status instead of the live mapToolStatus override. A completed spawn with an active child is replayed as finished, so the UI can show the subagent row as done even though the child is still running.
| status: mapStatus(item.status), | |
| ...(tool.rawInput !== undefined ? { rawInput: tool.rawInput } : {}), | |
| status: mapToolStatus(item), | |
| ...(tool.rawInput !== undefined ? { rawInput: tool.rawInput } : {}), |
| childItems && | ||
| childItems.length > 0 | ||
| ) { | ||
| if (isSubagentTool(toolName)) { |
There was a problem hiding this comment.
Childless Collaboration Rows Lose Details
When send_input, resume_agent, wait_agent, or close_agent has no nested child items, this branch still renders it with SubagentToolView. That view only shows child content, so these ordinary collaboration actions lose their own input/output details and become header-only Subagent · ... rows instead of the normal tool row.
| this.mcp.release(params); | ||
| } | ||
|
|
||
| if (!isMainThread) return; |
There was a problem hiding this comment.
When Codex emits thread/tokenUsage/updated for a spawned child thread, this early return skips the usage ingestion and usage extension notification path below. A turn that delegates work to a subagent can then underreport token usage and cost because only the parent thread's usage reaches the tracker.
Generated-By: PostHog Code Task-Id: 971044c5-e622-4f07-b1b5-dca9b06d040c
|
@MattPua i started working on this as well, then Sol saw that you had an open PR for it too, and it went nuts and just pushed changes to yours, sorry about that - reverted |
Restore the original implementation and leave the thread-isolation fix to its separate pull request. Generated-By: PostHog Code Task-Id: 971044c5-e622-4f07-b1b5-dca9b06d040c
Problem
Codex delegated-agent activity is emitted on child thread IDs, but the adapter only surfaced main-thread notifications. As a result, users could not see the subagent's streamed messages or tool calls under the spawn action. The spawn row also appeared finished as soon as creation completed, even while the child was still running, and wait/resume/close actions incorrectly inflated the displayed subagent count.
Changes
Screenshots not included because this change corrects streamed runtime state that is covered by focused adapter and conversation-builder tests.
How did you test this?
pnpm --filter @posthog/agent typecheck.pnpm --filter @posthog/ui typecheck.git diff --check.Automatic notifications
Created with PostHog Code