Skip to content

chat: keep subagent progress visible and show models early - #335899

Merged
Justin Chen (justschen) merged 5 commits into
mainfrom
justschen/335638
Sep 14, 2026
Merged

Justin Chen (justschen) merged 5 commits into
mainfrom
justschen/335638

Conversation

@justschen

Copy link
Copy Markdown
Collaborator

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]

## 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]>
Copilot AI balanced review requested due to automatic review settings September 11, 2026 21:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Medium severity

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.

@github-actions

github-actions Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: e6a2323c Current: 84129071

3 insignificant change(s) omitted (≤20 px, Δ≤2). See CI logs for details.

Added (58)

chat/agent-lifecycle/chatAgentLifecycle/SynchronousRunning/Dark

current

chat/agent-lifecycle/chatAgentLifecycle/SynchronousRunning/Light

current

chat/agent-lifecycle/chatAgentLifecycle/BackgroundQueued/Dark

current

chat/agent-lifecycle/chatAgentLifecycle/BackgroundQueued/Light

current

chat/agent-lifecycle/chatAgentLifecycle/BackgroundRunning/Dark

current

chat/agent-lifecycle/chatAgentLifecycle/BackgroundRunning/Light

current

chat/agent-lifecycle/chatAgentLifecycle/SynchronousAgentChat/Dark

current

chat/agent-lifecycle/chatAgentLifecycle/SynchronousAgentChat/Light

current

chat/agent-lifecycle/chatAgentLifecycle/BackgroundAgentChat/Dark

current

chat/agent-lifecycle/chatAgentLifecycle/BackgroundAgentChat/Light

current

chat/agent-lifecycle/chatAgentLifecycle/NestedBackgroundChat/Dark

current

chat/agent-lifecycle/chatAgentLifecycle/NestedBackgroundChat/Light

current

chat/agent-lifecycle/chatAgentLifecycle/ParentCompleteChildRunning/Dark

current

chat/agent-lifecycle/chatAgentLifecycle/ParentCompleteChildRunning/Light

current

chat/agent-lifecycle/chatAgentLifecycle/ParentCompleteChildRunning/DarkHighContrast

current

chat/agent-lifecycle/chatAgentLifecycle/ParentCompleteChildRunning/LightHighContrast

current

chat/agent-lifecycle/chatAgentLifecycle/ChildStartsAfterParentComplete/Dark

current

chat/agent-lifecycle/chatAgentLifecycle/ChildStartsAfterParentComplete/Light

current

chat/agent-lifecycle/chatAgentLifecycle/LateSubagentClassification/Dark

current

chat/agent-lifecycle/chatAgentLifecycle/LateSubagentClassification/Light

current

chat/agent-lifecycle/chatAgentLifecycle/ChildCompletesAfterParent/Dark

current

chat/agent-lifecycle/chatAgentLifecycle/ChildCompletesAfterParent/Light

current

chat/agent-lifecycle/chatAgentLifecycle/RetainedFollowUpFullConversation/Dark

current

chat/agent-lifecycle/chatAgentLifecycle/RetainedFollowUpFullConversation/Light

current

chat/agent-lifecycle/chatAgentLifecycle/RetainedFollowUpLatestTurn/Dark

current

chat/agent-lifecycle/chatAgentLifecycle/RetainedFollowUpLatestTurn/Light

current

chat/agent-lifecycle/chatAgentLifecycle/RetainedFollowUpLatestTurn/DarkHighContrast

current

chat/agent-lifecycle/chatAgentLifecycle/RetainedFollowUpLatestTurn/LightHighContrast

current

chat/agent-lifecycle/chatAgentLifecycle/ResumedIdleBackgroundAgent/Dark

current

chat/agent-lifecycle/chatAgentLifecycle/ResumedIdleBackgroundAgent/Light

current

chat/agent-lifecycle/chatAgentLifecycle/BackgroundCompletionNotification/Dark

current

chat/agent-lifecycle/chatAgentLifecycle/BackgroundCompletionNotification/Light

current

chat/agent-lifecycle/chatAgentLifecycle/CompletionWakesIdleParent/Dark

current

chat/agent-lifecycle/chatAgentLifecycle/CompletionWakesIdleParent/Light

current

chat/agent-lifecycle/chatAgentLifecycle/BackgroundFailureNotification/Dark

current

chat/agent-lifecycle/chatAgentLifecycle/BackgroundFailureNotification/Light

current

chat/agent-lifecycle/chatAgentLifecycle/NestedBackgroundRunning/Dark

current

chat/agent-lifecycle/chatAgentLifecycle/NestedBackgroundRunning/Light

current

chat/agent-lifecycle/chatAgentLifecycle/ParallelBackgroundAgents/Dark

current

chat/agent-lifecycle/chatAgentLifecycle/ParallelBackgroundAgents/Light

current

chat/agent-lifecycle/chatAgentLifecycle/UnknownModel/Dark

current

chat/agent-lifecycle/chatAgentLifecycle/UnknownModel/Light

current

chat/agent-lifecycle/chatAgentLifecycle/LateModelDiscovery/Dark

current

chat/agent-lifecycle/chatAgentLifecycle/LateModelDiscovery/Light

current

chat/agent-lifecycle/chatAgentLifecycle/MatchingParentModel/Dark

current

chat/agent-lifecycle/chatAgentLifecycle/MatchingParentModel/Light

current

chat/agent-lifecycle/chatAgentLifecycle/AutoParentConcreteChild/Dark

current

chat/agent-lifecycle/chatAgentLifecycle/AutoParentConcreteChild/Light

current

chat/agent-lifecycle/chatAgentLifecycle/MatchingByokModel/Dark

current

chat/agent-lifecycle/chatAgentLifecycle/MatchingByokModel/Light

current

chat/agent-lifecycle/chatAgentLifecycle/CreatedPeerChat/Dark

current

chat/agent-lifecycle/chatAgentLifecycle/CreatedPeerChat/Light

current

chat/agent-lifecycle/chatAgentLifecycle/CreatedIndependentSession/Dark

current

chat/agent-lifecycle/chatAgentLifecycle/CreatedIndependentSession/Light

current

chat/agent-lifecycle/chatAgentLifecycle/NarrowBackgroundRunning/Dark

current

chat/agent-lifecycle/chatAgentLifecycle/NarrowBackgroundRunning/Light

current

chat/agent-lifecycle/chatAgentLifecycle/InteractiveLifecycle/Dark

current

chat/agent-lifecycle/chatAgentLifecycle/InteractiveLifecycle/Light

current

- 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]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

It is a draft with cross-layer lifecycle, state-replay, telemetry, and focus-management changes requiring final human validation.

Review tier: Balanced
Findings: None

Resolved findings (2)

@justschen
Justin Chen (justschen) marked this pull request as ready for review 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]>
@justschen
Justin Chen (justschen) merged commit 2886f6d into main Sep 14, 2026
33 checks passed
@justschen
Justin Chen (justschen) deleted the justschen/335638 branch September 14, 2026 05:55
@vs-code-engineering vs-code-engineering Bot added this to the 1.139.0 milestone Sep 14, 2026
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Oct 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show model info while subagent is still running

3 participants