Skip to content

Remove Agent Host terminal auto-approve fallback rules #322791

Open

Description

Follow-up from #322774 and related to #322112.

Context

#322774 makes Agent Host consume the real chat.tools.terminal.autoApprove setting by forwarding normalized terminal auto-approve rules through Agent Host root config.

As part of that PR, CommandAutoApprover still keeps a bundled hard-coded default rule table as a compatibility fallback for clients that do not forward the setting yet. A TODO was added near that fallback:

Remove this fallback once all agent-host clients are guaranteed to forward chat.tools.terminal.autoApprove before shell approvals run.

Work

  • Audit Agent Host clients and startup ordering to confirm terminal auto-approve rules are always forwarded before shell approval checks can run.
  • Remove the bundled hard-coded fallback rule table from src/vs/platform/agentHost/node/commandAutoApprover.ts once forwarding is guaranteed.
  • Keep or adjust the source-of-truth tests so forwarded chat.tools.terminal.autoApprove rules remain authoritative over any fallback behavior.
  • Confirm local and remote Agent Host paths still respect chat.tools.terminal.autoApprove and chat.tools.terminal.ignoreDefaultAutoApproveRules after the fallback is removed.

Links

Activity

  1. added
    agent-host
    terminal-auto-approve
    on Jun 24, 2026
  2. MikiKaufhold commented on Jun 29, 2026

    @MikiKaufhold

    Terminal auto-approve still prompts in Insiders despite matching command-line allow rule

    I can still reproduce terminal approval prompts in VS Code Insiders even though terminal auto-approve is enabled and a matchCommandLine allow rule exists for the exact command.

    Environment

    VS Code: 1.127.0-insider
    Copilot version: 0.55.2026062901
    OS: Windows

    Observed behavior

    • In chat, running: Invoke-PromptHelper.ps1 -Operation git-branch-prune-local -OutputFormat Json still shows an approval prompt.
    • I must click Allow manually.
    • Restarting VS Code Insiders did not change behavior.

    Expected behavior

    The command should auto-approve without showing the approval prompt when it matches configured allow rules.

    Current config excerpt

    {
    "chat.tools.terminal.enableAutoApprove": true,
    "chat.tools.terminal.ignoreDefaultAutoApproveRules": false,
    "chat.tools.terminal.autoApprove": {
    "/^(?:(?:Set-Location|Push-Location|cd)\s+(?:"(?:[^"\]|\.)+"|'(?:[^'\]|\.)+'|[^;\r\n]+)\s*;\s*)?(?:&\s+)?(?:./|.\)?scripts[/\]Invoke-PromptHelper.ps1\s+-Operation\s+git-branch-prune-local(?:\s+-RepositoryPath\s+(?:.|(?:"(?:[^"\]|\.)+"|'(?:[^'\]|\.)+')))?(?:\s+-PruneDeleteChoice\s+[123])?(?:\s+-BaseBranch\s+(?:"(?:[^"\]|\.)+"|'(?:[^'\]|\.)+'|[A-Za-z0-9._/-]+))?(?:\s+-OutputFormat\s+Json)?\s*$/": {
    "approve": true,
    "matchCommandLine": true
    }
    }
    }

    Additional checks performed

    • No Windows policy override keys were found for ChatToolsTerminalEnableAutoApprove or VSCode/VSCodeInsiders under HKLM/HKCU SOFTWARE\Policies.
    • Repro remains consistent in chat UI: approval card still appears.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

agent-hostdebtterminal-auto-approve

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions