use risk assesment in general confirmations + in advanced autopilot mode#320204
Open
justschen wants to merge 8 commits into
Open
use risk assesment in general confirmations + in advanced autopilot mode#320204justschen wants to merge 8 commits into
justschen wants to merge 8 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands the existing tool risk-assessment badge so it can be reused across tool confirmation surfaces (not just terminal), and updates the risk assessment service to support multiple assessment rubrics (terminal vs generic tool calls).
Changes:
- Added a shared
createToolRiskBadgehelper that handles cached assessments, async assessment, and cancellation via a providedDisposableStore. - Updated
ChatToolRiskAssessmentServiceto support aToolRiskPromptKindand a new “generic tool call” prompt rubric, including kind-aware caching. - Wired the badge into additional confirmation UIs by injecting
IChatToolRiskAssessmentServiceinto the relevant confirmation parts and using the helper.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/toolRiskBadgeHelper.ts | New shared helper to create/manage a ToolRiskBadgeWidget with caching + async assessment + cancellation. |
| src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.ts | Passes IChatToolRiskAssessmentService through to the shared confirmation base (badge remains pre-exec only). |
| src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.ts | Injects risk assessment service and forwards it to the base confirmation renderer. |
| src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.ts | Refactors terminal confirmation badge creation to use the shared helper with kind: 'terminal'. |
| src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatModifiedFilesConfirmationSubPart.ts | Adds the risk badge as a footerBanner for modified-files confirmations. |
| src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMissingSandboxDepsConfirmationSubPart.ts | Injects and forwards the risk assessment service for sandbox-deps confirmations. |
| src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.ts | Centralizes pre-execution confirmation badge rendering via footerBanner and a helper method. |
| src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatElicitationContentPart.ts | Uses the shared helper for elicitation risk badges (removes duplicated async/cancellation logic). |
| src/vs/workbench/contrib/chat/browser/tools/chatToolRiskAssessmentService.ts | Adds ToolRiskPromptKind, kind resolution, kind-aware caching, and a new generic tool-call assessment prompt. |
| src/vs/workbench/contrib/chat/browser/chat.shared.contribution.ts | Updates the configuration description to reflect that risk badges apply to tool confirmations generally (not only terminal). |
Copilot's findings
- Files reviewed: 10/10 changed files
- Comments generated: 0
Contributor
|
Base:
|
… badge The risk-badge factory's isEnabled() guard ran after the call sites' languageModelToolsService.getTool() lookup. With the feature disabled, getTool() was still invoked; under the shared component-fixture mock (which omits getTool), this threw inside the confirmation subpart constructor, leaving partially-constructed parts unregistered and reported as leaked disposables. Move the getTool() lookup into createToolRiskBadge() after the isEnabled() check, so it is only reached when the feature is on. The factory now takes languageModelToolsService + toolId, removing the duplicated lookup and null-check from the terminal, generic, and elicitation confirmation surfaces.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
use the risk assessement badge whenever there is any type of confirmation.
also autopilot + risk assessment on tools