anomalyco / anomalyco/opencode

TUI blocks its first content on a 4.5MB provider payload; render the shell and populate async

Open
#41,078 1 comment 1 reaction 1 assignee View on GitHub

@kommander is already working on this.

Since Aug 7, 2026.

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

Description

Problem

opencode paints a frame quickly and then sits on a loading screen. On the latest published build (1.18.15, Linux, healthy network) the first frame appears at about 0.6s, and the actual UI, model list included, at about 3s. On current dev run from source the same pattern shows: frame at 1.9s, content at 4.3s.

I measured what the TUI waits on. The worker answers nothing until the instance bootstraps, and the TUI blocks its first content paint on the bootstrap calls. Per-call, from a dev run with the worker instrumented:

Call Time Response size
/provider 1349ms 4.6MB
/command 809ms 211KB
/agent 605ms 51KB
/mcp 306ms 34B
/config 63ms 15KB
/project/current 63ms 193B

/provider alone is a third of the wait, and the whole response is the models catalog: about 4.6MB of provider and model definitions serialized over the wire on first load. That payload is the bottleneck now. The network problems that used to cause 10s+ stalls are already fixed in dev (filesystem-only Npm.install, models.dev with a 10s timeout, bundled snapshot, and TTL cache), but the size and the blocking remain.

Proposed direction
  1. Render the shell first and populate content as data arrives, the way #39821 tried it. That PR was closed unmerged and predates the current packages/opencode layout, but the direction was right.
  2. Stop shipping the full models catalog to the TUI on first load. The bundled snapshot already exists server-side; serve the picker from it or embed it client-side and refresh in the background, instead of a 4.6MB HTTP response gating the first paint.
  3. Put timeouts on the remaining first-load calls (config.get, config.providers, agent, command). Log a warning, keep going with partial data, don't block content on them.

Related: #36798 (lazy CLI loading, open), #30453 (merged, startup time down 38%), #24868 (closed, static import tree).

For validation I'd run OPENCODE_SHOW_TTFD=1 (from #30453) plus a launch with the network blocked. Target: first frame under a second, and content that doesn't care about the models payload arriving late.

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.