Skip to content

server: reject agent commands in remote CLI - #331877

Merged
Connor Peet (connor4312) merged 3 commits into
mainfrom
connor4312/329934
Aug 20, 2026
Merged

server: reject agent commands in remote CLI#331877
Connor Peet (connor4312) merged 3 commits into
mainfrom
connor4312/329934

Conversation

@connor4312

Copy link
Copy Markdown
Member

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 #329934

(Commit message generated by Copilot)

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

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>
Copilot AI balanced review requested due to automatic review settings August 20, 2026 22:03
@connor4312
Connor Peet (connor4312) enabled auto-merge (squash) August 20, 2026 22:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread src/vs/server/node/server.cliAgent.ts Outdated
Comment thread src/vs/server/node/server.cliAgent.ts
- 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>
@connor4312
Connor Peet (connor4312) merged commit 1750b44 into main Aug 20, 2026
44 of 45 checks passed
@connor4312
Connor Peet (connor4312) deleted the connor4312/329934 branch August 20, 2026 23:19
@vs-code-engineering vs-code-engineering Bot added this to the 1.135.0 milestone 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WSL Insider build broken / unusable

3 participants