Skip to content

use risk assesment in general confirmations + in advanced autopilot mode#320204

Open
justschen wants to merge 8 commits into
mainfrom
justin/bounsweet
Open

use risk assesment in general confirmations + in advanced autopilot mode#320204
justschen wants to merge 8 commits into
mainfrom
justin/bounsweet

Conversation

@justschen
Copy link
Copy Markdown
Collaborator

@justschen justschen commented Jun 6, 2026

use the risk assessement badge whenever there is any type of confirmation.

also autopilot + risk assessment on tools

Screenshot 2026-06-05 at 8 46 57 PM Screenshot 2026-06-06 at 4 57 38 PM Screenshot 2026-06-06 at 3 54 46 PM

Copilot AI review requested due to automatic review settings June 6, 2026 03:57
Copy link
Copy Markdown
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 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 createToolRiskBadge helper that handles cached assessments, async assessment, and cancellation via a provided DisposableStore.
  • Updated ChatToolRiskAssessmentService to support a ToolRiskPromptKind and a new “generic tool call” prompt rubric, including kind-aware caching.
  • Wired the badge into additional confirmation UIs by injecting IChatToolRiskAssessmentService into 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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 6, 2026

Base: d40db46e Current: 8cb4f94a

No screenshot changes.

… 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.
Copy link
Copy Markdown
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.

Copilot's findings

  • Files reviewed: 10/10 changed files
  • Comments generated: 1

@justschen justschen requested a review from chrmarti June 6, 2026 17:10
@justschen justschen marked this pull request as ready for review June 6, 2026 17:10
@justschen justschen enabled auto-merge (squash) June 6, 2026 17:11
@justschen justschen requested a review from Copilot June 7, 2026 00:31
@justschen justschen changed the title use risk assesment in general confirmations use risk assesment in general confirmations + in advanced autopilot mode Jun 7, 2026
Copy link
Copy Markdown
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.

Copilot's findings

  • Files reviewed: 13/13 changed files
  • Comments generated: 1

justschen and others added 2 commits June 6, 2026 17:51
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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