Repository navigation
fix(deploy): correct vLLM HF model id and pass HF_TOKEN to VM - #2459
prekshivyas wants to merge 7 commits into
Conversation
…0.0.36
Two bugs caused the gateway to crash on OpenShell ≥0.0.36:
1. Landlock blocks /opt/nemoclaw-blueprint/ from non-root users. The
ws-proxy-fix.js preload was the only NODE_OPTIONS --require script
read directly from that path. The entrypoint hit "Permission denied"
on the shell redirect and set -euo pipefail killed it before
touch /tmp/gateway.log — leaving no log to diagnose.
Fix: copy ws-proxy-fix.js to /usr/local/lib/nemoclaw/ at build time
(Dockerfile), then to /tmp/ at runtime via emit_sandbox_sourced_file
(same pattern as every other preload).
2. Seccomp blocks getifaddrs (os.networkInterfaces()). The mDNS library
(@homebridge/ciao) calls it without error handling, producing an
unhandled promise rejection. OpenClaw's own rejection handler calls
process.exit(1) for unrecognised errors, killing the gateway ~200ms
after it logs "listening".
Fix: monkey-patch os.networkInterfaces() in a new always-installed
preload (seccomp-guard.js) to return {} when the syscall throws
uv_interface_addresses. mDNS discovery is not needed in a sandbox.
Also:
- Add early exec > >(tee) capture to /tmp/nemoclaw-start.log so crashes
before gateway.log are diagnosable.
- Dump /tmp/nemoclaw-start.log in e2e Phase 7 on S1 failure.
- Add 13 unit tests covering the seccomp guard, ws-proxy-fix Landlock
mitigation, and early stderr capture.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Signed-off-by: prekshivyas <[email protected]>
The early stderr capture via exec > >(tee) created the log with default umask permissions. The script later prints tokenized dashboard URLs (#token=...) to stderr, leaking the gateway token to any user who can read /tmp/nemoclaw-start.log. Pre-create the file with chmod 600 (root:root in root mode) before the exec redirect so only the owning user can read it. Also fix unused variable lint (origNI → _origNI) in seccomp-guard test. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> Signed-off-by: prekshivyas <[email protected]>
Add non-null assertions for Array.pop() returns and explicit parameter types for .some()/.find() callbacks that lost type inference after the errno/JSON type consolidation in #2447. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> Signed-off-by: prekshivyas <[email protected]>
Add hadolint ignore comments for pre-existing DL3006 (untagged FROM with build arg) and SC2015 (A && B || C pattern) warnings in Dockerfile. Increase global CLI test timeout from 5s to 15s — several integration tests spawn child processes with 10s exec timeouts, causing intermittent Vitest timeout failures. Include hook-generated updates to ws-proxy-fix.js comment and agent skills docs. Signed-off-by: prekshivyas <[email protected]> Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> Signed-off-by: prekshivyas <[email protected]>
The vLLM blueprint profile used the NIM catalog name (nvidia/nemotron-3-nano-30b-a3b) which does not exist on Hugging Face, causing a 404 when vLLM tries to download the model. Replace with the correct HF repo id (nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-FP8). Also add HF_TOKEN and HUGGING_FACE_HUB_TOKEN to DeployCredentials so Brev deploy passes them to the VM — without these, gated HF models return 401. Closes #996 Signed-off-by: prekshivyas <[email protected]> Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> Signed-off-by: prekshivyas <[email protected]>
📝 WalkthroughWalkthroughUpdates enable local vLLM inference by correcting the Hugging Face model id, passing HF tokens into deployed VMs, starting vLLM with --trust-remote-code, and improve runtime reliability and diagnostics (seccomp guard, ws-proxy preload, start log capture). Several tests and docs were added/updated. Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer / CLI
participant Installer as install.sh
participant VM as Deployed VM
participant vLLM as vLLM Server
participant HF as Hugging Face
Dev->>Installer: run install / deploy (provider=vllm)
Installer->>VM: provision VM, write .env (includes HF_TOKEN/HUGGING_FACE_HUB_TOKEN)
Installer->>VM: start vLLM api_server --trust-remote-code
VM->>vLLM: vLLM process starts and loads model
vLLM->>HF: download repo `nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-FP8` (auth via tokens)
vLLM->>VM: serve OpenAI-compatible API on :8000 (health OK)
VM->>Installer: report readiness
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
.agents/skills/nemoclaw-user-reference/references/commands.md (1)
177-184: Consolidate duplicated command docs in the source docs (not generated skills output).This adds duplicate coverage for
onboard --fromandsetupthat already exists elsewhere in the same document, which can drift over time. Please keep one canonical section in the generating docs source and regenerate this file.Based on learnings: markdown under
.agents/skills/is autogenerated fromdocs/and review feedback should target the source docs content.Also applies to: 598-607
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.agents/skills/nemoclaw-user-reference/references/commands.md around lines 177 - 184, The command docs for "nemoclaw onboard --from" and the "setup" section are duplicated in the generated skills markdown; remove the duplicate by editing the canonical source docs (the docs/ source that generates skills output) to keep a single canonical section for these commands, then regenerate the autogenerated skills docs so the generated markdown no longer contains the duplicate entries for "nemoclaw onboard --from" and "setup".test/e2e/test-messaging-providers.sh (1)
1186-1190: Prefer tailing inside the sandbox to keep failure diagnostics bounded.Fetching the whole file and tailing locally can move unnecessary data in noisy failures. Tail remotely instead.
♻️ Suggested refactor
- start_log=$(openshell sandbox exec --name "$SANDBOX_NAME" -- cat /tmp/nemoclaw-start.log 2>/dev/null || true) + start_log=$(openshell sandbox exec --name "$SANDBOX_NAME" -- tail -40 /tmp/nemoclaw-start.log 2>/dev/null || true) if [ -n "$start_log" ]; then info "Entrypoint log (last 40 lines of /tmp/nemoclaw-start.log):" - echo "$start_log" | tail -40 | while IFS= read -r line; do + echo "$start_log" | while IFS= read -r line; do info " $line" done fi🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@test/e2e/test-messaging-providers.sh` around lines 1186 - 1190, The test currently cats the entire /tmp/nemoclaw-start.log out of the sandbox into start_log then tails locally; instead run tail inside the sandbox to limit transferred data: replace the openshell call that sets start_log (using openshell sandbox exec --name "$SANDBOX_NAME" -- cat /tmp/nemoclaw-start.log ...) with an openshell sandbox exec that runs tail -n 40 /tmp/nemoclaw-start.log (still redirecting stderr to /dev/null and preserving the || true fallback), keep the subsequent info and loop over start_log unchanged so you still log each line; reference the existing variables/commands start_log, openshell sandbox exec, SANDBOX_NAME, and info to locate and update the code.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.agents/skills/nemoclaw-user-reference/references/commands.md:
- Around line 177-184: The command docs for "nemoclaw onboard --from" and the
"setup" section are duplicated in the generated skills markdown; remove the
duplicate by editing the canonical source docs (the docs/ source that generates
skills output) to keep a single canonical section for these commands, then
regenerate the autogenerated skills docs so the generated markdown no longer
contains the duplicate entries for "nemoclaw onboard --from" and "setup".
In `@test/e2e/test-messaging-providers.sh`:
- Around line 1186-1190: The test currently cats the entire
/tmp/nemoclaw-start.log out of the sandbox into start_log then tails locally;
instead run tail inside the sandbox to limit transferred data: replace the
openshell call that sets start_log (using openshell sandbox exec --name
"$SANDBOX_NAME" -- cat /tmp/nemoclaw-start.log ...) with an openshell sandbox
exec that runs tail -n 40 /tmp/nemoclaw-start.log (still redirecting stderr to
/dev/null and preserving the || true fallback), keep the subsequent info and
loop over start_log unchanged so you still log each line; reference the existing
variables/commands start_log, openshell sandbox exec, SANDBOX_NAME, and info to
locate and update the code.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: e3ce51c1-cad0-44cc-95ef-e45e9c84c3db
📒 Files selected for processing (13)
.agents/skills/nemoclaw-user-reference/references/commands.mdDockerfilenemoclaw-blueprint/blueprint.yamlnemoclaw-blueprint/scripts/ws-proxy-fix.jsscripts/nemoclaw-start.shscripts/test-inference-local.shsrc/lib/deploy.test.tssrc/lib/deploy.tstest/e2e/test-messaging-providers.shtest/onboard.test.tstest/policies.test.tstest/seccomp-guard.test.tsvitest.config.ts
PR #1470 removed brev-setup.sh, which was the only path that installed and started vLLM on Brev GPU deploys. Ollama setup in install.sh has also been commented out since commit 91982ef ("for now"). The result: users setting NEMOCLAW_PROVIDER=vllm or =ollama fall through onboarding with nothing to talk to on localhost:8000 or :11434 (NVQA #996). Restore both, gated on NEMOCLAW_PROVIDER so the default cloud path is unchanged: - `install_or_upgrade_ollama` — re-enabled behind NEMOCLAW_PROVIDER=ollama (was previously GPU-gated only; now opt-in to avoid pulling Nemotron models on hosts that don't need them). - `install_or_start_vllm` — new function. Pip-installs vllm when missing, starts it with --trust-remote-code against the HF model id declared in nemoclaw-blueprint/blueprint.yaml, and polls /v1/models for readiness. Bails with a warn on timeout or early exit. Test coverage: 4 unit tests verify the no-op gating path, the ollama conditional in main(), that the vLLM default model id stays in sync with the blueprint, and that --trust-remote-code is on the command line. Real end-to-end vLLM on a GPU host remains a manual check for now. Signed-off-by: Prekshi Vyas <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
test/local-inference-setup.test.ts (1)
41-52: Exerciseresolve_vllm_model()instead of re-parsinginstall.shin JS.This only compares two regex-extracted strings. The shell parser can break and this still passes, because the test never calls
resolve_vllm_model(). Prefer asserting the sourced function returns the blueprint model.Suggested refactor
it("vLLM default model id matches the blueprint", () => { - const content = fs.readFileSync(INSTALL_SH, "utf-8"); - const installMatch = content.match(/VLLM_DEFAULT_MODEL="([^"]+)"/); - expect(installMatch).not.toBeNull(); - const installModel = installMatch![1]; - const blueprintContent = fs.readFileSync(BLUEPRINT, "utf-8"); const blueprintMatch = blueprintContent.match(/vllm:[\s\S]*?model:\s*"([^"]+)"/); expect(blueprintMatch).not.toBeNull(); const blueprintModel = blueprintMatch![1]; - expect(installModel).toBe(blueprintModel); + const result = sourceAndRun('printf "%s" "$(resolve_vllm_model)"'); + expect(result.status).toBe(0); + expect(result.stdout.trim()).toBe(blueprintModel); });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@test/local-inference-setup.test.ts` around lines 41 - 52, The test currently re-parses INSTALL_SH with regex instead of invoking resolve_vllm_model(), so replace the regex-based install.sh parsing in the "vLLM default model id matches the blueprint" test with a call to resolve_vllm_model() to get the resolved model id and then assert that equals the blueprintModel (which you still extract from BLUEPRINT); specifically, import or source the module exposing resolve_vllm_model(), call resolve_vllm_model() to obtain installModel, and keep the existing blueprint parsing (blueprintMatch/blueprintModel) and the expect(installModel).toBe(blueprintModel) assertion.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@scripts/install.sh`:
- Around line 856-860: The awk in resolve_vllm_model() only matches a vllm: with
exactly six leading spaces so it misses root-level or differently-indented keys;
update the pattern that sets f to match vllm: with optional leading whitespace
(e.g. /^[[:space:]]*vllm:/) so the block is entered regardless of indentation,
keep the subsequent match for model: and the gsub extraction logic (refer to
resolve_vllm_model and the awk invocation) so the extracted model comes from the
blueprint when present instead of falling back to VLLM_DEFAULT_MODEL.
- Around line 877-883: The installer currently attempts to bootstrap pip3 with
apt-get but proceeds to call pip3 regardless, which can cause a cryptic "pip3:
command not found" error; update the vLLM install branch (the block that checks
python3 -c "import vllm" and calls command_exists pip3) to re-check for pip3
after the apt-get attempt (using the same command_exists pip3) and if pip3 is
still missing call info/error and exit non‑zero with a clear message; reference
the existing symbols/steps: the python3 import check, command_exists, the
apt-get install line, and the pip3 install commands so the check and explicit
failure are added between the apt-get bootstrap and the pip3 install invocation.
---
Nitpick comments:
In `@test/local-inference-setup.test.ts`:
- Around line 41-52: The test currently re-parses INSTALL_SH with regex instead
of invoking resolve_vllm_model(), so replace the regex-based install.sh parsing
in the "vLLM default model id matches the blueprint" test with a call to
resolve_vllm_model() to get the resolved model id and then assert that equals
the blueprintModel (which you still extract from BLUEPRINT); specifically,
import or source the module exposing resolve_vllm_model(), call
resolve_vllm_model() to obtain installModel, and keep the existing blueprint
parsing (blueprintMatch/blueprintModel) and the
expect(installModel).toBe(blueprintModel) assertion.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 0c02a5fc-88e5-472e-98c2-c54cfe45d79b
📒 Files selected for processing (2)
scripts/install.shtest/local-inference-setup.test.ts
| resolve_vllm_model() { | ||
| local blueprint="${SCRIPT_DIR}/../nemoclaw-blueprint/blueprint.yaml" | ||
| if [ -r "$blueprint" ]; then | ||
| awk '/^ vllm:/{f=1; next} f && /model:/{ gsub(/.*model: *"|".*/, ""); print; exit }' \ | ||
| "$blueprint" 2>/dev/null |
There was a problem hiding this comment.
Relax the vllm: match in resolve_vllm_model().
nemoclaw-blueprint/blueprint.yaml currently exposes vllm: as a root-level key, so this awk never enters the block and silently falls back to VLLM_DEFAULT_MODEL. That means the runtime parser here will ignore the blueprint if the two ever drift.
Suggested fix
resolve_vllm_model() {
local blueprint="${SCRIPT_DIR}/../nemoclaw-blueprint/blueprint.yaml"
if [ -r "$blueprint" ]; then
- awk '/^ vllm:/{f=1; next} f && /model:/{ gsub(/.*model: *"|".*/, ""); print; exit }' \
+ awk '
+ /^[[:space:]]*vllm:[[:space:]]*$/ { in_vllm=1; next }
+ in_vllm && /^[^[:space:]]/ { exit }
+ in_vllm && match($0, /model:[[:space:]]*"([^"]+)"/, m) { print m[1]; exit }
+ ' \
"$blueprint" 2>/dev/null
fi
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| resolve_vllm_model() { | |
| local blueprint="${SCRIPT_DIR}/../nemoclaw-blueprint/blueprint.yaml" | |
| if [ -r "$blueprint" ]; then | |
| awk '/^ vllm:/{f=1; next} f && /model:/{ gsub(/.*model: *"|".*/, ""); print; exit }' \ | |
| "$blueprint" 2>/dev/null | |
| resolve_vllm_model() { | |
| local blueprint="${SCRIPT_DIR}/../nemoclaw-blueprint/blueprint.yaml" | |
| if [ -r "$blueprint" ]; then | |
| awk ' | |
| /^[[:space:]]*vllm:[[:space:]]*$/ { in_vllm=1; next } | |
| in_vllm && /^[^[:space:]]/ { exit } | |
| in_vllm && match($0, /model:[[:space:]]*"([^"]+)"/, m) { print m[1]; exit } | |
| ' \ | |
| "$blueprint" 2>/dev/null | |
| fi | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@scripts/install.sh` around lines 856 - 860, The awk in resolve_vllm_model()
only matches a vllm: with exactly six leading spaces so it misses root-level or
differently-indented keys; update the pattern that sets f to match vllm: with
optional leading whitespace (e.g. /^[[:space:]]*vllm:/) so the block is entered
regardless of indentation, keep the subsequent match for model: and the gsub
extraction logic (refer to resolve_vllm_model and the awk invocation) so the
extracted model comes from the blueprint when present instead of falling back to
VLLM_DEFAULT_MODEL.
| if ! python3 -c "import vllm" 2>/dev/null; then | ||
| info "Installing vLLM…" | ||
| if ! command_exists pip3; then | ||
| sudo apt-get install -y -qq python3-pip >/dev/null 2>&1 || true | ||
| fi | ||
| pip3 install --break-system-packages vllm 2>/dev/null || pip3 install vllm | ||
| else |
There was a problem hiding this comment.
Don't swallow a failed python3-pip bootstrap.
If pip3 is missing and the apt-get attempt fails, the next pip3 install ... exits the installer with pip3: command not found. Re-check after the bootstrap attempt and fail with a clear message.
Suggested fix
if ! python3 -c "import vllm" 2>/dev/null; then
info "Installing vLLM…"
if ! command_exists pip3; then
sudo apt-get install -y -qq python3-pip >/dev/null 2>&1 || true
fi
+ command_exists pip3 || error "python3-pip is required to install vLLM automatically."
pip3 install --break-system-packages vllm 2>/dev/null || pip3 install vllm
else
info "vLLM already installed"
fi🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@scripts/install.sh` around lines 877 - 883, The installer currently attempts
to bootstrap pip3 with apt-get but proceeds to call pip3 regardless, which can
cause a cryptic "pip3: command not found" error; update the vLLM install branch
(the block that checks python3 -c "import vllm" and calls command_exists pip3)
to re-check for pip3 after the apt-get attempt (using the same command_exists
pip3) and if pip3 is still missing call info/error and exit non‑zero with a
clear message; reference the existing symbols/steps: the python3 import check,
command_exists, the apt-get install line, and the pip3 install commands so the
check and explicit failure are added between the apt-get bootstrap and the pip3
install invocation.
|
Superseded by #2729 — rebased with all commits signed off. Original branch had force-push protection so couldn't update history in place. |
## Summary Supersedes #2459 (rebased with signed-off commits; original branch had force-push protection). Fixes three issues from #996 that prevented vLLM from starting on Brev deploy: - **Wrong HF model id**: The vLLM blueprint profile used the NIM catalog name (`nvidia/nemotron-3-nano-30b-a3b`) which returns 404 on Hugging Face. Replaced with the correct HF repo id (`nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-FP8`). - **No HF_TOKEN on VM**: Added `HF_TOKEN` and `HUGGING_FACE_HUB_TOKEN` to `DeployCredentials` so Brev deploy passes them to the VM — without these, gated HF models return 401. - **Missing --trust-remote-code**: Documented in the blueprint profile comment that vLLM must be started with `--trust-remote-code` for models with custom code. NemoClaw doesn't launch vLLM itself, so this is a documentation fix. Also updated `scripts/test-inference-local.sh` to use the correct HF model id. Note: `nim-images.json` and `index.ts` NIM model entries are **not** changed — those use the NIM catalog name which is correct for the NIM API provider. Closes #996 ## Test plan - [x] New test: `HF_TOKEN` and `HUGGING_FACE_HUB_TOKEN` are passed through in `buildDeployEnvLines` - [x] Existing deploy tests pass (10/10) - [x] NIM tests unchanged and passing (27/27) - [x] All pre-commit and pre-push hooks pass - [x] All commits signed off (DCO) 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** - Local vLLM inference support with automatic model resolution and server lifecycle checks - Hugging Face token support for deployments * **Bug Fixes** - WebSocket proxy tunnel fix for sandboxed environments - Seccomp guard to prevent network-interface related crashes * **Improvements** - Early startup logging to /tmp for diagnostics - Model reference updated to a Hugging Face repo ID - Entrypoint/startup robustness and permission handling * **Tests** - New tests covering local inference setup and seccomp guard behavior <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: prekshivyas <[email protected]> Signed-off-by: Prekshi Vyas <[email protected]> Co-authored-by: Ubuntu <ubuntu@nemoclaw-f6a691-inst-3cs11f3ytmmzubymi5nzdncnwia.us-west1-a.c.brevdevprod.internal> Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]> Co-authored-by: J. Yaunches <[email protected]> Co-authored-by: Carlos Villela <[email protected]>
Summary
Fixes three issues from #996 that prevented vLLM from starting on Brev deploy:
nvidia/nemotron-3-nano-30b-a3b) which returns 404 on Hugging Face. Replaced with the correct HF repo id (nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-FP8).HF_TOKENandHUGGING_FACE_HUB_TOKENtoDeployCredentialsso Brev deploy passes them to the VM — without these, gated HF models return 401.--trust-remote-codefor models with custom code. NemoClaw doesn't launch vLLM itself, so this is a documentation fix.Also updated
scripts/test-inference-local.shto use the correct HF model id.Note:
nim-images.jsonandindex.tsNIM model entries are not changed — those use the NIM catalog name which is correct for the NIM API provider.Closes #996
Test plan
HF_TOKENandHUGGING_FACE_HUB_TOKENare passed through inbuildDeployEnvLines🤖 Generated with Claude Code
Summary by CodeRabbit
Documentation
onboard --from <Dockerfile>documented and deprecated aliases for legacy commands clarified.New Features
Bug Fixes
Tests