Skip to content

Support rendering subagent details from external agents#293705

Merged
roblourens merged 2 commits intomainfrom
roblou/shaggy-coral
Feb 7, 2026
Merged

Support rendering subagent details from external agents#293705
roblourens merged 2 commits intomainfrom
roblou/shaggy-coral

Conversation

@roblourens
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings February 7, 2026 21:39
@roblourens roblourens enabled auto-merge (squash) February 7, 2026 21:39
@roblourens roblourens self-assigned this Feb 7, 2026
@vs-code-engineering vs-code-engineering bot added this to the February 2026 milestone Feb 7, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends VS Code’s chat tool invocation rendering to support subagent grouping/details when the subagent is spawned by external agents/tools (not only the built-in runSubagent tool), and exposes a proposed API type to carry subagent metadata.

Changes:

  • Add proposed API ChatSubagentToolInvocationData and bump the chatParticipantAdditions proposal version to 3.
  • Plumb a subagent invocation id through external tool invocation updates and into the chat model’s tool invocation objects.
  • Update chat UI grouping logic to detect “parent subagent tools” via toolSpecificData.kind === 'subagent' instead of hard-coding RunSubagentTool.Id.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/vscode-dts/vscode.proposed.chatParticipantAdditions.d.ts Adds ChatSubagentToolInvocationData to the proposed API and extends toolSpecificData union; bumps proposal version.
src/vs/workbench/contrib/chat/common/model/chatModel.ts Passes through subagentInvocationId when creating external tool invocations.
src/vs/workbench/contrib/chat/common/chatService/chatService.ts Extends IChatExternalToolInvocationUpdate with a subagent invocation id field.
src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.ts Switches subagent grouping logic to rely on toolSpecificData.kind === 'subagent' and adds helper functions for determining subagent grouping id.
src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.ts Updates subagent info extraction/completion watching to apply to “parent subagent tools” identified by toolSpecificData rather than tool id.
src/vs/workbench/api/common/extHostTypes.ts Adds the ext host runtime class ChatSubagentToolInvocationData.
src/vs/workbench/api/common/extHostTypeConverters.ts Converts ChatSubagentToolInvocationData into internal kind:'subagent' tool data and wires subagentInvocationId for external tool invocation updates.
src/vs/workbench/api/common/extHost.protocol.ts Removes now-unneeded IChatExternalToolInvocationUpdateDto from the progress DTO union.
src/vs/platform/extensions/common/extensionsApiProposals.ts Updates the chatParticipantAdditions proposal version to 3.
Comments suppressed due to low confidence (1)

src/vs/workbench/api/common/extHostTypeConverters.ts:3040

  • convertToolSpecificData only recognizes subagent tool data via data instanceof types.ChatSubagentToolInvocationData. Because TypeScript is structural, extensions can (and often do) pass plain object literals that satisfy the shape, which will fail this instanceof check and skip conversion to { kind: 'subagent', ... }. That will prevent subagent grouping/rendering logic (which keys off toolSpecificData.kind === 'subagent') from working for external agents. Please switch to a shape-based guard (similar to the MCP/todo/resources cases) or otherwise ensure subagent data is reliably tagged as kind: 'subagent' regardless of how the extension constructs it.
		} else if (data instanceof types.ChatSubagentToolInvocationData) {
			// Convert extension API subagent tool data to internal format
			return {
				kind: 'subagent',
				description: data.description,
				agentName: data.agentName,
				prompt: data.prompt,
				result: data.result,
			};
		}

Comment on lines 2925 to 2935
if (part.enablePartialUpdate) {
return {
kind: 'externalToolInvocationUpdate',
toolCallId: part.toolCallId,
toolName: part.toolName,
isComplete: !!part.isComplete,
invocationMessage: part.invocationMessage ? MarkdownString.from(part.invocationMessage) : undefined,
pastTenseMessage: part.pastTenseMessage ? MarkdownString.from(part.pastTenseMessage) : undefined,
toolSpecificData,
subagentInvocationId: part.subAgentInvocationId,
};
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

There are currently no unit tests covering ChatToolInvocationPart.from conversion, and this change adds new behavior (subagent toolSpecificData conversion + wiring subagentInvocationId for external tool updates). Please add a focused test in src/vs/workbench/api/test/... to verify: (1) subagent toolSpecificData is converted to { kind: 'subagent', ... } and (2) subAgentInvocationId is propagated into the externalToolInvocationUpdate payload.

This issue also appears on line 3031 of the same file.

Copilot uses AI. Check for mistakes.
Comment on lines 871 to 873
toolSpecificData?: IChatTerminalToolInvocationData | IChatToolInputInvocationData | IChatExtensionsContent | IChatTodoListContent | IChatSubagentToolInvocationData;
subagentInvocationId?: string;
}
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

The new property is named subagentInvocationId, but the rest of the tool-invocation surface uses subAgentInvocationId (e.g. IChatToolInvocation.subAgentInvocationId, IChatToolInvocationSerialized.subAgentInvocationId, and the extension API ChatToolInvocationPart.subAgentInvocationId). Consider renaming this to subAgentInvocationId for consistency and to avoid wiring mistakes across the internal/external types.

Copilot uses AI. Check for mistakes.
@roblourens roblourens merged commit 1aa2356 into main Feb 7, 2026
28 of 29 checks passed
@roblourens roblourens deleted the roblou/shaggy-coral branch February 7, 2026 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants