Skip to content

AgentHost - add per-provider enable settings for Claude/Codex#321155

Merged
TylerLeonhardt merged 2 commits into
mainfrom
agent-host-claude-codex-enabled-settings
Jun 12, 2026
Merged

AgentHost - add per-provider enable settings for Claude/Codex#321155
TylerLeonhardt merged 2 commits into
mainfrom
agent-host-claude-codex-enabled-settings

Conversation

@TylerLeonhardt

Copy link
Copy Markdown
Member

Summary

Adds two new settings to the agent host's chat.agentHost.* namespace that gate provider registration independent of SDK availability:

  • chat.agentHost.claudeAgent.enabled (default: true)
  • chat.agentHost.codexAgent.enabled (default: false)

Both compose with the existing agentSdkDownloader.isAvailable(...) check as enabled && isAvailable, so the registration condition is now "the user wants this provider AND the SDK is reachable" instead of just the latter.

Why default Claude to true?

The new setting only controls whether the agent host advertises the Claude provider — it doesn't decide whether the workbench actually surfaces it. That's still governed by chat.agents.claude.preferAgentHost (Agents window) and chat.editor.claude.preferAgentHost (sidebar), both of which default to false. So even with claudeAgent.enabled: true, the user has to opt into the agent-host Claude integration via the prefer settings before they see any behavioral change. Defaulting Claude to true keeps the agent host's provider available for users who flip the prefer settings, without forcing two opt-ins for what feels like one decision.

Codex defaults to false because there's no extension-side Codex integration today — Codex through the agent host is the only path, so making it opt-in matches its experimental status.

Plumbing

Setting → env var → process gate, identical pattern to the existing SDK-root overrides:

  1. Settings registered in agentHostStarter.config.contribution.ts.
  2. IAgentSdkStarterSettings / buildAgentSdkEnv in agentService.ts get two new boolean fields, forwarded as VSCODE_AGENT_HOST_{CLAUDE,CODEX}_AGENT_ENABLED.
  3. Both starters (electronAgentHostStarter.ts, nodeAgentHostStarter.ts) read the settings and pass them through buildAgentSdkEnv.
  4. agentHostMain.ts and agentHostServerMain.ts read the env vars via a new shared isAgentEnabled() helper that handles the defaults (Claude → true, Codex → false) when the env var is absent.

Test plan

Manually verified all combinations end-to-end via the Agents window provider picker, with a dev SDK root pointed at a sibling checkout:

  • defaults (Claude unset, Codex unset) → log shows copilotcli, claude; picker shows Copilot CLI + Claude under Local Agent Host
  • both enabled → log shows copilotcli, claude, codex; picker shows all three
  • Claude off, Codex on → log shows copilotcli, codex; picker shows Copilot CLI + Codex
  • both disabled → log shows only copilotcli; picker shows only Copilot CLI under Local Agent Host
  • Claude explicitly true, Codex explicitly false → matches defaults

🤖 Generated with Claude Code

Adds two settings that gate provider registration in the agent host
process, independent of the SDK availability check that was the only
gate before:

- chat.agentHost.claudeAgent.enabled (default: true)
- chat.agentHost.codexAgent.enabled  (default: false)

The agent host's `chat.agentHost.*` namespace already had:
- `chat.agentHost.enabled` — master switch for spawning the host
- `chat.agentHost.claudeAgent.sdkRoot` / `chat.agentHost.codexAgent.sdkRoot`
  — dev-only path overrides for the SDK
- `chat.agentHost.codexAgent.codexHome` / `binaryArgs` — Codex runtime knobs

Provider registration in `agentHostMain.ts` / `agentHostServerMain.ts`
was previously gated only on `agentSdkDownloader.isAvailable(...)`,
which checks whether the SDK is reachable (dev override env var or a
`product.agentSdks.<pkg>` entry). The new settings compose with that
gate as `enabled && isAvailable`, giving users a way to suppress
Claude/Codex even when the SDK ships.

Wired through both starters (`electronAgentHostStarter.ts`,
`nodeAgentHostStarter.ts`) via a new field on `IAgentSdkStarterSettings`
and forwarded to the child process as
`VSCODE_AGENT_HOST_{CLAUDE,CODEX}_AGENT_ENABLED` env vars. The host
reads them through a shared `isAgentEnabled()` helper that defaults
to `true` for Claude and `false` for Codex when the env var is absent
(matches the setting defaults).

Note: this is independent of `chat.agents.claude.preferAgentHost` and
`chat.editor.claude.preferAgentHost`, which decide whether the
workbench surfaces the agent host's Claude provider vs. the GitHub
Copilot Chat extension's. The new settings control whether the agent
host advertises the provider at all.

Verified end-to-end with all four enable/disable combinations in the
Agents window picker.
Copilot AI review requested due to automatic review settings June 12, 2026 14:17

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

Adds per-provider enable/disable toggles under chat.agentHost.* to gate Claude/Codex provider registration independently of SDK reachability, wiring the settings through the starters as env vars and enforcing them in both the utility-process agent host and the standalone server entrypoint.

Changes:

  • Register new settings chat.agentHost.claudeAgent.enabled (default true) and chat.agentHost.codexAgent.enabled (default false) in the agent host starter config contribution.
  • Forward the new toggles from settings → env vars via buildAgentSdkEnv(...), and read them via a shared isAgentEnabled(...) helper.
  • Apply the enable gates in both agentHostMain.ts and agentHostServerMain.ts in addition to the existing agentSdkDownloader.isAvailable(...) checks.
Show a summary per file
File Description
src/vs/platform/agentHost/node/nodeAgentHostStarter.ts Reads new enable settings and forwards them into the spawned agent host environment.
src/vs/platform/agentHost/node/agentHostServerMain.ts Applies enable gating (env-driven) alongside SDK availability when registering providers in standalone server mode.
src/vs/platform/agentHost/node/agentHostMain.ts Applies enable gating (env-driven) alongside SDK availability when registering providers in the agent host process.
src/vs/platform/agentHost/electron-main/electronAgentHostStarter.ts Reads new enable settings and forwards them into the spawned agent host environment (desktop main process).
src/vs/platform/agentHost/common/agentService.ts Introduces setting/env-var identifiers, isAgentEnabled(...), and env fan-out for the new toggles.
src/vs/platform/agentHost/common/agentHostStarter.config.contribution.ts Registers the new user-facing configuration properties with defaults and descriptions.

Copilot's findings

  • Files reviewed: 6/6 changed files
  • Comments generated: 2

Comment thread src/vs/platform/agentHost/common/agentService.ts Outdated
Comment thread src/vs/platform/agentHost/common/agentService.ts
- JSDoc on `isAgentEnabled` now matches the implementation: lists all
  recognized values (`'true'`/`'1'` enable, `'false'`/`'0'` disable, anything
  else falls through to the default) instead of implying only `'false'`
  disables.
- New table-driven test suite covering undefined / empty / whitespace
  fallback to default, case-insensitive `'true'`/`'TRUE'`/`'false'`/`'FALSE'`,
  trimmed values, numeric `'1'`/`'0'`, and unrecognized values falling back.
@TylerLeonhardt TylerLeonhardt merged commit 319db25 into main Jun 12, 2026
25 checks passed
@TylerLeonhardt TylerLeonhardt deleted the agent-host-claude-codex-enabled-settings branch June 12, 2026 19:13
@vs-code-engineering vs-code-engineering Bot added this to the 1.125.0 milestone Jun 12, 2026
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