feat(chat): add handoff discovery and execution actions#302584
feat(chat): add handoff discovery and execution actions#302584eleanorjboyd wants to merge 5 commits intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
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.getHandoffsto return structured handoff metadata across built-in and custom modes. - Added
workbench.action.chat.executeHandoffto resolve and execute a handoff (optionally scoped to a session and/or source agent). - Refactored
ChatWidgetto expose anexecuteHandoff(...)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.
src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.ts
Outdated
Show resolved
Hide resolved
98dccac to
b2d94af
Compare
There was a problem hiding this comment.
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.getHandoffsandworkbench.action.chat.executeHandoffcommands, plus shared handoff metadata helpers (getHandoffId,buildCustomAgentHandoffsInfo). - Updates prompt parsing/validation to skip whitespace-only handoff labels and report duplicate handoff labels.
- Extends
IChatWidgetwith anexecuteHandoff(...)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 tologService.errorso 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.
Adds
workbench.action.chat.getHandoffsandworkbench.action.chat.executeHandoffalong with the necessary tests.workbench.action.chat.getHandoffsreturns an object array (ICustomAgentInfo[]) which include the the handoffs available across custom agents (and built-in modes).workbench.action.chat.executeHandoffexecutes actually doing the handoff in the current or specified session to the custom agent/mode defined.