Skip to content

fix: wire pluginAutoInstall config to plugin install behavior#27918

Open
ranxianglei wants to merge 1 commit into
anomalyco:devfrom
ranxianglei:fix/plugin-auto-install-config
Open

fix: wire pluginAutoInstall config to plugin install behavior#27918
ranxianglei wants to merge 1 commit into
anomalyco:devfrom
ranxianglei:fix/plugin-auto-install-config

Conversation

@ranxianglei
Copy link
Copy Markdown

@ranxianglei ranxianglei commented May 16, 2026

Issue for this PR

Closes #27923

Type of change

  • Bug fix

What does this PR do?

The pluginAutoInstall config field exists in the schema but has no effect — setting pluginAutoInstall: false doesn't prevent plugin auto-installation. Only the undocumented OPENCODE_DISABLE_PLUGIN_INSTALL=true env var works.

Three minimal changes:

  1. packages/core/src/flag/flag.ts — Add OPENCODE_DISABLE_PLUGIN_INSTALL as a runtime-evaluated getter (consistent with other OPENCODE_DISABLE_* flags)

  2. packages/core/src/npm.ts — Add early returns in add() and install() when Flag.OPENCODE_DISABLE_PLUGIN_INSTALL is true

  3. packages/opencode/src/config/config.ts — Add pluginAutoInstall to the schema, and wire it: when pluginAutoInstall === false, set process.env["OPENCODE_DISABLE_PLUGIN_INSTALL"] = "true" so the flag check picks it up

Usage:

// opencode.json
{
  "pluginAutoInstall": false
}

How did you verify your code works?

This fix has been running in our fork (based on v1.14.41) for several days. Verified that:

  • Setting pluginAutoInstall: false in opencode.json prevents all plugin auto-installation
  • The OPENCODE_DISABLE_PLUGIN_INSTALL env var still works independently
  • Plugin loading from file:// paths continues to work normally

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Add OPENCODE_DISABLE_PLUGIN_INSTALL flag and check it in Npm.add() and
Npm.install() to prevent automatic plugin installation when the user sets
pluginAutoInstall: false in their config.

Previously, the pluginAutoInstall config field existed in the schema but was
never connected to any behavior. Only the OPENCODE_DISABLE_PLUGIN_INSTALL
env var worked. Now setting pluginAutoInstall: false in config will set the
env var at load time, which the npm module checks before installing plugins.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels May 16, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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.

bug(config): pluginAutoInstall config has no effect

1 participant