server: model catalog fetch times out on slow connections, blocking startup ~21s

オープン
#67,104 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
electron, typescript

調査の方向性

Start with the server startup path exercised by opencode serve --service, then locate the model catalog request to the documented models.opencode.ai endpoint and inspect ~/.local/share/opencode/log/opencode.log. There are no file or test names in the issue, so find the existing fetch, timeout, configuration, and cache-related tests before changing behavior. Done means a slow catalog response can succeed or use cached data, and a failed refresh does not delay startup by the fetch timeout.

索引モデルが issue の本文から書いたものです。

説明

area/providers platform/windows status/repro-simulated type/bug version/v2

Summary

On startup, OpenCode fetches the model catalog from https://models.opencode.ai/experimental/v2.0/api.json?type=chat,decision,image with a hardcoded ~10s timeout. On slow connections the response is ~11.6 MB and takes 16-27s, so the fetch always fails and startup is blocked for ~21s on every launch.

Environment

  • opencode version: v2.2.7
  • OS: Windows 10 22H2 (Microsoft Windows NT 10.0.19045.0), x64
  • Terminal: Desktop app (Electron + WebView2) - no terminal
  • Shell: C:\Windows\system32\cmd.exe
  • Install/channel: latest - desktop app ai.opencode.desktop, bundled CLI 2.2.7-x64
  • Active plugins: none

Reproduction

  1. Use a connection where models.opencode.ai downloads at ~450 KB/s.
  2. Start OpenCode (desktop app, or opencode serve --service).
  3. Watch ~/.local/share/opencode/log/opencode.log for role=server.

Expected Behavior

The catalog fetch either succeeds, is cached across launches, or is not on the critical startup path. A failed catalog fetch should not add ~20s to startup.

Actual Behavior

level=ERROR message="Failed to fetch models.dev"
cause="Cause([Fail(TimeoutError: Operation timed out after '10s')])"

The fetch is retried and startup is blocked for ~21s before MCP servers begin connecting.

Measured from this machine with the same URL:

attempt size time
1 11,641 KB 23.3s
2 11,641 KB 27.3s
3 11,641 KB 15.8s

The same URL fetched with Invoke-WebRequest and a 60s timeout returns HTTP 200 every time, so the endpoint is healthy - only the 10s client timeout is too short.

Additional Context

Startup timeline for a single run (from the log):

07:30:56  cli starting
07:30:57  location services booted (1.1s)
07:31:19  Failed to fetch models.dev   (+22s)
07:31:47  mcp connected                (+26s)

Failed to fetch models.dev appears 104 times in the log. Earlier occurrences also show transient DNS failures:

Transport error (GET https://models.opencode.ai/experimental/v2.0/api.json?type=chat,decision,image)
(cause: TypeError: getaddrinfo ENOTFOUND models.opencode.ai)

DNS resolves correctly now (Cloudflare 104.18.10.66 / 104.18.11.66), so the remaining failure is purely the timeout.

Requested fix: make the catalog timeout configurable (or raise it), and/or cache the last successful catalog so a failed refresh does not block startup.

Workaround tried: none available - no documented config field controls this timeout.

主要言語
TypeScript
スター
230k
フォーク
31.3k
平均マージ
5時間 32分
マージ済み PR(30日)
453

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

anomalyco/opencode のほかの issue

anomalyco/opencode の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。