Skip to content

fix(web): Lineage keeps the latest batch of finished agents in view - #34872

Open
juliusmarminge wants to merge 2 commits into
mainfrom
factory/issue-26411
Open

juliusmarminge wants to merge 2 commits into
mainfrom
factory/issue-26411

Conversation

@juliusmarminge

Copy link
Copy Markdown
Member

ThreadRelationshipsPanel grouped every finished subagent edge (and every finished remote-environment subagent) into the collapsed 'Previous agents' group whatever run launched it, so the batch a thread just ran folded away as soon as it settled. The panel now computes the latest batch: the run with the highest ordinal among non-rolled-back runs that launched any subagent. A finished agent goes to 'Previous agents' only when its runId is not that run. A later turn that launches no agents leaves the last batch in the main list; the next turn that launches agents folds the old batch away. Rolled-back runs are skipped, as in the mobile rule from #25759. Both the local-edge grouping and the remote-agent grouping use the same predicate. No new regex or parser.

Fixes #26411

Reproduction on main

Commit 6ba3de7 (origin/main). Ran the web client with T3CODE_DEV_SEED=0 vp run dev (fresh database) and added a one-file git project with t3 project add. Enabled the OpenCode provider and started a thread with t3 thread start --provider opencode --model opencode/big-pickle. The prompt made the agent call its task tool twice. The timeline showed '2 subagents, 2 done'. Opened the thread in the browser and toggled the thread details panel: Lineage showed only a collapsed 'Previous agents 2' row, with neither agent in the main list. Then sent a follow-up with t3 thread send ('Reply with just the word ok. Do not use any tools.'), which launched no agents. The panel still showed only the collapsed 'Previous agents 2'. Expanding it revealed the two agents from the previous turn ('List directory files', 'Read README contents'). Also added a browser test to ThreadRelationshipsControl.browser.test.tsx with three completed runs, an older finished agent in run 1 and a latest finished agent in run 2. It fails on main because the latest agent is not in the document until 'Previous agents' is expanded. With the group expanded the row renders, so the fixture is valid.

Evidence

Being captured: before and after in the real app. This section is filled in before the pull request can merge.

Tests

vp test run src/components/chat/ThreadRelationshipsControl.browser.test.tsx: without the fix 1 failed / 10 passed (the repro test 'keeps the latest batch of finished agents in view after a later turn launches none'); with the fix 11 passed. vp run check:changed: format, lint, knip, typecheck (2 packages), tests (1 file), react compiler all pass.

Not in this change

  • Mobile's Agents pill (packages/client-runtime threadSubagents.ts latestTurn) hides finished agents once any later turn starts, even one that launched none; the issue asks web to keep them until a later turn launches agents, so the two clients still use slightly different rules. I left mobile and the shared helper unchanged.

AI-assisted; verified with the tests and tools listed above.

juliusmarminge and others added 2 commits November 12, 2026 07:16
Failing repro for #26411: finished subagents from the thread's latest agent
batch fold into the collapsed Previous agents group.

AI-assisted; verified with the tests and tools listed above.
The thread details panel folded every finished subagent into the collapsed
Previous agents group, so the batch a thread just ran looked gone. Only agents
from runs older than the latest run that launched agents fold away now.

AI-assisted; verified with the tests and tools listed above.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 12, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs Human Approval

Macroscope's review found this PR requires human approval — The latest finished agent batch now stays visible by default instead of collapsing into Previous agents. Human review is needed to confirm this change to the default Lineage presentation.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Lineage panel now groups finished local and remote subagents by run batch. Finished agents from the latest identifiable batch remain in the main list. A browser test checks that the latest batch is visible by default.

Changes: Lineage agent visibility

Layer / File(s) Summary
Classify finished agents by run batch
apps/web/src/components/chat/ThreadRelationshipsControl.tsx, apps/web/src/components/chat/ThreadRelationshipsControl.browser.test.tsx
The panel identifies the latest non-rolled-back run referenced by a projected subagent. It groups finished local and remote agents as previous when no latest batch is identified or their run ID differs from that batch. The browser test checks that the latest batch’s agent is shown by default and the older batch’s agent is hidden.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Possibly related PRs

  • pingdotgg/t3code#33498: This PR also changes which finished agents appear in the Lineage panel’s main list and Previous agents group.
  • pingdotgg/t3code#29285: This PR groups remote subagents into active and Previous agents sections, which overlaps with this PR’s remote-agent grouping change.

Suggested labels: bugfix

Suggested reviewers: t3dotgg, yash-singh1

Merge Risk: Minimal · up to dd754

Finished agents from the latest run that launched subagents now stay visible in the thread details panel, and older batches are grouped under Previous agents. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the Lineage panel in the web thread details view now keeps the latest batch of finished agents visible. It follows the conventional commit form and matches the linked …
Description check Passed The description covers the problem (finished subagents folded into 'Previous agents' after a run settles), the change (latest batch computed from the highest-ordinal non-rolled-back run that launched …
Linked Issues check Passed [#26411] requires that subagents from the latest turn that launched agents stay in the main list of the web thread details panel until a later turn launches new agents. The diff to apps/web/src/compon…
Out of Scope Changes check Passed The changes touch only apps/web/src/components/chat/ThreadRelationshipsControl.tsx and its browser test. They add a type-only RunId import from @t3tools/contracts. Each change supports the grouping ru…
Full details: Title check

Explanation

The title names the main change: the Lineage panel in the web thread details view now keeps the latest batch of finished agents visible. It follows the conventional commit form and matches the linked issue #26411 and the code changes in ThreadRelationshipsControl.tsx and its browser test.

Full details: Description check

Explanation

The description covers the problem (finished subagents folded into 'Previous agents' after a run settles), the change (latest batch computed from the highest-ordinal non-rolled-back run that launched subagents, shared predicate for local and remote agents), scope (links issue #26411, mentions the mobile rule from #25759), and verification (reproduction on main, a browser regression test failing without the fix and passing with it, and the check:changed results). The template's required sections are all present with substantive content. The Evidence section is a placeholder that says screenshots are still being captured, and the template asks for before/after screenshots for UI changes. That gap is the main item to finish before merge.

Full details: Linked Issues check

Explanation

[#26411] requires that subagents from the latest turn that launched agents stay in the main list of the web thread details panel until a later turn launches new agents. The diff to apps/web/src/components/chat/ThreadRelationshipsControl.tsx adds latestBatchRunId. It is the runId with the highest run ordinal among non-rolled-back runs that launched a projected subagent. isPreviousAgent returns true only when an agent is finished and its runId differs from latestBatchRunId. ThreadRelationshipsPanel uses this predicate for local subagent edges (edge.kind === 'subagent') and for remote subagents (remoteChild). A later turn with no agents leaves latestBatchRunId unchanged, so the last batch stays active. The PR adds a browser regression test, 'keeps the latest batch of finished agents in view after a later turn launches none'. The author reports it fails without the fix and passes with it. I did not run the tests. Unresolved: the 'Evidence' section (real-app before and after capture) is still pending. It is not a coding requirement, so it does not affect this verdict.

Full details: Out of Scope Changes check

Explanation

The changes touch only apps/web/src/components/chat/ThreadRelationshipsControl.tsx and its browser test. They add a type-only RunId import from @t3tools/contracts. Each change supports the grouping rule in #26411. The PR does not change mobile code or the shared client-runtime helper, and it states this. No unrelated changes appear in the reviewed diff.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Usage-based review receipt

Note

This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. View usage-based billing.

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between bfec275 and dd7547f.

Files selected for processing: 2

  • apps/web/src/components/chat/ThreadRelationshipsControl.browser.test.tsx
  • apps/web/src/components/chat/ThreadRelationshipsControl.tsx

Limit details: You’ve used all 10 included reviews currently available.

@juliusmarminge

Copy link
Copy Markdown
Member Author

The automated pipeline stopped on this pull request and will not merge it:

the capture step could not show the problem on the base commit, so there is nothing to prove fixed.

On each commit: (1) Start a fresh parent thread and delegate one remote task titled Older remote; await completion. (2) Open thread details and record the Lineage panel. (3) Send a second turn launching native local tasks Files and Readme plus a remote task New remote; await all three. (4) Send 'Reply with just the word ok. Do not use any tools.' (5) Capture collapsed history, expand Previous agents, capture, then collapse it. Base showed Previous agents 4; expansion revealed all four agents. Head kept Readme, Files, and New remote visible with Previous agents 1 containing Older remote. The no-tool follow-up preserved these states. Older completed remote agents remaining visible outside history did not reproduce on base.

It stays open for a person to finish or close.

This branch has not been deployed

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

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Thread details panel folds the subagents a thread just ran into "Previous agents", so they look gone

1 participant