server: model catalog fetch times out on slow connections, blocking startup ~21s
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 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 内容生成。
描述
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 CLI2.2.7-x64 - Active plugins: none
Reproduction
- Use a connection where
models.opencode.aidownloads at ~450 KB/s. - Start OpenCode (desktop app, or
opencode serve --service). - Watch
~/.local/share/opencode/log/opencode.logforrole=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 分钟
- 30 天内合并 PR
- 453
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
anomalyco/opencode 的其他 Issue
-
area/desktop platform/macos status/repro-plausible type/bug version/v2
难度 1/5 1-3 小时 新手友好度 88/100
anomalyco/opencode#67064 · 4 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 半天 新手友好度 82/100
anomalyco/opencode#67009 · 2 条评论 ·
维护者通常 1 天内回复
-
area/web type/feature version/v2
难度 2/5 1-3 小时 新手友好度 78/100
anomalyco/opencode#67001 · 3 条评论 ·
维护者通常 1 天内回复
-
skills: a Claude-compatible SKILL.md that fails to parse is dropped without any log可能已有人在做 @liwenjie200543 于 2 天前认领。 未关闭area/plugins platform/linux reproduced type/bug version/v2
难度 2/5 1-3 小时 新手友好度 72/100
anomalyco/opencode#66970 · 4 条评论 ·
维护者通常 1 天内回复
-
tui: Mermaid renderer displays <b>/<strong> tags literally and ignores \n line breaks可能已有人在做 @argszero 于 2 天前认领。 未关闭area/tui platform/wsl status/repro-simulated type/bug version/v2
难度 2/5 1-3 小时 新手友好度 82/100
anomalyco/opencode#66773 · 4 条评论 ·
维护者通常 1 天内回复
查看 anomalyco/opencode 的全部 Issue
相似的 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
ci
难度 2/5 1-3 小时 新手友好度 78/100
ClickHouse/clickhouse-js#1248 ·
维护者通常 1 天内回复
-
E2E: Darlehen-Test wartet auf die gebuchte Auszahlung, bevor er zur Liquiditätsvorschau wechselt未关闭technik
难度 2/5 1-3 小时 新手友好度 78/100
-
bug
难度 2/5 1-3 小时 新手友好度 67/100
SR5-FoundryVTT/SR5-FoundryVTT#2162 ·
维护者通常 1 天内回复
-
enhancement good first issue
难度 2/5 1-3 小时 新手友好度 84/100
AhmedNAgy25/analysor#25 ·
维护者通常 1 天内回复