Report a failed connection to Ollama as server_unreachable, not timeout

オープン 初心者向け
#73 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

評価

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

調査の方向性

internal/ollama/ollama.goと、httptestを使用するinternal/ollama配下の既存テストを読んでください。Chatがタイムアウトエラーをどのように分類するかを確認し、接続試行がタイムアウトする場合と、接続を受け付けても応答しないサーバーの場合のテストを追加してください。接続のテストは1秒未満にしてください。2つのケースがそれぞれErrUnreachableとErrTimeoutに一致するエラーを返し、make checkが成功すれば完了です。

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

説明

bench good first 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/ollama tests already fake servers with httptest. For the dial case, a listener that accepts nothing, or a short Client timeout against a non-routable address, works. Keep the test under a second.
  • make check passes.
主要言語
Go
スター
1
フォーク
2
平均マージ
12時間 55分
マージ済み PR(30日)
18

環境構築

はじめの一歩

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

Edwin-metcalf/MetCode のほかの issue

Edwin-metcalf/MetCode の issue をすべて見る

似ている issue

Go の issue をもっと見る

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

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