-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Description
Description
Plugins configured with @latest (or no version) never auto-update on subsequent OpenCode starts, requiring manual cache deletion:
rm -rf ~/.cache/opencode/node_modules/<plugin-name>
rm ~/.cache/opencode/bun.lockThis affects all plugins using @latest — not just a specific one. For example, with this config:
{
"plugin": ["oh-my-opencode@latest", "opencode-supermemory@latest"]
}Both plugins get frozen at whatever version was @latest at first install.
Root Cause
The isOutdated check in packages/opencode/src/bun/registry.ts uses bun info <pkg> version (via subprocess) to query the latest version. This has two failure modes:
1. Bun's registry cache returns stale data
bun info caches npm registry responses. When a new plugin version is published, bun info may return the old version from its cache, causing isOutdated() to return false — skipping the update.
2. Network failures silently suppress updates
If bun info fails for any reason (proxy issues, DNS resolution, timeouts), the function returns null, and isOutdated() falls back to return false — "not outdated". Users behind corporate proxies or tools like Surge (Fake-IP mode) are particularly affected since bun info subprocess may fail while fetch() would work fine.
Additionally, in packages/opencode/src/bun/index.ts, --no-cache is only passed to bun add when proxied() || process.env.CI. So even when isOutdated correctly detects a new version, bun add --force may still install from bun's package cache instead of fetching the new version from npm.
Evidence
| File | Cached Version | npm @latest |
|---|---|---|
| oh-my-opencode | 3.11.0 | 3.11.1 |
| opencode-supermemory | 2.0.2 | 2.0.4 |
Cache package.json stores exact resolved versions (e.g., "3.11.0" not "latest"), and the isOutdated check fails to detect newer versions due to the issues above.
Suggested Fix
- Replace
bun infowith direct HTTP fetch to npm registry inregistry.ts— avoids bun's registry cache entirely and is more reliable behind proxies - Always use
--no-cacheforbun addwhenversion === "latest"— ensures bun fetches fresh package data when updating plugins
See linked PR for implementation.
Related Issues
- Plugins with implied latest version don't auto-update on restart #6774
- Plugin updates: No way to get latest version after initial install #10546
- Plugins using npm dist-tags (e.g.
@dev) never auto-update due to bun lockfile caching #12712 - [bug] Plugin 'oh-my-opencode' fails to auto-update via bun, causing persistent '[config-context]' warnings #15673
OpenCode version
v1.2.21
Operating System
macOS (also affects all platforms)
Steps to reproduce
- Configure a plugin with
@latest:"plugin": ["some-plugin@latest"] - Start OpenCode — plugin installs at current latest (e.g., v1.0.0)
- Plugin author publishes v1.0.1
- Restart OpenCode — still uses v1.0.0
- Only manual
rm -rf ~/.cache/opencode/node_modules/some-plugin && rm ~/.cache/opencode/bun.locktriggers the update