Prompt restart for chat.agentHost.enabled setting#311531
Merged
roblourens merged 2 commits intomainfrom Apr 21, 2026
Merged
Conversation
Previously, toggling chat.agentHost.enabled at runtime required an app restart before the local agent host process actually spawned and the chat/sessions integrations registered. The setting was checked exactly once at construction time in four places, all of which early-returned if disabled. Each site now also registers a one-shot onDidChangeConfiguration listener true flip triggers setup without a restart: - src/vs/code/electron-main/app.ts: wraps the ElectronAgentHostStarter + AgentHostProcessManager construction. - src/vs/platform/agentHost/electron-browser/agentHostService.ts: AgentHostServiceClient calls _connect() on flip. - src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/ agentHostChatContribution.ts: extracted constructor body into _enable(). - src/vs/sessions/contrib/agentHost/browser/localAgentHost.contribution.ts: same one-shot pattern. Disable still requires a restart (no teardown of the singleton renderer service or utility process). Adds 5 unit tests in agentHostChatContribution.test.ts covering the gating behavior and the one-shot semantics. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes chat.agentHost.enabled take effect immediately at runtime (specifically on a false → true flip), so the local agent host process and related chat/sessions integrations can be enabled without requiring an application restart.
Changes:
- Adds one-shot
onDidChangeConfigurationlisteners in the main process, renderer agent host service, and both chat/sessions contributions to perform deferred initialization onfalse → true. - Refactors the two workbench contributions to move their gated setup into a dedicated
_enable()method. - Adds unit tests to verify initial gating behavior and one-shot enable semantics.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts | Adds unit tests validating dynamic enable gating and one-shot behavior. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostChatContribution.ts | Enables late initialization via a one-shot config-change listener and _enable() extraction. |
| src/vs/sessions/contrib/agentHost/browser/localAgentHost.contribution.ts | Mirrors the one-shot runtime enable pattern for Sessions app provider registration. |
| src/vs/platform/agentHost/electron-browser/agentHostService.ts | Defers _connect() until the setting flips on, using a one-shot listener. |
| src/vs/code/electron-main/app.ts | Defers spawning the agent host utility process until the setting flips on, using a one-shot listener. |
Copilot's findings
- Files reviewed: 5/5 changed files
- Comments generated: 1
Contributor
Replace the previous approach (one-shot config listeners in 4 files) with a single entry in SettingsChangeRelauncher.SETTINGS. Toggling the setting now shows the standard 'restart required' dialog, which is simpler and avoids races between renderer and main process setup. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
deepak1556
approved these changes
Apr 21, 2026
chat.agentHost.enabled flips onchat.agentHost.enabled setting
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.
Add
chat.agentHost.enabledto theSettingsChangeRelaunchersettings list so that toggling the setting prompts the user with the standard "A setting has changed that requires a restart" dialog.Previously the agent host wouldn't start until the next app launch after enabling the setting. This surfaces the restart prompt immediately so the user knows to restart.
(Written by Copilot)