You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Startup takes 10-30s, blocking network fetch of models.dev/api.json on every boot when cache is stale #42376
OpenCode blocks startup on a synchronous network fetch of the model registry (https://models.dev/api.json, ~3.6MB) whenever the local cache (~/.cache/opencode/models.json) is older than the 5-minute TTL. On connections where that host is slow/unstable, this adds 10-30 seconds to every launch before the TUI appears.
Measured on opencode 1.18.18, Linux, regular home connection (no proxy):
Condition
Boot gap (config-load → interactive)
models cache fresh (<5 min)
0.7-0.8s
models cache stale, network slow
10-30s
fetch pointed at localhost mirror
0.74-0.77s
The fetch latency itself was measured up to 16.4s TTFB (plus occasional TLS errors) for models.dev/api.json. The call uses AbortSignal.timeout(10000) and Bun's native fetch(), which does not honor HTTP_PROXY/HTTPS_PROXY.
This is related to #9758: the existing OPENCODE_DISABLE_MODELS_FETCH flag is broken by design it only stops the background refresh timer, not the lazy Data() read path, and setting it bypasses the bundled snapshot so the model picker breaks. Not a usable escape hatch.
Request: make the boot-time registry fetch non-blocking (render TUI immediately from cache/snapshot, refresh in background), honor HTTP_PROXY/HTTPS_PROXY, and provide a working offline/skip_models_fetch config (or fix OPENCODE_DISABLE_MODELS_FETCH).
Plugins
none required, reproduced with an empty plugin array. (User's real config also has opencode-mem@2.22.2, @tarquinen/opencode-dcp@3.1.14, opencode-pty@0.3.6, ./plugins/caveman/plugin.js; these add ~2s total and are not the cause.)
OpenCode version
1.18.18
Steps to reproduce
Install opencode 1.18.18 (no plugins needed).
Age the cache: touch -d "10 minutes ago" ~/.cache/opencode/models.json (or wait >5 min after last run).
Launch: script -qc "opencode" /dev/null (or a normal terminal).
Time from invocation until the TUI is interactive; compare to a run where the cache was just refreshed.
I can’t reproduce the claimed blocking path from the current implementation or the exact v1.18.18 source.
ModelsDev.populate() returns an existing disk cache regardless of its age, then falls back to the bundled snapshot. Cache staleness is only checked by refresh(), which runs in a forked background fiber. OPENCODE_DISABLE_MODELS_FETCH also prevents that refresh. Therefore, aging models.json past five minutes does not make startup synchronously wait for the catalog fetch.
There may be a separate source of startup latency in the reported environment, but the proposed root cause and reproduction do not match the released code. Closing as cannot reproduce.
Activity
github-actions commentedon Aug 13, 2026
This issue might be a duplicate of existing issues. Please check:
models.devfetch hangs startup on slow/unreliable networks.models.deverrors — also requests a way to disable the fetch, overlaps yourOPENCODE_DISABLE_MODELS_FETCHfindings.opencode-agent commentedon Aug 14, 2026
I can’t reproduce the claimed blocking path from the current implementation or the exact v1.18.18 source.
ModelsDev.populate()returns an existing disk cache regardless of its age, then falls back to the bundled snapshot. Cache staleness is only checked byrefresh(), which runs in a forked background fiber.OPENCODE_DISABLE_MODELS_FETCHalso prevents that refresh. Therefore, agingmodels.jsonpast five minutes does not make startup synchronously wait for the catalog fetch.There may be a separate source of startup latency in the reported environment, but the proposed root cause and reproduction do not match the released code. Closing as cannot reproduce.