Skip to content

Plugins using npm dist-tags (e.g. @dev) never auto-update due to bun lockfile caching #12712

@ErcinDedeoglu

Description

@ErcinDedeoglu

Problem

When a plugin is configured with an npm dist-tag specifier (e.g. "oc-solomemory@dev"), BunProc.install() resolves the tag to a concrete version on first install and writes it into bun.lock. On subsequent startups, bun sees the specifier "dev" hasn't changed, trusts the lockfile, and skips re-resolving — even though the dist-tag now points to a newer version on npm.

This means plugins using dist-tags like @dev, @beta, @canary, @next etc. are effectively pinned to whatever version was first installed, and never auto-update.

Steps to Reproduce

  1. Configure a plugin with a dist-tag: "plugin": ["my-plugin@dev"]
  2. Start opencode — plugin installs correctly (e.g. 1.0.7-dev.20260208142630.abc1234)
  3. Publish a new version to the same dist-tag (e.g. 1.0.7-dev.20260208144503.def5678)
  4. Restart opencode — plugin stays on the old version

Root Cause

In packages/opencode/src/bun/index.ts (around line 78), BunProc.install() compares the specifier from config against what's in package.json. Since both are "dev", it either skips install entirely or runs bun install which is a no-op due to the lockfile.

Deleting just bun.lock is insufficient — bun also short-circuits when node_modules/<package> already exists. Both bun.lock AND the cached node_modules/<package> directory must be deleted to force re-resolution.

Current Workaround

rm -rf ~/.cache/opencode/node_modules/<plugin-name> ~/.cache/opencode/bun.lock
# Then restart opencode

Suggested Fix

For plugin specifiers that are dist-tags (not semver ranges or exact versions), BunProc.install() should either:

  1. Pass --force to bun for dist-tag specifiers, forcing re-resolution on every startup
  2. Delete the lockfile entry for dist-tag plugins before running bun install
  3. Run bun update <package> instead of bun install when the specifier is a dist-tag

Detection heuristic: if the specifier after @ is not a valid semver range (i.e. doesn't start with a digit, ^, ~, >=, etc.), it's a dist-tag.

Environment

  • opencode: latest (upstream anomalyco/opencode)
  • bun: 1.x
  • OS: Linux (Ubuntu)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
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