-
Notifications
You must be signed in to change notification settings - Fork 35.7k
tools: add postapproval step for tool calls #272628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 adds a post-execution approval step for tool calls, allowing users to review and approve tool results before they are sent to the language model. This is particularly useful for tools marked with openWorldHint that may return sensitive or extensive data.
Key Changes:
- Added
confirmResultsflag toIToolConfirmationMessagesfor post-execution confirmation - Introduced new state
WaitingForPostApprovalin tool invocation lifecycle - Created separate storage for pre-execution and post-execution auto-confirmation settings
- Implemented UI for reviewing tool output before sending to the model
Reviewed Changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| mcpLanguageModelToolContribution.ts | Updated MCP tool confirmation logic to use separate pre/post confirmation flags based on tool annotations |
| languageModelToolsService.ts | Made confirmation messages optional and added confirmResults flag for post-execution approval |
| chatService.ts | Added WaitingForPostApproval state and helper functions for post-execution confirmation workflow |
| chatProgressTypes/chatToolInvocation.ts | Refactored completion logic to handle post-approval state and serialize skipped results |
| languageModelToolsService.ts (browser) | Implemented post-execution confirmation flow with separate storage and auto-confirmation handling |
| chatToolPostExecuteConfirmationPart.ts | New UI component for displaying and approving tool results before sending to model |
| abstractToolConfirmationSubPart.ts | New base class abstracting common confirmation widget functionality |
| chatToolConfirmationSubPart.ts | Refactored to use base class and support conditional result review |
| chatToolOutputContentSubPart.ts | Extracted reusable component for rendering tool output with code blocks and resources |
| chatToolInputOutputContentPart.ts | Refactored to use the extracted output subpart component |
| mockLanguageModelToolsService.ts | Added mock implementation for new post-execution confirmation methods |
| languageModelToolsService.test.ts | Removed tests for deprecated auto-confirmation methods |
| { label: localize('allowSession', 'Allow Without Review in this Session'), data: ConfirmationOutcome.AllowSession, tooltip: localize('allowSessionTooltip', 'Allow results from this tool to be sent without confirmation in this session.') }, | ||
| { label: localize('allowWorkspace', 'Allow Without Review in this Workspace'), data: ConfirmationOutcome.AllowWorkspace, tooltip: localize('allowWorkspaceTooltip', 'Allow results from this tool to be sent without confirmation in this workspace.') }, | ||
| { label: localize('allowGlobally', 'Always Allow Without Review'), data: ConfirmationOutcome.AllowGlobally, tooltip: localize('allowGloballyTooltip', 'Always allow results from this tool to be sent without confirmation.') }, |
Copilot
AI
Oct 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These action definitions are duplicated from chatToolConfirmationSubPart.ts (lines 89-91). Consider extracting these common action definitions into a shared constant or helper function to avoid duplication and ensure consistency.
Copilot uses AI. Check for mistakes.
| @@ -0,0 +1,267 @@ | |||
| /*--------------------------------------------------------------------------------------------- | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is a mostly literal move from chatToolInputOutputContentPart.ts, doesn't need granular review
Closes #270618