Repository navigation
Fall back to /v1/models when a server has no /health endpoint - #62
Merged
Merged
Conversation
OpenAI-compatible gateways and llama.cpp-style servers frequently ship without a /health route, so the startup check failed with a bare "404 (no /health endpoint)" warning even when the backend was perfectly usable — leaving --skip-health-check as the only way to silence it. health_check() now treats an HTTP 404 on /health as "endpoint missing" rather than "server unhealthy" and probes /v1/models instead: a non-empty model list proves the backend is reachable and serving, so it counts as a successful check. An empty list or a failing model request still reports an error naming both endpoints. Other /health statuses (5xx, 401, transport failures) are surfaced unchanged — the fallback never masks an endpoint that exists but is unhappy. - add fetch_models_raw(): strict variant that separates "answered with an empty list" from "request could not complete", which the health check needs to interpret the result. fetch_model_list() becomes a thin wrapper, keeping its lenient contract so model auto-selection is untouched - add models_url(), normalising a trailing /v1 the same way chat_url() does - cover all six paths with unit tests against a minimal in-test HTTP mock (tokio TcpListener, no new dependencies) - document the fallback in the Provider trait, the skip_health_check setting, the --skip-health-check help, README and TINYHARNESS.md Ollama needs no change (its health check already is a model listing) and Sockudo is left alone: its /up/<app> route reports tunnel status, not OpenAI compatibility.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OpenAI-compatible gateways and llama.cpp-style servers frequently ship without a /health route, so the startup check failed with a bare "404 (no /health endpoint)" warning even when the backend was perfectly usable — leaving --skip-health-check as the only way to silence it.
health_check() now treats an HTTP 404 on /health as "endpoint missing" rather than "server unhealthy" and probes /v1/models instead: a non-empty model list proves the backend is reachable and serving, so it counts as a successful check. An empty list or a failing model request still reports an error naming both endpoints. Other /health statuses (5xx, 401, transport failures) are surfaced unchanged — the fallback never masks an endpoint that exists but is unhappy.
Ollama needs no change (its health check already is a model listing) and Sockudo is left alone: its /up/ route reports tunnel status, not OpenAI compatibility.