Repository navigation
agentHost: add a macOS permission setup modal for Computer Use - #343308
Merged
Merged
Conversation
Computer Use's macOS permission prompts arrived as a new question carousel for every step, so granting Accessibility and Screen Recording meant answering a series of repeated forms. The local macOS Agent Host now recognizes those prompts by their verified source and structured choices and turns them into one setup per waiting turn. It publishes the setup as the transient root value `vscode.computerUse.status` and takes nonce-claimed requests from `vscode.computerUse.request`, answering the plugin's pending prompt over the MCP connection the Copilot runtime owns. Actions run one at a time across chats, permissions are reported only as verified by the plugin, and turn cancellation, disposal and stale requests complete each prompt exactly once. Chat shows a single card whose button opens a setup modal with live status, per-permission actions, a check when the window regains focus, and Continue once both permissions are confirmed. Other clients and hosts keep the plugin's ordinary questions, and no Agent Host Protocol types change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The setup modal only noticed a new Accessibility grant when the window regained focus. The System Settings step also assumed macOS still listed Copilot Computer Use, which it doesn't after the user removes the app. The Electron main process now forwards the macOS notification com.apple.accessibility.api to the Agent Host, which checks waiting setups again on its own. It ignores the notification while macOS shows its Accessibility prompt, because a check restarts the helper that holds the prompt open. Screen Recording keeps the focus check, since macOS reports that grant only to a new process. For the System Settings step, the modal offers the helper app as a native file drag into the permission list, plus Show in Finder. It also shows the app's own icon, read from its .icns file, with one action per permission and shorter copy. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ocessing Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> # Conflicts: # src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts
Contributor
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
3 open issues
What changed in this PR
Adds a macOS-specific “Computer Use” permission setup flow that replaces repeated plugin prompts with a single setup modal, plus the supporting host/client plumbing to publish status, request actions, and improve UX around Accessibility / Screen Recording.
Changes:
- Introduces a Computer Use setup service + modal UI (including helper-app drag-to-System Settings support) and wires it into chat rendering.
- Adds a new native host API to start a native file drag, plus macOS Accessibility trust-change reporting to re-verify automatically.
- Adds schema/metadata readers and extensive tests for the new status/request contract and UI behavior.
| File | Description |
|---|---|
| src/vs/workbench/test/electron-browser/workbenchTestServices.ts | Extends test native host service with startFileDrag API surface. |
| src/vs/workbench/contrib/chat/test/browser/agentSessions/stateToProgressAdapter.test.ts | Adds coverage for restoring Computer Use setup requests as settled cards. |
| src/vs/workbench/contrib/chat/test/browser/agentSessions/computerUseSetupDialog.test.ts | New tests for the Computer Use setup modal view/panel/dialog behavior. |
| src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts | Adds tests for rendering the setup card and opening the modal via service. |
| src/vs/workbench/contrib/chat/electron-browser/chat.contribution.ts | Registers helper-app contribution in electron chat contribution. |
| src/vs/workbench/contrib/chat/electron-browser/agentSessions/computerUseHelperApp.contribution.ts | New workbench contribution to bridge modal drag/reveal to native host APIs. |
| src/vs/workbench/contrib/chat/common/model/chatProgressTypes/chatElicitationRequestPart.ts | Adds keepActionsWhilePending to elicitation request parts. |
| src/vs/workbench/contrib/chat/common/chatService/chatService.ts | Documents/extends elicitation request API with keepActionsWhilePending. |
| src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatElicitationContentPart.ts | Keeps elicitation buttons visible while state remains pending when opted in. |
| src/vs/workbench/contrib/chat/browser/chat.shared.contribution.ts | Registers Computer Use setup service + command contribution. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/stateToProgressAdapter.ts | Converts settled setup requests into serialized elicitation cards for transcript/history. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/media/computerUseSetup.css | New styling for the Computer Use setup modal/panel. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/computerUseSetupDialog.ts | New setup modal implementation (view model + panel + dialog). |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/computerUseSetup.ts | New setup service that reads host status and opens/reveals modal. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/computerUseSetup.contribution.ts | Registers setup service singleton and “Set Up Computer Use” command. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts | Renders setup card that opens modal and ensures stable keying for in-place updates. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostChatContribution.ts | Enables setup-card UX only for supported local macOS clients/hosts. |
| src/vs/sessions/sessions.desktop.main.ts | Registers helper-app contribution for sessions desktop entrypoint. |
| src/vs/platform/native/electron-main/nativeHostMainService.ts | Implements startFileDrag in main process via webContents.startDrag. |
| src/vs/platform/native/common/native.ts | Adds startFileDrag API contract to common native host service. |
| src/vs/platform/agentHost/test/node/copilotComputerUseTestUtils.ts | New test utilities for Computer Use permission schemas + config harness. |
| src/vs/platform/agentHost/test/node/copilotComputerUsePlugin.test.ts | Adds tests for helper app path resolution and .icns icon extraction. |
| src/vs/platform/agentHost/test/node/copilotComputerUsePermissionSetup.test.ts | New comprehensive tests for permission setup orchestration and status publishing. |
| src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts | Integrates permission setup routing into agent session tests. |
| src/vs/platform/agentHost/test/node/copilotAgent.test.ts | Verifies status publishing only for local macOS agent host when enabled. |
| src/vs/platform/agentHost/test/node/agentServiceTestUtils.ts | Registers accessibility trust service in agent host test service set. |
| src/vs/platform/agentHost/test/node/agentService.test.ts | Updates management service construction to include accessibility trust service. |
| src/vs/platform/agentHost/test/common/computerUse.test.ts | New tests validating request/status/meta contract readers and invariants. |
| src/vs/platform/agentHost/node/copilot/copilotComputerUsePlugin.ts | Adds helper app path resolution and macOS .icns icon extraction helpers. |
| src/vs/platform/agentHost/node/copilot/copilotComputerUsePermissionSetup.ts | New shared setup orchestrator that publishes status + answers prompts via queued actions. |
| src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts | Routes Computer Use permission prompts through shared setup when available. |
| src/vs/platform/agentHost/node/copilot/copilotAgent.ts | Creates/disposes shared permission setup on macOS when Computer Use is enabled. |
| src/vs/platform/agentHost/node/agentHostManagementService.ts | Adds management API to report macOS Accessibility trust changes into agent host. |
| src/vs/platform/agentHost/node/agentHostMacAccessibilityTrustService.ts | New service relaying reported Accessibility trust-change signals to consumers. |
| src/vs/platform/agentHost/node/agentHostBootstrap.ts | Registers accessibility trust service in agent host runtime DI. |
| src/vs/platform/agentHost/electron-main/electronAgentHostStarter.ts | Subscribes to macOS Accessibility trust change notification and forwards to agent host. |
| src/vs/platform/agentHost/common/meta/vscode/computerUse.ts | New validating readers/writers for Computer Use status + setup-card meta. |
| src/vs/platform/agentHost/common/meta/computerUse.ts | Exposes readers and provides root-state status extraction helper. |
| src/vs/platform/agentHost/common/computerUse.ts | Defines the Computer Use status/request contract and request validator. |
| src/vs/platform/agentHost/common/agentService.ts | Adds management service API reportMacAccessibilityTrustChange. |
| src/vs/base/browser/ui/dialog/dialog.ts | Adds renderIcon option to render custom dialog icons. |
| src/vs/base/browser/ui/dialog/dialog.css | Styles dialog icon container when a custom icon is rendered. |
| build/lib/stylelint/vscode-known-variables.json | Registers new CSS custom property --computer-use-setup-stroke for linting. |
Review effort: Lite
Giuseppe Cianci (Giuspepe)
marked this pull request as ready for review
October 21, 2026 19:12
Giuseppe Cianci (Giuspepe)
enabled auto-merge (squash)
October 21, 2026 19:12
roblourens
approved these changes
Oct 21, 2026
This was referenced Oct 22, 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.

Why
Computer Use currently asks for macOS Accessibility and Screen Recording with a new question card at every step. This PR replaces those cards with one setup modal. It shows the verified state of both permissions and lets the waiting task continue once both are on.
What changed
vscode.computerUse.status. Clients act throughvscode.computerUse.request, and chat shows one card that opens the modal.com.apple.accessibility.api, so the row turns on without a click..icnsfile.Scope
Tradeoffs
app.getFileIconreturns at most 64 px and hung the main process at the large size, so the Agent Host reads the PNG from the app's icon file.Blast Radius
Chat shows the setup card only for the local Agent Host in a macOS window.
IDialogOptions.renderIconandINativeHostService.startFileDragchange nothing until a caller uses them, and the main process listens for one macOS notification while the Agent Host runs.Verification
chat.agentHost.computerUse.enabled, run/computer onin a local Copilot chat, and ask it to use an app. Set Up Computer Use in the Command Palette opens the modal any time.