Skip to content

Handle sub-agent rendering for both Claude and Codex #178

Closed

Description

@Juliusolsson05

Problem

Agent Code needs first-class rendering support for sub-agent activity from both Claude and Codex.

Today the feed/rendering model is already strained by multiple producers for the same conversation content: committed transcript JSONL, live semantic/proxy events, semantic history, ghosts, optimistic user rows, queued prompts, and provider-specific tool/UI events. Sub-agent output adds another dimension: a parent agent can delegate work to one or more child/sub-agents, and their status, messages, tool calls, results, and lifecycle events must not leak into the parent feed as ambiguous raw items or be flattened into ordinary assistant text.

This should be handled deliberately and consistently across providers, not as provider-specific one-off rendering behavior.

Desired Behavior

Sub-agent activity should render as a distinct, structured UI affordance in the parent conversation.

At minimum:

  • Claude and Codex sub-agent events are parsed into a typed representation.
  • Parent-agent output and sub-agent output have clear visual ownership.
  • Sub-agent lifecycle is visible: started, running, waiting, completed, failed/cancelled where the provider exposes it.
  • Sub-agent messages/tool activity are grouped under the correct sub-agent rather than becoming normal parent feed rows.
  • Multiple concurrent sub-agents can be represented without cross-rendering or row/key collisions.
  • Sub-agent output can be expanded/collapsed if verbose.
  • Final sub-agent results are easy to distinguish from live/provisional progress.
  • Rendering survives transcript catch-up, resume, and semantic-history fallback without duplicates.

Why

Sub-agent orchestration is only useful if the user can understand who is doing what. If child-agent work is rendered as raw JSON, ordinary assistant paragraphs, or interleaved parent-feed items, the user loses the execution structure that makes delegation trustworthy.

This is also a feed ownership problem. Sub-agent rows need the same kind of explicit ownership and handoff rules as normal chat rows:

  • live semantic/proxy owner while the child agent is active
  • committed transcript owner when durable history catches up
  • stable provisional rows while waiting for commit
  • no duplicate rows when semantic and JSONL both describe the same child activity
  • no accidental suppression of a still-live child block because another item in the parent turn committed

Provider Scope

Support both providers:

  • Claude: whatever shape Claude emits for sub-agent/task/delegation activity, including tool-use style events if that is how it appears.
  • Codex: Responses/proxy events and rollout JSONL shapes for delegated/sub-agent activity.

The implementation should prefer a shared renderer model with provider-specific parsers/adapters at the boundary, rather than two unrelated UI systems.

Related Rendering Constraints

This should be designed with the existing feed/rendering issues in mind:

  • #172 feed render ownership across committed transcript, semantic live/history, ghosts, and optimistic input
  • #171 rendering trace debug for transcript and semantic channel ownership
  • #173 Codex transcript/pane ownership and cross-rendering correctness
  • #174 prompt suggestions leaking into feed because no typed owner exists
  • #98 interactive question tool calls rendering as raw JSON because no dedicated UI exists

Sub-agent rendering should not become another untyped item stream that Feed has to guess about later.

Suggested Shape

  1. Define typed sub-agent events/state

    • A provider-neutral representation for sub-agent identity, parent turn/session, status, messages, tool calls, result, and timestamps.
    • Provider-specific adapters map Claude/Codex raw events into that representation.
  2. Add feed ownership rules

    • Sub-agent rows/groups should have stable logical ids.
    • Committed transcript rows should supersede matching live semantic sub-agent rows without duplicate rendering.
    • Concurrent sub-agents must not share React keys or overwrite each other's live content.
  3. Create dedicated UI rows/components

    • A compact sub-agent group row for the parent feed.
    • Expand/collapse details for verbose child output.
    • Clear status/result affordances.
    • Provider-neutral visual language, with provider labels/icons only where useful.
  4. Make debug traces explain it

    • Rendering trace/debug bundle output should label sub-agent owners and decisions.
    • It should be possible to answer: which parent turn spawned this sub-agent, which provider event created it, which row rendered it, and whether committed transcript superseded it.

Acceptance Criteria

  • Claude sub-agent activity renders as structured sub-agent UI, not raw JSON or ordinary parent assistant text.
  • Codex sub-agent activity renders as structured sub-agent UI, not raw JSON or ordinary parent assistant text.
  • Multiple simultaneous sub-agents render independently and remain attached to the correct parent turn/session.
  • Resume/history loading does not duplicate sub-agent rows when committed transcript catches up to live semantic state.
  • Sub-agent lifecycle states are visible and understandable.
  • Verbose sub-agent output can be inspected without overwhelming the parent feed.
  • React keys / logical ids are stable across live updates and transcript catch-up.
  • Debug/render trace output identifies sub-agent render ownership decisions.
  • Tests or focused harness cases cover at least one Claude-shaped and one Codex-shaped sub-agent event flow.

Activity

  1. Juliusolsson05 commented on Jun 22, 2026

    @Juliusolsson05
    OwnerAuthor

    Adding saved-bundle diagnosis. I split two concrete subagent-state failures into new issues because they are narrower than the general renderer issue:

    Key evidence:

    • 2026-06-18T11-12-28-535-21c515e9: note says "Not handling codex subagents at all"; state-snapshot.json has subAgents: {} while the screen/proxy show Codex child agent activity.
    • 2026-06-21T20-14-23-131-62432945: semantic text says all subagents are done, but state has 73 subagents with 57 still running.
    • 2026-06-22T09-05-45-698-7733b0fc: state has 79 subagents with 77 still running.

    Likely root: Codex subagent state is too dependent on rollout/transcript correlation and too narrow in how it marks terminal state.

  2. Juliusolsson05 commented on Jul 7, 2026

    @Juliusolsson05
    OwnerAuthor

    Shipped for both providers.

    Typed subagent tracking (src/main/subagents/SubAgentWatcher.ts for Claude, codexSubagentState.ts for Codex) rendered via dedicated fleet rows (SubagentGroupHeader / SubagentMiniFeed / TaskSubagentRow), with sidechain/subagent turns filtered out of the parent feed (#479/#480) and Claude+Codex test coverage. PRs #277, #292, #459–#461. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions