Skip to content

Multi-tier framework for evaluating AI agent skills and plugins with quality gates, security scanning, harness compatibility checks, semantic overlap detection, synthetic evaluation dataset generation, and live agent evaluation that measures how skills affect agent behavior. Ships reusable CI templates that bring every check to any repository.

fix(tier3): probe Gym policy endpoint reachability in doctor (#593)

Christopher Kevinfc7b0397872f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 817f7bbf..1a4f415c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -252,6 +252,10 @@ All notable changes to SkillEvaluator are documented in this file.
### Fixed
+- NeMo Gym doctor isolates its anonymous endpoint probe, honors proxy settings
+ without forwarding credentials, and reports proxy authentication and gateway failures.
+- Native NeMo Gym doctor now checks policy endpoint reachability with a bounded,
+ unauthenticated HTTP probe and actionable connection-failure guidance.
- Native NeMo Gym teardown now completes its cleanup progress stage after a
successful stop, instead of reporting an interrupted cleanup on cancellation.
- Native NeMo Gym cleanup now also stops run-owned detached server processes
diff --git a/docs/tier3-live-evaluation.mdx b/docs/tier3-live-evaluation.mdx
index f03941bc..0c5d068c 100644
--- a/docs/tier3-live-evaluation.mdx
+++ b/docs/tier3-live-evaluation.mdx
@@ -735,7 +735,15 @@ skillevaluator tier3 evaluate ./my-skill --backend nemo-gym --agents codex --mod
`tier3 doctor --backend nemo-gym` checks the Gym CLI interface and its version, that the Docker
daemon answers, the `SKILL_EVAL_NEMO_GYM_*` settings, each selected agent's policy model
-endpoint, and the selected agents and `--env-mode`. The CLI check runs
+endpoint, and the selected agents and `--env-mode`. The endpoint check uses
+an isolated, unauthenticated HTTP probe with a three-second deadline. It honors
+`HTTP_PROXY`, `HTTPS_PROXY` and `NO_PROXY` (also lowercase), but sends no endpoint
+or proxy credentials and does not follow redirects. Policy endpoint HTTP responses,
+including authentication errors, count as reachable. Proxy authentication failures
+(`407`), failed HTTPS tunnels, and plain-HTTP proxy gateway errors (`502`, `504`)
+fail the check instead. HTTPS origin responses after a successful tunnel still
+count as reachable, including `502` and `504`. It does not
+validate credentials or model compatibility. The separate CLI interface check runs
`gym eval run --help` with a 15-second timeout and a combined stdout/stderr limit of
256 KiB, without policy credentials or server startup. Timeout, interruption, or output
overflow stops its isolated process group with bounded TERM/KILL cleanup. It rejects
diff --git a/src/skillevaluator/tier3/commands.py b/src/skillevaluator/tier3/commands.py
index c94b8a88..7a4629e4 100644
--- a/src/skillevaluator/tier3/commands.py
+++ b/src/skillevaluator/tier3/commands.py
@@ -10,12 +10,14 @@ import math
import os
import shutil
import subprocess
+import sys
import tempfile
import tomllib
import webbrowser
from collections.abc import Mapping
from pathlib import Path
from typing import Any
+from urllib.parse import urlsplit
import yaml
from rich.box import SIMPLE
@@ -1081,6 +1083,91 @@ def _docker_daemon_error(env: Mapping[str, str]) -> str | None:
_DOCKER_PROBE_TIMEOUT_S = 15.0
+_POLICY_ENDPOINT_PROBE_TIMEOUT_S = 3.0
+_POLICY_ENDPOINT_PROBE = """
+import sys
+from urllib.parse import urlsplit, urlunsplit
+from urllib.error import HTTPError, URLError
+from urllib.request import HTTPRedirectHandler, ProxyHandler, Request, build_opener, getproxies_environment, proxy_bypass
+
+class NoRedirect(HTTPRedirectHandler):
+ def redirect_request(self, req, fp, code, msg, headers, newurl):
+ return None
+
+try:
+ url = urlsplit(sys.stdin.read())
+ if url.scheme not in ("http", "https") or not url.hostname or url.username or url.password:
+ sys.exit(1)
+ proxies = getproxies_environment()
+ using_proxy = bool(proxies.get(url.scheme)) and not proxy_bypass(url.netloc)
+ try:
+ response = build_opener(ProxyHandler(proxies), NoRedirect()).open(
+ Request(urlunsplit(url), method="HEAD"), timeout=2
+ )
+ except HTTPError as response:
+ response.close()
+ if using_proxy and (response.code == 407 or url.scheme == "http" and response.code in (502, 504)):
+ sys.exit(2 if response.code == 407 else 3)
+ except URLError as error:
+ if using_proxy:
+ sys.exit(2 if "Tunnel connection failed: 407" in str(error.reason) else 3)
+ sys.exit(1)
+ else:
+ response.close()
+except Exception:
+ sys.exit(1)
+"""
+
+
+def _nemo_gym_policy_endpoint_error(url: str) -> str | None:
+ """Probe anonymously in a bounded child so DNS resolution cannot hang doctor."""
+ from skillevaluator.tier3.nemo_gym.backend import MODEL_URL_ENV
+
+ probe_env = {
+ name: os.environ[name] for name in ("SYSTEMROOT", "SSL_CERT_FILE", "SSL_CERT_DIR") if name in os.environ
+ }
+ for name in ("http_proxy", "https_proxy", "HTTP_PROXY", "HTTPS_PROXY", "no_proxy", "NO_PROXY"):
+ if value := os.environ.get(name):
+ if name.lower() != "no_proxy":
+ try:
+ parsed = urlsplit(value if "://" in value else "//" + value, scheme="http")
+ if parsed.scheme not in ("http", "https") or not parsed.hostname:
+ continue
+ value = parsed._replace(netloc=parsed.netloc.rsplit("@", 1)[-1]).geturl()
+ except ValueError:
+ continue
+ probe_env[name] = value
+ detail = "could not reach the policy endpoint"
+ try:
+ probe = subprocess.run(
+ [sys.executable, "-I", "-c", _POLICY_ENDPOINT_PROBE],
+ env=probe_env,
+ input=url,
+ text=True,
+ stdout=subprocess.DEVNULL,
+ stderr=subprocess.DEVNULL,
+ timeout=_POLICY_ENDPOINT_PROBE_TIMEOUT_S,
+ check=False,
+ )
+ if probe.returncode == 0:
+ return None
+ if probe.returncode == 2:
+ detail = (
+ "policy endpoint proxy authentication is needed; this anonymous probe does not send proxy credentials"
+ )
+ elif probe.returncode == 3:
+ detail = "policy endpoint proxy could not reach the service; check HTTP_PROXY/HTTPS_PROXY/NO_PROXY and proxy access"
+ except subprocess.TimeoutExpired:
+ detail = f"policy endpoint probe timed out after {_POLICY_ENDPOINT_PROBE_TIMEOUT_S:g}s"
+ except OSError:
+ detail = "could not start the policy endpoint probe"
+ return (
+ f"NeMo Gym {detail}; check {MODEL_URL_ENV} or the selected provider's base URL, "
+ "start the inference service, and check network access. A policy endpoint HTTP response is sufficient; "
+ "this check does not validate credentials or model compatibility."
+ )
+
+
def _nemo_gym_doctor_rows(
agents: list[str],
env_mode: str,
@@ -1134,6 +1221,7 @@ def _nemo_gym_doctor_rows(
overrides = parse_agent_model_overrides(agent_model)
except ValueError:
overrides = {}
+ checked_endpoints: set[str] = set()
for agent in agents:
try:
_model, endpoint_url, _key = _model_endpoint((overrides.get(agent) or [None])[0])
@@ -1142,6 +1230,10 @@ def _nemo_gym_doctor_rows(
continue
if (url_error := model_url_credential_error(endpoint_url)) and url_error not in errors:
errors.append(url_error)
+ elif not url_error and endpoint_url not in checked_endpoints:
+ checked_endpoints.add(endpoint_url)
+ if endpoint_error := _nemo_gym_policy_endpoint_error(endpoint_url):
+ errors.append(f"{agent}: {endpoint_error}")
if env_mode == "docker" and (docker_error := _docker_daemon_error(gym_launch_environment({}))):
errors.append(docker_error)
rows += [("NeMo Gym backend", "fail", error) for error in errors] or [
diff --git a/tests/test_nemo_gym_backend.py b/tests/test_nemo_gym_backend.py
index e877b1a6..ba3ddf2c 100644
--- a/tests/test_nemo_gym_backend.py
+++ b/tests/test_nemo_gym_backend.py
@@ -1573,7 +1573,8 @@ def test_gym_run_removes_staged_tasks_and_jobs(tmp_path: Path, monkeypatch: pyte
assert json.loads((run_dir / "run_config.json").read_text())["harbor"]["jobs_retained"] is False
-def test_doctor_reports_nemo_gym_readiness(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
[email protected]("reachable", [True, False])
+def test_doctor_reports_nemo_gym_readiness(tmp_path: Path, monkeypatch: pytest.MonkeyPatch, reachable: bool) -> None:
from skillevaluator.tier3 import commands
from skillevaluator.tier3.nemo_gym import backend
from skillevaluator.tier3.nemo_gym import runner as gym_runner
@@ -1588,11 +1589,21 @@ def test_doctor_reports_nemo_gym_readiness(tmp_path: Path, monkeypatch: pytest.M
monkeypatch.setattr("shutil.which", lambda name: f"/usr/bin/{name}")
monkeypatch.setattr(commands, "_docker_daemon_error", lambda _env: None)
monkeypatch.setattr(gym_runner, "_model_endpoint", lambda model: (model or "m", "http://127.0.0.1:9/v1", "k"))
- rows = commands._nemo_gym_doctor_rows(["codex"], "docker", {})
+ probes = []
+
+ def endpoint_probe(url):
+ probes.append(url)
+ return None if reachable else "check SKILL_EVAL_NEMO_GYM_MODEL_URL"
+
+ monkeypatch.setattr(commands, "_nemo_gym_policy_endpoint_error", endpoint_probe)
+ rows = commands._nemo_gym_doctor_rows(["codex", "opencode"], "docker", {})
assert rows == [
("NeMo Gym CLI", "pass", f"{gym} (nemo-gym 0.7.0)"),
- ("NeMo Gym backend", "pass", "docker sandbox ready"),
+ ("NeMo Gym backend", "pass", "docker sandbox ready")
+ if reachable
+ else ("NeMo Gym backend", "fail", "codex: check SKILL_EVAL_NEMO_GYM_MODEL_URL"),
]
+ assert probes == ["http://127.0.0.1:9/v1"]
monkeypatch.setenv("SKILL_EVAL_NEMO_GYM_BIN", str(tmp_path / "missing"))
rows = commands._nemo_gym_doctor_rows(["codex", "goose"], "local", {})
@@ -1601,6 +1612,164 @@ def test_doctor_reports_nemo_gym_readiness(tmp_path: Path, monkeypatch: pytest.M
assert "goose" in details and "docker only" in details
[email protected]("status", [200, 307, 401, 403, 404, 405])
+def test_policy_endpoint_probe_accepts_any_http_response_without_credentials(status: int) -> None:
+ import http.server
+ import threading
+
+ from skillevaluator.tier3.commands import _nemo_gym_policy_endpoint_error
+
+ headers = []
+
+ class Handler(http.server.BaseHTTPRequestHandler):
+ def do_HEAD(self):
+ headers.append(dict(self.headers))
+ self.send_response(status)
+ self.send_header("Location", "http://127.0.0.1:9/unreachable")
+ self.end_headers()
+
+ def log_message(self, *_args):
+ pass
+
+ server = http.server.ThreadingHTTPServer(("127.0.0.1", 0), Handler)
+ thread = threading.Thread(target=server.serve_forever)
+ thread.start()
+ try:
+ assert _nemo_gym_policy_endpoint_error(f"http://127.0.0.1:{server.server_port}/v1") is None
+ assert len(headers) == 1
+ assert not any(name.lower() in {"authorization", "x-api-key"} for name in headers[0])
+ finally:
+ server.shutdown()
+ thread.join()
+ server.server_close()
+
+
[email protected]("url", ["", "not-a-url", "http://127.0.0.1:9/v1", "http://user:[email protected]:9/v1"])
+def test_policy_endpoint_probe_failure_is_actionable_and_redacted(url: str) -> None:
+ from skillevaluator.tier3.commands import _nemo_gym_policy_endpoint_error
+
+ error = _nemo_gym_policy_endpoint_error(url)
+ assert error and "SKILL_EVAL_NEMO_GYM_MODEL_URL" in error and "network access" in error
+ assert "credential@" not in error
+
+
+def test_policy_endpoint_probe_has_a_hard_deadline_even_for_stalled_dns(monkeypatch) -> None:
+ import subprocess
+
+ from skillevaluator.tier3 import commands
+
+ def stalled_probe(args, **kwargs):
+ assert kwargs["timeout"] == 3
+ assert kwargs["input"] == "https://example.invalid/v1"
+ assert "https://example.invalid/v1" not in args
+ assert kwargs["stderr"] == subprocess.DEVNULL
+ raise subprocess.TimeoutExpired(args, kwargs["timeout"])
+
+ monkeypatch.setattr(commands.subprocess, "run", stalled_probe)
+ error = commands._nemo_gym_policy_endpoint_error("https://example.invalid/v1")
+ assert "timed out after 3s" in error and "SKILL_EVAL_NEMO_GYM_MODEL_URL" in error
+
+
+def test_policy_endpoint_probe_does_not_import_from_checkout(tmp_path: Path, monkeypatch) -> None:
+ from skillevaluator.tier3.commands import _nemo_gym_policy_endpoint_error
+
+ marker = tmp_path / "imported"
+ (tmp_path / "http.py").write_text(f"from pathlib import Path\nPath({str(marker)!r}).touch()\n")
+ monkeypatch.chdir(tmp_path)
+ _nemo_gym_policy_endpoint_error("http://127.0.0.1:9/v1")
+ assert not marker.exists()
+
+
+def test_policy_endpoint_probe_environment_excludes_credentials(monkeypatch) -> None:
+ import subprocess
+
+ from skillevaluator.tier3 import commands
+
+ monkeypatch.setenv("OPENAI_API_KEY", "test-probe-credential")
+
+ def probe(_args, **kwargs):
+ assert "OPENAI_API_KEY" not in tuple(kwargs.get("env", os.environ))
+ return subprocess.CompletedProcess(_args, 0)
+
+ monkeypatch.setattr(commands.subprocess, "run", probe)
+ assert commands._nemo_gym_policy_endpoint_error("http://127.0.0.1:9/v1") is None
+
+
[email protected]("proxy_name", ["http_proxy", "HTTP_PROXY"])
[email protected]("scheme", ["http://", ""])
+ "endpoint_scheme, status",
+ [("http", 405), ("http", 407), ("http", 502), ("http", 504), ("https", 407), ("https", 502), ("https", 504)],
+)
+def test_policy_endpoint_probe_honors_anonymous_http_proxy(
+ monkeypatch, proxy_name, scheme, endpoint_scheme, status
+) -> None:
+ import http.server
+ import threading
+
+ from skillevaluator.tier3.commands import _nemo_gym_policy_endpoint_error
+
+ requests = []
+
+ class Handler(http.server.BaseHTTPRequestHandler):
+ def do_HEAD(self):
+ requests.append((self.path, tuple(self.headers)))
+ self.send_response(status)
+ self.end_headers()
+
+ def log_message(self, *_args):
+ pass
+
+ def do_CONNECT(self):
+ self.do_HEAD()
+
+ for name in ("http_proxy", "HTTP_PROXY", "https_proxy", "HTTPS_PROXY", "no_proxy", "NO_PROXY"):
+ monkeypatch.delenv(name, raising=False)
+ server = http.server.ThreadingHTTPServer(("127.0.0.1", 0), Handler)
+ thread = threading.Thread(target=server.serve_forever)
+ thread.start()
+ proxy_name = proxy_name.replace("http", endpoint_scheme).replace("HTTP", endpoint_scheme.upper())
+ monkeypatch.setenv(proxy_name, f"{scheme}user:[email protected]:{server.server_port}")
+ try:
+ error = _nemo_gym_policy_endpoint_error(f"{endpoint_scheme}://policy.invalid/v1")
+ expected_path = "http://policy.invalid/v1" if endpoint_scheme == "http" else "policy.invalid:443"
+ assert len(requests) == 1 and requests[0][0] == expected_path
+ assert not {name.lower() for name in requests[0][1]} & {"authorization", "proxy-authorization", "x-api-key"}
+ if status != 405:
+ assert error and "proxy" in error
+ if status == 407:
+ assert "authentication" in error
+ return
+ assert error is None
+ monkeypatch.setenv(proxy_name, "http://127.0.0.1:9")
+ monkeypatch.setenv("NO_PROXY", "127.0.0.1")
+ assert _nemo_gym_policy_endpoint_error(f"http://127.0.0.1:{server.server_port}/v1") is None
+ assert len(requests) == 2 and requests[1][0] == "/v1"
+ finally:
+ server.shutdown()
+ thread.join()
+ server.server_close()
+
+
[email protected]("status", [502, 504])
+def test_https_policy_endpoint_origin_error_after_proxy_tunnel_is_reachable(monkeypatch, status) -> None:
+ import io
+ import urllib.error
+ import urllib.request
+ from types import SimpleNamespace
+
+ from skillevaluator.tier3 import commands
+
+ def origin_response(request, **_kwargs):
+ raise urllib.error.HTTPError(request.full_url, status, "origin gateway error", {}, None)
+
+ monkeypatch.setattr(sys, "stdin", io.StringIO("https://policy.invalid/v1"))
+ monkeypatch.setattr(urllib.request, "getproxies_environment", lambda: {"https": "http://proxy.invalid"})
+ monkeypatch.setattr(urllib.request, "proxy_bypass", lambda _host: False)
+ monkeypatch.setattr(urllib.request, "build_opener", lambda *_handlers: SimpleNamespace(open=origin_response))
+ exec(commands._POLICY_ENDPOINT_PROBE, {})
+
+
def test_tier3_doctor_accepts_backend_option() -> None:
from click.testing import CliRunner