fix: is_local_endpoint misses Docker/Podman DNS names#7906
Conversation
) Extends is_local_endpoint() to detect local LLM proxies accessed via container DNS names (e.g. hermes-litellm, ollama), fixing the stale stream timeout (180s) firing on local providers during prefill. Three additions: 1. Unqualified hostnames (no dots) → always local. Docker/Podman DNS, mDNS, and /etc/hosts entries are always on the local network. 2. DNS resolution fallback — resolve hostname to IP with socket.gethostbyname(), check if the resolved address is private. 3. Configurable model.local_endpoints in config.yaml — explicit list of hostnames to treat as local for edge cases where DNS resolution isn't available. Fixes NousResearch#7905 Related: NousResearch#7069, NousResearch#6368 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Likely duplicate of #7950 (merged) — same fix for |
|
Thanks @malaiwah — closing as superseded. The entire stated goal is now on |
Summary
Extends
is_local_endpoint()inagent/model_metadata.pyto detect local LLM proxies accessed via container DNS names (e.g.ollama,litellm,hermes-litellm).Without this fix, the stale stream timeout (180s, added in #6368) is NOT auto-disabled for local providers accessed via Docker/Podman DNS, causing the infinite retry loop described in #7069.
Changes
Three additions to
is_local_endpoint():Unqualified hostnames (no dots) → always local. A hostname like
ollamaorlitellmis always a local network name (Docker/Podman DNS, mDNS,/etc/hosts). This is the most common case and requires zero configuration.DNS resolution fallback — resolve the hostname to an IP with
socket.gethostbyname(), check if the resolved address is private/loopback/link-local. Catches qualified local hostnames likeollama.local.Configurable
model.local_endpoints— a list of hostnames inconfig.yamlto explicitly mark as local. Useful for edge cases where DNS resolution isn't available or the hostname doesn't resolve to a private IP.Test plan
is_local_endpoint("http://ollama:11434/v1")returnsTrue(unqualified hostname)is_local_endpoint("http://my-litellm-proxy:4000/v1")returnsTrue(unqualified hostname)is_local_endpoint("http://api.openai.com/v1")returnsFalse(qualified, public)is_local_endpoint("http://localhost:11434/v1")still returnsTrue(existing behavior)is_local_endpoint("http://192.168.1.100:8000/v1")still returnsTrue(existing behavior)is_local_endpoint("http://my-host.local:8000/v1")resolves and checks IPmodel.local_endpointsconfig is read when setFixes #7905
Related: #7069, #6368
🤖 Generated with Claude Code