anomalyco / anomalyco/opencode
V2 plugin npm install can hang the session startup with no timeout
@rekram1-node is already working on this.
Since Aug 12, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
In V2, loading a plugin referenced by an npm specifier (e.g. "some-plugin@latest" in experimental.plugins) calls Npm.add → Arborist reify() with no timeout and no retry (packages/util/src/npm.ts). With a cold cache and a slow or wedged registry, the install can hang indefinitely, blocking the session/startup path that awaits the plugin load. The user sees the operation stuck in retries for a very long time before it eventually succeeds (or never).
This is the same unguarded-install mechanism as V1 issues #31463 (still open) and #33905 (closed as a mis-triage — the mechanism was left untracked; see the comment by willmcginnis). V2 inherits the same gap in PluginSupervisor.load (packages/core/src/plugin/supervisor.ts), which awaits npm.add(...) and the subsequent dynamic import with no bound.
Environment
- opencode version: V2 (next)
- OS: macOS
- Install/channel: next
Reproduction
- With a cold
~/.cache/opencode/packages/cache, add an npm-specifier plugin to the config - Slow down or wedge the npm registry (throttled network works)
- Start a session that loads the plugin
- The install neither fails nor completes within a bounded time; the path awaiting
npm.addstays blocked
Expected behavior
- The install is bounded by a configurable timeout (npm itself defaults to a 300s fetch timeout)
- On timeout, the failure is surfaced with the package name and install directory instead of a silent hang
- (Follow-up: bounded retry for transient registry errors, per #37888 the option to skip installs entirely)
Related: #31463, #33905, #37888, #25293
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.