You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
V2 does not load managed config from %ProgramData%\opencode (V1 managed settings) #51107
V1 documented a managed config directory (%ProgramData%\opencode on Windows, /etc/opencode on Linux, /Library/Application Support/opencode on macOS) loaded at the highest priority for admin-enforced settings. V2 does not appear to read it. The V2 migration guide lists only the global, project, and .opencode locations, and the policy precedence table doesn't include it.
Expected: Managed config is loaded with highest priority, as in V1. Per the migration guide, supported V1 behavior that stops working in V2 is a compatibility bug.
Impact: Organizations that use managed config to restrict providers lose that enforcement on upgrade to 2.x.
Plugins
No response
OpenCode version
2.0.16
Steps to reproduce
Place an opencode.json in C:\ProgramData\opencode defining a custom provider plus experimental.policies denying all other providers. It works in 1.18.32. In 2.0.16, the custom provider is missing and all built-in cloud providers appear. Copying the same file to ~/.config/opencode/opencode.json restores the expected behavior.
Screenshot and/or share link
No response
Operating System
Windows 11
Terminal
No response
Reacted by Renato Duarte, Samuel Masuy, Michael Booth, Jason Roth, Ollie Curtis and Kanalu Monaco
Following up with some source-code references from the v2.0.16 tag (commit 3a103fe) that may help narrow this down:
Where the V2 loader lives, and why the managed dir is skipped
V2's config discovery is in packages/core/src/config/discovery.ts, and the entry assembly is in packages/core/src/config.ts (Config.load). The full source list is:
well-known (remote) configs
global dir (~/.config/opencode)
OPENCODE_CONFIG (explicit file)
direct project opencode.json(c) files (outer → inner)
.opencode/opencode.json(c) directories
OPENCODE_CONFIG_CONTENT
There is no source for the system-managed directory (%ProgramData%\opencode / /etc/opencode / /Library/Application Support/opencode). The only "managed" concept in V2 is packages/core/src/managed-policy.ts, which is about policies compiled by a connected OpenCode Console workspace — that doesn't help self-hosted/MDM-managed deployments that rely on the on-disk managed config.
The V1 implementation being replaced
For reference, the V1 equivalent is packages/opencode/src/config/managed.ts (1.x line), which reads the managed directory at highest file precedence and, on macOS, also reads .mobileconfig MDM plists via plutil. Both behaviors are missing in V2.
Impact / workarounds
This is blocking our fleet upgrade (many VPCs whose provider restrictions are enforced via managed config). We've confirmed two workarounds that restore the behavior on 2.0.16:
Deploying the same file to %USERPROFILE%\.config\opencode\opencode.json (per user), or
A directory junction from %USERPROFILE%\.config\opencode to %ProgramData%\opencode (single-user machines).
Both lose the admin-only-writability of the managed location, so restoring the managed dir would be preferable.
Suggested expectation for a fix
Load <managed-dir>\opencode.json(c) in V2 with the same precedence as V1 — above all project/global file config, below Console-delivered policy statements — and keep the macOS MDM plist path, which would otherwise be a second silent regression for MDM-based fleets.
Happy to test a build if there's a branch or snapshot where this is being addressed.
Reacted by Renato Duarte, joe-workman and Michael Booth
Opened #51337 against v2 with a fix: loads the system managed directory and the macOS ai.opencode.managed plist at the highest file precedence, with managed policy statements ranked below Console organization statements. V1-shaped managed files go through the normal migration, so enabled_providers becomes enforced policies. Happy to adjust if you'd prefer a different precedence model.
OpenCode V2 works a bit differently here — the system config folder is loaded first as a base default, and non-overridable rules are enforced through experimental.policies (which evaluate in reverse order, so system policies override user and project configs). If anything you need to enforce isn't covered by experimental.policies yet, let us know and we'll expand it.
We will avoid breaking it even tho it's still listed as "experimental" it is already being used to power some features our console offering relies on, it just may get further extended.
Activity
ctmay4 commentedon Sep 24, 2026
Following up with some source-code references from the
v2.0.16tag (commit3a103fe) that may help narrow this down:Where the V2 loader lives, and why the managed dir is skipped
V2's config discovery is in
packages/core/src/config/discovery.ts, and the entry assembly is inpackages/core/src/config.ts(Config.load). The full source list is:~/.config/opencode)OPENCODE_CONFIG(explicit file)opencode.json(c)files (outer → inner).opencode/opencode.json(c)directoriesOPENCODE_CONFIG_CONTENTThere is no source for the system-managed directory (
%ProgramData%\opencode//etc/opencode//Library/Application Support/opencode). The only "managed" concept in V2 ispackages/core/src/managed-policy.ts, which is about policies compiled by a connected OpenCode Console workspace — that doesn't help self-hosted/MDM-managed deployments that rely on the on-disk managed config.The V1 implementation being replaced
For reference, the V1 equivalent is
packages/opencode/src/config/managed.ts(1.x line), which reads the managed directory at highest file precedence and, on macOS, also reads.mobileconfigMDM plists viaplutil. Both behaviors are missing in V2.Impact / workarounds
This is blocking our fleet upgrade (many VPCs whose provider restrictions are enforced via managed config). We've confirmed two workarounds that restore the behavior on 2.0.16:
%USERPROFILE%\.config\opencode\opencode.json(per user), or%USERPROFILE%\.config\opencodeto%ProgramData%\opencode(single-user machines).Both lose the admin-only-writability of the managed location, so restoring the managed dir would be preferable.
Suggested expectation for a fix
Load
<managed-dir>\opencode.json(c)in V2 with the same precedence as V1 — above all project/global file config, below Console-delivered policy statements — and keep the macOS MDM plist path, which would otherwise be a second silent regression for MDM-based fleets.Happy to test a build if there's a branch or snapshot where this is being addressed.
rntdrts commentedon Sep 25, 2026
Opened #51337 against
v2with a fix: loads the system managed directory and the macOSai.opencode.managedplist at the highest file precedence, with managed policy statements ranked below Console organization statements. V1-shaped managed files go through the normal migration, soenabled_providersbecomes enforced policies. Happy to adjust if you'd prefer a different precedence model.fix(core): load managed config directory and macOS managed preferences
fix(core): load managed config directory and macOS managed preferences
fix(core): load managed config directory and macOS managed preferences
fix(core): load managed config directory and macOS managed preferences
fix(core): load managed config directory and macOS managed preferences
fix(core): load managed config directory and macOS managed preferences
fix(core): load managed config directory and macOS managed preferences
fix(core): load managed config directory and macOS managed preferences
fix(core): load managed config directory and macOS managed preferences
fix(core): load managed config directory and macOS managed preferences
fix(core): load managed config directory and macOS managed preferences
fix(core): load managed config directory and macOS managed preferences
fix(core): load managed config directory and macOS managed preferences
fix(core): load managed config directory and macOS managed preferences
fix(core): load managed config directory and macOS managed preferences
fix(core): load managed config directory and macOS managed preferences
fix(core): load managed config directory and macOS managed preferences
fix(core): load managed config directory and macOS managed preferences
fix(core): load managed config directory and macOS managed preferences
rekram1-node commentedon Oct 13, 2026
OpenCode V2 works a bit differently here — the system config folder is loaded first as a base default, and non-overridable rules are enforced throughexperimental.policies(which evaluate in reverse order, so system policies override user and project configs). If anything you need to enforce isn't covered byexperimental.policiesyet, let us know and we'll expand it.We will avoid breaking it even tho it's still listed as "experimental" it is already being used to power some features our console offering relies on, it just may get further extended.Edit:
Copying for clarity:
#51337 (comment)