Repository navigation
Skip chat extension enablement change when locked by environment - #315453
Merged
Dmitriy Vasyura (dmitrivMS) merged 2 commits intoMay 19, 2026
Merged
Conversation
When chat.disableAIFeatures is true and the chat extension is in a non-changeable enablement state (DisabledByExtensionKind, DisabledByVirtualWorkspace, DisabledByAllowlist, etc.), ChatTeardownContribution.maybeEnableOrDisableExtension calls setEnablement which throws an unhandled error. Guard with canChangeEnablement / canChangeWorkspaceEnablement before calling. Fixes #312381
Dmitriy Vasyura (dmitrivMS)
requested review from
Copilot and
Sandeep Somavarapu (sandy081)
May 9, 2026 11:36
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
May 9, 2026 11:38
Contributor
There was a problem hiding this comment.
Pull request overview
Reduces high-volume unhandled errors in the chat teardown path by avoiding enablement changes for the GitHub Copilot Chat extension when its enablement is locked by environment/workspace constraints (e.g. disallowed, extension kind, virtual workspace).
Changes:
- Early-return from
maybeEnableOrDisableExtensionwhen the chat extension isn’t locally available. - Guard
setEnablementwithIWorkbenchExtensionEnablementService.canChangeEnablement/canChangeWorkspaceEnablementto avoid throwing for locked enablement states.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.ts | Adds enablement-change guardrails before calling setEnablement to prevent unhandled errors/telemetry noise when enablement is not changeable. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 0
Contributor
Screenshot ChangesBase: Changed (24) |
Sandeep Somavarapu (sandy081)
approved these changes
May 19, 2026
Dmitriy Vasyura (dmitrivMS)
deleted the
dev/dmitriv/unhandled-enablement-error
branch
May 19, 2026 12:58
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #312381
When
chat.disableAIFeaturesistrueand the GitHub Copilot Chat extension is in a non-changeable enablement state (e.g.DisabledByExtensionKind,DisabledByVirtualWorkspace,DisabledByAllowlist),ChatTeardownContribution.maybeEnableOrDisableExtensioncallssetEnablement, which throws an unhandled error.Guard with
canChangeEnablement/canChangeWorkspaceEnablementbefore callingsetEnablement. If the enablement is locked by the environment, bail out early.Repro Steps
"chat.disableAIFeatures": truein user settingsActual
Error in console:
ERR Cannot change enablement of GitHub Copilot Chat extension because of its extension kind: Error: Cannot change enablement of GitHub Copilot Chat extension because of its extension kind
at $tt.throwErrorIfEnablementStateCannotBeChanged (vscode-file://vscode-app/c:/Users/dmitriv/AppData/Local/Programs/Microsoft%20VS%20Code%20Insiders/3b8129f1d0/resources/app/out/vs/workbench/workbench.desktop.main.js:1827:19861)
at $tt.throwErrorIfCannotChangeEnablement (vscode-file://vscode-app/c:/Users/dmitriv/AppData/Local/Programs/Microsoft%20VS%20Code%20Insiders/3b8129f1d0/resources/app/out/vs/workbench/workbench.desktop.main.js:1827:19479)
at $tt.setEnablement (vscode-file://vscode-app/c:/Users/dmitriv/AppData/Local/Programs/Microsoft%20VS%20Code%20Insiders/3b8129f1d0/resources/app/out/vs/workbench/workbench.desktop.main.js:1827:20777)
at async o9.doSetEnablement (vscode-file://vscode-app/c:/Users/dmitriv/AppData/Local/Programs/Microsoft%20VS%20Code%20Insiders/3b8129f1d0/resources/app/out/vs/workbench/workbench.desktop.main.js:3650:55631)
at async Nve.maybeEnableOrDisableExtension (vscode-file://vscode-app/c:/Users/dmitriv/AppData/Local/Programs/Microsoft%20VS%20Code%20Insiders/3b8129f1d0/resources/app/out/vs/workbench/workbench.desktop.main.js:3304:48432)
Expected
No error.