[PR #5292] fix: resolve 'latest' to actual version when caching plugins #11328

Closed
opened 2026-02-16 18:16:09 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/5292

State: closed
Merged: Yes


Problem

When a plugin is specified without a version (e.g., "my-plugin" or "my-plugin@latest"), OpenCode stores the literal string "latest" in the cache (~/.cache/opencode/package.json).

On subsequent starts, the check parsed.dependencies[pkg] === version compares "latest" === "latest", returns the cached module, and never checks npm for updates.

Fix

After installing a package with @latest, read the actual installed version from the package's package.json and store that instead.

This means:

  • @latest now re-fetches on each start (correct behavior - user wants latest)
  • Explicit versions like @1.2.3 still use cache efficiently

Testing

  1. Clear cache: rm ~/.cache/opencode/package.json
  2. Start OpenCode with a plugin using @latest
  3. Check cache - now shows actual version (e.g., "1.2.3") instead of "latest"
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/5292 **State:** closed **Merged:** Yes --- ## Problem When a plugin is specified without a version (e.g., `"my-plugin"` or `"my-plugin@latest"`), OpenCode stores the literal string `"latest"` in the cache (`~/.cache/opencode/package.json`). On subsequent starts, the check `parsed.dependencies[pkg] === version` compares `"latest" === "latest"`, returns the cached module, and never checks npm for updates. ## Fix After installing a package with `@latest`, read the actual installed version from the package's `package.json` and store that instead. This means: - `@latest` now re-fetches on each start (correct behavior - user wants latest) - Explicit versions like `@1.2.3` still use cache efficiently ## Testing 1. Clear cache: `rm ~/.cache/opencode/package.json` 2. Start OpenCode with a plugin using `@latest` 3. Check cache - now shows actual version (e.g., `"1.2.3"`) instead of `"latest"`
yindo added the pull-request label 2026-02-16 18:16:09 -05:00
yindo closed this issue 2026-02-16 18:16:09 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11328