Repository navigation
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": trueusually 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:
- Load
tree-sitter-powershell.wasmin the Agent Host command auto-approver (it already ships in the same package). - Carry/select the shell grammar for both rule eligibility and enforcement.
- Add coverage for existing settings rules and rules created from Restore user/workspace terminal bash auto-approve actions for Agent Host Copilot #327947, including PowerShell-specific sub-command and exact-command-line cases.
Related forwarding work: #322774.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity