Skip to content

fix: handle non-semver cached versions in plugin installer#12265

Closed
bsreeram08 wants to merge 7 commits into
anomalyco:devfrom
bsreeram08:fix/plugin-version-semver-12143
Closed

fix: handle non-semver cached versions in plugin installer#12265
bsreeram08 wants to merge 7 commits into
anomalyco:devfrom
bsreeram08:fix/plugin-version-semver-12143

Conversation

@bsreeram08

Copy link
Copy Markdown

When a plugin is configured without a version (e.g. 'opencode-gemini-auth' instead of 'opencode-gemini-auth@1.3.8'), the version defaults to 'latest'. This caused semver.order() to throw 'Invalid SemVer: latest' because 'latest' is not a valid semver string.

Two fixes:

  1. Guard isOutdated() against non-semver cached versions by checking the format before passing to semver.order(), treating them as outdated so the package gets re-installed with a proper version
  2. Prevent 'latest' from being persisted as a cached version in the dependency map, so subsequent runs don't encounter the invalid string
  3. Validate cached versions before checking if outdated, removing corrupted cache entries

Also adds comprehensive tests to verify the fix works correctly.

Fixes #12143

What does this PR do?

Please provide a description of the issue (if there is one), the changes you made to fix it, and why they work. It is expected that you understand why your changes work and if you do not understand why at least say as much so a maintainer knows how much to value the pr.

If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!

How did you verify your code works?

When a plugin is configured without a version (e.g. 'opencode-gemini-auth' instead of 'opencode-gemini-auth@1.3.8'), the version defaults to 'latest'. This caused semver.order() to throw 'Invalid SemVer: latest' because 'latest' is not a valid semver string.

Two fixes:
1. Guard isOutdated() against non-semver cached versions by checking the format before passing to semver.order(), treating them as outdated so the package gets re-installed with a proper version
2. Prevent 'latest' from being persisted as a cached version in the dependency map, so subsequent runs don't encounter the invalid string
3. Validate cached versions before checking if outdated, removing corrupted cache entries

Also adds comprehensive tests to verify the fix works correctly.

Fixes #12143
@github-actions

github-actions Bot commented Feb 5, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@bsreeram08 bsreeram08 closed this by deleting the head repository Apr 13, 2026
Sign up for free to 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.

Plugin without version defaults to "latest" causing semver parsing error

2 participants