anomalyco / anomalyco/opencode

V2 plugin npm install can hang the session startup with no timeout

Open
#41,934 0 comments 0 reactions 1 assignee View on GitHub

@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

  1. With a cold ~/.cache/opencode/packages/ cache, add an npm-specifier plugin to the config
  2. Slow down or wedge the npm registry (throttled network works)
  3. Start a session that loads the plugin
  4. The install neither fails nor completes within a bounded time; the path awaiting npm.add stays 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.