From d1bbd909645efd15088949a8b7a6f77f3bd3b19f Mon Sep 17 00:00:00 2001 From: Carlos Villela Date: Thu, 16 Jul 2026 12:20:59 -0700 Subject: [PATCH 1/7] fix(onboard): adopt compatible vllm served aliases Signed-off-by: Carlos Villela --- docs/inference/set-up-vllm.mdx | 5 +- src/lib/onboard/setup-nim-vllm.test.ts | 84 +++++++++++++++++++++++--- src/lib/onboard/setup-nim-vllm.ts | 26 +++++++- test/onboard-selection-vllm.test.ts | 57 ++++++++++------- 4 files changed, 141 insertions(+), 31 deletions(-) diff --git a/docs/inference/set-up-vllm.mdx b/docs/inference/set-up-vllm.mdx index a251f37bdc4..75c91751213 100644 --- a/docs/inference/set-up-vllm.mdx +++ b/docs/inference/set-up-vllm.mdx @@ -38,6 +38,9 @@ $$nemoclaw onboard Select **Local vLLM**. On generic hosts, the entry includes an experimental label; on DGX Spark or DGX Station, it does not. NemoClaw validates the detected endpoint and records the model reported by `/v1/models`. +When an install request encounters an already-running server, NemoClaw selects that server instead of starting another container. +If the requested registry model and the served `id` differ, NemoClaw accepts the served `id` only when `/v1/models` reports a safe `root` that exactly matches the registry model. +NemoClaw rejects mismatched or unverifiable roots, and it still requires the exact served identity for a newly started NemoClaw-managed container and for an existing shared-gateway route. When vLLM exposes runtime metadata such as `max_model_len`, NemoClaw uses that value for the configured context window unless you set `NEMOCLAW_CONTEXT_WINDOW`. Start vLLM with the model you want before onboarding because NemoClaw uses the model already served by the endpoint. @@ -78,7 +81,7 @@ Press **Enter** to use the profile default or select another validated model wit NemoClaw pulls the vLLM image, downloads model weights into `~/.cache/huggingface`, starts the `nemoclaw-vllm` container on `localhost:8000`, streams Hugging Face download progress, and polls `/v1/models` until the model is ready. The container carries a NemoClaw ownership label so later onboarding runs can distinguish it from a bring-your-own server without trusting the container name alone. If an existing `nemoclaw-vllm` container does not carry that label, NemoClaw preserves it and asks you to remove or rename it before installing managed vLLM. -If another vLLM server already occupies port `8000`, the managed path stops and asks you to select the existing server or stop it first. +If another vLLM server already occupies port `8000`, NemoClaw selects the existing-server path and applies the model-identity checks described above. Managed profiles and model-specific recipes use immutable image digests: - DGX Spark and DGX Station models without a model-specific runtime use the `linux/arm64` digest `sha256:9204569b17ee4c0eff75194b8e6e458479c8aee18953b5ab9cf359fcdac659e2` with a compressed layer size of `9.60 GB` under `nvcr.io/nvidia/vllm:26.05.post1-py3`. diff --git a/src/lib/onboard/setup-nim-vllm.test.ts b/src/lib/onboard/setup-nim-vllm.test.ts index 9f45d705e73..f48287ba62e 100644 --- a/src/lib/onboard/setup-nim-vllm.test.ts +++ b/src/lib/onboard/setup-nim-vllm.test.ts @@ -76,26 +76,73 @@ describe("setupNim vLLM route containment", () => { expect(events).toEqual(["preflight", "probe", "exact", "validate"]); }); - it("rejects a detected model that differs from the durable shared route before validation", async () => { + it("adopts a served alias when its reported root matches the requested model (#7023)", async () => { + const validate = vi.fn(async () => ({ ok: true, api: "openai-completions" })); + const selection = state("nvidia/nemotron-3-ultra-550b-a55b"); + selection.assertRouteCompatible = () => ({ + requiredModel: null, + requiredEndpointUrl: null, + requiredInferenceApi: null, + }); + const handler = createSetupNimVllmHandler( + deps({ + runCapture: () => + JSON.stringify({ + data: [ + { + id: "nemotron-ultra", + root: "nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B-NVFP4", + }, + ], + }), + validateOpenAiLikeSelection: validate, + }), + ); + + await expect(handler(selection)).resolves.toBe("selected"); + expect(selection.model).toBe("nemotron-ultra"); + expect(validate).toHaveBeenCalledWith( + "Local vLLM", + "http://127.0.0.1:8000/v1", + "nemotron-ultra", + null, + ); + expect(console.error).not.toHaveBeenCalled(); + }); + + it("rejects a served alias when its reported root differs from the requested model", async () => { const validate = vi.fn(async () => ({ ok: true })); - const selection = state("required/model"); + const selection = state("nvidia/nemotron-3-ultra-550b-a55b"); selection.assertRouteCompatible = () => ({ - requiredModel: "required/model", + requiredModel: null, requiredEndpointUrl: null, requiredInferenceApi: null, }); - const handler = createSetupNimVllmHandler(deps({ validateOpenAiLikeSelection: validate })); + const handler = createSetupNimVllmHandler( + deps({ + runCapture: () => + JSON.stringify({ + data: [ + { + id: "deepseek", + root: "deepseek-ai/DeepSeek-V4-Flash", + }, + ], + }), + validateOpenAiLikeSelection: validate, + }), + ); await expect(handler(selection)).rejects.toThrow("exit 1"); expect(validate).not.toHaveBeenCalled(); expect(console.error).toHaveBeenCalledWith( - " Detected vLLM model 'served/model' does not match the shared gateway route 'required/model'.", + " Detected vLLM model 'deepseek' does not match the shared gateway route 'nvidia/nemotron-3-ultra-550b-a55b'.", ); expect(console.error).toHaveBeenCalledWith( - " To install 'required/model', stop the existing vLLM server on localhost:8000, then rerun the original install/onboard command.", + " To install 'nvidia/nemotron-3-ultra-550b-a55b', stop the existing vLLM server on localhost:8000, then rerun the original install/onboard command.", ); expect(console.error).toHaveBeenCalledWith( - " To keep 'served/model' instead, start detailed setup:", + " To keep 'deepseek' instead, start detailed setup:", ); expect(console.error).toHaveBeenCalledWith( " unset NEMOCLAW_PROVIDER NEMOCLAW_MODEL NEMOCLAW_VLLM_MODEL", @@ -104,6 +151,29 @@ describe("setupNim vLLM route containment", () => { expect(console.error).toHaveBeenCalledWith(" Then select Local vLLM when prompted."); }); + it("exact-checks an adopted alias against the durable shared route before validation", async () => { + const validate = vi.fn(async () => ({ ok: true })); + const selection = state("required/model"); + selection.assertRouteCompatible = () => { + if (selection.model === "served/model") throw new Error("shared route conflict"); + return { + requiredModel: null, + requiredEndpointUrl: null, + requiredInferenceApi: null, + }; + }; + const handler = createSetupNimVllmHandler( + deps({ + runCapture: () => + JSON.stringify({ data: [{ id: "served/model", root: "required/model" }] }), + validateOpenAiLikeSelection: validate, + }), + ); + + await expect(handler(selection)).rejects.toThrow("shared route conflict"); + expect(validate).not.toHaveBeenCalled(); + }); + it("warns on DGX Spark identified via GPU name (firmware-unknown GB10 host)", async () => { const selection = state(null); const handler = createSetupNimVllmHandler( diff --git a/src/lib/onboard/setup-nim-vllm.ts b/src/lib/onboard/setup-nim-vllm.ts index ead86ae7133..2da81827b6f 100644 --- a/src/lib/onboard/setup-nim-vllm.ts +++ b/src/lib/onboard/setup-nim-vllm.ts @@ -1,6 +1,7 @@ // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 +import { VLLM_MODELS } from "../inference/vllm-models"; import { cliName } from "./branding"; import type { SetupNimSelectionResult, SetupNimSelectionState } from "./setup-nim-flow"; @@ -83,6 +84,24 @@ function reportedModelRoot(entry: VllmModelEntry | null): string | null { return root && SAFE_REPORTED_MODEL_ID_PATTERN.test(root) ? root : null; } +/** Match an arbitrary served alias to the requested model through vLLM's reported root. */ +function reportedModelMatchesRequest( + models: VllmModels, + detectedModel: string, + requestedModel: string, +): boolean { + if (detectedModel === requestedModel) return true; + const root = reportedModelRoot(findVllmModelEntry(models, detectedModel)); + if (!root) return false; + const normalizedRequest = requestedModel.toLowerCase(); + const registeredModel = VLLM_MODELS.find( + (model) => + model.id.toLowerCase() === normalizedRequest || + model.servedModelId?.toLowerCase() === normalizedRequest, + ); + return root.toLowerCase() === (registeredModel?.id ?? requestedModel).toLowerCase(); +} + /** Read a string property from optional nested vLLM model metadata. */ function readObjectString(value: unknown, key: string): string | null { if (!value || typeof value !== "object" || Array.isArray(value)) return null; @@ -191,7 +210,12 @@ export function createSetupNimVllmHandler( console.error(" Detected vLLM model ID contains invalid characters."); deps.exitProcess(1); } - if (requiredModel && detectedModel !== requiredModel) { + if ( + requiredModel && + detectedModel !== requiredModel && + (options.managedInstall === true || + !reportedModelMatchesRequest(models, detectedModel, requiredModel)) + ) { console.error( ` Detected vLLM model '${detectedModel}' does not match the shared gateway route '${requiredModel}'.`, ); diff --git a/test/onboard-selection-vllm.test.ts b/test/onboard-selection-vllm.test.ts index f6beebf0e6f..4f79dd027cf 100644 --- a/test/onboard-selection-vllm.test.ts +++ b/test/onboard-selection-vllm.test.ts @@ -629,16 +629,35 @@ const { setupNim } = require(${onboardPath}); ); }); - it("rejects an existing DeepSeek server when Station express requires Ultra", () => { + it("adopts an existing Ultra served alias during Station express (#7023)", () => { const repoRoot = path.join(import.meta.dirname, ".."); - const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "nemoclaw-station-ultra-mismatch-")); - const scriptPath = path.join(tmpDir, "station-ultra-mismatch-check.js"); + const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "nemoclaw-station-ultra-alias-")); + const fakeBin = path.join(tmpDir, "bin"); + const scriptPath = path.join(tmpDir, "station-ultra-alias-check.js"); const onboardPath = JSON.stringify(path.join(repoRoot, "src", "lib", "onboard.ts")); const credentialsPath = JSON.stringify( path.join(repoRoot, "src", "lib", "credentials", "store.ts"), ); const runnerPath = JSON.stringify(path.join(repoRoot, "src", "lib", "runner.ts")); + fs.mkdirSync(fakeBin, { recursive: true }); + fs.writeFileSync( + path.join(fakeBin, "curl"), + `#!/usr/bin/env bash +body='{"id":"ok"}' +status="200" +outfile="" +while [ "$#" -gt 0 ]; do + case "$1" in + -o) outfile="$2"; shift 2 ;; + *) shift ;; + esac +done +printf '%s' "$body" > "$outfile" +printf '%s' "$status" +`, + { mode: 0o755 }, + ); const script = String.raw` const credentials = require(${credentialsPath}); const runner = require(${runnerPath}); @@ -654,7 +673,12 @@ runner.runCapture = (command) => { if (cmd.includes("command -v ollama")) return ""; if (cmd.includes("127.0.0.1:11434/api/tags")) return ""; if (cmd.includes("127.0.0.1:8000/v1/models")) { - return JSON.stringify({ data: [{ id: "deepseek-ai/DeepSeek-V4-Flash" }] }); + return JSON.stringify({ + data: [{ + id: "nemotron-ultra", + root: "nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B-NVFP4", + }], + }); } if (cmd.includes("docker images")) return ""; return ""; @@ -663,7 +687,8 @@ runner.runCapture = (command) => { const { setupNim } = require(${onboardPath}); (async () => { - await setupNim({ type: "nvidia", platform: "station" }, null); + const result = await setupNim({ type: "nvidia", platform: "station" }, null); + console.log("SELECTED " + result.provider + " " + result.model); })().catch((error) => { console.error(error); process.exit(1); @@ -677,6 +702,7 @@ const { setupNim } = require(${onboardPath}); env: { ...process.env, HOME: tmpDir, + PATH: `${fakeBin}:${process.env.PATH || ""}`, NEMOCLAW_NON_INTERACTIVE: "1", NEMOCLAW_PROVIDER: "install-vllm", NEMOCLAW_VLLM_MODEL: "nemotron-3-ultra-550b-a55b", @@ -684,26 +710,13 @@ const { setupNim } = require(${onboardPath}); }, }); - assert.equal(result.status, 1); + assert.equal(result.status, 0, result.stderr); assert.match( result.stdout, /NEMOCLAW_PROVIDER=install-vllm requested, but vLLM is already running on localhost:8000 — selecting the running instance\./, ); - assert.match( - result.stderr, - /Detected vLLM model 'deepseek-ai\/DeepSeek-V4-Flash' does not match the shared gateway route 'nvidia\/nemotron-3-ultra-550b-a55b'\./, - ); - assert.match( - result.stderr, - /To install 'nvidia\/nemotron-3-ultra-550b-a55b', stop the existing vLLM server on localhost:8000, then rerun the original install\/onboard command\./, - ); - assert.match( - result.stderr, - /To keep 'deepseek-ai\/DeepSeek-V4-Flash' instead, start detailed setup:/, - ); - assert.match( - result.stderr, - /unset NEMOCLAW_PROVIDER NEMOCLAW_MODEL NEMOCLAW_VLLM_MODEL\s+nemoclaw onboard --fresh\s+Then select Local vLLM when prompted\./, - ); + assert.match(result.stdout, /Detected model: nemotron-ultra/); + assert.match(result.stdout, /SELECTED vllm-local nemotron-ultra/); + assert.doesNotMatch(result.stderr, /does not match/); }); }); From ba738cbf31df806f30979ed181147dda23fdf178 Mon Sep 17 00:00:00 2001 From: Carlos Villela Date: Thu, 16 Jul 2026 12:24:56 -0700 Subject: [PATCH 2/7] test(onboard): keep alias route check linear Signed-off-by: Carlos Villela --- src/lib/onboard/setup-nim-vllm.test.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/lib/onboard/setup-nim-vllm.test.ts b/src/lib/onboard/setup-nim-vllm.test.ts index f48287ba62e..12df1650bff 100644 --- a/src/lib/onboard/setup-nim-vllm.test.ts +++ b/src/lib/onboard/setup-nim-vllm.test.ts @@ -154,14 +154,16 @@ describe("setupNim vLLM route containment", () => { it("exact-checks an adopted alias against the durable shared route before validation", async () => { const validate = vi.fn(async () => ({ ok: true })); const selection = state("required/model"); - selection.assertRouteCompatible = () => { - if (selection.model === "served/model") throw new Error("shared route conflict"); - return { + selection.assertRouteCompatible = vi + .fn() + .mockReturnValueOnce({ requiredModel: null, requiredEndpointUrl: null, requiredInferenceApi: null, - }; - }; + }) + .mockImplementationOnce(() => { + throw new Error("shared route conflict"); + }); const handler = createSetupNimVllmHandler( deps({ runCapture: () => From 7e0ca3726338f7924f20b12372873e58761fbd51 Mon Sep 17 00:00:00 2001 From: Carlos Villela Date: Thu, 16 Jul 2026 12:32:54 -0700 Subject: [PATCH 3/7] test(onboard): cover vllm alias without root Signed-off-by: Carlos Villela --- src/lib/onboard/setup-nim-vllm.test.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/lib/onboard/setup-nim-vllm.test.ts b/src/lib/onboard/setup-nim-vllm.test.ts index 12df1650bff..2c1cded0760 100644 --- a/src/lib/onboard/setup-nim-vllm.test.ts +++ b/src/lib/onboard/setup-nim-vllm.test.ts @@ -151,6 +151,28 @@ describe("setupNim vLLM route containment", () => { expect(console.error).toHaveBeenCalledWith(" Then select Local vLLM when prompted."); }); + it("rejects a served alias when root metadata is missing (#7023)", async () => { + const validate = vi.fn(async () => ({ ok: true })); + const selection = state("nvidia/nemotron-3-ultra-550b-a55b"); + selection.assertRouteCompatible = () => ({ + requiredModel: null, + requiredEndpointUrl: null, + requiredInferenceApi: null, + }); + const handler = createSetupNimVllmHandler( + deps({ + runCapture: () => JSON.stringify({ data: [{ id: "nemotron-ultra" }] }), + validateOpenAiLikeSelection: validate, + }), + ); + + await expect(handler(selection)).rejects.toThrow("exit 1"); + expect(validate).not.toHaveBeenCalled(); + expect(console.error).toHaveBeenCalledWith( + " Detected vLLM model 'nemotron-ultra' does not match the shared gateway route 'nvidia/nemotron-3-ultra-550b-a55b'.", + ); + }); + it("exact-checks an adopted alias against the durable shared route before validation", async () => { const validate = vi.fn(async () => ({ ok: true })); const selection = state("required/model"); From 0b06ef14d2990c84e2ea3502df696d3b01821737 Mon Sep 17 00:00:00 2001 From: Apurv Kumaria Date: Thu, 16 Jul 2026 13:03:41 -0700 Subject: [PATCH 4/7] test(onboard): cover vllm alias resume Prove that interrupted onboarding reuses the persisted callable served alias. The repaired inference step must not restore the requested registry identity. Co-authored-by: Carlos Villela Signed-off-by: Apurv Kumaria --- .../handlers/provider-inference.test.ts | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/lib/onboard/machine/handlers/provider-inference.test.ts b/src/lib/onboard/machine/handlers/provider-inference.test.ts index 9c6b857a27f..59bf0b05677 100644 --- a/src/lib/onboard/machine/handlers/provider-inference.test.ts +++ b/src/lib/onboard/machine/handlers/provider-inference.test.ts @@ -500,6 +500,44 @@ describe("handleProviderInferenceState", () => { expect(result).toMatchObject({ provider: "ollama-local", model: "llama3.1" }); }); + it("reuses a persisted vLLM served alias when resume repairs inference (#7023)", async () => { + const session = createSession({ + provider: "vllm-local", + model: "nemotron-ultra", + endpointUrl: "http://host.openshell.internal:8000/v1", + credentialEnv: null, + preferredInferenceApi: "openai-completions", + }); + session.steps.provider_selection.status = "complete"; + const { deps, calls } = createDeps({ isInferenceRouteReady: vi.fn(() => false) }); + + const result = await handleProviderInferenceState({ + ...baseOptions(deps, session), + resume: true, + sandboxName: "my-assistant", + }); + + expect(calls.setupNim).not.toHaveBeenCalled(); + expect(calls.setupInference).toHaveBeenCalledWith( + "my-assistant", + "nemotron-ultra", + "vllm-local", + "http://host.openshell.internal:8000/v1", + null, + null, + [], + expect.objectContaining({ + gatewayName: "nemoclaw", + preferredInferenceApi: "openai-completions", + }), + ); + expect(calls.complete).toHaveBeenCalledWith( + "inference", + expect.objectContaining({ provider: "vllm-local", model: "nemotron-ultra" }), + ); + expect(result).toMatchObject({ provider: "vllm-local", model: "nemotron-ultra" }); + }); + it("reserves the prompted sandbox route when resume skips already-ready inference (#6562)", async () => { const session = createSession({ provider: "nvidia-prod", From 3d7ab69e4ea5582a096a06271fe1a6f9744bb1c0 Mon Sep 17 00:00:00 2001 From: Apurv Kumaria Date: Thu, 16 Jul 2026 14:09:45 -0700 Subject: [PATCH 5/7] test(onboard): use distinct resumed vllm alias Prove resume preserves a non-canonical served alias end to end. Co-authored-by: Carlos Villela Signed-off-by: Apurv Kumaria --- .../onboard/machine/handlers/provider-inference.test.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lib/onboard/machine/handlers/provider-inference.test.ts b/src/lib/onboard/machine/handlers/provider-inference.test.ts index 59bf0b05677..abb2b0638d8 100644 --- a/src/lib/onboard/machine/handlers/provider-inference.test.ts +++ b/src/lib/onboard/machine/handlers/provider-inference.test.ts @@ -501,9 +501,10 @@ describe("handleProviderInferenceState", () => { }); it("reuses a persisted vLLM served alias when resume repairs inference (#7023)", async () => { + const persistedServedAlias = "my-ultra-served-alias"; const session = createSession({ provider: "vllm-local", - model: "nemotron-ultra", + model: persistedServedAlias, endpointUrl: "http://host.openshell.internal:8000/v1", credentialEnv: null, preferredInferenceApi: "openai-completions", @@ -520,7 +521,7 @@ describe("handleProviderInferenceState", () => { expect(calls.setupNim).not.toHaveBeenCalled(); expect(calls.setupInference).toHaveBeenCalledWith( "my-assistant", - "nemotron-ultra", + persistedServedAlias, "vllm-local", "http://host.openshell.internal:8000/v1", null, @@ -533,9 +534,9 @@ describe("handleProviderInferenceState", () => { ); expect(calls.complete).toHaveBeenCalledWith( "inference", - expect.objectContaining({ provider: "vllm-local", model: "nemotron-ultra" }), + expect.objectContaining({ provider: "vllm-local", model: persistedServedAlias }), ); - expect(result).toMatchObject({ provider: "vllm-local", model: "nemotron-ultra" }); + expect(result).toMatchObject({ provider: "vllm-local", model: persistedServedAlias }); }); it("reserves the prompted sandbox route when resume skips already-ready inference (#6562)", async () => { From 46cacda8a3a4410a3f2eeae5b77d963ea9d5b573 Mon Sep 17 00:00:00 2001 From: Apurv Kumaria Date: Thu, 16 Jul 2026 17:49:34 -0700 Subject: [PATCH 6/7] test(onboard): cover failed vLLM alias repair resume Co-authored-by: Carlos Villela Signed-off-by: Apurv Kumaria --- .../handlers/provider-inference.test.ts | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/src/lib/onboard/machine/handlers/provider-inference.test.ts b/src/lib/onboard/machine/handlers/provider-inference.test.ts index abb2b0638d8..6b7ecbf670b 100644 --- a/src/lib/onboard/machine/handlers/provider-inference.test.ts +++ b/src/lib/onboard/machine/handlers/provider-inference.test.ts @@ -539,6 +539,87 @@ describe("handleProviderInferenceState", () => { expect(result).toMatchObject({ provider: "vllm-local", model: persistedServedAlias }); }); + it("keeps a persisted vLLM served alias across a failed repair and resume retry (#7023)", async () => { + const persistedServedAlias = "my-ultra-served-alias"; + const persistedEndpointUrl = "http://host.openshell.internal:8000/v1"; + const session = createSession({ + provider: "vllm-local", + model: persistedServedAlias, + endpointUrl: persistedEndpointUrl, + credentialEnv: null, + preferredInferenceApi: "openai-completions", + }); + session.steps.provider_selection.status = "complete"; + const setupInference = vi + .fn["deps"]["setupInference"]>() + .mockRejectedValueOnce(new Error("alias repair failed")) + .mockResolvedValueOnce({ ok: true }); + const { deps, calls } = createDeps({ + setupInference, + isInferenceRouteReady: vi.fn(() => false), + }); + calls.complete.mockResolvedValue(session); + const resumeOptions = { + ...baseOptions(deps, session), + resume: true, + sandboxName: "my-assistant", + }; + + await expect(handleProviderInferenceState(resumeOptions)).rejects.toThrow( + "alias repair failed", + ); + + expect(calls.setupNim).not.toHaveBeenCalled(); + expect(calls.complete).not.toHaveBeenCalledWith("inference", expect.anything()); + + const result = await handleProviderInferenceState(resumeOptions); + + expect(setupInference).toHaveBeenNthCalledWith( + 1, + "my-assistant", + persistedServedAlias, + "vllm-local", + persistedEndpointUrl, + null, + null, + [], + expect.objectContaining({ + gatewayName: "nemoclaw", + preferredInferenceApi: "openai-completions", + }), + ); + expect(setupInference).toHaveBeenNthCalledWith( + 2, + "my-assistant", + persistedServedAlias, + "vllm-local", + persistedEndpointUrl, + null, + null, + [], + expect.objectContaining({ + gatewayName: "nemoclaw", + preferredInferenceApi: "openai-completions", + }), + ); + expect(calls.setupNim).not.toHaveBeenCalled(); + expect(calls.complete).toHaveBeenCalledOnce(); + expect(calls.complete).toHaveBeenCalledWith( + "inference", + expect.objectContaining({ provider: "vllm-local", model: persistedServedAlias }), + ); + expect(result).toMatchObject({ + provider: "vllm-local", + model: persistedServedAlias, + endpointUrl: persistedEndpointUrl, + session: { + provider: "vllm-local", + model: persistedServedAlias, + endpointUrl: persistedEndpointUrl, + }, + }); + }); + it("reserves the prompted sandbox route when resume skips already-ready inference (#6562)", async () => { const session = createSession({ provider: "nvidia-prod", From 00f7dc69303dd6f664d6e0b5551a2d25dffd0f73 Mon Sep 17 00:00:00 2001 From: Apurv Kumaria Date: Thu, 16 Jul 2026 20:03:25 -0700 Subject: [PATCH 7/7] test(onboard): cover managed vLLM alias rejection Co-authored-by: Carlos Villela Signed-off-by: Apurv Kumaria --- src/lib/onboard/setup-nim-vllm.test.ts | 32 ++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/lib/onboard/setup-nim-vllm.test.ts b/src/lib/onboard/setup-nim-vllm.test.ts index 2c1cded0760..666d78c34b4 100644 --- a/src/lib/onboard/setup-nim-vllm.test.ts +++ b/src/lib/onboard/setup-nim-vllm.test.ts @@ -110,6 +110,38 @@ describe("setupNim vLLM route containment", () => { expect(console.error).not.toHaveBeenCalled(); }); + it("rejects a root-matched served alias during managed install (#7023)", async () => { + const validate = vi.fn(async () => ({ ok: true, api: "openai-completions" })); + const requestedModel = "nvidia/nemotron-3-ultra-550b-a55b"; + const selection = state(requestedModel); + selection.assertRouteCompatible = () => ({ + requiredModel: null, + requiredEndpointUrl: null, + requiredInferenceApi: null, + }); + const handler = createSetupNimVllmHandler( + deps({ + runCapture: () => + JSON.stringify({ + data: [ + { + id: "nemotron-ultra", + root: "nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B-NVFP4", + }, + ], + }), + validateOpenAiLikeSelection: validate, + }), + ); + + await expect(handler(selection, { managedInstall: true })).rejects.toThrow("exit 1"); + expect(selection.model).toBe(requestedModel); + expect(validate).not.toHaveBeenCalled(); + expect(console.error).toHaveBeenCalledWith( + " Detected vLLM model 'nemotron-ultra' does not match the shared gateway route 'nvidia/nemotron-3-ultra-550b-a55b'.", + ); + }); + it("rejects a served alias when its reported root differs from the requested model", async () => { const validate = vi.fn(async () => ({ ok: true })); const selection = state("nvidia/nemotron-3-ultra-550b-a55b");