Skip to content

fix(codex): keep delegated child-agent output out of parent chats - #5955

Open
Umais-Adeed wants to merge 6 commits into
pingdotgg:mainfrom
Umais-Adeed:fix/codex-child-agent-routing
Open

fix(codex): keep delegated child-agent output out of parent chats#5955
Umais-Adeed wants to merge 6 commits into
pingdotgg:mainfrom
Umais-Adeed:fix/codex-child-agent-routing

Conversation

@Umais-Adeed

@Umais-Adeed Umais-Adeed commented Aug 10, 2026

Copy link
Copy Markdown

What Changed

  • Register Codex collabAgentToolCall.receiverThreadIds as soon as direct child agents are spawned.
  • Keep child narration, reasoning, command output, and tool progress out of the parent conversation.
  • Emit synthetic child-agent lifecycle events so the Agents panel can render the work.
  • Recover coordinator-assigned child names and update the panel with readable names and statuses.
  • Add readable fallbacks and status labels for opaque child IDs in the Agents panel.
  • Add wire and runtime regression coverage for child-first ordering, direct spawns, terminal lifecycle events, and dropped child chatter.

Why

Codex direct child threads can emit events before T3 has registered their IDs. Those events were treated as parent-thread content, flooding the coordinator conversation and leaving the Agents panel empty or displaying opaque UUIDs.

This change keeps the coordinator timeline focused while preserving child progress in the Agents panel.

UI Changes

Before: child agents are missing from the Agents panel.

Before: child agents are missing from the Agents panel

After: named child agents appear with status and usage.

After: named child agents appear with status and usage

Verification

  • Codex collab integration tests: 4 passed.
  • Codex wire tests: 9 passed.
  • Codex adapter tests: 25 passed.
  • Client subagent runtime tests: 46 passed.
  • Server and web typechecks passed.
  • Scoped lint, formatting, and diff checks passed.
  • Manually verified with three Codex sub-agents.

Names are associated with child IDs in spawn order because the direct Codex wire shape does not provide an explicit receiver-ID-to-nickname mapping.

Checklist

  • This PR is focused on one Codex child-agent observability bug.
  • The change and motivation are explained.
  • Before/after screenshots are included.
  • No animation or transition changes are introduced, so a video is not applicable.

Fixes #5953

Generated with GPT-5.6 Luna in T3 Code using the Codex harness.


Note

Medium Risk
Large changes to Codex notification interception and parent/child timeline routing; mistakes could hide coordinator content or leak child chatter, though coverage is extensive.

Overview
Codex direct collab child threads can emit events before T3 registers them, which previously flooded the coordinator chat and left the Agents panel empty or showing raw UUIDs. This PR tightens child registration, routing, and naming so parent and child surfaces stay separate.

Runtime (CodexSessionRuntime) registers children from collabAgentToolCall receiverThreadIds (including builds that skip thread/started / subAgentActivity), tracks spawn order (spawnIndex), and provisionally registers unknown foreign thread IDs while dropping expanded child chatter (deltas, terminal interaction, MCP progress). Child traffic is re-emitted as synthetic collabAgent/* events; coordinator summaries are parsed via readCoordinatorAgentNames to emit collabAgent/renamed in spawn order. turn/started no longer updates session state until the root provider thread id exists.

Adapter maps collabAgent/renamed to task.updated with optional title and timelineBypass.

Agents panel adds friendlier labels for opaque IDs, readable activity/role text, and copy tweaks.

Integration and wire tests cover direct spawns, naming order, unscoped children, and logical-root coordinator items.

Reviewed by Cursor Bugbot for commit c0e073d. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Filter delegated child-agent output from parent chat timelines in Codex collab runtime

  • Extends makeCodexSessionRuntime in CodexSessionRuntime.ts to register child agents from collabAgentToolCall receiver IDs, track spawn order via spawnIndex, and suppress child chatter (including item/commandExecution/terminalInteraction and item/mcpToolCall/progress) from the parent timeline.
  • Adds readCoordinatorAgentNames to parse coordinator summaries for agent names and readCollabPromptNickname to derive nicknames from spawn prompts; emits collabAgent/renamed events when names are resolved.
  • Handles collabAgent/renamed in CodexAdapter.ts by mapping it to a task.updated canonical event with timelineBypass: true.
  • Improves the AgentsPanel with readable activity/role labels, opaque-title fallbacks (e.g. 'Agent 1'), and clearer token count text.
  • Behavioral Change: early child turn/started notifications no longer claim the root session when providerThreadId is unset or mismatched; logical-root items remain on the parent timeline.

Macroscope summarized c0e073d.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5660ebc2-8c10-4fb1-bb1f-6dfcb60bcb3f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Aug 10, 2026
Comment thread apps/server/src/provider/Layers/CodexSessionRuntime.ts
Comment thread apps/server/src/provider/Layers/CodexAdapter.ts
Comment thread apps/server/src/provider/Layers/CodexSessionRuntime.ts
@macroscopeapp

macroscopeapp Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR introduces substantial new logic (~950 additions) for multi-agent notification routing, child agent registration, and spawn ordering - beyond a simple fix. The author is new to this codebase and the changes affect core runtime behavior in the multi-agent system.

You can customize Macroscope's approvability policy. Learn more.

Comment thread apps/server/src/provider/Layers/CodexSessionRuntime.ts Outdated
Comment thread apps/server/src/provider/Layers/CodexSessionRuntime.ts Outdated
Comment thread apps/server/src/provider/Layers/CodexSessionRuntime.ts
Comment thread apps/server/src/provider/Layers/CodexSessionRuntime.ts Outdated
Comment thread apps/server/src/provider/Layers/CodexSessionRuntime.ts

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 75b2a2d. Configure here.

Comment thread apps/server/src/provider/testFixtures/codexCollabMockPeer.mjs
Comment thread apps/server/src/provider/Layers/CodexSessionRuntime.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Codex child-agent output floods the parent chat

1 participant