Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(web): surface orchestration agents in the timeline #4664

Closedshivamhwp(GitHub profile, opens in a new tab)wants to merge 250+ commits intot3code/codex-turn-mapping fromsubagent-obs/05-thread-visibilityopened View on GitHub

Orchestrator V2 already projects native subagents, and the existing Agents panel already owns their live detail. The remaining problem is presentation: chat repeats one lifecycle row per agent, duplicating the roster and stretching the turn.

This PR keeps the existing orchestration semantics and:

  • collapses only local subagents from the same run into one compact timeline action;
  • derives the visible count and aggregate state from existing projected item statuses;
  • keeps partial failures visible and destructive while sibling agents are still working;
  • opens the existing Agents panel for names, status, duration, output, and hierarchy;
  • preserves inherited fork projections as lifecycle rows so they keep their source-thread context;
  • keeps superseded and replacement attempts in separate summary rosters;
  • isolates changing agent summaries from unrelated virtualized timeline rows.

There are no server, contract, persistence, provider-adapter, recovery, client-runtime, or mobile behavior changes.

Screenshots

Before · individual agent rowsAfter · summaries and Agents panel
Isolated UI fixture using the existing individual-row fallbackPR 4664 at 8513f93ad: grouped summaries and the existing Agents panel
Narrow timelineNarrow Agents panel
Grouped agent statuses at a 390-pixel browser widthExisting Agents panel at a 390-pixel browser width

Verification

  • 169 focused timeline tests pass across two files.
  • Web typecheck passes.
  • The changed timeline files pass formatting, lint, and whitespace checks.
  • Render coverage confirms local agents collapse to one summary row while inherited rows and separate attempts remain independent.
  • The summary exposes working, idle, failed, stopped, and completed states and opens the existing Agents panel.

Built and tested with GPT-5.6-Sol in the Codex harness through T3 Code.


Note

Low Risk UI-only timeline presentation and row derivation; no auth, API, or persistence changes, with a safe fallback when the Agents opener is omitted.

Overview Local subagent events in the chat timeline are collapsed into one summary row per run (or per attempt / orphan item) instead of repeating a lifecycle card for every agent, while inherited fork projections still render as normal event rows.

deriveMessagesTimelineRows gains optional summarizeSubagents and builds agent-spawn rows with aggregate working, idle, failed, and stopped counts; non-representative entries in a group are dropped from the list. Summarization turns on only when MessagesTimeline receives onOpenAgents—ChatView wires that to the existing Agents panel opener.

The new AgentSpawnCtaRow is a single clickable control (“Kicked off N agents…”, failure styling when needed, Open Agents / View) so roster detail stays in the Agents panel. Without onOpenAgents, behavior stays the old per-event rows. Stable row comparison and tests cover grouping, idle vs completed, superseded attempts, and cache refresh when agent status changes.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a61796ea36263c07d2fdcc17d0aa42d638ea3499. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Add grouped agent-spawn summary rows to MessagesTimeline timeline

  • ChatView passes its existing Agents-surface opener to MessagesTimeline via a new optional callback prop, enabling subagent summarization only when the callback is present
  • deriveAgentSpawnSummaries in MessagesTimeline.logic.ts aggregates local subagent events into per-run, per-attempt, or per-item groups, suppressing later entries in each group and exposing working, idle, failed, and stopped counts
  • The new AgentSpawnCtaRow component renders each summary as a clickable control showing total and status counts; active groups offer "Open Agents" and settled groups offer "View", with destructive styling for failures
  • Inherited entries, non-subagent events, and entries without a summary remain ordinary event rows
  • Behavioral Change: MessagesTimeline now displays grouped summary rows instead of individual local subagent events when the Agents opener is provided; without it, rendering is unchanged. The new agent-spawn variant in MessagesTimelineRow must be handled by any consumer of that union
Macroscope summarized 62d1993.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      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: Team

      Run ID: 606ccf48-8344-45dd-ab00-72d4e58d33f9

      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
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests
      • Commit unit tests in branch `subagent-obs/05-thread-visibility`

      Warning

      Your free Security trial is over. An organization admin can upgrade to Advanced for continuous pull request security review or dismiss this notice.


      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium

      https://github.com/pingdotgg/t3code/blob/39912b07140d6d057bbfb575c8576097e855cd5a/apps/web/src/components/chat/ThreadRelationshipsControl.tsx#L127

      When a user-facing thread's only relationships are subagent edges, the .filter((relationship) => relationship.edge.kind !== "subagent") call empties relationshipRows, causing the early return null at line 127 to hide the entire panel — including the "Disconnect agent session" menu. So even when canDetach is true, the user cannot stop the provider session from this panel. The canDetach check and its menu are computed before the early return but are never rendered because the return short-circuits first. Consider gating the early return on the absence of both relationship rows and a detachable session, or rendering the session controls independently of the relationship list.

      ✅ Resolved in 1d37a6f377f63475cef42d66c9fb8108ea9190d5

    4. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — This changes the production timeline by replacing individual local subagent lifecycle rows with aggregate, clickable summaries and wiring them to the Agents panel. Because it introduces new user-facing behavior and changes an existing rendering path, the scope merits human review.

      No code changes detected at 62d1993. Prior analysis still applies.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. shivamhwp(GitHub profile, opens in a new tab) changed the title

    6. shivamhwp(GitHub profile, opens in a new tab) changed the title

    7. Reviewed the Effect service surfaces touched by this PR (ProviderTurnControlService.stopTask, EffectWorker effect case, Orchestrator.dispatchSubagentStop, ProviderTurnStartService rehydration, ThreadManagementService.listAllThreadRefs, and the new SubagentObservability helpers). Dependency acquisition, error modeling (ProviderTaskStopError with structural fields plus preserved cause, exported Schema.is predicate, pass-through of the already-structured error), and Effect.catchTags usage all follow the conventions. One import-convention issue in the new test file.

      Posted via Macroscope — Effect Service Conventions
    8. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟠 High

      https://github.com/pingdotgg/t3code/blob/66a10765acc853a619ff79b0b20e32c1013777ff/apps/server/src/orchestration-v2/ThreadManagementService.ts#L480

      listAllThreadRefs only maps snapshot.threads, silently omitting snapshot.archivedThreads. The returned OrchestrationV2ListAllThreadRefsResult is missing all archived threads, so any caller that treats it as the complete set of thread references will misclassify worktrees owned solely by archived threads as orphaned and remove them. This happens because the implementation chains .map onto snapshot.threads alone rather than combining both the live and archived shell arrays. Include snapshot.archivedThreads in the returned references.

      🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
      In file @apps/server/src/orchestration-v2/ThreadManagementService.ts around line 480:
      
      `listAllThreadRefs` only maps `snapshot.threads`, silently omitting `snapshot.archivedThreads`. The returned `OrchestrationV2ListAllThreadRefsResult` is missing all archived threads, so any caller that treats it as the complete set of thread references will misclassify worktrees owned solely by archived threads as orphaned and remove them. This happens because the implementation chains `.map` onto `snapshot.threads` alone rather than combining both the live and archived shell arrays. Include `snapshot.archivedThreads` in the returned references.
    9. Fixed in da4dc4521 — the RPC now maps both snapshot.threads and snapshot.archivedThreads, with the service test covering an archived-only worktree.

    10. One convention issue found: redundant/duplicated service-module imports introduced in ProviderTurnStartService.test.ts. Everything else in the changed Effect service surface (new ProviderTaskStopError + Schema.is predicate export, stopTask on ProviderTurnControlServiceV2, environment-based dependency acquisition in ProviderTurnStartService, Effect.catchTags usage, effect/* subpath namespace imports) follows the conventions.

      Posted via Macroscope — Effect Service Conventions
    11. github-actions[bot](GitHub profile, opens in a new tab)commented

      Thread transfer impact

      ⚠️ The latest CI run did not produce a thread transfer result for 62d1993.

      This comment will update automatically after the next completed run.

    12. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium Adapters/ClaudeAdapterV2.ts:4305

      A late task_progress snapshot creates pending/running workflow_agent rows after the coordinator has terminalized, and those rows remain live indefinitely. workflowParent still resolves the settled coordinator entry, so this loop projects its workers without checking the parent status; skip projection when the coordinator is no longer active.

                  if (
                    workflowParent !== undefined &&
                    (workflowParent.task.status === "pending" ||
                      workflowParent.task.status === "running" ||
                      workflowParent.task.status === "waiting")
                  ) {
      🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
      In file @apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts around line 4305:
      
      A late `task_progress` snapshot creates `pending`/`running` `workflow_agent` rows after the coordinator has terminalized, and those rows remain live indefinitely. `workflowParent` still resolves the settled coordinator entry, so this loop projects its workers without checking the parent status; skip projection when the coordinator is no longer active.
    13. shivamhwp(GitHub profile, opens in a new tab) changed the title

    14. Fixed in e4a4c6012. Workflow worker snapshots are now projected only while the coordinator is active, with a regression covering late progress after coordinator settlement.

    15. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟠 High

      https://github.com/pingdotgg/t3code/blob/e4a4c6012180167f7af264f385af0a7db05c96c3/apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts#L5149

      hasPendingBackgroundWork ignores workflow workers whose status is pending or waiting, so the session can be idle-released while a live worker is still blocked or queued. The Claude query then closes before later progress or completion events arrive, stranding the worker lifecycle; count pending, running, and waiting as pending work.

      ✅ Resolved in d45c3e7f9a8f3477edaa6e69ea89f3e13f4a2682

    16. Fixed in d45c3e7f9. Session idling now treats pending, running, and waiting subagents as live work, with a total status-mapping regression.

    17. One finding: the new subagent CTA row is an interactive <button> that drops the focus-visible ring and pointer cursor every other clickable timeline row in this file provides.

      Posted via Macroscope — UI Consistency

Sign in to join this conversation.