Description
Follow up to #328052, #328108, #328109.
Problem
The tree-sitter-powershell grammar shipped in @vscode/tree-sitter-wasm fails to parse a meaningful fraction of the command lines agents actually emit. Since both the workbench and the Agent Host derive auto-approval from the parse, an unparsable command line means no auto-approval and no way for the user to fix it from the confirmation UI.
Measurement
36 plausible agent-emitted commands parsed with the PowerShell grammar; 3 produced hasError:
ERROR npm run test -- --grep "foo"
ERROR ./scripts/test.sh
ERROR git diff -- src/
That is ~8%. Two distinct triggers, both very common:
- a bare
--separator (npm run test -- …,git diff -- <path>) ./pathat command position (./scripts/test.sh,./gradlew build)
A third known limitation is already worked around in both codebases: POSIX-style --flag=value arguments parse as assignment expressions and truncate the surrounding command (#294010), which both TreeSitterCommandParser and the Agent Host's CommandAutoApprover mask before parsing.
Impact
With the errored-parse gate in place (#328108, and already shipping in the Agent Host), these command lines resolve to noMatch with autoApproveRuleResolvable: false. The renderer only offers persistent auto-approve actions when autoApproveRuleResolvable is set (chatTerminalToolConfirmationSubPart.ts), so the user sees a confirmation with no auto-approve options at all, every time, forever.
Honouring explicit matchCommandLine rules before parsing (#328109) gives users an escape hatch but does not remove the underlying gap — the suggested sub-command rules still cannot be generated.
Possible directions
- Fix upstream in the tree-sitter PowerShell grammar (the
--and./pathcases) and pick up the updated wasm. - Extend the existing masking workaround to cover a bare
--separator, in the same spirit as the--flag=valuemask. - Fall back to a coarser tokenizer for suggestion generation only (never for enforcement) so the confirmation can still offer a sensible sub-command rule.
Option 2 is the cheapest and matches an existing precedent; option 1 is the real fix.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNo status
Activity
neverendingqs commentedon Aug 31, 2026
Anthony Kim (@anthonykim1) - curious as to the status of this issue and when it's planned for. I hit this many times per day across all my sessions.
iket0731 commentedon Sep 24, 2026
This seems to affect quite a few users. The same root cause (standalone
--failing to parse in PowerShell) has been reported separately in #325635, #324059 and #321748.There's also an open community PR, #335465, that implements option 2 (masking a bare
--before parsing, similar to the existing--flag=valueworkaround). It is waiting for a review.Anthony Kim (@anthonykim1) Would this approach be acceptable as a short-term fix while the upstream grammar is addressed? It would help a lot of us who hit this many times a day. Thanks!