anomalyco / anomalyco/opencode

Boot blocks for minutes on project .opencode/ dir + any plugin when IPv6 is advertised but unroutable (registry install: no timeout, AAAA-first)

Open
#49,629 1 comment 0 reactions 1 assignee View on GitHub

@neriousy is already working on this.

Since Sep 17, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Note: written by an AI assistant (opencode + GLM) at the user's request, based on a live debugging session on the affected machine. Kept concise per the template guidance.

Description

Boot blocks for minutes when the project has an .opencode/ directory and any plugin is configured, on hosts where DNS returns AAAA records but IPv6 is unroutable (router advertises RA, upstream dead). The registry install triggered by the .opencode/ dir has no timeout and prefers IPv6, so each fetch stalls in SYN-SENT for the kernel retry window (~130s) before falling back to IPv4.

Measured trigger matrix (opencode run, v1.18.31):

.opencode/ dir plugin(s) in config result
yes yes stalled >70s (killed)
no yes ~9s, OK
yes no ~9s, OK
--pure OK
Plugins

Any plugin reproduces it (tested with user's local file:// plugins and a minimal empty plugin).

OpenCode version

1.18.31 (Linux, Bun-compiled binary)

Steps to reproduce

Precondition: broken IPv6 (verifiable with curl -6 -m5 https://registry.npmjs.org/ timing out while curl -4 returns 200 quickly).

mkdir repro && cd repro && git init -q
mkdir .opencode && printf '{ "lsp": false }\n' > .opencode/opencode.json
# any plugin in global config, e.g.:
#   printf 'export const P = async () => ({})\n' > /tmp/p.js
#   add "file:///tmp/p.js" to "plugin" in ~/.config/opencode/opencode.json
time opencode run "Reply OK"
# stalls after the "loading path=..." config log lines
# control: rm -rf .opencode -> boots in ~9s
Expected behavior

Boot does not block on background dependency installation; a dead network path degrades to a warning (as background dependency install failed already does on fast failures).

Actual behavior

During the stall: zero CPU, no child processes, and TCP sockets stuck in SYN-SENT to 2606:4700::6810:* (registry.npmjs.org AAAA records):

SYN-SENT  0  1 [2804:...]:55696 [2606:4700::6810:822]:443
SYN-SENT  0  1 [2804:...]:37796 [2606:4700::6810:722]:443

Root cause chain (v1.18.31 source):

  • packages/opencode/src/config/config.ts:452 forks npmSvc.install(dir, {add: ["@opencode-ai/plugin"]}) for every existing config dir, including the project .opencode/ (included by ConfigPaths.directories only when it exists)
  • packages/core/src/npm.ts:149-152 runs arborist reify() whenever that dir lacks node_modules — a live registry install triggered by merely having project config
  • config.ts:634 / tui.ts:266 (waitForDependencies) block boot until those installs finish
  • the fetch prefers AAAA with no timeout and no happy-eyeballs fallback; dns-result-order=ipv4first in ~/.npmrc does not help (ignored by the Bun runtime)
Environment
  • OS: Linux x86_64 (Ubuntu-ish, Kernel 6.x)
  • Network: RA-advertised IPv6 default route, IPv6 transit dead, IPv4 fine
Screenshot and/or share link

n/a (headless repro above; can provide full ss/log captures on request)

Workarounds

Remove the project .opencode/ dir (global config install is satisfied by existing node_modules + lockfile, no fetch), or repair/disable host IPv6 (sysctl net.ipv6.conf.all.disable_ipv6=1).

Related: #48147 (plugin loading waits for install) and #30337 (.opencode install side effects).

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.