Skip to content

agentHost: let the agent ask to turn on Computer Use - #343469

Merged
Giuseppe Cianci (Giuspepe) merged 3 commits into
mainfrom
agents/computer-use-activation
Oct 22, 2026
Merged

Giuseppe Cianci (Giuspepe) merged 3 commits into
mainfrom
agents/computer-use-activation

Conversation

@Giuspepe

@Giuspepe Giuseppe Cianci (Giuspepe) commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #343308.

The Copilot runtime keeps its built-in Computer Use plugin off until the user runs /computer on. With chat.agentHost.computerUse.enabled on, 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_use tool. Calling it shows a "Turn on Computer Use?" card with the agent's reason. Turn On calls plugins.enable for computer-use, which is what /computer on does. The runtime saves the choice in $COPILOT_HOME/settings.json and starts the Computer Use MCP server before the call returns, so the tools work in the same turn.

Changing chat.agentHost.computerUse.enabled now also offers a restart, like chat.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

  • At most once per chat. After Not Now, the tool tells the model to continue without Computer Use and to point the user to /computer on.
  • Not in autopilot, with automatic replies, or outside a running turn. The tool tells the model the user can run /computer on.
  • Not when managed settings set features.computerUse to false.
  • Not in chats with their own GitHub credentials, because their runtime doesn't have the plugin.

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

  • Tools are fixed when a session launches, so the tool is added only when the plugin is off at launch. If the plugin is turned on later, the tool answers that it is already on.
  • The runtime's plugin list can't tell "turned off with /computer off" apart from "never turned on". Users who ran /computer off still see the card once per chat.
  • There is no telemetry for card outcomes yet.

How to test

  1. Turn on chat.agentHost.computerUse.enabled. VS Code offers to restart. Launch with COPILOT_HOME set to a temporary folder if you don't want to change your real Copilot settings.
  2. Start a new chat with the Copilot (Agent Host) session type.
  3. Ask "Open the Calculator app on my Mac and use it to compute 12 times 7."
  4. The agent shows the card. Turn On makes the Computer Use tools available in the same turn. Not Now makes the agent continue without them, and it doesn't ask again in that chat.
  5. Run /computer off to turn it off again.

Validation

  • Unit tests passed, 2646 tests:
    ./scripts/test.sh --run src/vs/platform/agentHost/test/node/copilotComputerUseActivationTool.test.ts --run src/vs/platform/agentHost/test/common/computerUse.test.ts --run src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts --run src/vs/platform/agentHost/test/node/copilotSessionLauncher.test.ts --run src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts --run src/vs/workbench/contrib/chat/test/browser/agentSessions/stateToProgressAdapter.test.ts
    
  • ./scripts/test.sh --run src/vs/workbench/contrib/relauncher/test/browser/relauncher.test.ts passed, 8 tests. The new restart test fails without the relauncher change.
  • npm run typecheck-client passed.
  • npm run valid-layers-check passed.
  • npm run eslint reported no problems on the 19 changed files.
  • Manual run in Code OSS on macOS with a temporary COPILOT_HOME. The model called the tool on its own. Turn On wrote enabledPlugins.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 off turned it off, and a new chat asked again.

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>
Copilot AI balanced review requested due to automatic review settings October 22, 2026 10:47
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>

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.

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
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>
@Giuspepe
Giuseppe Cianci (Giuspepe) merged commit f2b5f7d into main Oct 22, 2026
105 of 107 checks passed
@Giuspepe
Giuseppe Cianci (Giuspepe) deleted the agents/computer-use-activation branch October 22, 2026 13:26
@vs-code-engineering vs-code-engineering Bot added this to the 1.144.0 milestone Oct 22, 2026
Sandeep Somavarapu (sandy081) added a commit that referenced this pull request Oct 22, 2026
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>
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>
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.

3 participants