Skip to content

fix(agent): skip local server probes on known public endpoints - #61692

Closed
kyssta-exe wants to merge 1 commit into
NousResearch:mainfrom
kyssta-exe:fix/skip-probes-on-known-public-endpoints-61421
Closed

fix(agent): skip local server probes on known public endpoints#61692
kyssta-exe wants to merge 1 commit into
NousResearch:mainfrom
kyssta-exe:fix/skip-probes-on-known-public-endpoints-61421

Conversation

@kyssta-exe

Copy link
Copy Markdown
Contributor

Problem

detect_local_server_type() probes for Ollama/LM Studio/vLLM/llama.cpp by sending GET requests to paths like /api/tags, /v1/props, /version on the configured base URL. When the base URL is https://api.openai.com/v1, these probes produce harmless but noisy 404s that pollute egress logs and trigger false-positive monitoring alerts (#61421).

Fix

Add _is_likely_local_network() helper that returns True only for local/private addresses: localhost, 127.0.0.1, 10.x.x.x, 172.16-31.x.x, 192.168.x.x, Docker internal hosts, and Unix sockets. When the endpoint is NOT local/private, skip probing and return None.

Rationale

The function is named detect_local_server_type — it semantically should only probe local endpoints. The previous behavior probed every endpoint including public cloud APIs, which is both wasteful and noisy.

Test Plan

  • Existing tests use localhost / 127.0.0.1 / 192.168.x.x addresses — all continue to pass.
  • detect_local_server_type("https://api.openai.com/v1") now returns None immediately without any HTTP traffic.

Closes #61421

detect_local_server_type() probes for Ollama/LM Studio/vLLM/llama.cpp
by sending GET requests to paths like /api/tags, /v1/props, /version.
When the configured base_url is a well-known public endpoint like
api.openai.com, these probes produce harmless but noisy 404s that:
  - Pollute egress logs
  - Trigger false-positive alerts in monitoring
  - Make it harder to distinguish real issues (NousResearch#61421)

Fix: add _is_likely_local_network() helper that returns True only for
localhost, 127.0.0.1, private IPv4 ranges (10.x, 172.16-31.x, 192.168.x),
Docker internal hosts, and Unix socket paths.  When the endpoint is NOT
on a local/private network, skip probing entirely and return None.

This is semantically correct: the function is called 'detect_local_server_type'
— it should only probe endpoints that could plausibly be local servers.

Closes NousResearch#61421
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/openai OpenAI / Codex Responses API labels Jul 9, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related: competing with #61428 (both fix #61421). This PR uses an allowlist approach (_is_likely_local_network() — only probe local/private hosts); #61428 uses a denylist (short-circuit known public provider hosts). Same goal, different mechanism — maintainer picks.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for tracing the noisy public-endpoint probes. The premise is confirmed on current main: detect_local_server_type() constructs its client at agent/model_metadata.py:704 and unconditionally issues the local-server requests at lines 707, 717, 730/732, and 740.

Problems

  • The new _is_likely_local_network() duplicates but narrows the established is_local_endpoint() contract at agent/model_metadata.py:594-647. In particular, it drops the supported Tailscale CGNAT range (100.64.0.0/10, lines 622-644) and unqualified local hostnames (lines 618-621), so those local deployments would stop being detected.
  • The PR changes only agent/model_metadata.py; please add coverage for the public no-request case and retained local classes.

Suggested changes

  • Gate detect_local_server_type() with the existing is_local_endpoint(base_url) helper, rather than maintaining a second classifier.
  • Mock httpx.Client to prove https://api.openai.com/v1 performs no probe, and retain positive coverage for a Tailscale endpoint and an unqualified local service host.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 11, 2026
@kyssta-exe

Copy link
Copy Markdown
Contributor Author

Stale — no merge activity for 4-6 days. Can resubmit if still needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P3 Low — cosmetic, nice to have provider/openai OpenAI / Codex Responses API sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Hermes probes non‑OpenAI endpoints (/api/tags, /v1/props, /version) on api.openai.com, causing noisy 404s

3 participants