fix(web): finished remote subagents move into Previous agents #26576
main fromrefs/pull/26576/head·opened View on GitHubProblem#
In a thread's Lineage panel, subagents that ran in a linked environment never leave the list. Local subagents move into the collapsed "Previous agents" group once they finish. Remote ones are drawn in a separate list after the groups with no status filter, so every finished remote child stays in view for good. A parent that has delegated a few tasks to another machine ends up with a growing stack of "on box · Done" rows next to the collapsed group.
To reproduce: delegate a task to a linked environment and let it finish. The parent's Lineage panel shows its "Done" row next to "Previous agents" indefinitely.
Change#
The grouping rule now lives in groupWebThreadLineageRows in packages/client-runtime/src/state/threadRelationships.ts, next to orderWebThreadLineageRows. It puts local rows and remote subagents into the same related / active / previous buckets and uses one terminal-status set for both. In ThreadRelationshipsControl.tsx, ThreadLineageGroup takes either kind of row. It renders RemoteSubagentRow for remote ones, and its collapsed count and "N failed" badge include them. The separate remote list is removed.
Running, pending and waiting remote subagents still appear, now in the active group with local ones. The "N running" heading count is unchanged: remote tasks were already counted through childThreadId === null, and the count of active thread rows skips remote rows, so nothing is counted twice. Mobile has no "Previous agents" grouping and already lists remote and local subagents the same way, so it needs no change.
Scope and approval#
This is a small fix for an obvious bug: finished remote subagents stay visible even though finished local ones are collapsed. It applies the existing local grouping rule to remote subagents and adds no workflow, setting or contract.
Verification#
vp test run packages/client-runtime/src/state/threadRelationships.test.tspasses 12 tests. The new case, "moves finished subagents into previous, including ones in a linked environment", fails when the helper only groups thread rows (main's behavior): the remote running and remote done subagents are missing fromactiveandprevious.vp run check:changedpasses format, lint, knip, typecheck (7 packages) and the test beside the change.- Screenshots: a temporary, uncommitted browser test rendered
ThreadRelationshipsPanelwith the app stylesheet and mocked state hooks. The fixture has one finished local subagent ("Review the diff") and one finished subagent in a linked environment named "box" ("Run the migration check"). Main's code and this branch were rendered with the same fixture, width and theme.
Before, with "Previous agents" collapsed: the finished remote child stays visible, and the group counts only the local one.
After, with "Previous agents" collapsed: both finished children are in the group.
After, with "Previous agents" expanded: the remote child is listed with its environment and status.
Not checked: a live linked environment end to end, and the desktop shell. Web and desktop share this rendering logic; mobile is unchanged.
Claude Opus 5.5 via Claude Code in T3 Code
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
No actionable comments were generated in the recent review.
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: main
- File: .coderabbit.config.ts
- Commit: d07c0a7
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
5eae48b1-61dc-4691-9741-e69402bf95e4
Commits-
Reviewing files that changed from the base of the PR and between d07c0a7c7b91b0b40146546cbc7ab2bb91ff228d and c0bebd2696d8f82ae74c7ecbbf45e281c288d1fb.
Files selected for processing: 3-
apps/web/src/components/chat/ThreadRelationshipsControl.tsxpackages/client-runtime/src/state/threadRelationships.test.tspackages/client-runtime/src/state/threadRelationships.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
-
Walkthrough
-
The client runtime now groups remote subagents with thread-lineage rows. The chat panel uses the shared groups for row counts and rendering, instead of displaying remote subagents in a separate list.
Changes: Thread-lineage grouping
Priority:Layer / File(s) Summary Define and test lineage grouping
packages/client-runtime/src/state/threadRelationships.ts,packages/client-runtime/src/state/threadRelationships.test.tsAdds row types and a status accessor for local and remote rows. The grouping function puts qualifying relationships in related, non-settled subagents inactive, and rows with listed settled statuses inprevious. The test covers fork rows and running and completed local and remote subagents.Render grouped rows in the chat panel
apps/web/src/components/chat/ThreadRelationshipsControl.tsxPasses remote subagents into the grouping function. Uses the resulting groups for row counts and rendering, and removes the separate remote-subagent list. LowEstimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Sequence Diagram(s)#
sequenceDiagram participant ThreadRelationshipsControl participant groupWebThreadLineageRows participant ThreadLineageGroup participant RemoteSubagentRow ThreadRelationshipsControl->>groupWebThreadLineageRows: Provide relationship rows and remote subagents groupWebThreadLineageRows-->>ThreadRelationshipsControl: Return related, active, and previous groups ThreadRelationshipsControl->>ThreadLineageGroup: Render grouped lineage rows ThreadRelationshipsControl->>RemoteSubagentRow: Render remote-subagent rowsPossibly related issues
Suggested reviewers:
juliusmarminge,t3dotgg
Merge Risk:
Minimal · up toc0beb-
No merge-blocking issue was established in the remote-agent grouping change.
Pre-merge checks:
4-
Check name Status Explanation Title check The title clearly and concisely describes the main change: moving finished remote subagents into the existing Previous agents group. Description check The description includes all required sections. It explains the problem and reproduction steps, the implementation, scope justification, focused verification results, screenshots, limitations, and age… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Full details: Description check
-
Explanation
The description includes all required sections. It explains the problem and reproduction steps, the implementation, scope justification, focused verification results, screenshots, limitations, and agent attribution.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
juliusmarminge added labelsbugfix
juliusmarminge added labelspr:gate-failed
juliusmarminge removed labelspr:gate-failed
juliusmarminge closed this
Sign in to join this conversation.
Approvability#
Verdict: Needs Human Approval
Macroscope's review found this PR requires human approval — Finished remote agents now appear in the initially collapsed Previous agents section instead of remaining directly visible. Human confirmation is required for this default visibility change, including how failed remote agents are surfaced.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).