Repository navigation
Description
Follow up to #323570 and #322112. Rules from chat.tools.terminal.autoApprove are forwarded to agent host and respected (#322774), but the approval experience did not come along. When a command isn't auto-approved, agent host sessions only get "Allow" (once) and "Skip".
From local harness we used to have:
- Always Allow
<command> - Allow
<command>in this Session / in this Workspace - Allow Exact Command Line
- Allow All Commands in this Session
- Configure Auto Approve...
None of these show up in agent host copilot today, so users have to re-approve the same command over and over. Awkward part is the agent host side already offers an "Allow in this Session" option over the protocol, but our terminal confirmation UI hardcodes its two buttons and drops it on the floor.
Work needed:
- Bring the rule-creating options back for agent host terminal confirmations (user/workspace scope can just write to the existing setting, which is already forwarded)
- Forward session-scoped rules to the agent host process so "allow in this session" actually auto-approves later commands silently
- Some telemetry on how often people add rules from the confirmation UI, per scope. Would be useful signal for the item below.
Bigger picture: right now VS Code owns the rules and we forward + re-parse commands ourselves. I think this should be the other way around, where Copilot CLI/SDK is the source of truth so approval behavior is consistent whether you're in VS Code, CLI in terminal, etc. The SDK already has most of the pieces (session/location scoped approvals, permissions.configure / modifyRules, persisted grants in ~/.copilot/permissions-config.json). Open questions before we can converge:
- Rule shape mismatch: our setting is regex/
matchCommandLinebased, SDK grants are command-identifier based - SDK has no user-global allow list today, only per repo/dir
- AHP has no standard message for standing allow/deny rules (scoped approvals are opaque option ids, approve-all is a vendor RPC)
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNo status
Activity
anthonykim1 commentedon Jul 29, 2026
Adding findings from the Agent Host PowerShell-grammar work (#328052) that are convergence items rather than standalone bugs.
While reviewing that change I built a consistency matrix across the two engines. The standalone defects are filed separately (#328107, #328108, #328109, #328110); what is left below is the structural drift that belongs on this umbrella.
Where the two engines differ today
NpmScriptAutoApprover)skipSessionScoped)isPowerShell(shell, os))getShellLanguage)>$HOME/x)The grammar-signal row is not a defect — the Agent Host has no persistent terminal, so the tool name is the only correct signal available. Same intent, different input.
Root cause: duplicated logic, shared data
The two engines already share the rule data —
getAgentHostTerminalAutoApproveRulesConfigforwards the effectivechat.tools.terminal.autoApproveover AHP, so the Agent Host's bundled default table is only a legacy-client fallback. What is duplicated is the logic, and every divergence above is a symptom: the errored-parse gate exists in one copy, the assignment hole existed in both, and a dead leading-(matching branch was copied from the workbench into the Agent Host (it is unreachable in both, since the PowerShell grammar already strips the parens).Suggested convergence work
Extract a shared core. Put parsing + rule matching in an environment-agnostic
common/module both sides consume, with tree-sitter access injected (Agent Host reads wasm viafs; workbench usesITreeSitterLibraryService). Layering permits this — workbench may import from platform. This removes drift by construction.Invert the safety invariant. Replace "enumerate
(command)nodes and check each" with "verify the captured spans account for the whole command line, and fail closed on anything unaccounted for." This is grammar-agnostic and fails closed on node types nobody enumerated. It subsumes both the errored-parse gate (Terminal auto-approve: a partially-failed tree-sitter parse can still auto-approve #328108) and the assignment/invocation hole (Terminal auto-approve: assignments and method invocations bypass sub-command checks #328107), which is a strong signal it is the shape the code wants.One language vocabulary. Today:
_meta.languageuses'shellscript' | 'powershell',IAgentToolPendingConfirmationSignal.shellLanguageuses'bash' | 'powershell',IShouldAutoApproveOptions.languageuses'bash' | 'powershell',TreeSitterCommandParserLanguageis a fourth, and the renderer converts back to'shellscript'. One enum plus one converter.Close the feature gap so the same command gets the same answer on both surfaces — npm-script auto-approval and session-scoped rules. The
skipSessionScoped: truestopgap interminalChatService.tsis the honest interim answer and its comment already explains why.A shared conformance corpus. One table of
(commandLine, shell, expectedResult)run against both implementations. This is the artifact that would have caught the regression in Agent Host terminal auto-approve should use PowerShell grammar for PowerShell commands #328052 — that PR's own tests all passed, because they asserted the new behaviour rather than comparing it to the old.dagwinstox commentedon Oct 5, 2026
I'm seeing what looks like a regression with chat.tools.terminal.autoApprove in the Local harness.
VS Code: 1.140.0
Commit: 07f806f
OS: Windows NT x64 10.0.26200
chat.tools.terminal.enableAutoApprove is enabled and chat.tools.terminal.autoApprove contains the standard/default allow rules.
With the Local harness, commands that match auto-approve rules, for example:
git status
still show the "Run bash command?" confirmation.
This is not specific to the Git regex. Other commands present in the auto-approve list behave the same way.
If I switch the exact same session/workspace to the Copilot harness, the auto-approve configuration works as expected and matching commands execute without requesting confirmation.
So on my installation:
leonardos-cerebras commentedon Oct 19, 2026
With the Copilot harness, "Allow All Commands in this Session" is missing:

With the local harness:

Problems: