Repository navigation
Restore user/workspace terminal bash auto-approve actions for Agent Host Copilot - #327947
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds persistent auto-approve rule actions to Agent Host Copilot terminal confirmations.
Changes:
- Generates workspace/user rule actions using existing terminal analyzers.
- Propagates Agent Host metadata to gate eligible confirmations.
- Adds coverage for action filtering and metadata stamping.
Show a summary per file
| File | Description |
|---|---|
runInTerminalHelpers.test.ts |
Tests session-action filtering. |
runInTerminalHelpers.ts |
Supports omitting session-scoped actions. |
terminalChatService.ts |
Lazily generates auto-approve actions. |
terminal.ts |
Exposes action-generation API. |
chatService.ts |
Adds rule-applicability terminal metadata. |
chatTerminalToolConfirmationSubPart.ts |
Asynchronously updates confirmation actions. |
stateToProgressAdapter.ts |
Maps Agent Host metadata into terminal data. |
agentSideEffects.test.ts |
Tests metadata stamping. |
agentSideEffects.ts |
Stamps shell-confirmation metadata. |
agentToolCallMeta.ts |
Defines and validates the metadata key. |
Review details
- Files reviewed: 10/10 changed files
- Comments generated: 3
- Review effort level: Medium
This comment was marked as low quality.
This comment was marked as low quality.
Contributor
There was a problem hiding this comment.
Review details
Comments suppressed due to low confidence (1)
src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.ts:233
- This asynchronous refresh replaces both button DOM nodes.
ChatCustomConfirmationWidget.updateButtonsremoves every child before recreating them (chatConfirmationWidget.ts:426-465), so if a keyboard or screen-reader user has already focused Allow or Skip while tree-sitter is loading, focus is discarded when the actions arrive. Please preserve and restore the focused button (or update the existing Allow control in place) when refreshing the actions.
confirmWidget.updateButtons(this._createButtons(buildMoreActions()));
- Files reviewed: 14/14 changed files
- Comments generated: 0 new
- Review effort level: Medium
Anthony Kim (anthonykim1)
marked this pull request as ready for review
July 29, 2026 18:25
Dmitriy Vasyura (dmitrivMS)
approved these changes
Jul 29, 2026
Closed
3 tasks done
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Part of: #324136
<cmd>in this Workspace", "Always Allow<cmd>", exact-command-line variants) for Agent Host Copilot terminal confirmations, which arrive without pre-computed actions.ITerminalChatService.getAutoApproveActions: parse the command withTreeSitterCommandParser, evaluate sub-commands withCommandLineAutoApproveragainst persisted configuration rules only (never workbench session rules — the agent host does not consume them), and reusegenerateAutoApproveActionsso suggestions match the built-in tool.autoApproveRulesApplytool-call metadata in the Agent Host viaSessionPermissionManager.canFutureRuleSuppressPrompt, only when a missing allow rule is the sole blocker: the command parsed, matched no deny rule, and has no unapproved write redirect. Managed approvals, sandbox-bypass prompts, denials, and unparseable commands are never marked, so the dropdown never offers a rule that could not suppress future prompts.getAutoApprovaluntouched: eligibility re-evaluates the command instead of restructuring the approval path's return type (parse is sub-millisecond, compiled rules are cached).agent-host-copilotclisessions whenchat.tools.terminal.enableAutoApproveis on, and update the confirmation buttons in place when actions arrive asynchronously, guarded against disposal and already-resolved confirmations.skipSessionScoped): workbench session rules are not forwarded to the Agent Host yet, so offering them would appear to work while later commands still prompt. That half of Agent Host: bring back granular "sticky" terminal auto-approve controls (allow for session / always allow exact command line) #324136 stays open.powershelltool, PowerShell-specific syntax can yield a suggested rule the bash-grammar enforcement won't match; follow-up is loadingtree-sitter-powershell.wasm(already shipped in the same package) in the approver. ----> Agent Host terminal auto-approve should use PowerShell grammar for PowerShell commands #328052evaluate()outcome table (approved, denied, unknown command, transient env-var, unsafe redirects, parser unavailable),_metastamping for plain vs sandbox-bypass vs managed confirmations,canFutureRuleSuppressPromptgates, adapter meta-to-tool-data copy,getAutoApproveActionsempty/parse-failure paths, and theskipSessionScopedaction snapshot. Follow-up: an electron-browser integration test with real tree-sitter parsing (browser unit suites cannot load the wasm).Inspirations from:
{ subCommandResults, commandLineResult }) and the "only when not auto-approved and auto-approve is enabled" condition come from the built-in tool's call site incommandLineAutoApproveAnalyzer.ts.generateAutoApproveActionsrather than reimplemented; this PR only adds theskipSessionScopedoption to it._metawell-known-key producer pattern (merge into the outgoing state viatoToolCallMeta) comes from the existingautoApproveBySettingstamp inagentSideEffects.ts.requestSandboxBypassearly return inSessionPermissionManager.getAutoApprovaland the intentional omission ofpermissionKind: 'shell'for unsandboxed-command confirmations incopilotAgentSession.ts.