opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Plugins with implied latest version don't auto-update on restart

Open backnotprop opened this issue 2 weeks ago • 3 comments

Description

When a plugin is configured without a version (defaulting to "latest"):

 {
   "plugin": ["@plannotator/opencode"]
 }

It doesn't update to newer versions on subsequent OpenCode starts.

Root Cause

In packages/opencode/src/bun/index.ts, after installing a "latest" plugin, the resolved version is saved to the cache:

  if (version === "latest") {
    resolvedVersion = installedPkg.version  // e.g. "0.2.3"
  }
  parsed.dependencies[pkg] = resolvedVersion  // Saves "0.2.3", not "latest"

On next startup, the check parsed.dependencies[pkg] === version compares "0.2.3" === "latest" which is false, so it proceeds to reinstall - but Bun's registry cache often returns the same version.

Workaround:

Users can manually clear the cache:

rm -rf ~/.cache/opencode/node_modules/<plugin-name>

Suggested Fix: https://github.com/anomalyco/opencode/pull/6772

Plugins

plannotator

OpenCode version

latest

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

mac

Terminal

ghostty

backnotprop avatar Jan 03 '26 21:01 backnotprop