chat: delegate agent-host sessions#321702
Merged
DonJayamanne merged 8 commits intoJun 17, 2026
Merged
Conversation
- Pass transcript handoff as an attachment so the prompt stays user-authored. - Route agent-host delegation through the correct session-opening path in VS Code and Agents Window. - Preserve attachment round-tripping and existing Agents Window behavior while matching the updated SDK behavior. Fixes #319819 (Commit message generated by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds “Continue in…” delegation support for agent-host-backed sessions (local agent-host-* and remote remote-*) across the main VS Code window and the Agents window, while keeping transcript handoff user-authored by moving prior conversation context into a paste attachment.
Changes:
- Build and hand off a bounded “delegation transcript”, passed as a paste attachment for agent-host targets (and inlined into the prompt for non-agent-host targets).
- Route agent-host delegation via a single generic command in the Agents window, and via
openChatSessionin the main window; update UI state/menus to reflect pending delegation selection. - Add paste-attachment metadata + restoration logic to preserve attachment round-tripping, and extend/adjust tests accordingly.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/test/browser/chatContinueInAction.test.ts | New unit tests for delegation transcript building and transcript-as-paste attachment wrapping. |
| src/vs/workbench/contrib/chat/test/browser/agentSessions/agentSessionViewModel.test.ts | Expands coverage for getAgentCanContinueIn to include agent-host session types. |
| src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts | Tests paste variables → simple attachments and restoration back to paste variables. |
| src/vs/workbench/contrib/chat/common/attachments/chatVariableEntries.ts | Introduces paste attachment metadata constants and helpers to create/restore paste variable entries. |
| src/vs/workbench/contrib/chat/common/actions/chatContextKeys.ts | Adds a context key to track a pending delegation target (pre-submit). |
| src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.ts | Enables delegation from agent-host sources and tweaks visibility rules for sessions window targets. |
| src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.ts | Tracks pending delegation target + context key, and centralizes active session-type resolution for delegation. |
| src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.ts | After initial send, swaps the UI to newSessionResource when the send commits a new session resource. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.ts | Adds a generic agent-host delegation command id + request shape; broadens “can continue in” for agent-host targets. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/stateToProgressAdapter.ts | Restores paste attachments back into paste variable entries; adds tooltip for generic simple attachments. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts | Emits paste variables as simple attachments tagged with displayKind: 'paste' and adds extra trace diagnostics. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostChatContribution.ts | Marks agent-host contributions as delegation-capable in both VS Code and Agents window. |
| src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.ts | Lets delegation resolve targets by either provider mapping or exact session type id; hides model/mode pickers while pending. |
| src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.ts | Implements transcript generation/attachment handoff; routes agent-host delegation via generic command or openChatSession. |
| src/vs/sessions/SESSIONS.md | Documents delegation flow in the Agents window architecture notes. |
| src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHost.contribution.ts | Enables delegation support for remote agent-host session contributions. |
| src/vs/sessions/contrib/providers/agentHost/browser/baseAgentHostSessionsProvider.ts | Adds trace logging for attached context in provider send path. |
| src/vs/sessions/contrib/providers/agentHost/browser/agentHostSessionConfigPicker.ts | Hides agent-mode picker while a delegation target is pending. |
| src/vs/sessions/contrib/providers/agentHost/browser/agentHostAgentPicker.ts | Hides agent picker while a delegation target is pending. |
| src/vs/sessions/contrib/chat/browser/chat.contribution.ts | Wires in the new Agents-window agent-host delegation command handler. |
| src/vs/sessions/contrib/chat/browser/agentHostDelegation.ts | Implements the generic command handler to create a new session beside the source and send the initial request with attachments. |
| src/vs/platform/extensions/common/extensionsApiProposals.ts | Updates the generated API proposals typing to match current generator output. |
| src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts | Adds test coverage for paste/simple attachment mapping to SDK blob attachments. |
| src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts | Adds attachment summarization helpers + logs for protocol/SDK attachments during send. |
| .github/skills/sessions/SKILL.md | Updates sessions guidance on not collapsing distinct provider identities in pickers. |
Copilot's findings
- Files reviewed: 25/25 changed files
- Comments generated: 3
- Keeps normal pasted chat context as opaque simple attachments so existing paste chips render as before. - Uses delegation transcript metadata, not display kind, to restore transcript handoff attachments. - Updates attachment restore coverage to distinguish tagged transcripts from display-kind-only paste attachments. (Commit message generated by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- Avoids changing generic restored attachment UI while preserving metadata-based delegation transcript restore. - Keeps normal simple attachment rendering behavior narrowly scoped to the existing generic path. (Commit message generated by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Removes temporary attachment and delegation trace logging added while diagnosing transcript handoff. - Restores the Copilot attachment log to its previous low-detail trace shape. - Reverts the unintended API proposal type change so proposal versions remain supported. (Commit message generated by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Completes the paste attachment request test with the chat turn completion event used by the state-driven test helper. - Keeps the assertion that normal paste variables stay simple attachments without paste display kind. (Commit message generated by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Avoids computing chat initial session options for the Agents Window agent-host delegation path where they are not consumed. - Keeps repository options for paths that pass them through workbench chat session creation. (Commit message generated by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This reverts commit b67d77c.
amunger
approved these changes
Jun 17, 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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #319819
(Commit message generated by Copilot)