Skip to content

Agent Host: stop delivering standalone customizations as plugin content - #340079

Merged
Anthony Kim (anthonykim1) merged 2 commits into
mainfrom
anthonykim1/selective-customization-lockdown
Oct 7, 2026
Merged

Anthony Kim (anthonykim1) merged 2 commits into
mainfrom
anthonykim1/selective-customization-lockdown

Conversation

@anthonykim1

@anthonykim1 Anthony Kim (anthonykim1) commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Part of: https://github.com/microsoft/vscode-internalbacklog/issues/8826

TL;DR: VS Code bundles the skills, agents, and MCP servers it forwards into a synthetic "VS Code Synced Data" plugin (SyncedCustomizationBundler), and the Agent Host passes it in pluginDirectories. The runtime loads those skills as plugin skills, so the skills lockdown skipped them. Forwarded MCP servers were already registered through session config, and bundled agents weren't exposed. Fix: send user/workspace skills and agents, and all forwarded MCP servers, through skillDirectories, customAgents, and mcpServers, so the runtime filters them itself. Extension and built-in skills and agents stay in the synced plugin.

Current flow

  • resolveCustomizationRefs bundles loose skills, agents, instructions, prompt files, and forwarded MCP servers into "VS Code Synced Data".
  • The Copilot Agent Host copies the bundle to disk and passes it in pluginDirectories.
  • The runtime loads those skills as plugin skills, so the skills lock doesn't apply. MCP servers already go through session config, and agents in the bundle aren't exposed.

New flow

  • User/workspace skills and agents, plus every forwarded MCP server, go to a second bundle marked with _meta vscode.standaloneCustomizations: true.
  • For that bundle, the host drops pluginDir, so skills go through skillDirectories, agents through customAgents, and MCP servers through session mcpServers, where the runtime applies the lockdown. resourceDir keeps reads of its files auto-approved.
  • Extension and built-in skills and agents, instructions, and prompt files stay in "VS Code Synced Data".
  • Hosts that ignore the marker (Claude, Codex) keep treating the bundle as a plugin.

Not in this PR

  • Array support in the workbench (Local harness and UI), which still reads only the boolean setting.
  • Hooks: VS Code doesn't forward them, so the runtime already governs the ones it discovers.

Risks

  • Behavior change: forwarded agents now reach the runtime, so without a lockdown they're available as subagents.
  • The customAgents converter carries name, description, model, reasoning effort, tools, skills, infer, and the prompt; other agent frontmatter is dropped.
  • Ephemeral sessions (inline and terminal chat) skip customAgents and session-config MCP servers, so moved agents and MCP servers don't reach them.
  • Moved items get a new client plugin URI, so host-side enablement may reset once.

How to test

Manual before/after verification with screenshots: #340079 (comment)

  1. Serve {"strictPluginOnlyCustomization": ["skills", "agents", "mcp"]} through the mock policy server (.github/skills/policy-and-managed-settings/local-testing.md).
  2. Configure a skill and an agent with chat.agentSkillsLocations and chat.agentFilesLocations, add a server to the user mcp.json, and start a Copilot Agent Host session.
  3. /env shouldn't list the skill or the server, and the model can't run the agent. Without the lockdown, all three work.

Automated: the targeted suites pass (93, 1524, and 1878 passing), and ESLint is clean. npm run typecheck-client reports no new errors; my local node_modules is stale, so CI is the real check.

Commands
npm run transpile-client

./scripts/test.sh \
	--run src/vs/workbench/contrib/chat/test/browser/agentSessions/resolveCustomizationRefs.test.ts \
	--run src/vs/workbench/contrib/chat/test/browser/agentSessions/syncedCustomizationBundler.test.ts

./scripts/test.sh \
	--run src/vs/sessions/contrib/providers/agentHost/test/browser/agentHostAutomationStore.test.ts \
	--run src/vs/sessions/contrib/providers/agentHost/test/browser/localAgentHostSessionsProvider.test.ts \
	--run src/vs/sessions/contrib/providers/remoteAgentHost/test/browser/remoteAgentHostSessionsProvider.test.ts \
	--run src/vs/sessions/services/agentHost/test/browser/agentHostCustomizationService.test.ts \
	--run src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts \
	--run src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostClientTools.test.ts \
	--run src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostCustomizationService.test.ts \
	--run src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostUntitledProvisionalSessionService.test.ts \
	--run src/vs/workbench/contrib/chat/test/browser/agentSessions/enumerateLocalCustomizationsForHarness.test.ts \
	--run src/vs/workbench/contrib/chat/test/browser/agentSessions/workbenchAgentHostCustomizationService.test.ts \
	--run src/vs/workbench/contrib/chat/test/browser/aiCustomization/customizationMigrationServiceImpl.test.ts \
	--run src/vs/workbench/contrib/chat/test/browser/aiCustomization/customizationsTelemetryService.test.ts

./scripts/test.sh \
	--run src/vs/platform/agentHost/test/node/copilotAgent.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/platform/agentHost/test/node/copilotPluginConverters.test.ts \
	--run src/vs/platform/agentHost/test/node/claudeAgent.test.ts \
	--run src/vs/platform/agentHost/test/node/codex/codexClientCustomizations.test.ts \
	--run src/vs/platform/agentHost/test/common/agentMetaReaders.test.ts

npx eslint --max-warnings 0 $(git diff --name-only HEAD~1 -- '*.ts')

npm run typecheck-client

Inspirations from:

VS Code bundled forwarded user and workspace skills and agents, and the
MCP servers it forwards, into the synthetic "VS Code Synced Data" plugin.
The Copilot Agent Host passed that bundle in `pluginDirectories`, so the
runtime treated everything inside as plugin content and
`strictPluginOnlyCustomization`, including its array form, skipped it.

Bundle those items separately and mark the bundle as standalone. The host
passes them through the SDK's `skillDirectories`, `customAgents`, and
session `mcpServers`, so the runtime applies its own lockdown to them.
Extension and built-in skills and agents, instructions, and prompt files
stay in the synced plugin.
Copilot AI balanced review requested due to automatic review settings October 6, 2026 15:59
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: 3dabe9b5 Current: 63bf80e2

Changed (1)

sessions/sessionChatInputToolbar/SessionChatPills_HorizontalOverflow/Light
Before After
before after

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.

Copilot review overview

🔵 Needs a closer look

Security-sensitive runtime lockdown enforcement remains unverified beyond mocked SDK routing tests.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Separates forwarded standalone customizations from plugin content so Copilot Agent Host can delegate lockdown enforcement to the runtime.

Changes:

  • Adds a separate, marked bundle for standalone customizations.
  • Routes marked content through non-plugin SDK options while preserving trusted resource reads.
  • Updates routing tests and policy documentation.
File Description
src/​vs/​workbench/​contrib/​chat/​test/​browser/​agentSessions/​syncedCustomizationBundler.test.ts Tests standalone bundle metadata.
src/​vs/​workbench/​contrib/​chat/​test/​browser/​agentSessions/​resolveCustomizationRefs.test.ts Tests split customization routing.
src/​vs/​workbench/​contrib/​chat/​common/​plugins/​AGENTS_PLUGINS.md Documents standalone delivery.
src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​syncedCustomizationBundler.ts Adds standalone bundle support.
src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​agentHostLocalCustomizations.ts Separates standalone files and forwarded MCP servers.
src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​agentHostActiveClientService.ts Manages both bundlers and their lookups.
src/​vs/​platform/​agentHost/​test/​node/​copilotAgent.test.ts Tests projected SDK options.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgentSession.ts Preserves trusted bundle reads.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgent.ts Removes standalone bundles from plugin-directory delivery.
src/​vs/​platform/​agentHost/​common/​meta/​vscode/​clientPluginCustomizationMeta.ts Adds standalone marker helpers.
src/​vs/​platform/​agentHost/​common/​meta/​clientPluginCustomizationMeta.ts Exports marker helpers.
src/​vs/​platform/​agentHost/​common/​agentHostPolicySupport.ts Clarifies partial-policy support comments.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@anthonykim1

Anthony Kim (anthonykim1) commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor Author

Verified on macOS 26.7 arm64 with Code OSS Dev 1.142.0, comparing main without this PR (c1239d20320) against this PR (a6a4f2fe1ec).

Setup: {"strictPluginOnlyCustomization": ["skills", "agents", "mcp"]} served only to the Copilot runtime (mock policy server + COPILOT_DEBUG_GITHUB_API_URL). The workspace had a skill and an agent in configured non-default folders, a server in the user mcp.json, and a .github/ skill and agent as controls. I checked the runtime's /env output and asked the model to run the configured agent as a subagent.

Results:

  • Skills (fixed): without this PR, the configured skill loaded as a plugin skill despite the lockdown. With this PR it's blocked, and it still loads when the lockdown is off.
  • MCP (unchanged): the mcp.json server is blocked under the lockdown with or without this PR, and connects when the lockdown is off.
  • Agents (behavior change): without this PR, the configured agent wasn't available to the runtime, even with the lockdown off. With this PR it's blocked under the lockdown and runs as a subagent when the lockdown is off.
  • The .github/ skill was blocked under the lockdown in both builds, so the lockdown was active.

Screenshots are collapsed. Click a section below to expand it.

Runtime policy: the lockdown reached the runtime

The runtime's server layer has strictPluginOnlyCustomization: ["skills", "agents", "mcp"], so every lockdown run below had it applied.

Policy Diagnostics: the runtime's server layer sets strictPluginOnlyCustomization to skills, agents, and mcp

Before (without this PR, lockdown on): bad, the configured skill still loads

configured-probe-skill is listed as a (Plugin) skill from "VS Code Synced Data". The lockdown blocks skills, so it shouldn't be there.

Without this PR, lockdown on: /env lists configured-probe-skill as a Plugin skill

After (with this PR, lockdown on): good, the configured skill and agent are blocked

configured-probe-skill is gone, and only VS Code's built-in plugin skills remain. The model can't run configured-probe-agent either.

With this PR, lockdown on: configured-probe-skill is gone from /env

With this PR, lockdown on: configured-probe-agent is unavailable

Control (with this PR, lockdown off): good, forwarded items still reach the runtime

configured-probe-skill loads as (Custom), lockdown-probe-mcp connects, and configured-probe-agent runs as a subagent, so the fix didn't break delivery.

With this PR, lockdown off: configured-probe-skill loads as Custom and lockdown-probe-mcp connects

With this PR, lockdown off: configured-probe-agent runs as a subagent

Control (without this PR, lockdown off): the MCP server works, but the agent isn't available

lockdown-probe-mcp connects here, so its absence under the lockdown was enforcement, not a broken server. configured-probe-agent is unavailable even with the lockdown off.

Without this PR, lockdown off: lockdown-probe-mcp connects

Without this PR, lockdown off: configured-probe-agent is unavailable

The test build reused node_modules and built-in extensions from another local VS Code checkout, so the runtime came from @github/copilot-sdk 1.0.17-preview.0, which includes the array lockdown.

Addresses review thread #340079 (comment).
The unit test only checked SDK routing. This host-only E2E test serves
strictPluginOnlyCustomization ["skills", "agents", "mcp"] to the bundled
runtime and reads its /env report: a standalone skill and MCP server are
blocked while a plugin skill still loads, and both return once the policy
is removed.
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