Skip to content

Enable user to repair bubble wrap incase of error due to app armor#320866

Open
dileepyavan wants to merge 4 commits into
mainfrom
DileepY/ubuntu-24.04
Open

Enable user to repair bubble wrap incase of error due to app armor#320866
dileepyavan wants to merge 4 commits into
mainfrom
DileepY/ubuntu-24.04

Conversation

@dileepyavan

@dileepyavan dileepyavan commented Jun 11, 2026

Copy link
Copy Markdown
Member

fixes: #316046

Copilot AI review requested due to automatic review settings June 11, 2026 00:23
@dileepyavan dileepyavan changed the title Dileep y/ubuntu 24.04 Enable user to repair bubble wrap incase of error due to app armor Jun 11, 2026
@vs-code-engineering

vs-code-engineering Bot commented Jun 11, 2026

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/common/terminalChatAgentToolsConfiguration.ts
  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.ts
  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/browser/terminalSandboxService.test.ts
  • src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/electron-browser/runInTerminalTool.test.ts

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

This PR improves the terminal sandbox precheck flow on Linux by distinguishing between “bubblewrap missing” vs “bubblewrap installed but unusable” (e.g. AppArmor userns restrictions), and adds a user-confirmable remediation path that can attempt to repair the environment before retrying the command.

Changes:

  • Add a bubblewrap capability probe (bubblewrapUsable + bubblewrapError) and surface a dedicated prereq failure (TerminalSandboxPrerequisiteCheck.Bubblewrap) with remediations.
  • Add a “Repair Bubblewrap Sandbox” confirmation flow and remediation execution path, including forced prereq re-check after installs/remediations.
  • Refine chat notifications to omit “exit code 0” from “command completed/terminal exited” messages, and expand/update tests.
Show a summary per file
File Description
src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/electron-browser/runInTerminalTool.test.ts Adds coverage for bubblewrap unusable + remediation/refresh flows and exit-code messaging changes.
src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/browser/terminalSandboxService.test.ts Adds tests for bubblewrap unusable reporting and remediation command execution.
src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.ts Implements runSandboxRemediation and unifies prerequisite command execution.
src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration.ts Updates sandbox filesystem setting descriptions re: workspace storage writes.
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.ts Adds bubblewrap remediation confirmation/invocation flow and omits success exit code in chat notices.
src/vs/workbench/contrib/chat/common/chatService/chatService.ts Extends terminal tool invocation data with remediation/failure fields.
src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart.ts Switches confirmation UI subpart to the generalized sandbox prerequisite confirmation.
src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatSandboxPrerequisiteConfirmationSubPart.ts New/renamed confirmation subpart for sandbox dependency/remediation confirmations.
src/vs/platform/sandbox/test/node/sandboxHelper.test.ts New unit tests for bubblewrap probing behavior in the helper service.
src/vs/platform/sandbox/test/common/terminalSandboxEngine.test.ts Updates dependency status shape and adds coverage for caching + bubblewrap remediation reporting.
src/vs/platform/sandbox/node/sandboxHelper.ts Adds bubblewrap capability probe via execFile and reports usability/error details.
src/vs/platform/sandbox/common/terminalSandboxService.ts Adds prereq check + remediation enums and exposes runSandboxRemediation on the service contract.
src/vs/platform/sandbox/common/terminalSandboxEngine.ts Surfaces bubblewrap unusable as a distinct prereq failure with remediation(s).
src/vs/platform/sandbox/common/sandboxHelperService.ts Extends dependency status to include bubblewrapUsable and bubblewrapError.
src/vs/platform/sandbox/browser/sandboxHelperService.ts Updates null helper to return bubblewrapUsable: true for browser environments.

Copilot's findings

Comments suppressed due to low confidence (1)

src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.ts:997

  • The bubblewrap remediation confirmation text is too generic for an action that runs a privileged sysctl and weakens a system security policy. The confirmation should clearly state what will be executed (including the exact command), that it requires sudo, that it changes the kernel setting (likely until reboot), and that it may reduce system security.
				message: new MarkdownString(localize(
					'runInTerminal.missingDeps.message',
					"The following dependencies required for sandboxed execution are not installed: {0}. Would you like to install them?",
  • Files reviewed: 15/15 changed files
  • Comments generated: 3

Comment on lines +26 to 28
export const enum TerminalSandboxPreCheckRemediation {
DisableUnprivilagedusernamespaceRestriction = 'disableUserNamespaceRestriction',
}
Comment on lines +295 to +297
default:
throw new Error('Unsupported sandbox remediation');
}
Comment on lines +617 to +620
/** Approved repair actions that may make an installed but unusable sandbox dependency work. */
sandboxRemediations?: string[];
/** User-visible reason a sandbox prerequisite cannot be repaired automatically. */
sandboxPrerequisiteFailure?: string;
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.

Sandbox: In ubuntu 24.04, bwrap fails fails to create user namespace if apparmor profile is not loaded that grants the access.

3 participants