Report a failed connection to Ollama as server_unreachable, not timeout
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
阅读 internal/ollama/ollama.go 以及 internal/ollama 下使用 httptest 的现有测试。检查 Chat 如何对超时错误进行分类,然后添加测试,分别覆盖拨号超时以及服务器接受连接但不响应的情况;拨号测试应在一秒内完成。完成标准是这两种情况分别返回与 ErrUnreachable 和 ErrTimeout 匹配的错误,并且 make check 通过。
由索引模型根据 Issue 内容生成。
描述
What
When the Ollama host is down or unreachable, the TCP connection never opend and go will give up. MetCode reports this as "timeout" yet this is not specific enough for our case. We should report this as server_unreachable instead.
Where
The cause is in internal/ollama/ollama.go, in Chat: any net.Error with Timeout() == true becomes ErrTimeout, including a failed dial.
Fix
Before the Timeout() check, detect a failed dial and return ErrUnreachable instead. A dial failure is a *net.OpError with Op == "dial" (use errors.As).
Done when
- A request that cannot connect returns an error that
errors.Is(err, ollama.ErrUnreachable)accepts, even when the dial timed out. - A server that accepts the connection but never answers still returns
ErrTimeout. - There is a test for each case.
internal/ollamatests already fake servers withhttptest. For the dial case, a listener that accepts nothing, or a shortClienttimeout against a non-routable address, works. Keep the test under a second. make checkpasses.
- 主要语言
- Go
- 星标
- 1
- 派生
- 2
- 平均合并
- 12 小时 55 分钟
- 30 天内合并 PR
- 18
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Edwin-metcalf/MetCode 的其他 Issue
-
good first issue tools
难度 2/5 1-3 小时 新手友好度 90/100
Edwin-metcalf/MetCode#76 ·
维护者通常 1 天内回复
-
good first issue tools
难度 2/5 1-3 小时 新手友好度 88/100
Edwin-metcalf/MetCode#75 ·
维护者通常 1 天内回复
-
bench good first issue
难度 2/5 1-3 小时 新手友好度 85/100
Edwin-metcalf/MetCode#74 ·
维护者通常 1 天内回复
-
enhancement good first issue
难度 2/5 1-3 小时 新手友好度 85/100
Edwin-metcalf/MetCode#67 ·
维护者通常 1 天内回复
-
documentation good first issue
难度 1/5 1-3 小时 新手友好度 88/100
Edwin-metcalf/MetCode#58 ·
维护者通常 1 天内回复
查看 Edwin-metcalf/MetCode 的全部 Issue
相似的 Issue
-
-diff's removed-name budget ignores the names the -ptr pass tested可能已有人在做 @nova-loop 今天认领。 未关闭area: cli bug good first issue severity: low
难度 2/5 1-3 小时 新手友好度 84/100
TMHSDigital/subenum#495 ·
维护者通常 1 天内回复
-
bug effort:s impact:med raised-by:worker risk:low to:worker
难度 2/5 1-3 小时 新手友好度 78/100
medici-finance/assay#8120 · 1 条评论 ·
维护者通常 1 天内回复
-
factory:subtask
难度 1/5 1 小时以内 新手友好度 72/100
维护者通常 1 天内回复
-
reportedBy/community
难度 2/5 1-3 小时 新手友好度 78/100
openchoreo/openchoreo#5751 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 77/100
agent-substrate/substrate#4308 ·
维护者通常 2 天内回复