server: reject agent commands in remote CLI - #331877
Merged
Merged
Conversation
Prevent the remote CLI from treating unsupported agent subcommands as file paths. - Detect agent commands before the remote CLI filters and parses its options. - Return a clear error and nonzero exit code instead of opening command arguments as files. - Add focused tests for global options, option values, and the option terminator. Fixes #329934 (Commit message generated by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Dmitriy Vasyura (dmitrivMS)
previously approved these changes
Aug 20, 2026
Connor Peet (connor4312)
enabled auto-merge (squash)
August 20, 2026 22:04
Contributor
There was a problem hiding this comment.
Pull request overview
Rejects unsupported agent subcommands in the remote CLI instead of interpreting their arguments as file paths.
Changes:
- Adds agent-command detection before remote argument filtering.
- Returns an error and nonzero exit code.
- Adds focused command-detection tests.
Show a summary per file
| File | Description |
|---|---|
src/vs/server/node/server.cli.ts |
Rejects detected agent commands. |
src/vs/server/node/server.cliAgent.ts |
Implements argument scanning. |
src/vs/server/test/node/server.cliAgent.test.ts |
Tests detection edge cases. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Balanced
- Recognize deprecated option IDs when skipping option values. - Stop scanning when another top-level subcommand appears first. - Add regression coverage for deprecated options and competing subcommands. (Commit message generated by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Dmitriy Vasyura (dmitrivMS)
approved these changes
Aug 20, 2026
Dmitriy Vasyura (dmitrivMS)
approved these changes
Aug 20, 2026
Abdon Morales (abdonmorales)
pushed a commit
to abdonmorales/vscode-utcs
that referenced
this pull request
Aug 22, 2026
* server: reject agent commands in remote CLI Prevent the remote CLI from treating unsupported agent subcommands as file paths. - Detect agent commands before the remote CLI filters and parses its options. - Return a clear error and nonzero exit code instead of opening command arguments as files. - Add focused tests for global options, option values, and the option terminator. Fixes microsoft#329934 (Commit message generated by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * server: align agent guard parsing - Recognize deprecated option IDs when skipping option values. - Stop scanning when another top-level subcommand appears first. - Add regression coverage for deprecated options and competing subcommands. (Commit message generated by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> (cherry picked from commit 1750b44)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
server: reject agent commands in remote CLI
Prevent the remote CLI from treating unsupported agent subcommands as file paths.
Fixes #329934
(Commit message generated by Copilot)
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com