2026-11-26 15:47 UTC

OpenCode V2 config change prompts managed-policy precedence dispute

state: corroboratedheat: mediumuncertainty: mediumrelevance: highopencode coding-agent-security supply-chainrekram1-nodeverdverm

What is this?

OpenCode PR #54921, merged into the V2 development branch on Oct. 13, 2026, added platform-wide configuration directories such as `/etc/opencode` and loaded them at the lowest precedence for ordinary settings. The PR says policy documents are evaluated in reverse order, so system-level policies still receive highest file-based authority. Contributor verdverm objected that this changes V1’s broader guarantee: users and projects could override system-managed settings, undermining centrally enforced controls. The supplied search results indicate a follow-up PR, #55267, proposes restoring highest precedence for managed configuration; its final status is not established here.

Why it matters

This is a consequential configuration-security change in an AI coding agent: organizations may rely on machine-managed settings that users or project files cannot override. The merged PR’s design says system policies retain top file-based authority, but a contributor argues other centrally enforced settings lose the precedence they had in V1. A search result points to a follow-up PR proposing to restore managed configuration’s highest precedence, so the practical status may have changed; its merge and release status are not confirmed by the supplied evidence.

Current assessment

PR #54921 was merged into OpenCode’s V2 development branch on Oct. 13, 2026. It added system configuration directories (/etc/opencode on Linux, /Library/Application Support/opencode on macOS, and %ProgramData%\\opencode on Windows) at lowest precedence for ordinary settings. The PR author’s rationale was that policy documents are evaluated in reverse order, preserving highest file-based authority for system policies. Contributor verdverm objected that the change makes non-policy managed settings user- or project-overridable, weakening V1’s broader centrally enforced configuration model; that is an attributed security concern, not evidence of an exploit. A web result for follow-up PR #55267 says the team decided to make behavior more like V1 and proposes highest precedence for managed configuration, including macOS MDM preferences. The supplied result does not establish whether that follow-up merged, shipped, or fully resolves the concern. Track its status and the V2 release behavior; this matters particularly to enterprise and managed deployments, while impact on ordinary users depends on whether they have system-level configuration.

Measured heat

now 0 pts/hpeak 0 pts/hcomments 0/hpeers p10momentum: steady2 platformsage 1082h
points/hour across evidence · reading as of 2026-11-27 02:23:58.509736+11:00 · deterministic, not a model opinion

How the heat travelled

10-12 13:00⭐ origin echo-reconstructedPR #54921 "fix(core): discover system configuration directory at lowest precedence" (opened Oct 12, merged into dev by rekram1-node Oct 13,
rekram1-node (collaborator, anomalyco/opencode) on github (echo) · attributed from hn.story.50075319
—
10-13 17:20first on hacker news · published · +28.4hMajor security regression merged into OpenCode V2
verdverm
—
10-13 17:20amplified on hacker newshn.story.50075319
verdverm
peak 18 · 9 comments · 1% of case engagement
10-14 20:48amplified on hacker news 👑hn.story.50094994
gmays
peak 890 · 396 comments · 52% of case engagement
10-17 18:01amplified on hacker newshn.story.50133401
pranshuchittora
peak 977 · 185 comments · 47% of case engagement
10-13 18:21our radar first saw it · +29.4hdiscovery anchor: hn.story.50075319—
10-15 00:05reached heat=high · +59.1h · via ledger——

Evidence (4) — ⭐ canonical anchor

sourceobjectauthorscorecomments
🟧 hnMajor security regression merged into OpenCode V2
Retrieved article excerpt

Open article · Retrieved 2026-10-13T18:28:35.124213+00:00

## Repository navigation



# fix(core): discover system configuration directory at lowest precedence - #54921

#54921

Merged

[rekram1-node](https://github.com/rekram1-node) merged 3 commits into

[dev](https://github.com/anomalyco/opencode/tree/dev)anomalyco/opencode:devfrom 

[system-config](https://github.com/anomalyco/opencode/tree/system-config)anomalyco/opencode:system-configCopy head branch name to clipboard

Oct 13, 2026

Merged

## [fix(core): discover system configuration directory at lowest precedence](https://github.com/anomalyco/opencode/pull/54921#top)#54921 [rekram1-node](https://github.com/rekram1-node) merged 3 commits into [dev](https://github.com/anomalyco/opencode/tree/dev)anomalyco/opencode:devfrom [system-config](https://github.com/anomalyco/opencode/tree/system-config)anomalyco/opencode:system-configCopy head branch name to clipboard

## Conversation

[@rekram1-node](https://github.com/rekram1-node)

### @rekram1-node **[rekram1-node](https://github.com/rekram1-node)** commented [Oct 12, 2026](https://github.com/anomalyco/opencode/pull/54921#issue-5819800957) • edited Loading Uh oh! There was an error while loading. [Please reload this page](https://github.com/anomalyco/opencode/pull/54921).

Copy link
 

Copy Markdown

Collaborator

### Issue for this PR

Fixes [#51107](https://github.com/anomalyco/opencode/issues/51107)  
Fixes [#53074](https://github.com/anomalyco/opencode/issues/53074)

### Type of change

- Bug fix
- New feature
- Refactor / code improvement
- Documentation

### What does this PR do?

Includes the platform system configuration directory (`/Library/Application Support/opencode` on macOS, `/etc/opencode` on Linux, `%ProgramData%\opencode` on Windows) in `ConfigDiscovery.discover`, `Config.load`, and `ConfigWatch.plan` at the lowest configuration priority (ahead of well-known, global, and project configuration).

- Ordinary settings and directory-backed definitions (`providers`, `mcp`, `agents`, `commands`, `skills`, `plugins`, `model`, etc.) act as machine-wide defaults that user-global and project configuration can build on or override.
- Because `ManagedPolicy.statements` evaluates authored documents in reverse order (`entries.toReversed()`), loading the system configuration directory first automatically gives its `experimental.policies` (and migrated V1 `enabled_providers` / `disabled_providers`) the highest file-based policy authority—outranking project and user-global policies without special-casing `ManagedPolicy`.

### How did you verify your code works?

- Added unit and live tests in `packages/core/test/config/config.test.ts` and `packages/core/test/config/watch.test.ts` covering platform path resolution, lowest-priority loading, `system: false` isolation, and watcher planning.
- Ran `bun run check` and the full `packages/core/test/config/` suite.

[opencode-agent[bot]](https://github.com/apps/opencode-agent)

**[opencode-agent](https://github.com/apps/opencode-agent)
Bot**
reviewed
[Oct 12, 2026](https://github.com/anomalyco/opencode/pull/54921#pullrequestreview-5495533190)

[View reviewed changes](https://github.com/anomalyco/opencode/pull/54921/files)

### @opencode-agent **[opencode-agent](https://github.com/apps/opencode-agent) Bot** left a comment

Copy link
 

Copy Markdown

Contributor

There was a problem hiding this comment.

### Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. [Learn more](https://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment).

Works as described. With `/etc/opencode/opencode.json` present, the base ignores it. With this PR, its settings load at the lowest priority, and a system `provider.use` deny removes a provider that the project config defines (checked with `config.get` / `provider.list` via opencode-drive in both checkouts). `bun test test/config/` passes (231) and `packages/core` typechecks cleanly.

Public API (all backwards compatible): adds the platform system config directory as a new config source (`/etc/opencode`, `/Library/Application Support/opencode`, `%ProgramData%\opencode`), so existing configs only change behaviour if that directory exists. Also adds `ConfigDiscovery.Sources.system`, `ConfigDiscovery.systemDirectory()` and a `system?: boolean | string` option on `Config.Options`. `global: false` now also skips the system directory. No HTTP API, SDK, CLI or environment variable changes.

Main point: V1 loaded this directory at the highest priority for *all* settings. Here only policies outrank users and projects, so other admin settings become user-overridable (see the inline comment). The tests could also be smaller (inline). The macOS `ai.opencode.managed` profile is still not read.

Fixes [#51107](https://github.com/anomalyco/opencode/issues/51107)  
Related: [#53074](https://github.com/anomalyco/opencode/issues/53074), [#47351](https://github.com/anomalyco/opencode/issues/47351)

Comment thread

[packages/core/src/config.ts](https://github.com/anomalyco/opencode/pull/54921/files#diff-4114b8f08217be27efd35a3891857cfabc6eb75aee8ab39ba304e4d1b1095323)
 





Show resolved
 





Hide resolved

### Uh oh!

There was an error while loading. [Please reload this page](https://github.com/anomalyco/opencode/pull/54921).




Comment thread

[packages/core/test/config/policy.test.ts](https://github.com/anomalyco/opencode/pull/54921/files#diff-0abe122f02d1e14fbf123c262df3eef8bed19a8313262d2c3d12cfc514548c61)

Outdated
 
 





Show resolved
 





Hide resolved

### Uh oh!

There was an error while loading. [Please reload this page](https://github.com/anomalyco/opencode/pull/54921).




Comment thread

[packages/core/test/config/config.test.ts](https://github.com/anomalyco/opencode/pull/54921/files#diff-9982e8302b9d4b8f0ab202b0e3a88673d57add0564659dcf186b28196545e911)

Outdated
 
 





Show resolved
 





Hide resolved

### Uh oh!

There was an error while loading. [Please reload this page](https://github.com/anomalyco/opencode/pull/54921).

[@rekram1-node](https://github.com/rekram1-node)

[rekram1-node](https://github.com/rekram1-node)
[force-pushed](https://github.com/anomalyco/opencode/compare/9abe8ede4af8c9949711b617031ba74a4e99b2e9..f36a16a181843f2d514e7d0da6cc92016b59286a)
the

system-config
branch
from
[`9abe8ed`](https://github.com/anomalyco/opencode/commit/9abe8ede4af8c9949711b617031ba74a4e99b2e9) to
[`f36a16a`](https://github.com/anomalyco/opencode/commit/f36a16a181843f2d514e7d0da6cc92016b59286a)  [Compare](https://github.com/anomalyco/opencode/compare/9abe8ede4af8c9949711b617031ba74a4e99b2e9..f36a16a181843f2d514e7d0da6cc92016b59286a)
[October 13, 2026 01:28](https://github.com/anomalyco/opencode/pull/54921#event-33093258035)

[@rekram1-node](https://github.com/rekram1-node) [@rntdrts](https://github.com/rntdrts)

`fix(core): discover system configuration directory at lowest precedence`

 …

`d4b059c`

```
Co-authored-by: Renato Duarte <[email protected]>
```

[@rekram1-node](https://github.com/rekram1-node)

[rekram1-node](https://github.com/rekram1-node)
[force-pushed](https://github.com/anomalyco/opencode/compare/f36a16a181843f2d514e7d0da6cc92016b59286a..d4b059cd66927c1ad523277fdfe9d1efb29691a7)
the

system-config
branch
from
[`f36a16a`](https://github.com/anomalyco/opencode/commit/f36a16a181843f2d514e7d0da6cc92016b59286a) to
[`d4b059c`](https://github.com/anomalyco/opencode/commit/d4b059cd66927c1ad523277fdfe9d1efb29691a7)  [Compare](https://github.com/anomalyco/opencode/compare/f36a16a181843f2d514e7d0da6cc92016b59286a..d4b059cd66927c1ad523277fdfe9d1efb29691a7)
[October 13, 2026 01:28](https://github.com/anomalyco/opencode/pull/54921#event-33093267438)

[@rekram1-node](https://github.com/rekram1-node)
[rekram1-node](https://github.com/rekram1-node)
mentioned this pull request
[Oct 13, 2026](https://github.com/anomalyco/opencode/pull/54921#ref-pullrequest-5582950374)

[fix(core): load managed config directory and macOS managed preferences
#51337](https://github.com/anomalyco/opencode/pull/51337)

Closed

4 of 6 tasks

[rekram1-node](https://github.com/rekram1-node)
added 2 commits
[October 12, 2026 22:07](https://github.com/anomalyco/opencode/pull/54921#commits-pushed-8f8b54f)

[@rekram1-node](https://github.com/rekram1-node)

`feat(core): load macOS MDM managed preferences`

`8f8b54f`

[@rekram1-node](https://github.com/rekram1-node)

`refactor(core): simplify system directory resolution`

`a73a9ec`

Hide details
View details

[@rekram1-node](https://github.com/rekram1-node)

[rekram1-node](https://github.com/rekram1-node)
merged commit [`ba82b37`](https://github.com/anomalyco/opencode/commit/ba82b370c1c3853d2e06e8c5f3837d43e62bbcd2)
into

dev
[Oct 13, 2026](https://github.com/anomalyco/opencode/pull/54921#event-33100199937)

9 checks passed

### Uh oh!

There was an error while loading. [Please reload this page](https://github.com/anomalyco/opencode/pull/54921).

[@rekram1-node](https://github.com/rekram1-node)

[rekram1-node](https://github.com/rekram1-node)
deleted the

system-config
 
branch
[October 13, 2026 04:02](https://github.com/anomalyco/opencode/pull/54921#event-33100201383)

[@verdverm](https://github.com/verdverm)

### **[verdverm](https://github.com/verdverm)** commented [Oct 13, 2026](https://github.com/anomalyco/opencode/pull/54921#issuecomment-6151059619) • edited Loading Uh oh! There was an error while loading. [Please reload this page](https://github.com/anomalyco/opencode/pull/54921).

Copy link
 

Copy Markdown

Contributor

|  |
| --- |
| This breaks the security controls having the system config as the highest priority, which is not editable by users. Our need is to prevent policies from being circumventable by user/project config.  This is a **major** security regression  For reference   - <https://code.claude.com/docs/en/settings#check-what-your-organization-enforces> - <https://learn.chatgpt.com/docs/enterprise/managed-configuration#locations-and-precedence> |

[@verdverm](https://github.com/verdverm)
[verdverm](https://github.com/verdverm)
mentioned this pull request
[Oct 13, 2026](https://github.com/anomalyco/opencode/pull/54921#ref-issue-5835214796)

[Support system level configuration at the highest precedence to enhance security posturing
earendil-works/pi#10895](https://github.com/earendil-works/pi/issues/10895)

Closed

[Sign up for free](https://github.com/join?source=comment-repo)
**to join this conversation on GitHub**.
Already have an account?
[Sign in to comment](https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fanomalyco%2Fopencode%2Fpull%2F54921)

### Labels

None yet

### 2 participants

[@rekram1-node](https://github.com/rekram1-node) [@verdverm](https://github.com/verdverm)

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.
verdverm189
🟧 echo.github ⭐PR #54921 "fix(core): discover system configuration directory at lowest precedence" (opened Oct 12, merged into dev by rekram1-node Oct 13, rekram1-node (collaborator, anomalyco/opencode)——
🟧 hnOpenCode 2.0gmays890396
🟧 hnOpenCode Hacked: User credentials leakedpranshuchittora977185

Interpretation history

Decision trace