feat(quality-test): auto-set BENCHLOCAL_HERMES_RESOLVE_LOCALHOST=1 for localhost URLs
When the user runs quality-test.sh with a localhost-style URL (default `http://localhost:8020`, or any `localhost`/`127.x`/`[::1]` variant), auto-export `BENCHLOCAL_HERMES_RESOLVE_LOCALHOST=1` so benchlocal-cli rewrites the hermes-agent's outbound model endpoint from `localhost:<port>` to `host.docker.internal:<port>` inside the Docker sandbox container. Without this, the hermes-agent inside the sandbox can't reach the host's vLLM (localhost resolves to the container itself) and every scenario fails with `"API call failed after 3 retries: Connection error."` — produced spurious 0/20 grades on this rig prior to the benchlocal-cli runner.py 9c1566f fix. Skips the auto-set when: - User already set the env var (explicit override) - URL points at a non-loopback host (real LAN IP, k8s service name, host.docker.internal already) — no rewrite needed Emits a stderr breadcrumb when the auto-set fires so users can see what changed.
This commit is contained in:
@@ -177,6 +177,19 @@ if [[ -n "$DETECTED_MODEL" && "$DETECTED_MODEL" != "$MODEL" ]]; then
|
||||
MODEL="$DETECTED_MODEL"
|
||||
fi
|
||||
|
||||
# hermesagent-20 runs its agent inside a Docker sandbox container. Localhost-style
|
||||
# URLs (localhost/127.x/[::1]) inside the container resolve to the container itself,
|
||||
# not the host's vLLM. Auto-set BENCHLOCAL_HERMES_RESOLVE_LOCALHOST=1 so benchlocal-cli
|
||||
# (a) adds --add-host=host.docker.internal:host-gateway to the sandbox container, and
|
||||
# (b) rewrites the model endpoint URL to use host.docker.internal:<port> for the
|
||||
# hermes-agent's outbound API calls. Skip if already set (user override) or if URL
|
||||
# already uses host.docker.internal / a non-loopback host (real LAN IP, k8s service).
|
||||
if [[ -z "${BENCHLOCAL_HERMES_RESOLVE_LOCALHOST:-}" ]] \
|
||||
&& [[ "$URL" =~ ^https?://(localhost|127\.|\[::1\]) ]]; then
|
||||
export BENCHLOCAL_HERMES_RESOLVE_LOCALHOST=1
|
||||
echo "[quality-test] localhost URL detected — auto-set BENCHLOCAL_HERMES_RESOLVE_LOCALHOST=1 for hermes sandbox endpoint rewrite" >&2
|
||||
fi
|
||||
|
||||
# ---- run benchlocal-cli ------------------------------------------------------
|
||||
|
||||
RESULTS_DIR="${ROOT_DIR}/results/quality"
|
||||
|
||||
Reference in New Issue
Block a user