Skip to content
Merged
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
7 changes: 5 additions & 2 deletions docs/inference/verify-inference-route.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ Run the named sandbox status command.
$$nemoclaw <name> status
```

The `Inference` row checks the sandbox's `inference.local` path and reports the provider, model, and endpoint with the rest of the sandbox state.
The `Inference` row checks the sandbox's `inference.local` path and reports it as `reachable` when the route returns HTTP `200` through `499`.
This includes authentication responses such as HTTP `401` and `403`: they confirm route access, not valid provider credentials or a successful model invocation.
Use the status command's upstream provider diagnostic or send a short agent request to verify the configured model.
The provider, model, and endpoint appear with the rest of the sandbox state.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
This path includes the OpenShell proxy and its authentication rewrite.
When onboarding prints a dashboard summary, use it to verify that NemoClaw ran the same route-reachability probe from inside the sandbox.
Treat an unreachable route or HTTP 5xx response as a failed readiness check: onboarding marks the sandbox not ready and exits non-zero.
Expand Down Expand Up @@ -61,7 +64,7 @@ Use the status command and a short agent request after onboarding to verify ongo
Connect to the sandbox and send a short request before starting long-running work.
A successful response proves that the configured model can serve an agent request through the OpenShell route.

If status is healthy but a tool action returns JSON as normal assistant text, troubleshoot structured tool calling instead of the network route.
If the status route is reachable but a tool action returns JSON as normal assistant text, troubleshoot structured tool calling instead of the network route.

## Related Topics

Expand Down
9 changes: 6 additions & 3 deletions docs/reference/commands.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1218,14 +1218,17 @@ The main `Inference` line reports one of these states:

| State | Meaning |
|-------|---------|
| `healthy` | The route returned an HTTP status from `200` through `499`. Authentication responses such as `401` and `403` confirm route reachability. |
| `reachable` | The route returned an HTTP status from `200` through `499`. Authentication responses such as `401` and `403` confirm route reachability. |
| `unhealthy` | The route returned an HTTP status from `500` through `599`. |
| `unreachable` | The route had a transport failure, returned no final HTTP status (`000` or an interim `100` through `199`), or returned an invalid status outside `100` through `599`. |
| `not probed` | NemoClaw could not run the authoritative route probe from a reachable sandbox. |
| `not verified` | NemoClaw could not verify the sandbox or gateway state, so it skips inference probing. |

An authentication response confirms that the route is reachable, not that provider credentials are valid.
The command can also print direct host-side provider checks such as `Inference (upstream)` and provider-specific subprobes.
For supported remote providers, this diagnostic sends an authenticated request to the configured model and accepts only a recognized Chat Completions, streaming Chat Completions, or Anthropic Messages response.
It uses a 3-second connection timeout, a 5-second total timeout, and an 8-token output limit.
If the request reaches the time limit, NemoClaw reports the provider as `not probed` and leaves model health unverified instead of reporting it as unhealthy.
These checks are diagnostic only and do not override the authoritative `inference.local` result or determine the command exit status.

Local providers add host-side backend diagnostics.
Expand Down Expand Up @@ -1345,15 +1348,15 @@ The rebuild reuses the existing sandbox name and preserved manifest-defined stat
### `$$nemoclaw <name> doctor`

Run a focused health check for one sandbox and the host services it depends on.
The command checks the local CLI build, Docker daemon, OpenShell CLI, NemoClaw gateway container, gateway port mapping, live sandbox state, inference route, provider reachability, Ollama reachability, and the cloudflared tunnel state.
The command checks the local CLI build, Docker daemon, OpenShell CLI, NemoClaw gateway container, gateway port mapping, live sandbox state, inference route, configured-provider model invocation, Ollama reachability, and the cloudflared tunnel state.
<AgentOnly variant="openclaw,hermes">
For gateway-based agents, it also reports messaging channel conflicts.
</AgentOnly>

For inference health, `doctor` treats the probe to `https://inference.local/v1/models` from inside the sandbox as authoritative.
HTTP responses from `200` through `499`, including `401` and `403`, pass this check.
HTTP `500` through `599`, interim `100` through `199`, transport failures with status `000`, invalid status values, and an unavailable authoritative probe fail the check.
Direct provider and upstream probes are diagnostics only, so their failure does not fail `doctor` when the authoritative in-sandbox route is healthy.
Direct provider and upstream probes use the same authenticated model-invocation checks as status and remain diagnostic only, so their failure does not fail `doctor` when the authoritative in-sandbox route is reachable.

Warnings do not make the command fail.
Failed checks, including a failed or unavailable authoritative inference route, exit non-zero so scripts can use `doctor` as a readiness gate.
Expand Down
37 changes: 36 additions & 1 deletion src/lib/actions/sandbox/status-flow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe("showSandboxStatus flow", () => {
expect(output).toContain("Sandbox-scoped status for 'alpha'");
expect(output).toContain("Sandbox: alpha");
expect(output).toContain("Model: nvidia/nemotron");
expect(output).toContain("Inference: healthy");
expect(output).toContain("Inference: reachable");
expect(output).toContain("Inference (ollama backend):");
expect(output).toContain("Host GPU: yes");
expect(output).toContain("last CUDA proof failed: cuInit");
Expand Down Expand Up @@ -213,6 +213,41 @@ describe("showSandboxStatus flow", () => {
expect(process.exitCode).toBeUndefined();
});

it("distinguishes route reachability from model-invocation health in the rendered labels (#6846)", async () => {
const harness = createStatusFlowHarness({
inferenceHealth: {
ok: true,
probed: true,
providerLabel: "Inference route",
endpoint: "https://inference.local/v1/models",
detail: "route reachable",
okLabel: "reachable",
subprobes: [
{
ok: true,
probed: true,
providerLabel: "NVIDIA Endpoints",
endpoint: "https://integrate.api.nvidia.com/v1/chat/completions",
detail: "model invocation probe succeeded",
probeLabel: "upstream",
},
],
},
});

await expect(harness.showSandboxStatus("alpha")).resolves.toBeUndefined();

const output = harness.logSpy.mock.calls.flat().join("\n");
// The route probe only proves network-path reachability (#6192); the
// upstream subprobe is what proves the configured model is invocable
// (#6846). Rendering the same word for both would re-introduce the
// false-positive this PR fixes.
expect(output).toContain("Inference: reachable");
expect(output).not.toContain("Inference: healthy");
expect(output).toContain("Inference (upstream): healthy");
expect(process.exitCode).toBeUndefined();
});

it("probes terminal runtime agent version when cached metadata is missing", async () => {
const harness = createStatusFlowHarness({
sandboxEntry: {
Expand Down
142 changes: 142 additions & 0 deletions src/lib/actions/sandbox/status-snapshot-inference-health.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

import { describe, expect, it } from "vitest";

import type { ProviderHealthStatus } from "../../inference/health";
import type { SandboxEntry } from "../../state/registry";
import type { SandboxInferenceRouteHealth } from "./inference-route-health";
import { collectSandboxStatusSnapshot } from "./status-snapshot";

// Direct, unmocked coverage of `buildSandboxInferenceRouteHealth` through the
// exported `collectSandboxStatusSnapshot` entry point (it is not itself
// exported). status-flow.test.ts mocks collectSandboxStatusSnapshot wholesale
// and never exercises this code, so it never proves okLabel is actually set
// in production wiring rather than merely respected if present (#6846).
function snapshotDeps(
gateway: SandboxInferenceRouteHealth | null,
providerHealth: ProviderHealthStatus | null = null,
) {
const sandbox: SandboxEntry = {
name: "alpha",
agent: "openclaw",
policies: [],
provider: "nvidia",
model: "nvidia/nemotron",
};
return {
suppressInferenceProbe: false,
deps: {
getSandbox: () => sandbox,
listSandboxes: () => ({ sandboxes: [sandbox], defaultSandbox: sandbox.name }),
reconcile: async () => ({ state: "present" as const, output: "Phase: Ready" }),
// The live-route RPC lookup is independent of the authoritative
// inference.local gateway probe under test; throwing here just leaves
// liveRoute/routeDrift null without needing a fabricated exec transcript.
captureOpenshellForStatusImpl: async () => {
throw new Error("live route lookup not needed for this test");
},
probeProviderHealthImpl: () => providerHealth,
probeSandboxInferenceGatewayHealthImpl: async () => gateway,
},
};
}

describe("collectSandboxStatusSnapshot inference route health", () => {
it("labels a reachable route okLabel: reachable, not a bare healthy claim (#6846)", async () => {
const gateway: SandboxInferenceRouteHealth = {
ok: true,
endpoint: "https://inference.local/v1/models",
httpStatus: 200,
detail:
"Inference gateway responded HTTP 200 on https://inference.local/v1/models (full chain reachable).",
};

const snapshot = await collectSandboxStatusSnapshot("alpha", snapshotDeps(gateway));

expect(snapshot.inferenceHealth).toMatchObject({
ok: true,
probed: true,
providerLabel: "Inference route",
endpoint: "https://inference.local/v1/models",
okLabel: "reachable",
});
expect(snapshot.inferenceHealth?.failureLabel).toBeUndefined();
});

it("does not set okLabel for a 5xx route failure, and classifies it unhealthy (#6846)", async () => {
const gateway: SandboxInferenceRouteHealth = {
ok: false,
endpoint: "https://inference.local/v1/models",
httpStatus: 502,
detail:
"Inference gateway returned HTTP 502 on https://inference.local/v1/models; the route is reachable but unhealthy.",
};

const snapshot = await collectSandboxStatusSnapshot("alpha", snapshotDeps(gateway));

expect(snapshot.inferenceHealth).toMatchObject({
ok: false,
failureLabel: "unhealthy",
});
expect(snapshot.inferenceHealth?.okLabel).toBeUndefined();
});

it("does not set okLabel when the route is unreachable (#6846)", async () => {
const gateway: SandboxInferenceRouteHealth = {
ok: false,
endpoint: "https://inference.local/v1/models",
httpStatus: 0,
detail:
"Inference gateway unreachable on https://inference.local/v1/models from inside the sandbox.",
};

const snapshot = await collectSandboxStatusSnapshot("alpha", snapshotDeps(gateway));

expect(snapshot.inferenceHealth).toMatchObject({
ok: false,
failureLabel: "unreachable",
});
expect(snapshot.inferenceHealth?.okLabel).toBeUndefined();
});

it("stays unprobed with no okLabel when the gateway probe is unavailable (#6846)", async () => {
const snapshot = await collectSandboxStatusSnapshot("alpha", snapshotDeps(null));

expect(snapshot.inferenceHealth).toMatchObject({
ok: false,
probed: false,
providerLabel: "Inference route",
});
expect(snapshot.inferenceHealth?.okLabel).toBeUndefined();
expect(snapshot.inferenceHealth?.failureLabel).toBeUndefined();
});

it("keeps a failed model-invocation subprobe distinct from the reachable route label (#6846)", async () => {
const gateway: SandboxInferenceRouteHealth = {
ok: true,
endpoint: "https://inference.local/v1/models",
httpStatus: 200,
detail:
"Inference gateway responded HTTP 200 on https://inference.local/v1/models (full chain reachable).",
};
const providerHealth: ProviderHealthStatus = {
ok: false,
probed: true,
providerLabel: "NVIDIA Endpoints",
endpoint: "https://integrate.api.nvidia.com/v1/chat/completions",
detail: "model invocation probe failed",
failureLabel: "unauthorized",
};

const snapshot = await collectSandboxStatusSnapshot(
"alpha",
snapshotDeps(gateway, providerHealth),
);

expect(snapshot.inferenceHealth).toMatchObject({ ok: true, okLabel: "reachable" });
expect(snapshot.inferenceHealth?.subprobes).toEqual([
{ ...providerHealth, probeLabel: "upstream" },
]);
});
});
2 changes: 1 addition & 1 deletion src/lib/actions/sandbox/status-snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function buildSandboxInferenceRouteHealth(
endpoint,
detail: gateway.detail,
...(gateway.ok
? {}
? { okLabel: "reachable" }
: {
failureLabel: classifyInferenceRouteFailureLabel(gateway.httpStatus),
}),
Expand Down
2 changes: 1 addition & 1 deletion src/lib/actions/sandbox/status-text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function printInferenceProbeLine(probe: ProviderHealthStatus): void {
return;
}
if (probe.ok) {
console.log(` ${label}: ${G}healthy${R} (${probe.endpoint})`);
console.log(` ${label}: ${G}${probe.okLabel ?? "healthy"}${R} (${probe.endpoint})`);
return;
}
console.log(` ${label}: ${RD}${probe.failureLabel || "unreachable"}${R} (${probe.endpoint})`);
Expand Down
Loading
Loading