Repository navigation
chat: keep subagent progress visible and show models early - #335899
Merged
Merged
Conversation
## Summary - Keep late-discovered background agents from remaining generic tools or disappearing into completed-step disclosures, including when a nested worker is still active after its parent finishes. - Preserve sibling tool content, keyboard focus, and observer cleanup when a completed tool is promoted to the shared subagent pill. - Show the child's known model at startup rather than waiting for usage or completion. Carry canonical model identity through live progress and restored history so matching models, including BYOK display-name variants, do not produce redundant labels. Preserve Auto routing on configuration-only updates. - Make synchronous/background progress and navigation parity inspectable with 27 interactive lifecycle fixtures (58 themed variants), using real chat models, pills, child transcripts, and session/chat result links. ## Intended behavior and scope The clickable pill remains in the response to the request that spawned the child and updates there through startup, follow-ups, and completion. A child first discovered after parent completion is appended to that original response; an existing launch that is reclassified is promoted in place. No pinned activity area or duplicate launch pill is added to later turns. Peer chats and independent sessions retain their structured link presentation. The separate Autopilot case where task_complete succeeds but the SDK idle/parent turn-complete handoff is missing is not addressed here. ## Validation - 289 focused cross-layer subagent/background regression tests passed before commit. - ESLint passed for all 23 changed TypeScript files. - All 58 themed component captures passed their assertions and disposal checks. - Browser interaction checks verified pointer/keyboard opening and changing progress in parent and child views, including completed-parent, nested, and retained-worker cases. - The broader client type check has three previously reproduced SDK baseline errors involving clientInfo and autoTier; no new fixture diagnostics. - Additional local testing is in progress; this PR is intentionally a draft. ## Manual testing Start the Component Explorer Server and filter for agent-lifecycle. Compare SynchronousRunning and BackgroundRunning: use Advance Child Progress, click the bordered pill to inspect its live child transcript, advance again, and return with Back to Parent. Also inspect ParentCompleteChildRunning, ChildStartsAfterParentComplete, LateSubagentClassification, RetainedFollowUpLatestTurn, NestedBackgroundChat, and the model-label variants. Fixes #335638 (Commit message generated by Copilot) Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Disclosure removal can lose keyboard focus, and identity-only model updates can leave the pill using stale comparison data.
Get a fresh assessment by requesting another Copilot review.
Review tier: Balanced
Findings: 2
Open findings (2)
What changed in this PR
Improves subagent lifecycle rendering and surfaces model identity earlier across live and restored Agent Host sessions.
Changes:
- Keeps active and late-discovered subagent pills visible and preserves focus/content during promotion.
- Propagates canonical model IDs through execution, protocol state, history, and UI.
- Adds extensive lifecycle fixtures and regression tests.
| File | Description |
|---|---|
chatWidget.fixture.ts |
Exposes fixture services and view model. |
chatAgentLifecycle.fixture.ts |
Adds interactive lifecycle scenarios. |
runSubagentTool.test.ts |
Verifies model ID propagation. |
chatModel.test.ts |
Tests promotion notifications and cleanup. |
chatListRenderer.test.ts |
Tests disclosure, promotion, and focus behavior. |
chatThinkingContentPart.test.ts |
Tests late subagent replacement. |
chatSubagentContentPart.test.ts |
Tests model labels, progress, and navigation. |
stateToProgressAdapter.test.ts |
Tests model identity persistence. |
agentHostChatContribution.test.ts |
Tests early and restored model reporting. |
runSubagentTool.ts |
Records selected subagent model IDs. |
chatModel.ts |
Observes completed-tool reclassification. |
chatService.ts |
Adds canonical subagent model identity. |
chatListRenderer.ts |
Keeps active subagents outside disclosures. |
chatThinkingContentPart.ts |
Replaces completed thinking groups after promotion. |
chatSubagentOpenChat.ts |
Compares canonical model identities. |
chatSubagentContentPart.ts |
Passes model identity and supports focus handoff. |
stateToProgressAdapter.ts |
Preserves model IDs during updates and serialization. |
agentHostSessionHandler.ts |
Resolves live and restored child models. |
mapSessionEvents.test.ts |
Tests restored model and Auto routing behavior. |
copilotAgentSession.test.ts |
Tests early model protocol updates. |
mapSessionEvents.ts |
Reconstructs subagent models from SDK events. |
copilotSessionWrapper.ts |
Exposes subagent configuration events. |
copilotAgentSession.ts |
Publishes model updates before usage. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
Screenshot ChangesBase: 3 insignificant change(s) omitted (≤20 px, Δ≤2). See CI logs for details. Added (58) |
- Provide the model-change event required by subagent observation so the client-tool tests no longer throw or leak disposables in full CI runs. - Verify that identity-only model changes update the existing pill for both executing and completed launches with an unchanged display name. - Protect the leading-subagent focus handoff, including the renderer's reserved empty references slot and removal of the completed disclosure. The existing production refresh and focus paths already handle the two review scenarios; these tests make those guarantees explicit. Validation: 238 Electron tests, 237 Chromium tests, and 237 WebKit tests passed, with one existing skipped test per runner. Formatting and lint passed for all three changed files. Co-authored-by: Copilot <[email protected]>
Justin Chen (justschen)
marked this pull request as ready for review
September 13, 2026 23:54
Justin Chen (justschen)
enabled auto-merge (squash)
September 13, 2026 23:54
Keep promoted launch tools from rebuilding unchanged thinking siblings, scope grouping to the rendered prefix, and retain focused controls while completed-response disclosures move content. Co-authored-by: Copilot <[email protected]>
Keep working progress references typed and rebuild promoted thinking groups without dropping unchanged tool controls or their disposable ownership. Preserve expansion, content order, and focus across group splits, disclosure moves, and final single-tool unwrapping. Validate the client type check and the renderer, thinking, and subagent suites in Electron, Chromium, and WebKit. Co-authored-by: Copilot <[email protected]>
Dmitriy Vasyura (dmitrivMS)
approved these changes
Sep 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Intended behavior and scope
The clickable pill remains in the response to the request that spawned the child and updates there through startup, follow-ups, and completion. A child first discovered after parent completion is appended to that original response; an existing launch that is reclassified is promoted in place. No pinned activity area or duplicate launch pill is added to later turns. Peer chats and independent sessions retain their structured link presentation.
The separate Autopilot case where task_complete succeeds but the SDK idle/parent turn-complete handoff is missing is not addressed here.
Validation
Manual testing
Start the Component Explorer Server and filter for agent-lifecycle. Compare SynchronousRunning and BackgroundRunning: use Advance Child Progress, click the bordered pill to inspect its live child transcript, advance again, and return with Back to Parent. Also inspect ParentCompleteChildRunning, ChildStartsAfterParentComplete, LateSubagentClassification, RetainedFollowUpLatestTurn, NestedBackgroundChat, and the model-label variants.
Fixes #335638
(Commit message generated by Copilot)
Co-authored-by: Copilot [email protected]