Show disabled agent mode in mode picker when blocked by organization policy #275881
+143
−42
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.
Description
When agent mode is disabled via organization policy (
chat.agent.enabledsetting managed and set to false), it should appear in the mode picker as a greyed-out option with a lock icon, not hidden entirely.Changes
Core logic (
chatModes.ts)getBuiltinModes()now always includesChatMode.Agentregardless ofhasToolsAgentstateisAgentModePolicyDisabled()helper to detect policy-managed disabled state viaIConfigurationService.inspect().policyValueMode picker UI (
modePickerActionItem.ts)makeAction()to setenabled: falseand add lock icon when agent mode is policy-blockedKeyboard navigation (
chatExecuteActions.ts)ToggleChatModeAction.getNextMode()filters out policy-disabled modes from cycling (Ctrl+.)Session validation (
chatInputPart.ts)validateAgentMode()switches users away from agent mode if it becomes policy-disabled mid-sessioncurrentModeKindgetter considers policy-disabled state for consistent fallback to Edit/Ask modeTests (
chatModeService.test.ts)isAgentModePolicyDisabled()covering policy-enabled, policy-disabled, and no-policy scenariosPolicy Detection
Only treats as "disabled by admin" when both conditions are met:
User-disabled settings without policy are unaffected.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.