Skip to content

fix(opencode): allow pinning the plugin package version at build time - #62223

Open
saulocn wants to merge 1 commit into
anomalyco:v1from
saulocn:plugin-version-pin
Open

saulocn wants to merge 1 commit into
anomalyco:v1from
saulocn:plugin-version-pin

Conversation

@saulocn

@saulocn saulocn commented Nov 6, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #37806

Same failure as #30197, #30908, #37024 and #31708.

Type of change

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

What does this PR do?

The config and TUI layers install @opencode-ai/plugin into every config directory, using the binary version as the package version. When that version is not published to npm, the install fails on every start (No matching version found for @opencode-ai/plugin@<version>). The linked issues hit this with local; forks and custom builds hit it with their own version numbers. Local tools in .opencode/tool then cannot resolve their import, and prompts fail.

This adds an optional OPENCODE_PLUGIN_VERSION build define. When it is set, the dependency install uses it. When it is not set, InstallationPluginVersion falls back to InstallationVersion, so default builds behave exactly as before.

How did you verify your code works?

  • bun typecheck in packages/opencode and packages/core.
  • bun test test/installation/installation.test.ts test/config/config.test.ts test/config/tui.test.ts in packages/opencode, including a new test for the fallback.
  • Built a binary whose version is not on npm, with OPENCODE_PLUGIN_VERSION set to a published plugin version: the background install succeeded and .opencode/tool loaded. Before the change the same build logged NpmInstallFailedError on every start.

Screenshots / recordings

Not a UI change.

Checklist

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

The config and TUI layers install @opencode-ai/plugin into every config
directory using the binary version. Builds whose version is not published
to npm (forks and custom builds) fail that install on every start, and
local tools in .opencode/tool then cannot resolve their import.

Add an optional OPENCODE_PLUGIN_VERSION build define. When it is set, the
dependency install uses it; when it is not, the plugin version follows the
binary version, so default builds behave exactly as before.

This branch has not been deployed

No deployments
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.

1 participant