Skip to content

Agent Host terminal auto-approve should use PowerShell grammar for PowerShell commands #328052

Closed

Description

Follow up to #326766 and #324136. PR #327947 adds persistent user/workspace auto-approve actions to Agent Host Copilot terminal confirmations, but there is still a parser mismatch for the SDK's powershell tool.

The workbench generates suggestions using the PowerShell tree-sitter grammar, while Agent Host's commandAutoApprover.ts only loads tree-sitter-bash.wasm for eligibility and enforcement.

Impact:

  • Existing settings rule: a simple rule such as "Get-ChildItem": true usually works because bash can treat it as a generic command name. Rules for PowerShell-specific syntax can still miss because Agent Host splits/interprets the command using bash grammar.
  • Rule added from Restore user/workspace terminal bash auto-approve actions for Agent Host Copilot #327947: the workbench can suggest and persist a rule from an accurate PowerShell parse, but Agent Host re-parses the next command as bash. The user selects "Always Allow" and is prompted again.
  • Exact command-line rule: this can also miss when bash parsing fails because Agent Host parses before checking the exact command-line allow rule.

Representative cases include pipelines with script blocks (Where-Object { ... }), $() subexpressions, backtick continuations, PowerShell operators, and PowerShell-specific redirects such as $null.

The expected failure mode is conservative re-prompting/inconsistent suggestions; Agent Host remains authoritative for approval. There is no known auto-approval bypass from this mismatch.

Work needed:

Related forwarding work: #322774.

Activity

  1. added
    terminal
    agent-host
    on Jul 29, 2026
  2. added
    feature-request
    on Jul 29, 2026
  3. added
    unreleased
    insiders-released
    verification-needed
    and removed
    unreleased
    verification-needed
    on Jul 30, 2026
  4. locked and limited conversation to collaborators on Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

agent-hostfeature-requestinsiders-releasedon-testplanterminal

Type

No type

Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions