fix(bun): use direct npm registry fetch for plugin @latest update checks#16609
Open
conversun wants to merge 1 commit intoanomalyco:devfrom
Open
fix(bun): use direct npm registry fetch for plugin @latest update checks#16609conversun wants to merge 1 commit intoanomalyco:devfrom
conversun wants to merge 1 commit intoanomalyco:devfrom
Conversation
Replace `bun info` subprocess (subject to bun's stale registry cache) with a direct HTTP fetch to registry.npmjs.org for version checks. Also always pass `--no-cache` to `bun add` when version is 'latest' to ensure fresh package data is fetched during plugin updates. Fixes anomalyco#16608
3ef71eb to
0ca3d60
Compare
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
3 tasks
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.
Issue for this PR
Closes #16608
Type of change
What does this PR do?
Plugins configured with
@latestnever auto-update because theisOutdatedcheck inregistry.tsusesbun info(subprocess) which returns stale data from bun's registry cache. Even when it works,bun addalso uses cached packages since--no-cacheis only passed behind proxies/CI.This PR makes two targeted changes:
registry.ts: Replacesbun info <pkg> versionsubprocess with a directfetch()toregistry.npmjs.org. This bypasses bun's registry cache entirely, andfetch()natively respectsHTTP_PROXY/HTTPS_PROXYenv vars — making it more reliable behind proxies where the subprocess often fails silently (causingisOutdatedto returnfalse).index.ts: Addsversion === "latest"to the--no-cachecondition forbun add, so when an update IS detected, bun actually downloads the new package instead of serving it from its local package cache.config.ts: Updated call site to match the simplifiedisOutdatedsignature (removed unusedcwdparam that was only needed forbun info).How did you verify your code works?
oh-my-opencode,@opencode-ai/plugin)config.tswhich has been fixed)fetch()approach uses a 10sAbortSignal.timeoutand falls back gracefully (returnsfalse= "not outdated") if the registry is unreachableScreenshots / recordings
Not a UI change.
Checklist