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
Building on the recent work to have
chat.tools.terminal.autoApproveandchat.tools.terminal.enableAutoApproverespected 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 forwardedchat.tools.terminal.autoApproverules and checks each command against them. Unlike the workbench auto-approver (.../chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/commandLineAutoApprover.ts, which has_getSessionRulesand 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:
<command / combination of commands>for this session<command>(persists to thechat.tools.terminal.autoApprovesetting)Pointers for agent:
src/vs/platform/agentHost/node/commandAutoApprover.ts, andsessionPermissions.ts(getAutoApproval,permissionKind === 'shell'path)_getSessionRulesin.../chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/commandLineAutoApprover.ts