Skip to content

add enable/disable ai features actions - #308988

Merged
Sandeep Somavarapu (sandy081) merged 2 commits into
mainfrom
sandy081/victorious-coral
Apr 10, 2026
Merged

Sandeep Somavarapu (sandy081) merged 2 commits into
mainfrom
sandy081/victorious-coral

Conversation

@sandy081

Copy link
Copy Markdown
Member
  • add enable/disable ai features actions
  • disable ai features when extension is disabled at workspace level

Copilot AI review requested due to automatic review settings April 10, 2026 10:15
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

Benjamin Pasero (@bpasero)

Matched files:

  • src/vs/workbench/browser/actions/helpActions.ts
  • src/vs/workbench/browser/parts/editor/editorGroupWatermark.ts

TylerLeonhardt

Matched files:

  • src/vs/workbench/contrib/authentication/browser/actions/manageTrustedMcpServersForAccountAction.ts

Johannes Rieken (@jrieken)

Matched files:

  • src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.ts

Ladislau Szomoru (@lszomoru)

Matched files:

  • src/vs/workbench/contrib/scm/browser/scm.contribution.ts
  • src/vs/workbench/contrib/scm/browser/scmInput.ts

@github-actions

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: 8b5518b0 Current: df11989b

Changed (2)

agentSessionsViewer/ApprovalRowLongLabel/Dark
Before After
before after
agentSessionsViewer/ApprovalRowLongLabel/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.

Pull request overview

This PR adds workspace-level “AI disabled” state to Chat entitlement context and wires it through various UI entry points, and introduces new extension actions intended to enable/disable AI features (especially for the default chat extension).

Changes:

  • Add a new context key/state (chatSetupDisabledInWorkspace) to represent Chat being disabled at workspace scope.
  • Gate Chat- and agent-related UI contributions (Getting Started, SCM suggestions, MCP views/commands, inline chat, help actions, etc.) on the new workspace-disabled state.
  • Add new Extensions UI actions to enable/disable AI features globally and per-workspace, and adjust migration behavior when the built-in chat extension is disabled.
Show a summary per file
File Description
src/vs/workbench/services/extensionManagement/browser/extensionEnablementService.ts Migration logic relating chat extension disablement to chat.disableAIFeatures.
src/vs/workbench/services/chat/common/chatEntitlementService.ts Introduces disabledInWorkspace sentiment/context key and propagates it via ChatEntitlementContext.
src/vs/workbench/contrib/welcomeGettingStarted/common/gettingStartedContent.ts Hides Copilot “getting started” entry points when disabled in workspace.
src/vs/workbench/contrib/scm/browser/scmInput.ts Disables SCM Chat setup suggestion when disabled in workspace.
src/vs/workbench/contrib/scm/browser/scm.contribution.ts Disables SCM merge-conflict Chat affordances when disabled in workspace.
src/vs/workbench/contrib/mcp/browser/mcpServersView.ts Hides MCP views when Chat is disabled in workspace.
src/vs/workbench/contrib/mcp/browser/mcpCommands.ts Adds workspace-disabled gating to MCP command preconditions/menus.
src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.ts Gates inline-chat action on workspace-disabled state.
src/vs/workbench/contrib/extensions/browser/extensionsActions.ts Adds “Enable/Disable AI Features” actions and customizes chat extension enablement actions.
src/vs/workbench/contrib/chat/electron-browser/agentSessions/agentSessionsActions.ts Gates “Open Agents Application” action when disabled in workspace.
src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.ts Avoids registering chat/AI providers and actions when disabled in workspace; sets disabledInWorkspace from extension enablement state.
src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.ts Updates Chat view visibility conditions to respect workspace-disabled state.
src/vs/workbench/contrib/chat/browser/agentPluginsView.ts Gates agent plugin browsing commands/menus when disabled in workspace.
src/vs/workbench/contrib/chat/browser/actions/createPluginAction.ts Gates plugin creation action when disabled in workspace.
src/vs/workbench/contrib/chat/browser/actions/chatPluginActions.ts Gates plugin marketplace actions when disabled in workspace.
src/vs/workbench/contrib/chat/browser/actions/chatActions.ts Gates chat-opening and editor context submenu when disabled in workspace.
src/vs/workbench/contrib/authentication/browser/actions/manageTrustedMcpServersForAccountAction.ts Gates MCP-trust management action when disabled in workspace.
src/vs/workbench/browser/parts/editor/editorGroupWatermark.ts Hides “Open Chat” watermark entry when disabled in workspace.
src/vs/workbench/browser/actions/helpActions.ts Hides “Ask Victor Salazar (@VScode)” when disabled in workspace.

Copilot's findings

Comments suppressed due to low confidence (2)

src/vs/workbench/services/chat/common/chatEntitlementService.ts:528

  • disabledInWorkspace is now part of sentiment, but onDidChangeSentiment is still only wired to the previous set of context keys. As a result, toggling the workspace-disabled state can leave sentimentObs/UI consumers stale. Include ChatEntitlementContextKeys.Setup.disabledInWorkspace.key in the affectsSome(...) set used to raise onDidChangeSentiment.
	get sentiment(): IChatSentiment {
		return {
			completed: this.contextKeyService.getContextKeyValue<boolean>(ChatEntitlementContextKeys.Setup.completed.key) === true,
			installed: this.contextKeyService.getContextKeyValue<boolean>(ChatEntitlementContextKeys.Setup.installed.key) === true,
			hidden: this.contextKeyService.getContextKeyValue<boolean>(ChatEntitlementContextKeys.Setup.hidden.key) === true,
			disabledInWorkspace: this.contextKeyService.getContextKeyValue<boolean>(ChatEntitlementContextKeys.Setup.disabledInWorkspace.key) === true,
			disabled: this.contextKeyService.getContextKeyValue<boolean>(ChatEntitlementContextKeys.Setup.disabled.key) === true,
			untrusted: this.contextKeyService.getContextKeyValue<boolean>(ChatEntitlementContextKeys.Setup.untrusted.key) === true,
			later: this.contextKeyService.getContextKeyValue<boolean>(ChatEntitlementContextKeys.Setup.later.key) === true,
			registered: this.contextKeyService.getContextKeyValue<boolean>(ChatEntitlementContextKeys.Setup.registered.key) === true

src/vs/workbench/services/extensionManagement/browser/extensionEnablementService.ts:156

  • The migration sets chat.disableAIFeatures=true when the builtin chat extension is disabled globally, but it does not re-enable the extension. Combined with the new Extensions UI behavior that hides regular enable/disable actions for the chat extension, this risks leaving users with a globally-disabled chat extension and no obvious way to re-enable it. Consider also enabling the chat extension here (so the setting becomes the source of truth), or ensure the UI still exposes an enable-extension action for this scenario.
				const context = (chatEntitlementService as ChatEntitlementService).context;
				if (context) {
					if (context.value.state.completed) {
						// User has used chat features before
						if (this._isDisabledGlobally({ id: this._chatExtensionId })) {
							// User had specifically disabled the chat extension to disable AI features
							if (this.configurationService.getValue('chat.disableAIFeatures') !== true) {
								// Honor that choice by disabling AI features
								this.logService.debug('Disabling AI features because builtin chat extension is disabled');
								this.configurationService.updateValue('chat.disableAIFeatures', true)
									.catch(err => this.logService.error('Failed to update chat.disableAIFeatures setting during builtin chat extension enablement migration', err));
							}
  • Files reviewed: 19/19 changed files
  • Comments generated: 3

Comment on lines +1798 to +1880
class EnableAIFeaturesGloballyAction extends ExtensionAction {

static readonly ID = 'extensions.enableAIGlobally';
static readonly LABEL = localize('enableAIGloballyAction', "Enable AI Features");

constructor(
@IProductService private readonly productService: IProductService,
@IConfigurationService private readonly configurationService: IConfigurationService,
) {
super(EnableAIFeaturesGloballyAction.ID, EnableAIFeaturesGloballyAction.LABEL, ExtensionAction.LABEL_ACTION_CLASS);
this.tooltip = localize('enableAIGloballyActionToolTip', "Enable AI features");
this.update();
}

update(): void {
this.enabled = false;
if (this.extension && ExtensionIdentifier.equals(this.extension.identifier.id, this.productService.defaultChatAgent?.chatExtensionId)) {
this.enabled = this.configurationService.getValue<boolean>(CHAT_AI_DISABLED_SETTING) === true
&& this.extension.enablementState !== EnablementState.DisabledWorkspace;
}
}

override async run(): Promise<void> {
await this.configurationService.updateValue(CHAT_AI_DISABLED_SETTING, false);
}
}

class EnableAIFeaturesInWorkspaceAction extends ExtensionAction {

static readonly ID = 'extensions.enableAIInWorkspace';
static readonly LABEL = localize('enableAIInWorkspaceAction', "Enable AI Features (Workspace)");

constructor(
@IProductService private readonly productService: IProductService,
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
) {
super(EnableAIFeaturesInWorkspaceAction.ID, EnableAIFeaturesInWorkspaceAction.LABEL, ExtensionAction.LABEL_ACTION_CLASS);
this.tooltip = localize('enableAIInWorkspaceActionToolTip', "Enable AI features in this workspace");
this.update();
}

update(): void {
this.enabled = false;
if (this.extension && this.extension.local && ExtensionIdentifier.equals(this.extension.identifier.id, this.productService.defaultChatAgent?.chatExtensionId)) {
this.enabled = this.extension.enablementState === EnablementState.DisabledWorkspace;
}
}

override async run(): Promise<void> {
if (!this.extension) {
return;
}
return this.extensionsWorkbenchService.setEnablement(this.extension, EnablementState.EnabledWorkspace);
}
}

class DisableAIFeaturesGloballyAction extends ExtensionAction {

static readonly ID = 'extensions.disableAIGlobally';
static readonly LABEL = localize('disableAIGloballyAction', "Disable AI Features");

constructor(
@IProductService private readonly productService: IProductService,
@IConfigurationService private readonly configurationService: IConfigurationService,
) {
super(DisableAIFeaturesGloballyAction.ID, DisableAIFeaturesGloballyAction.LABEL, ExtensionAction.LABEL_ACTION_CLASS);
this.tooltip = localize('disableAIGloballyActionToolTip', "Disable AI features");
this.update();
}

update(): void {
this.enabled = false;
if (this.extension && ExtensionIdentifier.equals(this.extension.identifier.id, this.productService.defaultChatAgent?.chatExtensionId)) {
this.enabled = this.extension.state === ExtensionState.Installed
&& this.configurationService.getValue<boolean>(CHAT_AI_DISABLED_SETTING) !== true
&& this.extension.enablementState !== EnablementState.DisabledWorkspace;
}
}

override async run(): Promise<void> {
await this.configurationService.updateValue(CHAT_AI_DISABLED_SETTING, true);
}
}

Copilot AI Apr 10, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EnableAIFeaturesGloballyAction / DisableAIFeaturesGloballyAction derive their enabled/hidden state from chat.disableAIFeatures but never listen for configuration changes. If the setting is changed via Settings UI or by another action, these actions can remain stale until some unrelated refresh. Register a configurationService.onDidChangeConfiguration listener (filtering on chat.disableAIFeatures) to call update().

Copilot uses AI. Check for mistakes.

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.

Sandeep Somavarapu (@sandy081) did you see this?

@sandy081
Sandeep Somavarapu (sandy081) merged commit 17c0b4f into main Apr 10, 2026
30 checks passed
@sandy081
Sandeep Somavarapu (sandy081) deleted the sandy081/victorious-coral branch April 10, 2026 10:37
@vs-code-engineering vs-code-engineering Bot added this to the 1.116.0 milestone Apr 10, 2026
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators May 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants