[cherry-pick] [WindowsSandboxing]: Updated env and commandline for executing commands using pwsh.exe (#318466)#318476
Merged
Merged
Conversation
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @anthonykim1Matched files:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Cherry-pick of #318466 to release/1.122. Updates Windows MXC sandboxing to launch user commands via pwsh.exe with explicit arguments, expands the injected Windows/PowerShell environment, switches containment to processcontainer, defaults Windows cwd to the first write root, resolves Windows filesystem symlinks, and bumps @microsoft/mxc-sdk to 0.2.1. Tests are updated to cover the new command line, env vars, cwd fallback, and symlink resolution.
Changes:
- MXC config now wraps the command with
"<shell>" -NoProfile -ExecutionPolicy Bypass -Command "<cmd>", usescontainment: 'processcontainer', setsui.allowWindows: true, and adds the shell's directory to readonly paths. SandboxHelperService.getWindowsMxcEnvironmentnow exportsSystemRoot,PATH,ComSpec,PATHEXT,PSModulePath,USERPROFILE,APPDATA,LOCALAPPDATA,PSHOME; Windows paths are resolved throughrealpathvia a new_toWindowsFileSystemResourceconverter.- Bumped
@microsoft/mxc-sdkfrom0.2.0to0.2.1in both root and remote manifests/lockfiles.
Show a summary per file
| File | Description |
|---|---|
| src/vs/platform/sandbox/common/terminalSandboxMxcRuntime.ts | Build PowerShell-wrapped command line, switch containment to processcontainer, add shell dir to readonly, set allowWindows. |
| src/vs/platform/sandbox/common/terminalSandboxEngine.ts | Pass shell to MXC config, default Windows cwd to first write root, resolve Windows paths via new URI converter. |
| src/vs/platform/sandbox/node/sandboxHelper.ts | Inject expanded Windows/PowerShell env vars into MXC environment. |
| src/vs/platform/sandbox/test/common/terminalSandboxEngine.test.ts | Update Windows fixtures/assertions; add symlink-resolution test. |
| src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/browser/terminalSandboxService.test.ts | Update remote Windows test for new env, command-line wrapping, and shell dir read access. |
| package.json, package-lock.json, remote/package.json, remote/package-lock.json | Bump @microsoft/mxc-sdk to 0.2.1. |
Copilot's findings
Files not reviewed (1)
- remote/package-lock.json: Language not supported
- Files reviewed: 7/9 changed files
- Comments generated: 0
vijayupadya
approved these changes
May 27, 2026
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.
Cherry-pick of #318466 to
release/1.122.This backports the Windows MXC PowerShell command-line/environment changes and related package and test updates.
Validation:
npm run transpile-clientsrc/vs/platform/sandbox/test/common/terminalSandboxEngine.test.tssrc/vs/workbench/contrib/terminalContrib/chatAgentTools/test/browser/terminalSandboxService.test.tsFocused test result: 75 passed, 0 failed.