cli: opencode run hangs indefinitely with local Ollama model
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 38/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- nodejs, ollama, typescript
- 領域
- cli
研究方向
Start by reproducing with opencode debug config to confirm the resolved default model, then run opencode run "Reply with exactly: LOCAL_OK" with a short timeout and check whether the request ever reaches http://127.0.0.1:11434/v1. The report leaves two suspects: the @ai-sdk/openai-compatible provider path and the sandbox block, since Docker Desktop's engine was not running during the hang while the remote-model control succeeded. Done means opencode run either prints the reply or exits with a clear timeout/connection error, ideally covered by a test that exercises a non-streaming local endpoint.
由索引模型根據 Issue 內容生成。
描述
Summary
opencode run with the default local Ollama model produces no output and never exits. The same CLI completes normally with an HTTP-compatible remote model, and Ollama's own API answers the same prompt in seconds.
Environment
- opencode version: 1.18.31 (
opencode --version; executable resolved through%APPDATA%\npm\opencode.ps1). OpenCode Desktop 2.3.2 is also installed but its CLI is not the one onPATH. - OS: Microsoft Windows NT 10.0.26300.0 (Windows 11 x64).
veris unavailable in PowerShell, so[Environment]::OSVersion.VersionStringwas used. - Terminal:
TERM=xterm-256color;TERM_PROGRAM,COLORTERM, andWT_SESSIONunset. Command was launched from the OpenCode shell tool (non-interactive). - Shell:
%COMSPEC%=C:\WINDOWS\system32\cmd.exe; OpenCode config sets"shell": "powershell"for its own shell tool. - Install/channel: npm global install, release channel (
C:\Users\<user>\AppData\Roaming\npm\opencode.ps1). - Active plugins: None found. No
pluginskey in~/.config/opencode/opencode.jsonoropencode.jsonc; no.opencode/plugin,.opencode/plugins,plugin, orpluginsdirectories under the global config directory.
Reproduction
- Install Ollama 0.40.16 and pull
qwen2.5-coder:7b(4.7 GB). Runollama servewithOLLAMA_HOST=127.0.0.1:11434; confirmGET http://127.0.0.1:11434/api/tagsreturns 200. - In the global config, the resolved default model is
ollama/qwen2.5-coder:7b(opencode debug configconfirms this). - Run
opencode run "Reply with exactly: LOCAL_OK"from any directory. - Wait several minutes. No output is produced and the prompt never returns.
- Control A: direct
POST http://127.0.0.1:11434/api/generatewith{"model":"qwen2.5-coder:7b","prompt":"Say OK","stream":false,"options":{"num_predict":8}}returns HTTP 200, body{"response":"OK"}, in about 19 seconds. - Control B:
opencode run -m freellmapi/nemotron-3-ultra-550b "Reply with exactly: SAFE_OK"printsSAFE_OKand exits normally.
Expected Behavior
opencode run should print the model's reply and exit, or surface a clear timeout/connection error if the model cannot be reached.
Actual Behavior
The process stayed alive for about 8 minutes with no stdout and no error. Get-Process showed the opencode.exe process alive with Responding = True and roughly 22 seconds of cumulative CPU time. The parent shell also stayed alive with no output because the pipeline buffers until the child exits. Both were terminated manually; the shell reported exit code 4294967295.
Additional Context
- Frequency: observed once; not re-run after restarting Ollama.
- Ollama was listening only on
127.0.0.1:11434with an inbound firewall block, so this is not a network reachability problem. - Relevant global config (no credentials shown):
"model": "ollama/qwen2.5-coder:7b",
"provider": {
"ollama": {
"npm": "@ai-sdk/openai-compatible",
"options": { "baseURL": "http://127.0.0.1:11434/v1" },
"models": {
"qwen2.5-coder:7b": { "name": "Qwen2.5 Coder 7B" }
}
}
},
"sandbox": {
"enabled": true,
"image": "langchain/langgraph-sandbox:latest",
"resources": { "cpu": 2, "memory": "4GiB" }
}
- Docker Desktop's engine was not running during the failing test (it was started afterwards for an unrelated container audit). If sandbox startup is involved in this hang, that is worth checking; the remote-model control succeeded under the same condition.
- No custom plugins or provider overrides affect this model beyond the config above.
- 主要語言
- TypeScript
- 星號
- 227k
- 分支
- 30.7k
- 平均合併
- 3 小時 57 分鐘
- 30 天內合併 PR
- 484
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
anomalyco/opencode 的其他 Issue
-
[Site] Active section detection should respect scroll-margin-top可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉area/web reproduced type/bug
難度 2/5 1-3 小時 新手友好度 65/100
anomalyco/opencode#65384 · 1 則留言 ·
維護者通常 1 天內回覆
-
area/cli type/feature version/v2
難度 2/5 1-3 小時 新手友好度 68/100
anomalyco/opencode#65379 · 1 則留言 ·
維護者通常 1 天內回覆
-
Shell tool: no upper bound on the timeout a model can ask for, so one call can hold a turn for hours未關閉area/core platform/linux type/feature version/v2
難度 2/5 1-3 小時 新手友好度 75/100
anomalyco/opencode#65254 · 1 則留言 ·
維護者通常 1 天內回覆
-
inference/go type/feature
難度 1/5 1-3 小時 新手友好度 72/100
anomalyco/opencode#65148 · 1 則留言 ·
維護者通常 1 天內回覆
-
area/providers type/feature version/v2
難度 2/5 1-3 小時 新手友好度 68/100
anomalyco/opencode#64845 · 1 則留言 ·
維護者通常 1 天內回覆
查看 anomalyco/opencode 的全部 Issue
相似的 Issue
-
難度 1/5 1 小時以內 新手友好度 88/100
vercel-labs/ui#999 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 73/100
melgarafael/DeskcommCRM#5109 · 1 則留言 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 78/100
Doist/todoist-sdk-typescript#783 ·
-
難度 2/5 1-3 小時 新手友好度 64/100
nicobailon/pi-subagents#3319 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆