Skip to content

fix(core): read stdout and stderr in PackageRegistry.info before waiting for the process to exit#16998

Merged
rekram1-node merged 1 commit intoanomalyco:devfrom
ghost91-:fix-automatic-plugin-updates
Mar 11, 2026
Merged

fix(core): read stdout and stderr in PackageRegistry.info before waiting for the process to exit#16998
rekram1-node merged 1 commit intoanomalyco:devfrom
ghost91-:fix-automatic-plugin-updates

Conversation

@ghost91-
Copy link
Contributor

@ghost91- ghost91- commented Mar 11, 2026

Issue for this PR

Fixes #16608
Fixes #10546
Fixes #15673

Type of change

  • Bug fix

What does this PR do?

The previous implementation waited for the process to exit first, which resulted in empty stdout and stderr. Subsequently, this caused the PackageRegistry.isOutdated check to always return false and log

Failed to resolve latest version, using cached

Therefore, plugins that were configured to use latest as version were never actually updated.

To fix this, this change ensures stdout and stderr are read while still available. It uses the exact same approach as Process.run.

How did you verify your code works?

I manually tested it with a plugin. I first intentionally installed an older version of the plugin. Then changed it to @latest in the opencode config. Then we can observe in the logs that the new plugin version is automatically installed when running OpenCode:

INFO 2026-03-11T08:35:16 +8ms service=plugin path=opencode-handoff@latest loading plugin
INFO 2026-03-11T08:35:17 +524ms service=bun pkg=opencode-handoff cachedVersion=0.4.0 Cached version is outdated, proceeding with install
INFO 2026-03-11T08:35:17 +0ms service=bun pkg=opencode-handoff version=latest installing package using Bun's default registry resolution
INFO 2026-03-11T08:35:17 +0ms service=bun cmd=["/usr/bin/bun","add","--force","--exact","--no-cache","--cwd","/home/loherj/.cache/opencode","opencode-handoff@latest"] cwd=/home/loherj/.cache/opencode running
INFO 2026-03-11T08:35:17 +293ms service=bun code=0 stdout= stderr= done

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions
Copy link
Contributor

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

Based on the search results, I found one potentially related PR:

fix(bun): use direct npm registry fetch for plugin @latest update checks (#16609)

This PR appears related because it addresses similar issues around plugin version checking and @latest updates (PR #16998 fixes issue #16608, which this PR addresses). Both PRs are working on the plugin version update mechanism and the isOutdated check functionality.

However, the current PR (#16998) is the main fix for the root cause (reading stdout/stderr before process exit), while #16609 may be an alternative or related approach. You may want to review these together to ensure they don't conflict.

@ghost91- ghost91- force-pushed the fix-automatic-plugin-updates branch from 1fc55bd to 59d7896 Compare March 11, 2026 08:45
@unfrgivn
Copy link

Confirmed working for me. My plugins that are not pinned are now updating ~/.cache/opencode/package.json to the latest version in the bun registry when restarting Opencode.

@ghost91- ghost91- force-pushed the fix-automatic-plugin-updates branch 3 times, most recently from edd2885 to 7c839e2 Compare March 11, 2026 17:16
…ing for the process to exit

The previous implementation waited for the process to exit first, which resulted in empty stdout and stderr.
Subsequently, this caused the PackageRegistry.isOutdated check to always return false and log
"Failed to resolve latest version, using cached".

Fixes anomalyco#16608
Fixes anomalyco#10546
Fixes anomalyco#15673
@ghost91- ghost91- force-pushed the fix-automatic-plugin-updates branch from 7c839e2 to ed4213e Compare March 11, 2026 17:48
@rekram1-node
Copy link
Collaborator

same test failures are occuring in dev currently, don't appear to be related.

@rekram1-node rekram1-node merged commit 2aae0d3 into anomalyco:dev Mar 11, 2026
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants