Skip to content

Fix issues related with sandbox repair in dev containers. - #327679

Closed
dileepyavan wants to merge 13 commits into
mainfrom
DileepY/devcontainers
Closed

Fix issues related with sandbox repair in dev containers.#327679
dileepyavan wants to merge 13 commits into
mainfrom
DileepY/devcontainers

Conversation

@dileepyavan

Copy link
Copy Markdown
Member

Summary

  • enable the terminal sandbox to run in supported containerized environments
  • improve bubblewrap host-restriction detection and return actionable guidance when sandbox creation is blocked
  • add and update sandbox helper, engine, and terminal tool tests

Testing

  • Added and updated automated tests covering container execution and host-restriction handling.

Fixes #316626

dileepyavan and others added 5 commits July 25, 2026 19:41
Signed-off-by: Dileep Yavanmandha <dileepy@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e1208fbe-68f8-47ea-a191-749bf2c4ea7b
Co-authored-by: vs-code-engineering[bot] <vs-code-engineering[bot]@users.noreply.github.com>
…groups (#327654)

Co-authored-by: vs-code-engineering[bot] <vs-code-engineering[bot]@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 27, 2026 18:37
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@anthonykim1

Matched files:

  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.ts
  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/browser/terminalSandboxService.test.ts
  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/electron-browser/runInTerminalTool.test.ts

Co-authored-by: vs-code-engineering[bot] <vs-code-engineering[bot]@users.noreply.github.com>

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

Enables terminal sandbox fallback behavior in containerized Linux environments and improves bubblewrap restriction handling.

Changes:

  • Detects AppArmor user-namespace restrictions and enables weaker nested sandboxing.
  • Automates AppArmor remediation and adds actionable failure guidance.
  • Expands sandbox helper, engine, and terminal tool tests.
Show a summary per file
File Description
src/vs/platform/sandbox/common/sandboxHelperService.ts Adds AppArmor restriction status.
src/vs/platform/sandbox/node/sandboxHelper.ts Reads the AppArmor kernel setting.
src/vs/platform/sandbox/common/terminalSandboxEngine.ts Selects nested sandbox fallback behavior.
src/vs/platform/sandbox/test/node/sandboxHelper.test.ts Updates helper expectations.
src/vs/platform/sandbox/test/common/terminalSandboxEngine.test.ts Tests nested sandbox fallback.
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.ts Automates remediation and reports restrictions.
src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/browser/terminalSandboxService.test.ts Updates prerequisite test data.
src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/electron-browser/runInTerminalTool.test.ts Tests remediation and guidance flows.

Review details

  • Files reviewed: 8/8 changed files
  • Comments generated: 3
  • Review effort level: Medium

Comment on lines +1872 to 1873
const selectedRemediation = toolSpecificData.sandboxRemediations[0] as TerminalSandboxPreCheckRemediation;
const { exitCode } = await this._terminalSandboxService.runSandboxRemediation(selectedRemediation, invocation.context.sessionResource, token, sandboxPrerequisiteTerminalOptions);
Comment on lines +336 to +340
if (missingDependencies.length === 0 && this._sandboxDependencyStatus?.bubblewrapUsable === false) {
if (this._sandboxDependencyStatus.apparmorRestrictsUnprivilegedUserNamespaces !== true || (forceRefresh && this._apparmorRemediationRequested)) {
if (!this._enableWeakerNestedSandbox) {
this._enableWeakerNestedSandbox = true;
await this.getSandboxConfigPath(true, precheckInputs);
Comment on lines +2581 to +2592
private _getBubblewrapHostRestrictedResult(): IToolResult {
const settingId = AgentSandboxSettingId.AgentSandboxEnabled;
const message = localize(
'runInTerminal.bubblewrap.hostRestriction',
"Sandbox creation failed due to host restrictions. Disable sandboxing (`{0}`).",
settingId,
);
return {
content: [{ kind: 'text', value: message }],
toolResultMessage: message,
};
}
@dileepyavan
dileepyavan marked this pull request as draft July 27, 2026 18:44
@dileepyavan dileepyavan changed the title Enable terminal sandboxing inside containers Fix issues related with sandbox repair in dev containers. Jul 27, 2026
@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Base: 1e53f489 Current: 37a8a946

No screenshot changes.

vs-code-engineering Bot and others added 4 commits July 27, 2026 21:04
Co-authored-by: vs-code-engineering[bot] <vs-code-engineering[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* [cherry-pick] Revert "rotating empty state messaging"

* Delete unused chatInputPlaceholderRotation.ts left over from conflict resolution

Co-authored-by: justschen <54879025+justschen@users.noreply.github.com>

---------

Co-authored-by: vs-code-engineering[bot] <vs-code-engineering[bot]@users.noreply.github.com>
Co-authored-by: Justin Chen <54879025+justschen@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
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.

Sandboxed Agent terminal commands fail in Linux Devcontainer

3 participants