Skip to content

fix(onboard): honor NEMOCLAW_SANDBOX_NAME as interactive prompt default (#3060)#3078

Open
latenighthackathon wants to merge 1 commit intoNVIDIA:mainfrom
latenighthackathon:fix/sandbox-name-env-interactive-default
Open

fix(onboard): honor NEMOCLAW_SANDBOX_NAME as interactive prompt default (#3060)#3078
latenighthackathon wants to merge 1 commit intoNVIDIA:mainfrom
latenighthackathon:fix/sandbox-name-env-interactive-default

Conversation

@latenighthackathon
Copy link
Copy Markdown
Contributor

@latenighthackathon latenighthackathon commented May 6, 2026

Summary

#3060 reports that NEMOCLAW_SANDBOX_NAME, exported in the user's environment, is silently ignored when nemoclaw onboard runs interactively. Other env vars (e.g. NEMOCLAW_ENDPOINT_URL) already pre-populate the prompt; the sandbox name was the inconsistent case. Reporter:

export NEMOCLAW_SANDBOX_NAME=mythos
nemoclaw onboard
# Prompt shows the agent default ("my-assistant"), not "mythos"

This PR makes the interactive default consistent.

Problem

getSandboxPromptDefault(agent) returned getDefaultSandboxNameForAgent(agent) unconditionally, never consulting process.env.NEMOCLAW_SANDBOX_NAME. The non-interactive path inside promptOrDefault did read the env var, so the env-var contract was honored in non-interactive mode but quietly broken in interactive mode.

Changes

  • src/lib/onboard.ts:getSandboxPromptDefault resolves NEMOCLAW_SANDBOX_NAME first; falls back to the agent default if unset, empty, or rejected by validateName. Falling back on invalid keeps the user from getting stuck on a value they cannot accept by hitting enter.
  • test/onboard.test.ts: the existing test asserted the buggy behavior (env var ignored). Updated to assert the env value is now returned, plus added cases for invalid value (leading digit) and empty string falling back to the agent default.

Type of Change

  • Code change (feature, bug fix, or refactor)

Test plan

  • npx vitest run test/onboard.test.ts -t "onboard helpers" (174/174 pass)
  • No secrets, API keys, or credentials committed
  • Tests updated for new behavior

Closes #3060


Signed-off-by: latenighthackathon latenighthackathon@users.noreply.github.com

Summary by CodeRabbit

  • New Features

    • Added support for pre-filling sandbox name during onboarding from an environment variable, with automatic fallback to agent-specific defaults if the variable is not set or invalid.
  • Tests

    • Extended test coverage for environment variable handling in sandbox prompts.

…lt (NVIDIA#3060)

When NEMOCLAW_SANDBOX_NAME is exported, the interactive sandbox-name
prompt ignored it. Other env vars like NEMOCLAW_ENDPOINT_URL already
pre-populated the prompt; the sandbox name was the inconsistent case.

Reporter @oparoz:
  export NEMOCLAW_SANDBOX_NAME=mythos
  nemoclaw onboard
  # Prompt shows the agent default (e.g. "my-assistant"), not "mythos"

Resolve the env var inside getSandboxPromptDefault so both the bracketed
default in the question and the empty-enter fallback flow from one place.
The function still returns a string, so call sites do not change.

Validation: if the env value is non-empty but rejected by validateName
(e.g. starts with a digit), fall back to the agent default rather than
getting the user stuck on a value they cannot accept by hitting enter.
Empty / unset NEMOCLAW_SANDBOX_NAME continues to use the agent default.

Test changes:

- The existing onboard-helpers test asserted the buggy behavior:
  `expect(getSandboxPromptDefault(hermes)).toBe("hermes")` after setting
  NEMOCLAW_SANDBOX_NAME=custom-hermes. Updated to assert the env value
  is now returned.
- Added a case for an invalid env value (leading digit rejected by
  validateName) confirming fallback to the agent default.
- Added an empty-string case confirming fallback.

Closes NVIDIA#3060

Re-ran:
  npx vitest run test/onboard.test.ts -t "onboard helpers"

174/174 pass.

Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com>
@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented May 6, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 16f8f35b-00be-45da-b056-4e42d64a121c

📥 Commits

Reviewing files that changed from the base of the PR and between 0f1e6d2 and 47966b4.

📒 Files selected for processing (2)
  • src/lib/onboard.ts
  • test/onboard.test.ts

📝 Walkthrough

Walkthrough

The onboard sandbox name prompt now supports pre-filling from the NEMOCLAW_SANDBOX_NAME environment variable. If set and valid, it becomes the default; otherwise, the agent-specific default applies.

Changes

Sandbox Name Environment Defaulting

Layer / File(s) Summary
Core Logic
src/lib/onboard.ts
getSandboxPromptDefault reads NEMOCLAW_SANDBOX_NAME from environment, validates it via validateName, and returns it if valid; otherwise falls back to the agent-specific default.
Tests
test/onboard.test.ts
New test cases verify that a valid custom env value is honored, invalid leading-digit values fall back to agent default, and empty strings also fall back, addressing issue #3060.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A sandbox name, no longer unseen,
From NEMOCLAW_SANDBOX_NAME so keen,
Environment whispers its tale,
Validated and ready, it won't fail—
Hop in with defaults that feel just right! 🏜️

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: honoring NEMOCLAW_SANDBOX_NAME as an interactive prompt default.
Linked Issues check ✅ Passed The PR implementation fully addresses #3060 by making getSandboxPromptDefault resolve NEMOCLAW_SANDBOX_NAME with validation and fallback logic, ensuring consistency with other env vars.
Out of Scope Changes check ✅ Passed All changes are directly related to resolving #3060: modifying getSandboxPromptDefault logic and adding corresponding test coverage for the env var handling.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

jason-ma-nv added a commit that referenced this pull request May 6, 2026
If NEMOCLAW_SANDBOX_NAME held an invalid value (e.g. leading digit,
spaces), getSandboxPromptDefault returned it verbatim. The prompt then
showed the invalid value as the default; pressing Enter triggered a
validateName error that surprised the user. Now falls back to the agent
default for invalid values, matching PR #3078's approach.

Also adds explicit tests for the invalid-value and space-in-name fallback
paths.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: jason-ma-nv <jama@nvidia.com>
@wscurran wscurran added Getting Started Use this label to identify setup, installation, or onboarding issues. priority: high Important issue that should be resolved in the next release NemoClaw CLI Use this label to identify issues with the NemoClaw command-line interface (CLI). fix Sandbox Use this label to identify issues related to the NemoClaw isolated environment based on OpenShell. labels May 6, 2026
@wscurran
Copy link
Copy Markdown
Contributor

wscurran commented May 6, 2026

✨ Thanks for pointing out that NEMOCLAW_SANDBOX_NAME was ignored during interactive onboarding.
This PR updates the onboard prompt logic to read the environment variable first, falling back to the agent default when unset or invalid.


Related open issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Getting Started Use this label to identify setup, installation, or onboarding issues. NemoClaw CLI Use this label to identify issues with the NemoClaw command-line interface (CLI). priority: high Important issue that should be resolved in the next release Sandbox Use this label to identify issues related to the NemoClaw isolated environment based on OpenShell.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NEMOCLAW_SANDBOX_NAME is not used in interactive mode

2 participants