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
4 changes: 4 additions & 0 deletions ci/env-var-doc-allowlist.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,9 @@
{
"name": "NEMOCLAW_MANAGED_HERMES_HASH_B64",
"reason": "Internal one-shot transport from the privileged managed-startup runtime or root image applicator to the sandbox-owned Hermes compatibility-hash writer. The value is a bounded base64-encoded hash receipt that only the private internal writer consumes; NemoClaw synthesizes it and users must not set it."
},
{
"name": "NEMOCLAW_VLLM_GPU_DEVICE",
"reason": "Internal command-scoped handoff for the public --vllm-gpu-device flag. NemoClaw validates, persists, scopes, and restores it; users should set the CLI flag instead."
}
]
9 changes: 6 additions & 3 deletions docs/reference/commands.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ The wizard creates an OpenShell gateway, registers inference providers, builds t
Use this command for new installs and for recreating a sandbox after changes to policy or configuration.

```bash
$$nemoclaw onboard [--profile <name>] [--non-interactive] [--resume | --fresh] [--recreate-sandbox] [--gpu | --no-gpu] [--from <Dockerfile>] [--name <sandbox>] [--host-mount <host:/sandbox/path>] [--sandbox-gpu | --no-sandbox-gpu] [--sandbox-gpu-device <device>] [--agent <name>] [--agents <agents.yaml>] [--tool-disclosure <progressive|direct>] [--observability | --no-observability] [--control-ui-port <N>] [--events=jsonl] [--yes | -y] [--no-ollama-autostart] [--yes-i-accept-third-party-software]
$$nemoclaw onboard [--profile <name>] [--non-interactive] [--resume | --fresh] [--recreate-sandbox] [--gpu | --no-gpu] [--from <Dockerfile>] [--name <sandbox>] [--host-mount <host:/sandbox/path>] [--sandbox-gpu | --no-sandbox-gpu] [--sandbox-gpu-device <device>] [--vllm-gpu-device <index-or-uuid>] [--agent <name>] [--agents <agents.yaml>] [--tool-disclosure <progressive|direct>] [--observability | --no-observability] [--control-ui-port <N>] [--events=jsonl] [--yes | -y] [--no-ollama-autostart] [--yes-i-accept-third-party-software]
```

<AgentOnly variant="hermes">
Expand Down Expand Up @@ -1056,6 +1056,9 @@ Use `--gpu` to require GPU passthrough and fail fast if an NVIDIA GPU is not det
Use `--sandbox-gpu` or `--no-sandbox-gpu` to control only direct NVIDIA GPU access inside the sandbox.
Use `--sandbox-gpu --sandbox-gpu-device <device>` to select an NVIDIA GPU by index (`0`), GPU UUID (`GPU-...`), or full CDI device name (`nvidia.com/gpu=0`).
NemoClaw preserves the selection on resume.
Use `--vllm-gpu-device <index-or-uuid>` to select the host GPU for the vLLM container that NemoClaw installs and manages.
This selection is separate from sandbox GPU access, and NemoClaw also preserves it on resume.
The selected GPU must satisfy the model's memory and compute-capability requirements.
For native Docker and Podman creation, NemoClaw passes the normalized CDI name through OpenShell driver config; compatibility routes use the equivalent container-runtime selector.
Device selection requires explicit sandbox GPU enablement.
On ordinary native Linux Docker-driver hosts, NemoClaw uses native OpenShell GPU injection by default and never broadens confinement automatically.
Expand Down Expand Up @@ -4319,7 +4322,7 @@ The `$$nemoclaw setup` command is deprecated.
Use `$$nemoclaw onboard` instead.
</Warning>

This command remains as a compatibility alias to `$$nemoclaw onboard` and accepts the same flags: `--profile <name>`, `--non-interactive`, `--resume`, `--fresh`, `--recreate-sandbox`, `--gpu` / `--no-gpu`, `--from`, `--name`, `--host-mount`, `--sandbox-gpu` / `--no-sandbox-gpu`, `--sandbox-gpu-device`, `--agent`, `--agents <agents.yaml>`, `--tool-disclosure <progressive|direct>`, `--observability` / `--no-observability`, `--control-ui-port`, `--yes` / `-y`, `--no-ollama-autostart`, `--yes-i-accept-third-party-software`.
This command remains as a compatibility alias to `$$nemoclaw onboard` and accepts the same flags: `--profile <name>`, `--non-interactive`, `--resume`, `--fresh`, `--recreate-sandbox`, `--gpu` / `--no-gpu`, `--from`, `--name`, `--host-mount`, `--sandbox-gpu` / `--no-sandbox-gpu`, `--sandbox-gpu-device`, `--vllm-gpu-device`, `--agent`, `--agents <agents.yaml>`, `--tool-disclosure <progressive|direct>`, `--observability` / `--no-observability`, `--control-ui-port`, `--yes` / `-y`, `--no-ollama-autostart`, `--yes-i-accept-third-party-software`.

```bash
$$nemoclaw setup
Expand All @@ -4332,7 +4335,7 @@ The `$$nemoclaw setup-spark` command is deprecated.
Use the standard installer and run `$$nemoclaw onboard` instead, because current OpenShell releases handle the older DGX Spark cgroup behavior.
</Warning>

This command remains as a compatibility alias to `$$nemoclaw onboard` and accepts the same flags: `--profile <name>`, `--non-interactive`, `--resume`, `--fresh`, `--recreate-sandbox`, `--gpu` / `--no-gpu`, `--from`, `--name`, `--host-mount`, `--sandbox-gpu` / `--no-sandbox-gpu`, `--sandbox-gpu-device`, `--agent`, `--agents <agents.yaml>`, `--tool-disclosure <progressive|direct>`, `--observability` / `--no-observability`, `--control-ui-port`, `--yes` / `-y`, `--no-ollama-autostart`, `--yes-i-accept-third-party-software`.
This command remains as a compatibility alias to `$$nemoclaw onboard` and accepts the same flags: `--profile <name>`, `--non-interactive`, `--resume`, `--fresh`, `--recreate-sandbox`, `--gpu` / `--no-gpu`, `--from`, `--name`, `--host-mount`, `--sandbox-gpu` / `--no-sandbox-gpu`, `--sandbox-gpu-device`, `--vllm-gpu-device`, `--agent`, `--agents <agents.yaml>`, `--tool-disclosure <progressive|direct>`, `--observability` / `--no-observability`, `--control-ui-port`, `--yes` / `-y`, `--no-ollama-autostart`, `--yes-i-accept-third-party-software`.

```bash
$$nemoclaw setup-spark
Expand Down
15 changes: 15 additions & 0 deletions src/commands/onboard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,21 @@ describe("onboard oclif command", () => {
);
});

it("forwards the managed vLLM GPU device independently of sandbox GPU flags", async () => {
await OnboardCliCommand.run(
["--non-interactive", "--vllm-gpu-device", "GPU-69adb14e-820e-bfb4-0993-171e73f68504"],
rootDir,
);

expect(runOnboardAction).toHaveBeenCalledWith(
expect.objectContaining({
"non-interactive": true,
"vllm-gpu-device": "GPU-69adb14e-820e-bfb4-0993-171e73f68504",
}),
mocks.onboardRuntimeDeps,
);
});

it("forwards --no-gpu to the onboard action", async () => {
await OnboardCliCommand.run(["--non-interactive", "--no-gpu"], rootDir);

Expand Down
4 changes: 2 additions & 2 deletions src/lib/actions/onboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { GooglechatTunnelRuntimeDeps } from "../messaging/channels/googlech
import { type OnboardCommandOptions, runOnboardCommand } from "../onboard/command";
import { type OnboardFlags, readAgentRegistryNames } from "../onboard/command-support";
import { resolveOnboardResumeIntent } from "../onboard/session-bootstrap";
import { loadServingProfileResumeSession } from "../onboard/sandbox-registration";
import { loadOnboardCommandResumeSession } from "../onboard/sandbox-registration";
import type { OnboardOptions } from "../onboard/types";

export interface OnboardActionRuntimeDeps {
Expand All @@ -32,7 +32,7 @@ function buildOnboardCommandDeps(flags: OnboardFlags, runtimeDeps: OnboardAction
runOnboard: (options: OnboardCommandOptions) => runOnboard(options, runtimeDeps),
listAgents: () => [...readAgentRegistryNames()],
loadServingCatalog,
loadSession: loadServingProfileResumeSession,
loadSession: loadOnboardCommandResumeSession,
resolveResumeIntent: resolveOnboardResumeIntent,
log: console.log,
error: console.error,
Expand Down
64 changes: 64 additions & 0 deletions src/lib/inference/vllm-compute-capability.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import {
readGpuComputeCapabilities,
readGpuMemoryDevices,
resolveVllmModelRuntime,
selectVllmGpuDevice,
type VllmProfile,
} from "./vllm";
import {
Expand All @@ -80,6 +81,7 @@ import {
withVllmInstallTestReadiness,
} from "./vllm-install.test-support";
import { VLLM_MODELS } from "./vllm-models";
import { NEMOCLAW_VLLM_GPU_DEVICE_ENV } from "./vllm-models";

const READY_MODELS_RESPONSE = '{"data":[]}';

Expand Down Expand Up @@ -213,6 +215,16 @@ describe("managed vLLM GPU compute capability preflight", () => {
expect(computeCapabilityPreflight(model!, [121, 90])).toEqual({ ok: true });
});

it("queries compute capability for the selected GPU UUID", () => {
mockHostCommands({ computeCap: "9.0\n" });

expect(readGpuComputeCapabilities("GPU-69adb14e-820e-bfb4-0993-171e73f68504")).toEqual([90]);
expect(mocks.runCapture).toHaveBeenCalledWith(
expect.arrayContaining(["--id=GPU-69adb14e-820e-bfb4-0993-171e73f68504"]),
expect.any(Object),
);
});

it("prints a capability on the scale vLLM reports (#8307)", () => {
expect(formatComputeCapability(80)).toBe("8.0");
expect(formatComputeCapability(89)).toBe("8.9");
Expand Down Expand Up @@ -280,6 +292,31 @@ describe("managed vLLM GPU memory preflight", () => {
expect(errors).toContain("then resume onboarding");
});

it("launches managed vLLM on the selected UUID and checks that GPU's free memory", async () => {
const profile = { ...detectVllmProfile({ type: "nvidia" })!, architecture: "x64" as const };
const uuid = "GPU-69adb14e-820e-bfb4-0993-171e73f68504";
process.env.NEMOCLAW_VLLM_MODEL = "qwen3.6-27b";
process.env[NEMOCLAW_VLLM_GPU_DEVICE_ENV] = uuid;
mockHostCommands({
computeCap: "9.0\n9.0\n",
gpuMemory:
`0, GPU-00000000-0000-0000-0000-000000000000, 97887, 1000\n` + `1, ${uuid}, 97887, 90000\n`,
});
mockDockerDaemon(profile.containerName);

const result = await installVllm(profile, {
hasImage: false,
nonInteractive: true,
promptFn: vi.fn(),
});

expect(result).toEqual({ ok: true });
expect(mocks.tryInstallManagedClusterManagedVllm).not.toHaveBeenCalled();
expect(mocks.dockerRunDetached.mock.calls[0]?.[0]).toEqual(
expect.arrayContaining(["--gpus", `device=${uuid}`]),
);
});

it.each(["--gpu-memory-utilization", "--gpu_memory_utilization"])(
"uses the effective %s override for the early preflight",
async (option) => {
Expand Down Expand Up @@ -388,6 +425,33 @@ describe("managed vLLM GPU memory preflight", () => {
expect(gpuMemoryPreflight(model, profile, devices)).toEqual({ ok: true });
});

it("checks memory on the UUID selected for managed vLLM", () => {
const detected = detectVllmProfile({ type: "nvidia" })!;
const model = VLLM_MODELS.find((entry) => entry.envValue === "muse-glimmer-30b")!;
const resolved = resolveVllmModelRuntime(detected, model, "x64");
const profile = selectVllmGpuDevice(
resolved.profile,
"GPU-69adb14e-820e-bfb4-0993-171e73f68504",
);

expect(
gpuMemoryPreflight(model, profile, [
{
index: 0,
uuid: "GPU-00000000-0000-0000-0000-000000000000",
totalBytes: 96n,
freeBytes: 1n,
},
{
index: 1,
uuid: "GPU-69adb14e-820e-bfb4-0993-171e73f68504",
totalBytes: 96n,
freeBytes: 80n,
},
]),
).toEqual({ ok: true });
});

it("fails closed when Docker's selected GPU is absent from telemetry", () => {
const detected = detectVllmProfile({ type: "nvidia" })!;
const model = VLLM_MODELS.find((entry) => entry.envValue === "muse-glimmer-30b")!;
Expand Down
27 changes: 27 additions & 0 deletions src/lib/inference/vllm-models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,33 @@ import type {
export type VllmPlatform = "spark" | "station" | "n1x" | "linux";
export const STATION_PAIR_OPTIONAL_ORCHESTRATION = "vllm.station-pair-optional/v1";
export const DUAL_STATION_VLLM_GPU_MEMORY_UTILIZATION = 0.9;
export const NEMOCLAW_VLLM_GPU_DEVICE_ENV = "NEMOCLAW_VLLM_GPU_DEVICE" as const;

const GPU_INDEX_PATTERN = /^\d+$/;
const GPU_UUID_PATTERN = /^GPU-[A-Fa-f0-9]{8}(?:-[A-Fa-f0-9]{4}){3}-[A-Fa-f0-9]{12}$/;

export function normalizeVllmGpuDevice(value: string): string {
const candidate = value.trim();
if (GPU_INDEX_PATTERN.test(candidate)) {
const index = Number(candidate);
if (Number.isSafeInteger(index)) return String(index);
}
if (GPU_UUID_PATTERN.test(candidate)) {
return `GPU-${candidate.slice("GPU-".length).toLowerCase()}`;
}
throw new Error(
"vLLM GPU device must be a non-negative GPU index or full GPU UUID reported by nvidia-smi",
);
}

export function parseVllmGpuDevice(value: unknown): string | null {
if (typeof value !== "string") return null;
try {
return normalizeVllmGpuDevice(value);
} catch {
return null;
}
}

export interface VllmServingCatalogIdentity {
readonly catalogDigest: string;
Expand Down
Loading
Loading