Skip to content

fix(bun): always check for updates when plugin version is implied latest - #6772

Closed
backnotprop wants to merge 1 commit into
anomalyco:devfrom
backnotprop:fix/plugin-latest-update
Closed

fix(bun): always check for updates when plugin version is implied latest#6772
backnotprop wants to merge 1 commit into
anomalyco:devfrom
backnotprop:fix/plugin-latest-update

Conversation

@backnotprop

@backnotpropbacknotprop commented Jan 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes an issue where plugins configured with implied "latest" version (or no version) were not updating to newer versions on subsequent OpenCode starts.

Problem

When a user configures a plugin like:

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

The install flow was:

  1. First start: version = "latest", installs package, resolves to "0.2.3"
  2. Saves "@plannotator/opencode": "0.2.3" to cache
  3. Next start: version = "latest", cache has "0.2.3"
  4. Check: "0.2.3" === "latest" → false → proceeds to reinstall
  5. But bun add --force uses cached registry data, doesn't fetch new version

Users were stuck on old versions unless they manually cleared ~/.cache/opencode/.

Solution

Skip the early cache return when version === "latest":

// Beforeif(parsed.dependencies[pkg]===version)returnmod// After if(version!=="latest"&&parsed.dependencies[pkg]===version)returnmod

This ensures:

  • Pinned versions (e.g., @pkg@1.0.0) still skip reinstalls via cache
  • Latest versions always run bun add to check for updates

Test plan

  • Configure a plugin with "latest" version
  • Verify it updates when a new version is published
  • Verify pinned versions still skip unnecessary reinstalls

Two changes to ensure "latest" plugins actually get updates:
1. Skip early return cache check for "latest" versions
- Ensures we always attempt an install, not skip based on cached version
2. Add --no-cache flag for "latest" versions
- Forces Bun to bypass its registry cache and fetch fresh from npm
- This is the key fix: without --no-cache, bun add --force still
uses cached registry metadata
Users with "@plannotator/opencode" (no version) were stuck on old
versions because Bun's registry cache wasn't being invalidated.
@backnotprop
backnotpropforce-pushed the fix/plugin-latest-update branch from 80c41b4 to 81507b3CompareJanuary 3, 2026 21:12
@backnotprop

Copy link
Copy Markdown
ContributorAuthor

Probably don't merge this. Not tested extensively

@backnotpropbacknotprop changed the title fix(bun): always check for updates when plugin version is "latest"fix(bun): always check for updates when plugin version is implied latestJan 3, 2026
@thdxr
thdxrforce-pushed the dev branch 3 times, most recently from f1ae801 to 08fa7f7CompareJanuary 30, 2026 14:37
@github-actions

Copy link
Copy Markdown
Contributor

Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR.

@backnotprop

Copy link
Copy Markdown
ContributorAuthor

It's still bad that this is a problem.

Sign up for freeto 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

@backnotprop