Skip to content

agentHost: move IAgentHostEnablementService to platform layer and make setting private - #325008

Open
Sandeep Somavarapu (sandy081) wants to merge 4 commits into
release/1.128from
sandy081/agenthost-enablement-platform-1.128
Open

agentHost: move IAgentHostEnablementService to platform layer and make setting private#325008
Sandeep Somavarapu (sandy081) wants to merge 4 commits into
release/1.128from
sandy081/agenthost-enablement-platform-1.128

Conversation

@sandy081

Copy link
Copy Markdown
Member

Cherry-pick of #325001 onto release/1.128.

Summary

Moves IAgentHostEnablementService from the sessions layer to the platform layer so all consumers can use it. Makes the chat.agentHost.enabled setting ID private/internal — only the service reads it at runtime.

See the main PR (#325001) for full details.

1.128-specific notes

  • agentHostCopilotCliSettingsContribution.ts was added as a compatibility shim since release/1.128 does not yet have AgentHostRootConfigForwarder or copilotCliConfig
  • agentHostCopilotPromptContribution.test.ts (1.128 name) updated instead of agentHostCopilotCliSettingsContribution.test.ts

…e setting private

- Moves IAgentHostEnablementService interface and implementation from
  sessions/ to platform/agentHost/common and platform/agentHost/browser
- Merges the two agentHost config contribution files into the service
  files, making AgentHostEnabledSettingId an unexported module-private
  constant (only the service reads the config value at runtime)
- Removes the isAgentHostEnabled() helper from agentService.ts
- Adds AGENT_HOST_ENABLED_CONTEXT_KEY (RawContextKey) set eagerly by
  the service, replacing ad-hoc ContextKeyExpr.equals('config.xxx')
  expressions in when clauses
- All consumers (localAgentHostService, editorRemoteAgentHostServiceClient,
  workbench contributions, sessions providers) now inject and use
  IAgentHostEnablementService instead of reading the config directly

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ion tests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 8, 2026 18:10

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

This PR cherry-picks #325001 onto release/1.128. It relocates IAgentHostEnablementService from the sessions layer (vs/sessions/services/agentHost/common) to the platform layer (vs/platform/agentHost/common) so workbench, sessions, and platform consumers can all inject it, and it makes the chat.agentHost.enabled setting ID private — the setting is now read only through the service (fixed at startup), and when-clause consumers switch from the ad-hoc config.chat.agentHost.enabled expression to a proper AGENT_HOST_ENABLED_CONTEXT_KEY. A 1.128-specific compatibility shim re-exports the prompt contribution under its old CLI-settings name.

Changes:

  • New platform-layer service (common interface + config/context-key registration, browser implementation registered Eager, applying the policy upgrade and setting the context key).
  • Removed AgentHostEnabledSettingId/isAgentHostEnabled from agentService.ts; consumers now inject the service or use AGENT_HOST_ENABLED_CONTEXT_KEY; runtime config-change listeners dropped (enablement fixed at startup).
  • Deleted the old sessions service and agentHost.config.contribution.ts (common + browser); tests updated to stub the service directly.
Show a summary per file
File Description
platform/agentHost/common/agentHostEnablementService.ts New: interface, private setting ID, AGENT_HOST_ENABLED_CONTEXT_KEY, config registration
platform/agentHost/browser/agentHostEnablementService.ts New: impl (Eager), policy upgrade, sets context key
platform/agentHost/common/agentService.ts Removed AgentHostEnabledSettingId, isAgentHostEnabled, unused isWeb import
platform/agentHost/browser/agentHost.config.contribution.ts Deleted (merged into new service)
platform/agentHost/electron-main/electronAgentHostStarter.ts Import points to new service file
platform/agentHost/electron-browser/localAgentHostService.ts Injects service, uses enabled
workbench/.../editorRemoteAgentHostServiceClient.ts Injects service; log text hard-codes setting name
workbench/.../agentHostChatContribution.ts Uses service; keeps configurationService for later use
workbench/.../agentHostTerminalContribution.ts / agentHostCopilotPromptContribution.ts Use service; removed config-change listeners
workbench/.../agentHostSessionListContribution.ts Injects service, uses enabled
workbench/.../agentHostCopilotCliSettingsContribution.ts Now a re-export shim (1.128 compat)
workbench/.../actions/{profile,debug,exportAgentHostDebugLogs}Action.ts Use AGENT_HOST_ENABLED_CONTEXT_KEY
workbench/.../chat.shared.contribution.ts Import new service files; description text updated
workbench/workbench.desktop.main.ts / workbench.web.main.ts Register the platform service
sessions/sessions.common.main.ts Register the platform service
sessions/services/agentHost/browser/agentHostEnablementService.ts Deleted (moved to platform)
sessions/contrib/.../sessionsViewActions.ts, exportDebugLogsAction.ts, localAgentHost.contribution.ts, providers Use context key / new import path / updated descriptions
*.test.ts (chat, sessions providers) Stub IAgentHostEnablementService.enabled directly

Review details

Comments suppressed due to low confidence (1)

src/vs/platform/agentHost/common/agentHostEnablementService.ts:51

  • This nls.localize call still passes agentHostEnabledSettingId as a format argument, but the message no longer contains a {0} placeholder (it was replaced with the hard-coded `#chat.agentHost.enabled#`). The trailing argument is now dead and inconsistent with the two other identical refactors in this PR, which correctly dropped the argument (see chat.shared.contribution.ts for chat.agents.claude.preferAgentHost and localAgentHost.contribution.ts for sessions.chat.agentHost.defaultSessionsProvider). Remove the unused argument.
  • Files reviewed: 30/30 changed files
  • Comments generated: 0
  • Review effort level: Medium

…ration in agents window

- SessionsDefaultConfiguration now extends the workbench DefaultConfiguration
  (with caching) instead of the base platform one, so experiment-driven default
  overrides for settings like chat.agentHost.enabled are persisted to disk and
  read back immediately on subsequent startups - same as the editor window
- Pass IConfigurationCache and IBrowserWorkbenchEnvironmentService through to
  the ConfigurationService constructor in both desktop and web sessions mains
- hasCachedConfigurationDefaultsOverrides() now delegates to
  defaultConfiguration instead of hardcoding false
- reloadConfiguration() now always reloads defaults first via a new
  reloadDefaultConfiguration() helper; when called with
  ConfigurationTarget.DEFAULT it returns after that, matching the editor
  window's behaviour

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.

2 participants