core: OPENCODE_DISABLE_PROJECT_CONFIG is ignored in v2 · Issue #36837 · anomalyco/opencode · GitHub
Skip to content

core: OPENCODE_DISABLE_PROJECT_CONFIG is ignored in v2 #36837

Closed as not planned
Closed as not planned

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

Activity

  1. github-actions commented on Jul 14, 2026

    @github-actions
    Contributor

    This issue might be related to existing issues. Please check:

    These are distinct bugs, but if you're investigating the v2 config loader, the above may be worth coordinating on.

  2. corrius commented on Jul 14, 2026

    @corrius
    Author

    I prepared a minimal fix on corrius:fix/disable-project-config-v2 (commit 8078652).

    It makes the v2 core loader skip repository-controlled opencode.json*, .opencode, .claude, and .agents discovery when the flag is enabled, while preserving global configuration. It also adds a regression test covering both sides of that boundary.

    Validation:

    • packages/core config suite: 20 passed
    • packages/core typecheck passed
    • full pre-push monorepo typecheck: 32/32 packages passed

    Happy to open a PR against v2 if this behavior matches the intended semantics.

  3. changed the title [-]OPENCODE_DISABLE_PROJECT_CONFIG is ignored by the v2 core config loader[/-] [+]core: OPENCODE_DISABLE_PROJECT_CONFIG is ignored in v2[/+] on Jul 14, 2026
  4. opencode-agent commented on Jul 15, 2026

    @opencode-agent
    Contributor

    Thanks for the report. We found this is part of a broader V1-to-V2 environment-variable compatibility gap, so we are consolidating the work in #36990. That umbrella issue includes OPENCODE_DISABLE_PROJECT_CONFIG and links back here. Closing this issue in favor of the larger tracker.

  5. opencode-agent commented on Jul 15, 2026

    @opencode-agent
    Contributor

    Tracked in #36990.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions