Skip to content

Load managed-settings.json from well-known disk path#321870

Merged
joshspicer merged 1 commit into
mainfrom
joshspicer/file-managed-settings
Jun 24, 2026
Merged

Load managed-settings.json from well-known disk path#321870
joshspicer merged 1 commit into
mainfrom
joshspicer/file-managed-settings

Conversation

@joshspicer

@joshspicer joshspicer commented Jun 18, 2026

Copy link
Copy Markdown
Member

Adds a file-based delivery channel for Copilot managed settings, so enterprises using config management (Chef, Puppet, Ansible) can deploy settings without MDM.

The main process reads managed-settings.json from a well-known per-OS path and exposes it to renderer windows over IPC, mirroring the existing server and native-MDM channels.

Platform Path
macOS /Library/Application Support/GitHubCopilot/managed-settings.json
Windows %ProgramFiles%\GitHubCopilot\managed-settings.json
Linux /etc/github-copilot/managed-settings.json

Precedence

Server > native MDM > file — a single authoritative source wins; the channels are not merged. The file channel slots in as the lowest precedence via the shared selectManagedSettings(server, nativeMdm, file).

Notes

  • normalizeManagedSettings() is the single normalizer shared by all channels (the server adapter adaptManagedSettings() is now a thin wrapper around it).
  • FileManagedSettingsService reads/watches the file via IFileService (follows the FilePolicyService pattern); IPC follows CopilotManagedSettingsIpc.
  • Developer: Policy Diagnostics gains a File section, a 'file' active-source label, and now attributes managed-settings-driven policies to their actual channel (e.g. Managed Settings: File (managed-settings.json)) instead of the generic AccountPolicyService.

Rebased onto latest main and aligned with the managed-settings refactor in #322439.

Ref: microsoft/vscode-internalbacklog#7932

Copilot AI review requested due to automatic review settings June 18, 2026 02:30

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 a file-based delivery channel for Copilot managed settings (read from a well-known path on disk) and wires it into the existing policy/managed-settings pipeline so enterprise configuration management tools can deploy settings without MDM.

Changes:

  • Introduces FileManagedSettingsService to read + watch managed-settings.json and normalizes it via a shared normalizeManagedSettings() path.
  • Adds IPC plumbing (FileManagedSettingsChannel/Client) and wires the client into both the desktop workbench window and the Agents window so file-based managed settings participate in policy evaluation.
  • Extends policy export to include cross-window policyReference settings via a shared external manifest (externalPolicyReferences), and updates the generated policyData.jsonc.
Show a summary per file
File Description
src/vs/workbench/services/policies/common/accountPolicyService.ts Merges file-based managed settings at lowest priority into account policy data.
src/vs/workbench/services/accounts/browser/managedSettings.ts Switches server response adaptation to the shared managed-settings normalizer.
src/vs/workbench/electron-browser/desktop.main.ts Wires up the file-based managed settings IPC client and passes it into AccountPolicyService.
src/vs/workbench/contrib/policyExport/electron-browser/policyExport.contribution.ts Includes cross-window external policyReference settings in exported policy catalog.
src/vs/sessions/electron-browser/sessions.main.ts Wires up the file-based managed settings IPC client for the Agents window.
src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessions.contribution.ts Uses shared external policy reference manifest for Claude gating.
src/vs/platform/policy/test/common/fileManagedSettingsService.test.ts Adds unit tests for normalization and file-managed settings service behavior.
src/vs/platform/policy/common/policyIpc.ts Disposes the policy IPC listener by registering it on the client’s disposable store.
src/vs/platform/policy/common/fileManagedSettingsService.ts Implements file read/watch + normalization for managed settings on disk.
src/vs/platform/policy/common/fileManagedSettingsIpc.ts Adds IPC channel/client to expose file-managed settings from main → renderer.
src/vs/platform/policy/common/externalPolicyReferences.ts Introduces a shared manifest for cross-window policy references.
src/vs/platform/policy/common/copilotManagedSettings.ts Adds file path constants, shared normalizeManagedSettings(), and the file managed settings service interface.
src/vs/code/electron-main/main.ts Creates and registers FileManagedSettingsService in the main process service collection.
src/vs/code/electron-main/app.ts Registers the file-managed settings IPC channel.
build/lib/policies/policyData.jsonc Updates generated policy catalog to include the Agents window Claude setting reference.

Copilot's findings

  • Files reviewed: 15/15 changed files
  • Comments generated: 2

Comment thread src/vs/workbench/services/policies/common/accountPolicyService.ts Outdated
Comment thread src/vs/platform/policy/common/copilotManagedSettings.ts Outdated
@joshspicer joshspicer force-pushed the joshspicer/file-managed-settings branch 3 times, most recently from 6713a7f to ab9c22d Compare June 19, 2026 22:31
@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Base: d2ac9adc Current: 54166dd2

No screenshot changes.

@joshspicer joshspicer force-pushed the joshspicer/file-managed-settings branch 6 times, most recently from a4683a7 to f5f0477 Compare June 24, 2026 21:05
@joshspicer joshspicer marked this pull request as ready for review June 24, 2026 21:55
@joshspicer joshspicer requested a review from Copilot June 24, 2026 21:56
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

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

@deepak1556

Matched files:

  • src/vs/code/electron-main/app.ts
  • src/vs/code/electron-main/main.ts

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.

Copilot's findings

  • Files reviewed: 18/18 changed files
  • Comments generated: 4

Comment thread src/vs/platform/policy/common/fileManagedSettingsService.ts Outdated
Comment thread .github/skills/add-policy/SKILL.md Outdated
Comment thread .github/skills/add-policy/SKILL.md Outdated
Comment thread .github/skills/add-policy/github-managed-settings.md
roblourens
roblourens previously approved these changes Jun 24, 2026
Add a file-based managed-settings delivery channel that reads
managed-settings.json from a well-known per-OS disk path in the main
process and exposes it to renderer windows over IPC. Mirrors the
existing Copilot managed-settings (server / native MDM) channels.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@joshspicer joshspicer force-pushed the joshspicer/file-managed-settings branch from 19c443a to be7acd8 Compare June 24, 2026 22:21

@javi0guerrero4-cloud javi0guerrero4-cloud left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Ok

@joshspicer joshspicer merged commit 865f5a0 into main Jun 24, 2026
45 of 46 checks passed
@joshspicer joshspicer deleted the joshspicer/file-managed-settings branch June 24, 2026 23:09
@vs-code-engineering vs-code-engineering Bot added this to the 1.127.0 milestone Jun 24, 2026
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.

5 participants