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

Abierto
#67,104 5 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
72/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
electron, typescript

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
230k
Forks
31.3k
Merge medio
5 h 32 min
PR fusionados (30 d)
453

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de anomalyco/opencode

Todos los issues de anomalyco/opencode

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.