opencode icon indicating copy to clipboard operation
opencode copied to clipboard

`@latest` plugin spec never refreshes cached install

Open klonuo opened this issue 1 month ago • 5 comments

Description

Cache dir ~/.cache/opencode/npm/.../1791113570889 held 0.5.1 from Oct 4; 0.5.2 released later but @latest kept loading 0.5.1 across restarts and opencode service restart. Only a version pin (@0.5.2, new cache key) picked up the fix.

Log showed failed to load plugin ... Context.Tag is not a function the whole time.

Plugins

@langfuse/opencode-observability-plugin@latest

OpenCode version

2.0.26

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

Windows 11

Terminal

No response

klonuo avatar Oct 09 '26 11:10 klonuo

Thanks for the report, @klonuo!

In v2, package plugins are cached once they're installed, even ones using @latest, and restarting doesn't look up the version again. Refreshing them is a separate step:

opencode plugin check    # list package plugins that have a newer version
opencode plugin update   # update all outdated package plugins
opencode plugin update @langfuse/opencode-observability-plugin@latest

(see the plugins docs). Running opencode plugin update should have moved you from 0.5.1 to 0.5.2 without pinning the version. If it doesn't for you, please reply here with the command output. That would be a bug and we'll look into it.

I'm marking this as a feature request: you'd like @latest (and other non-pinned specs) to refresh by themselves after a restart, or at least to be told that the cached copy is out of date, especially when the plugin fails to load like Context.Tag is not a function did here. Maintainers will consider it.

Related (these are about the older v1 package cache, which had no update command):

  • #49970: a plugin kept serving a stale version after a new release
  • #48514: the same package cached under two keys and never refreshed

opencode-agent[bot] avatar Oct 09 '26 11:10 opencode-agent[bot]

Yes, ideally to get notified in some way that there is an update

klonuo avatar Oct 09 '26 11:10 klonuo

Same experience here on 2.0.21 to 2.0.26, across four machines. I use OpenCode every day and still had no idea the plugin was out of date. @openviking/opencode-plugin in opencode.json had been on its first cached install for one to three weeks on each box until I ran opencode plugin check by hand.

Two things that might help the discussion:

  • Automatic refresh did ship. #45118 and #45993 refreshed unpinned plugins in the background ("Automatic updates remain enabled"). Commit 5d73a5789 ("support live package updates", 1 Sep) replaced that with the 24 hour PluginUpdate.check and a manual update. I couldn't find a note explaining the change, so anyone who set up @latest plugins before then is now quietly stuck on old versions.
  • The result of that daily check is only shown in the Plugins dialog. OpenCode's own updates get a line on the home screen, and the log records "OpenCode update available", but an outdated plugin produces nothing outside the dialog.

Showing pending plugin updates the same way OpenCode's own updates are shown would cover most of this. An opt-in setting to install them on the next restart would cover the rest, and people who want to update deliberately would keep today's behaviour.

oliver-mee avatar Oct 13 '26 07:10 oliver-mee

Same on OpenCode 2.3.0 (Windows 11), and it's not limited to server plugins:

  • @slkiser/opencode-quota 6.0.0 (server plugin, opencode.json) was cached on 2026-11-01. 6.2.2 shipped 2026-11-05. It was still loading 6.0.0 today, including after the background server restarted during the session.
  • opencode-quill 0.6.3 (TUI-only plugin, cli.json) was in the same state; 0.6.4 shipped 2026-11-08.

opencode plugin check correctly reported both as outdated, and opencode plugin update moved them to 6.2.2 and 0.6.4, so the manual path works. What's missing is the signal: nothing on Home, no toast, no log line — the pending update is only visible in the Plugins dialog or from the CLI.

I only found out by running plugin check by hand after seeing a release note. +1 for refreshing unpinned specs on restart and/or showing pending plugin updates the way OpenCode's own update notice is shown.

danieliyahu1 avatar Nov 13 '26 21:11 danieliyahu1

This was fixed by #64764: a plugin written as name@latest now checks for a newer version on startup and every 24 hours, installs it and reloads it, and keeps the previous version if the new one fails to load. It ships in the next release; if a @latest plugin still stays on an old version after that, comment here and we'll reopen.

neriousy avatar Nov 19 '26 12:11 neriousy