fix: also invalidate plugin from CACHE_DIR in invalidatePackage#2291
Merged
acamq merged 1 commit intocode-yeongyu:devfrom Mar 7, 2026
Merged
Conversation
Fix code-yeongyu#2289 invalidatePackage() only removed the plugin from USER_CONFIG_DIR/node_modules/, but bun may install it in CACHE_DIR/node_modules/ on some systems. This left a stale copy behind, causing the startup toast to keep showing the old version even after the auto-update completed successfully. Now both candidate locations are checked and removed so the reinstalled version is loaded on the next restart.
Contributor
|
All contributors have signed the CLA. Thank you! ✅ |
Contributor
Author
|
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
No issues found across 1 file
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: Simple and safe expansion of the cache invalidation logic to include the CACHE_DIR, fixing the reported stale plugin issue with no risk of regression.
Collaborator
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2289
invalidatePackage()only removed the stale plugin fromUSER_CONFIG_DIR/node_modules/, but on some systems bun installs the plugin intoCACHE_DIR/node_modules/instead. This left the old version untouched, sogetCachedVersion()would keep reading the stale copy viaimport.meta.urltraversal, causing the startup toast to show the old version even after the auto-updater ran successfully.Root Cause
constants.tsdefines two separate directories:USER_CONFIG_DIR=~/.config/opencode/(where config lives)CACHE_DIR=~/.cache/opencode/on Linux/macOS,%LOCALAPPDATA%\opencodeon WindowsinvalidatePackage()was only checkingUSER_CONFIG_DIR/node_modules/oh-my-opencode/. If bun placed the plugin inCACHE_DIR/node_modules/, the stale directory was never removed.Change
src/hooks/auto-update-checker/cache.ts— check and remove the plugin from both candidate directories:PR Checklist
package.jsonSummary by cubic
Ensures auto-updated plugins load correctly by removing stale installs from both USER_CONFIG_DIR and CACHE_DIR. Fixes the startup toast showing the old version after an update.
Written for commit f67b605. Summary will update on new commits.