fix(onboard): honor NEMOCLAW_SANDBOX_NAME as interactive prompt default (#3060)#3078
Conversation
…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>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe onboard sandbox name prompt now supports pre-filling from the ChangesSandbox Name Environment Defaulting
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 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 unit tests (beta)
Comment |
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>
|
✨ Thanks for pointing out that NEMOCLAW_SANDBOX_NAME was ignored during interactive onboarding. Related open issues: |
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:
This PR makes the interactive default consistent.
Problem
getSandboxPromptDefault(agent)returnedgetDefaultSandboxNameForAgent(agent)unconditionally, never consultingprocess.env.NEMOCLAW_SANDBOX_NAME. The non-interactive path insidepromptOrDefaultdid 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:getSandboxPromptDefaultresolvesNEMOCLAW_SANDBOX_NAMEfirst; falls back to the agent default if unset, empty, or rejected byvalidateName. 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
Test plan
npx vitest run test/onboard.test.ts -t "onboard helpers"(174/174 pass)Closes #3060
Signed-off-by: latenighthackathon latenighthackathon@users.noreply.github.com
Summary by CodeRabbit
New Features
Tests