Skip to content

feat(chat): add handoff discovery and execution actions#302584

Open
eleanorjboyd wants to merge 5 commits intomicrosoft:mainfrom
eleanorjboyd:broad-unicorn
Open

feat(chat): add handoff discovery and execution actions#302584
eleanorjboyd wants to merge 5 commits intomicrosoft:mainfrom
eleanorjboyd:broad-unicorn

Conversation

@eleanorjboyd
Copy link
Member

Adds workbench.action.chat.getHandoffs and workbench.action.chat.executeHandoff along with the necessary tests.

workbench.action.chat.getHandoffs returns an object array (ICustomAgentInfo[]) which include the the handoffs available across custom agents (and built-in modes).

workbench.action.chat.executeHandoff executes actually doing the handoff in the current or specified session to the custom agent/mode defined.

@eleanorjboyd eleanorjboyd self-assigned this Mar 17, 2026
Copilot AI review requested due to automatic review settings March 17, 2026 22:15
@eleanorjboyd eleanorjboyd marked this pull request as draft March 17, 2026 22:15
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

Adds programmatic discovery and execution of chat handoffs, enabling external automation (commands) to enumerate handoffs across modes and trigger a selected handoff in a target chat session.

Changes:

  • Added workbench.action.chat.getHandoffs to return structured handoff metadata across built-in and custom modes.
  • Added workbench.action.chat.executeHandoff to resolve and execute a handoff (optionally scoped to a session and/or source agent).
  • Refactored ChatWidget to expose an executeHandoff(...) method and added unit tests for ID generation, discovery, and execution.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/vs/workbench/contrib/chat/common/chatModes.ts Introduces getHandoffId, handoff/mode info types, and buildCustomAgentHandoffsInfo for the discovery command.
src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.ts Registers new commands for handoff discovery and execution.
src/vs/workbench/contrib/chat/browser/widget/chatWidget.ts Exposes executeHandoff(...) for reuse by UI and commands.
src/vs/workbench/contrib/chat/browser/chat.ts Extends IChatWidget interface with executeHandoff.
src/vs/workbench/contrib/chat/test/common/chatHandoffs.test.ts Adds tests for getHandoffId and buildCustomAgentHandoffsInfo.
src/vs/workbench/contrib/chat/test/browser/actions/chatExecuteActions.test.ts Adds browser tests covering both new commands and widget/session resolution behavior.

You can also share your feedback on Copilot code review. Take the survey.

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

Adds command-level APIs and supporting plumbing/tests for discovering and executing “handoff” actions across chat modes/agents, improving programmability of handoffs and strengthening prompt validation around handoff definitions.

Changes:

  • Introduces workbench.action.chat.getHandoffs and workbench.action.chat.executeHandoff commands, plus shared handoff metadata helpers (getHandoffId, buildCustomAgentHandoffsInfo).
  • Updates prompt parsing/validation to skip whitespace-only handoff labels and report duplicate handoff labels.
  • Extends IChatWidget with an executeHandoff(...) method and adds/updates unit tests covering the new behaviors.

Reviewed changes

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

Show a summary per file
File Description
src/vs/workbench/contrib/chat/common/chatModes.ts Adds handoff ID generation and builds a structured handoff discovery payload (ICustomAgentInfo[]).
src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.ts Adds the two new commands and wires them to mode/widget services for discovery + execution.
src/vs/workbench/contrib/chat/browser/chat.ts Extends IChatWidget to expose executeHandoff(...) for command invocation.
src/vs/workbench/contrib/chat/browser/widget/chatWidget.ts Implements executeHandoff(...) and routes handoff selection through it (with updated error logging).
src/vs/workbench/contrib/chat/common/promptSyntax/promptFileParser.ts Skips parsing handoffs whose label is whitespace-only.
src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.ts Adds duplicate-handoff-label validation.
src/vs/workbench/contrib/chat/test/common/promptSyntax/service/promptFileParser.test.ts Adds coverage for skipping whitespace-only handoff labels.
src/vs/workbench/contrib/chat/test/common/chatHandoffs.test.ts New unit tests for getHandoffId and buildCustomAgentHandoffsInfo.
src/vs/workbench/contrib/chat/test/browser/promptSyntax/languageProviders/promptValidator.test.ts Adds coverage for duplicate handoff label diagnostics.
src/vs/workbench/contrib/chat/test/browser/actions/chatExecuteActions.test.ts New unit tests for the new discovery/execution commands.
Comments suppressed due to low confidence (1)

src/vs/workbench/contrib/chat/browser/widget/chatWidget.ts:1279

  • acceptInput().catch(e => this.logService.error(...${e})) interpolates the error into the string, which typically loses stack/structured details. Prefer passing the error object as a separate argument to logService.error so the stack is preserved (and consider keeping the message free of ${e}).
			this.acceptInput().catch(e => this.logService.error(`[Handoff] Failed to submit delegated handoff to '@${agentId}': ${e}`));

You can also share your feedback on Copilot code review. Take the survey.

@eleanorjboyd eleanorjboyd marked this pull request as ready for review March 17, 2026 23:52
@vs-code-engineering vs-code-engineering bot added this to the 1.113.0 milestone Mar 17, 2026
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.

3 participants