Skip to content

[Bug] TUI startup can hang ~6 min on "Loading plugins...": client-side plugin stage=setup stalls on an external connection; reconciliation frozen ~360 s #56885

Closed as not planned

Description

@NickRivers1983

Environment

  • OpenCode 2.0.26 (bundled bun runtime), Linux Bazzite (immutable, Fedora-based), kernel 6.x
  • Reproduces both via the shared background service (127.0.0.1:49374) and with --standalone; also with --server attach
  • Affected plugin in our traces: @tarquinen/opencode-dcp (but the mechanism looks plugin-agnostic — see below)

Symptom

Every TUI start: Loading plugins… for ~5–6 minutes, then startup proceeds normally. Server side shows nothing wrong.

Evidence chain (timestamps UTC, from ~/.local/share/opencode/log/opencode.log)

17:47:44 plugin operation stalled ... id=49 stage=setup elapsedMs=5000 plugin=opencode-dcp target=@tarquinen/opencode-dcp role=cli
17:49:58 plugin operation failed component=plugin id=22 stage=setup durationMs=360146
         error="Transport: The operation timed out." plugin=opencode-dcp target=@tarquinen/opencode-dcp role=cli
17:49:58 plugin reconciliation completed id=1 durationMs=360304 plugins=15
17:49:58 plugin reconciliation completed id=2 durationMs=3
  • The 5 s stalled line is the diagnostic-only warn (matches packages/tui/src/plugin/context.tsx ~114–140). The op itself never errors until ~300–360 s.
  • 300–360 s is variable (observed 330532 / 360146 / 146-less variants and a 300022 ms instance): it is a runtime/network timeout, not a code constant (grep for 360000 in the binary only hits substrings of 3600000 = 1 h and unit tables).
  • Meanwhile the server loads the very same plugin in ~1 s (loading plugin id=@tarquinen/opencode-dcp ... role=server) and MCPs connect in 1.7–2 s — the shared service is healthy.
  • After the failure, reconciliation completes and the next reconciliation runs in 3 ms.

Dynamic instrumentation (socat tee in front of the local service + tiny CONNECT-logging proxy)

  1. The TUI client sends only GET /api/info and GET /api/fs/list (both 200), then no further traffic to the local service for >400 s while the UI stays on "Loading plugins…".
  2. Exactly one external connection appears ~2 s after boot: CONNECT opencode.ai:443.
  3. When that socket is held open by a local proxy, the client never produces an error and hangs indefinitely (observed 400 s).
  4. In normal networking the fetch still ends with Bun's runtime error code 314 ("The operation timed out.") after ~300–360 s; the Transport: prefix comes from OpenCode's own client error wrapper (in the binary: class Bb extends Io("TransportError") plus a formatter that strips the Error suffix).

Ruled out (checked with the actual artifacts)

  • Plugin code: both @tarquinen/opencode-dcp 3.1.15 and 3.2.0 contain zero occurrences of Transport / timed out / 360000. DCP 3.1.15's tui.tsx is sync-fs only (loadConfig + registerCommands); the single fetch in its init is a version check with a 10 s AbortSignal.timeout. No WebSocket/spawn/listen in dist/index.js.
  • Proxy env vars (none in session or in the app's .env).
  • A second plugin (opencode-supermemory) — removed from config earlier with no change in behavior.

Feature request (framed as request, not a confirmed-spec claim)

  • A bounded deadline for the client-side plugin setup stage (e.g. 15–30 s), treating a slow/failed external fetch as non-fatal instead of gating the whole first reconciliation on it
  • Cancellation of the setup op when startup is aborted / the TUI is closed
  • A clearer error line for Bun 314 timeouts from this wrapper (Transport: alone is opaque)

Notes

  • The user-local watchdog for this failure pattern: grep 'message="plugin operation failed".*stage=setup' with durationMs>=300000 (real incidents today: 17:42, 17:45, 17:49, 17:50, 18:02 UTC + one on Oct 14).
  • Machine artifacts available on request (tgz checksums, tee logs, no private data included in this draft).

Activity

  1. opencode-agent commented on Oct 18, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed write-up and the traces.

    I couldn't reproduce this yet. What I tried:

    • OpenCode 2.0.26 on Linux, project config plugins: ["@tarquinen/[email protected]"], started in the TUI. Startup was ready within about 10 s and "Loading plugins…" never appeared.
    • The same setup with opencode.ai pointed at a non-routable address, so HTTPS connections to it hang, standing in for your stuck CONNECT opencode.ai:443. Same result. The DCP command ("Open DCP panel") showed up in the command palette, so the plugin's client-side setup had finished.

    One thing I noticed in the code: DCP 3.2.0's client-side setup only waits on one call, ctx.client.rpc(...).status(...), which goes to the OpenCode service, not to opencode.ai. OpenCode has no deadline on a plugin's setup step (it only logs the 5 s "stalled" warning). So if that call never gets an answer, the first plugin load waits until the connection times out, which would match your Transport: The operation timed out. line. I couldn't trigger that here, so something in your setup seems to matter.

    These would help:

    1. Does the stall go away if you remove only @tarquinen/opencode-dcp from your config and keep the other 14 plugins? And does it still happen with DCP as the only plugin?
    2. Your plugin list (redacted as needed) and which config files it comes from.
    3. A startup log captured at debug level (--log-level DEBUG if your build supports it), covering the time from launch until reconciliation completes. In particular, the server-side lines for the dcp RPC status call during that window, if any.
    4. Whether it also happens with a fresh config and data directory (e.g. XDG_CONFIG_HOME/XDG_DATA_HOME pointed at empty temp dirs) and just DCP installed.

    Related, but not the same problem: #54974 (the stock TUI client drops long-pending plugin requests at Bun's ~5 min fetch deadline).

  2. opencode-agent commented on Oct 21, 2026

    @opencode-agent
    Contributor

    We couldn't reproduce the hang, and the details we asked for haven't come in, so I'm closing this as not planned for now.

    What we tried: OpenCode 2.0.26 on Linux with @tarquinen/[email protected]. We also ran it with opencode.ai blocked so that connection hangs. In every run, DCP's client-side setup finished within seconds and "Loading plugins…" never stayed on screen.

    If it still happens for you, please reopen or comment here with:

    • whether removing only DCP (or running with DCP as the only plugin) makes the stall go away
    • your plugin list
    • a debug-level startup log covering launch until plugin loading completes, including the server-side lines for DCP's status RPC call

    Thanks again for the detailed traces. They'll help if this comes back. Also related: #54974.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions