Skip to content

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

Open

Description

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

Activity

  1. added
    agent-host
    terminal-auto-approve
    on Jul 3, 2026
  2. anthonykim1 commented on Jul 27, 2026

    @anthonykim1
    ContributorAuthor
    Image

    Allow something like:

  3. added
    feature-request
    on Jul 27, 2026
  4. anthonykim1 commented on Jul 29, 2026

    @anthonykim1
    ContributorAuthor

    We need to use pwsh grammar for pwsh commands ---> #328052

  5. dmitrivMS commented on Sep 26, 2026

    @dmitrivMS
    Collaborator

    Dupe of #326766?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

agent-hostfeature-requeston-testplanterminal-auto-approve

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions