Skip to content

fix(onboard): validate NEMOCLAW_PROVIDER before preflight checks#1772

Merged
ericksoa merged 2 commits intoNVIDIA:mainfrom
latenighthackathon:fix/early-provider-validation
Apr 16, 2026
Merged

fix(onboard): validate NEMOCLAW_PROVIDER before preflight checks#1772
ericksoa merged 2 commits intoNVIDIA:mainfrom
latenighthackathon:fix/early-provider-validation

Conversation

@latenighthackathon
Copy link
Copy Markdown
Contributor

@latenighthackathon latenighthackathon commented Apr 11, 2026

Summary

Invalid NEMOCLAW_PROVIDER values in non-interactive mode now fail immediately with a clear error instead of falling through to misleading preflight failures.

Problem

NEMOCLAW_PROVIDER=invalid nemoclaw onboard --non-interactive reaches preflight (Docker/OpenShell checks) before provider validation. If Docker isn't installed, the user sees "Docker is not reachable" and installs Docker -- only to discover on the next run that the real issue was an invalid provider value.

Fix

Call getRequestedProviderHint() immediately after the third-party notice consent, before preflight and lock acquisition. The existing getNonInteractiveProvider() validation already has the right error message and process.exit(1) -- it just needed to run earlier.

Test plan

  • npm run build:cli passes
  • npm run typecheck:cli passes
  • npm run lint passes
  • All 22 provider-related onboard tests pass
  • All 35 onboard-selection tests pass

Closes #1729

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

Summary by CodeRabbit

  • Bug Fixes
    • Non-interactive runs now validate the configured provider earlier and fail fast for unsupported values, preventing the onboarding flow from proceeding into later preflight steps with invalid settings.

An invalid NEMOCLAW_PROVIDER value in non-interactive mode would fall
through to preflight, which fails with a misleading 'Docker is not
reachable' error.  The user would fix Docker, re-run, and only then
discover the real problem: an unsupported provider value.

Move the provider validation call (getRequestedProviderHint) to run
immediately after the third-party notice consent, before preflight and
lock acquisition.  Invalid values now fail immediately with:
  Unsupported NEMOCLAW_PROVIDER: <value>
  Valid values: build, openai, anthropic, ...

Closes NVIDIA#1729

Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b66868a0-5de9-42be-8d84-17ecf5082f13

📥 Commits

Reviewing files that changed from the base of the PR and between 1922630 and 1a3703f.

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

📝 Walkthrough

Walkthrough

The onboarding flow now performs an early provider validation in non-interactive runs: after usage-consent is checked and before acquiring the onboarding lock, getRequestedProviderHint(true) is invoked to fail fast on unsupported NEMOCLAW_PROVIDER values prior to preflight checks.

Changes

Cohort / File(s) Summary
Non-interactive Provider Validation
src/lib/onboard.ts
Inserted an early call to getRequestedProviderHint(true) when isNonInteractive() is true, causing unsupported NEMOCLAW_PROVIDER values to be rejected before onboarding proceeds to preflight checks (e.g., Docker).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A rabbit nudges the onboarding gate,
Sniffs the provider, clears the slate,
Before containers wake and spin,
I catch the wrong name — out it’s been! 🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding provider validation before preflight checks in the onboarding flow.
Linked Issues check ✅ Passed The PR directly addresses issue #1729 by calling getRequestedProviderHint() early to validate NEMOCLAW_PROVIDER before preflight checks, ensuring invalid provider values fail immediately with a clear error message.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the issue objective: early provider validation in onboard.ts to fail-fast on invalid NEMOCLAW_PROVIDER values before preflight checks.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ 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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/lib/onboard.ts (1)

4334-4336: Reduce branch count in onboard() while preserving fail-fast validation.

This can be a direct call since getRequestedProviderHint() already no-ops in interactive mode; same behavior, lower complexity in an already large function.

♻️ Proposed simplification
-  if (isNonInteractive()) {
-    getRequestedProviderHint(true);
-  }
+  getRequestedProviderHint();

As per coding guidelines, "Limit cyclomatic complexity to 20 in JavaScript/TypeScript files, with target of 15".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lib/onboard.ts` around lines 4334 - 4336, The conditional branch in
onboard() that calls getRequestedProviderHint(true) only when isNonInteractive()
is true should be simplified to a direct call to getRequestedProviderHint(true)
because getRequestedProviderHint already no-ops in interactive mode; replace the
if (isNonInteractive()) { getRequestedProviderHint(true); } with a straight
getRequestedProviderHint(true) call to reduce cyclomatic complexity while
preserving the fail-fast validation behavior (refer to onboard(),
getRequestedProviderHint(), and isNonInteractive()).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/lib/onboard.ts`:
- Around line 4334-4336: The conditional branch in onboard() that calls
getRequestedProviderHint(true) only when isNonInteractive() is true should be
simplified to a direct call to getRequestedProviderHint(true) because
getRequestedProviderHint already no-ops in interactive mode; replace the if
(isNonInteractive()) { getRequestedProviderHint(true); } with a straight
getRequestedProviderHint(true) call to reduce cyclomatic complexity while
preserving the fail-fast validation behavior (refer to onboard(),
getRequestedProviderHint(), and isNonInteractive()).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5f897b4a-e306-4525-987d-64505573838f

📥 Commits

Reviewing files that changed from the base of the PR and between 035144e and 1922630.

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

getRequestedProviderHint() already no-ops in interactive mode, so the
isNonInteractive() guard is redundant. Call it directly to reduce
cyclomatic complexity in onboard().

Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com>
@wscurran wscurran added bug Something isn't working NemoClaw CLI Use this label to identify issues with the NemoClaw command-line interface (CLI). labels Apr 13, 2026
@wscurran
Copy link
Copy Markdown
Contributor

✨ Thanks for submitting this PR, which proposes a fix for a bug where invalid NEMOCLAW_PROVIDER values in non-interactive mode do not fail immediately with a clear error.


Possibly related open issues:

@cv cv added the v0.0.18 Release target label Apr 16, 2026
@prekshivyas prekshivyas self-assigned this Apr 16, 2026
Copy link
Copy Markdown
Contributor

@prekshivyas prekshivyas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean — moves existing validation earlier, no-op in interactive mode, no regressions. @latenighthackathon can you update branch with main?

@ericksoa ericksoa merged commit ca99cb9 into NVIDIA:main Apr 16, 2026
12 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working NemoClaw CLI Use this label to identify issues with the NemoClaw command-line interface (CLI). v0.0.18 Release target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[All Platforms][Nemoclaw] NEMOCLAW_PROVIDER=invalid in non-interactive mode fails at Docker preflight instead of provider validation

5 participants