Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions docs/reference/troubleshooting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2065,16 +2065,17 @@ Expected output:
* connect to 172.17.0.1 port 11434 failed: Connection refused
```

For local Ollama, use the auth-proxy URL that NemoClaw's "Local Ollama" onboard
option configures automatically:
For local Ollama, select **Local Ollama** during onboarding so NemoClaw configures the sandbox-facing route for the detected runtime.
On runtimes other than WSL with Docker Desktop, NemoClaw uses the token-gated auth-proxy URL:

```text
http://host.openshell.internal:11435/v1
```

`host.openshell.internal` resolves to the same gateway IP, and the
[token-gated Ollama auth proxy](#ollama-auth-proxy-did-not-start) binds port
`11435` there and forwards requests to `127.0.0.1:11434` on the host.
`host.openshell.internal` resolves to the same gateway IP, and the [token-gated Ollama auth proxy](#ollama-auth-proxy-did-not-start) binds port `11435` there and forwards requests to `127.0.0.1:11434` on the host.
On WSL with Docker Desktop, NemoClaw instead uses `http://host.openshell.internal:11434/v1` because Docker Desktop bridges the WSL host loopback into containers.
Manually created OpenShell providers and direct sandbox requests to `host.docker.internal:11434` remain unsupported.
Those routes are outside the managed `ollama-local` path and can still fail inside k3s.
If you need a different host service exposed to the sandbox, route it through
the OpenShell gateway rather than relying on `host.docker.internal`.
Refer to issue [#3136](https://github.com/NVIDIA/NemoClaw/issues/3136).
Expand Down
88 changes: 81 additions & 7 deletions scripts/lib/runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,76 @@ infer_container_runtime_from_info() {
fi
}

is_wsl_runtime() {
# Keep this shell-side WSL check aligned with src/lib/platform.ts:isWsl().
# Source boundary (#3136): this script runs before OpenShell network policy is
# applied, so it must choose the provider URL that later enters the sandbox.
# Remove this local workaround after OpenShell exposes one uniform
# sandbox-to-host local-service route for WSL and non-WSL runtimes. Review by
# 2026-12-31.
local system_name
system_name="$(uname -s 2>/dev/null || true)"
if [ "$system_name" != "Linux" ]; then
return 1
fi

if [ -n "${WSL_DISTRO_NAME:-}" ] || [ -n "${WSL_INTEROP:-}" ]; then
return 0
fi

local release proc_version
release="$(uname -r 2>/dev/null || true)"
proc_version="$(cat /proc/version 2>/dev/null || true)"
local normalized
normalized="$(printf '%s\n%s' "$release" "$proc_version" | tr '[:upper:]' '[:lower:]')"
[[ "$normalized" == *microsoft* ]]
}

detect_container_runtime_from_docker() {
# Best effort only: missing/unhealthy Docker maps to unknown, and callers then
# fail safe to the token-gated Ollama auth proxy instead of raw host loopback.
local info=""
if command -v docker >/dev/null 2>&1; then
info="$(docker info --format '{{.OperatingSystem}} {{range .Labels}}{{.}} {{end}}' 2>/dev/null || true)"
fi
infer_container_runtime_from_info "$info"
}

container_can_reach_host_loopback() {
# Only WSL + Docker Desktop is allowed to use raw host loopback. Every other
# runtime, including macOS Docker Desktop, Colima, Podman, and native Docker,
# defaults to the auth proxy as the security fail-safe.
if ! is_wsl_runtime; then
return 1
fi

local runtime
runtime="$(detect_container_runtime_from_docker)"

[ "$runtime" = "docker-desktop" ]
}

get_ollama_container_port() {
local ollama_port="${NEMOCLAW_OLLAMA_PORT:-11434}"
local ollama_proxy_port="${NEMOCLAW_OLLAMA_PROXY_PORT:-11435}"

# Both routes ultimately depend on the host Ollama daemon: the WSL path
# reaches it directly, while the managed proxy forwards to this raw port.
_validate_port NEMOCLAW_OLLAMA_PORT "$ollama_port" || return 1
if container_can_reach_host_loopback; then
printf '%s\n' "$ollama_port"
else
# The WSL Docker Desktop loopback path does not use the proxy listener, so
# the raw/proxy equality check is only required when both listeners coexist.
_validate_port NEMOCLAW_OLLAMA_PROXY_PORT "$ollama_proxy_port" || return 1
if [ "$ollama_port" = "$ollama_proxy_port" ]; then
printf 'Invalid NEMOCLAW_OLLAMA_PROXY_PORT=%s (must differ from NEMOCLAW_OLLAMA_PORT on non-WSL hosts)\n' "$ollama_proxy_port" >&2
return 1
fi
printf '%s\n' "$ollama_proxy_port"
fi
}

find_podman_socket() {
local home_dir="${1:-${HOME:-/tmp}}"
local socket_path
Expand Down Expand Up @@ -253,12 +323,14 @@ get_local_provider_base_url() {
local provider="${1:-}"

local vllm_port="${NEMOCLAW_VLLM_PORT:-8000}"
local ollama_port="${NEMOCLAW_OLLAMA_PORT:-11434}"
_validate_port NEMOCLAW_VLLM_PORT "$vllm_port" || return 1
_validate_port NEMOCLAW_OLLAMA_PORT "$ollama_port" || return 1
case "$provider" in
vllm-local) printf 'http://host.openshell.internal:%s/v1\n' "$vllm_port" ;;
ollama-local) printf 'http://host.openshell.internal:%s/v1\n' "$ollama_port" ;;
ollama-local)
local ollama_container_port
ollama_container_port="$(get_ollama_container_port)" || return 1
printf 'http://host.openshell.internal:%s/v1\n' "$ollama_container_port"
;;
*) return 1 ;;
esac
}
Expand All @@ -267,15 +339,17 @@ check_local_provider_health() {
local provider="${1:-}"

local vllm_port="${NEMOCLAW_VLLM_PORT:-8000}"
local ollama_port="${NEMOCLAW_OLLAMA_PORT:-11434}"
_validate_port NEMOCLAW_VLLM_PORT "$vllm_port" || return 1
_validate_port NEMOCLAW_OLLAMA_PORT "$ollama_port" || return 1
case "$provider" in
vllm-local)
_validate_port NEMOCLAW_VLLM_PORT "$vllm_port" || return 1
curl -sf "http://localhost:${vllm_port}/v1/models" >/dev/null 2>&1
;;
ollama-local)
curl -sf "http://localhost:${ollama_port}/api/tags" >/dev/null 2>&1
# Health checks validate the host daemon. The sandbox-facing provider URL
# can still use the auth proxy on non-WSL hosts.
local ollama_port="${NEMOCLAW_OLLAMA_PORT:-11434}"
_validate_port NEMOCLAW_OLLAMA_PORT "$ollama_port" || return 1
curl -sf "http://127.0.0.1:${ollama_port}/api/tags" >/dev/null 2>&1
;;
*)
return 1
Expand Down
Loading
Loading