Repository navigation
agentHost: let the agent ask to turn on Computer Use - #343469
Merged
Merged
Conversation
The Copilot runtime keeps its built-in Computer Use plugin off until the user runs /computer on. Users have to know that command. While VS Code registers the plugin and it is still off, the Agent Host now gives the model an enable_computer_use tool. Calling it shows a "Turn on Computer Use?" card with the agent's reason. Turn On does what /computer on does, and the Computer Use tools work in the same turn. The card shows at most once per chat. It doesn't show in autopilot, with automatic replies, outside a running turn, in chats with their own GitHub credentials, or when managed settings turn Computer Use off. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The Copilot runtime registers its Computer Use plugin when it starts, and chats keep the tools they started with. Changing chat.agentHost.computerUse.enabled now offers to restart, like chat.agentHost.claudeAgent.enabled. An experiment changing the default value doesn't prompt. The setting's description now also says that the agent can ask to turn Computer Use on. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
4 open issues
The activation reason length limit differs from the tool’s runtime trimming (`MAX_REASON_LENGTH =… · New The activation reason length limit differs from the tool’s runtime trimming (`MAX_REASON_LENGTH =… · New The user-facing activation message text is duplicated (also built in… · New_requestWaitersis never cleaned up after a waiter is satisfied, sorequestInputrepeatedly… · New
What changed in this PR
Enables Copilot Agent Host sessions to let the model request user opt-in for “Computer Use” via an in-chat activation card and tool (enable_computer_use), so the feature can be turned on in the same turn without requiring the user to know /computer on.
Changes:
- Adds a Computer Use activation tool to Agent Host sessions when the runtime plugin is present but disabled, and wires it through session/tool plumbing.
- Renders/restores a compact “Turn on Computer Use?” elicitation card (including message escaping and history restoration).
- Updates settings/relauncher behavior and extends tests across agent host, UI adapter, and session launcher.
| File | Description |
|---|---|
| src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts | Triggers restart prompt when the Computer Use enablement setting changes. |
| src/vs/workbench/contrib/relauncher/test/browser/relauncher.test.ts | Adds coverage ensuring the new setting prompts restart. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/stateToProgressAdapter.ts | Restores Computer Use activation requests into a settled elicitation card in history. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/computerUseSetup.ts | Adds localized/escaped text builder for the activation card message. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts | Renders activation request as a compact card and settles it based on completion/answers. |
| src/vs/platform/agentHost/node/copilot/copilotSessionLauncher.ts | Includes activation tools in session tool list (excluding ephemeral sessions). |
| src/vs/platform/agentHost/node/copilot/copilotComputerUseActivationTool.ts | Introduces the enable_computer_use tool and activation flow (policy, decline memory, enable plugin). |
| src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts | Wires activation tool into session lifecycle and input responses; observes managed settings. |
| src/vs/platform/agentHost/node/copilot/copilotToolDisplay.ts | Hides the activation tool from transcript tool-call rendering. |
| src/vs/platform/agentHost/common/computerUse.ts | Extends the Computer Use contract with activation meta key + question ids/choices. |
| src/vs/platform/agentHost/common/meta/vscode/computerUse.ts | Adds meta helpers to tag/read activation cards and determine accepted “Turn On”. |
| src/vs/platform/agentHost/common/meta/computerUse.ts | Re-exports activation meta helpers. |
| src/vs/platform/agentHost/common/agentHostStarter.config.contribution.ts | Updates setting description to mention agent-driven prompting and restart requirement. |
| src/vs/platform/agentHost/test/node/copilotComputerUseActivationTool.test.ts | Adds dedicated unit tests for activation tool outcomes and behavior. |
| src/vs/platform/agentHost/test/node/copilotSessionLauncher.test.ts | Verifies activation tools are added except for ephemeral chats. |
| src/vs/platform/agentHost/test/common/computerUse.test.ts | Validates activation meta contract and acceptance rules. |
| src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts | Verifies UI rendering/accept/reject behavior of the activation card. |
| src/vs/workbench/contrib/chat/test/browser/agentSessions/stateToProgressAdapter.test.ts | Verifies activation card restoration into history and acceptance semantics. |
Review effort: Lite
The Agent Host's request and VS Code's card now build the explanation with one helper, so the copy and its translation can't drift. The tool's trimming and the card reader use one reason limit, so a host can't send a reason the reader drops. The activation test chat also drops request waiters once they resolve. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Giuseppe Cianci (Giuspepe)
marked this pull request as ready for review
October 22, 2026 13:10
Giuseppe Cianci (Giuspepe)
enabled auto-merge (squash)
October 22, 2026 13:11
Dirk Bäumer (dbaeumer)
approved these changes
Oct 22, 2026
Megan Rogge (meganrogge)
added a commit
that referenced
this pull request
Oct 22, 2026
…launcher test (#343504) #343282 made discoveredAgents and additionalRootInstructions required on the client snapshot, while #343469 added a test whose snapshot omits them, so getCopilotCustomAgents throws on main. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sandeep Somavarapu (sandy081)
added a commit
that referenced
this pull request
Oct 22, 2026
…343496) * sessions: expand a collapsed chat group when its chat becomes active Picking the main session from the sessions list changes the active chat without focusing its group, so a group squeezed to its minimum size was not expanded, unlike when the group is clicked directly. Fixes #341126 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: name the collapse tolerance in the chat group expand test Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: complete the snapshot in the Computer Use launcher test The test added in #343469 builds a customization snapshot without discoveredAgents, which became required in #343282, so _buildSessionConfig throws "discoveredAgents is not iterable". Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.


Follow-up to #343308.
The Copilot runtime keeps its built-in Computer Use plugin off until the user runs
/computer on. Withchat.agentHost.computerUse.enabledon, VS Code registers the plugin, but users still have to know that command.This PR lets the agent ask instead. While the plugin is registered and off, the Agent Host gives the model an
enable_computer_usetool. Calling it shows a "Turn on Computer Use?" card with the agent's reason. Turn On callsplugins.enableforcomputer-use, which is what/computer ondoes. The runtime saves the choice in$COPILOT_HOME/settings.jsonand starts the Computer Use MCP server before the call returns, so the tools work in the same turn.Changing
chat.agentHost.computerUse.enablednow also offers a restart, likechat.agentHost.claudeAgent.enabled. The runtime registers the plugin when it starts, and chats keep the tools they started with. An experiment changing the default value doesn't prompt.When the card shows
/computer on./computer on.features.computerUsetofalse.The tool is hidden from the transcript because the card is what the user sees. The card is restored from history. The agent's reason is trimmed and escaped, so it renders as plain text.
Notes for reviewers
/computer off" apart from "never turned on". Users who ran/computer offstill see the card once per chat.How to test
chat.agentHost.computerUse.enabled. VS Code offers to restart. Launch withCOPILOT_HOMEset to a temporary folder if you don't want to change your real Copilot settings./computer offto turn it off again.Validation
./scripts/test.sh --run src/vs/workbench/contrib/relauncher/test/browser/relauncher.test.tspassed, 8 tests. The new restart test fails without the relauncher change.npm run typecheck-clientpassed.npm run valid-layers-checkpassed.npm run eslintreported no problems on the 19 changed files.COPILOT_HOME. The model called the tool on its own. Turn On wroteenabledPlugins.computer-use: true, and the model listed the 10 Computer Use tools in the same turn. Not Now showed no second card in that chat./computer offturned it off, and a new chat asked again.