Skip to content

Agent Host: bring back granular "sticky" terminal auto-approve controls (allow for session / always allow exact command line) #324136

Description

@anthonykim1

Building on the recent work to have chat.tools.terminal.autoApprove and chat.tools.terminal.enableAutoApprove respected for Agent Host Copilot (#322633, #322774), I'd like to bring back the more granular, "sticky" approval controls we used to have so users aren't re-prompted for commands they've already OK'd.

Issue:

Today the AH terminal auto-approver (src/vs/platform/agentHost/node/commandAutoApprover.ts) only compiles the forwarded chat.tools.terminal.autoApprove rules and checks each command against them. Unlike the workbench auto-approver (.../chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/commandLineAutoApprover.ts, which has _getSessionRules and shows "Auto approved for this session"), the AH side has no concept of session-scoped approvals. So once I approve something, there's no way to make it stick for the rest of the session, and I keep getting re-prompted.

This shows up a lot because terminal auto-approve is deliberately picky about sub-commands: a compound command only auto-approves if every parsed segment matches a rule, and things like nested $(...) substitutions, added write redirects, or combos the tree-sitter parser can't decompose will still prompt.

Potential thoughts/plan forward:

  • Allow <command / combination of commands> for this session
  • Always allow exact command line <command> (persists to the chat.tools.terminal.autoApprove setting)
  • Allow all commands in this session — would want to align with the permissions / risk-assessment folks on how this interacts with the session permission model before wiring it up

Pointers for agent:

  • AH: src/vs/platform/agentHost/node/commandAutoApprover.ts, and sessionPermissions.ts (getAutoApproval, permissionKind === 'shell' path)
  • Workbench reference for session-scoped rules: _getSessionRules in .../chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/commandLineAutoApprover.ts

Metadata

Metadata

Assignees

Labels

agent-hostIssues for the agent-host implementation (not the protocol)terminal-auto-approveRelated to the terminal's auto approve logic

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions