Skip to content

core: OPENCODE_DISABLE_PROJECT_CONFIG is ignored in v2 #36837

Description

@corrius

Description

With OPENCODE_DISABLE_PROJECT_CONFIG=true, the v2 config service still discovers repository-controlled opencode.json / opencode.jsonc files and .opencode, .claude, and .agents directories.

The legacy config loader honors the flag for project OpenCode configuration, and v2 instruction discovery already honors it for project AGENTS.md. The v2 core config loader does not. In managed/headless deployments, this lets a repository change permissions, plugins, agents, MCP servers, or skill sources after project configuration was explicitly disabled.

Plugins

None

OpenCode version

v2 at 828a4b3f15a3d2b0bca26b0fc09067397f1c924d

Steps to reproduce

  1. Check out the v2 branch and install dependencies.
  2. Run the existing test that verifies project configuration is loaded, with the disable flag set:
cd packages/core
OPENCODE_DISABLE_PROJECT_CONFIG=true bun test test/config/config.test.ts --test-name-pattern 'loads supported scalar and resource configuration'
  1. The test passes (1 pass, 0 fail), even though its project-level configuration should be excluded while the flag is enabled.

Expected: project configuration and project ecosystem directories are excluded; global configuration remains available.

Actual: project configuration is discovered exactly as it is without the flag. Config.discover() only skips discovery when the working directory is the global config directory and never checks Flag.OPENCODE_DISABLE_PROJECT_CONFIG.

Screenshot and/or share link

Not applicable; this is a headless configuration-loader issue.

Operating System

Linux

Terminal

Headless / shell

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions