Skip to content

fix(cli): report an unfinished install instead of a bare command failure - #10444

Merged
prekshivyas merged 12 commits into
mainfrom
fix/10372-incomplete-install-hint
Sep 1, 2026
Merged

prekshivyas merged 12 commits into
mainfrom
fix/10372-incomplete-install-hint

Conversation

@jason-ma-nv

@jason-ma-nv jason-ma-nv commented Aug 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

An interrupted install or upgrade leaves NemoClaw's compiled CLI unresolvable, so the launcher's require throws MODULE_NOT_FOUND and the redacting fallback prints Error: Command failed. Every state-inspection command a user reaches for then reports that same contextless line, naming neither the half-finished install nor the rerun that repairs it. The launcher now recognizes that one load failure and reports the state and the recovery step instead.

Related Issue

Fixes #10372

Changes

  • bin/nemoclaw.js: when loading ../dist/nemoclaw fails with MODULE_NOT_FOUND, report that the compiled CLI is missing or incomplete, that an install or upgrade did not finish, and that rerunning the installer resumes and recovers existing sandboxes. Any other startup failure keeps the existing handleTopLevelError path unchanged, so the redaction behavior pinned by the #8202 tests is untouched. The unresolved module path is deliberately not echoed — an untrusted path in a diagnostic is exactly what that fallback exists to redact.
  • test/package-contract/cli/top-level-error.test.ts: two tests in the existing launcher-contract suite. One pins the reported message, the other pins that the report contains neither dist nor Cannot find module. Both reproduce the failure by making the compiled entrypoint unresolvable through Module._load, rather than deleting dist/, which the rest of this lane needs.

Type of Change

  • 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)

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging)
  • Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification:
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

DGX Station Hardware Evidence

  • Tested on DGX Station
  • Tested commit:
  • Station profile/scenario:
  • Result:
  • Supporting evidence:

Verification

  • PR description includes a Signed-off-by: line and every commit appears as Verified in GitHub
  • Normal pre-commit, commit-msg, and pre-push hooks passed, or npm run validate:pr passed after refreshing origin/main when hooks were skipped or unavailable — hooks are not installed in the authoring checkout, so the stages were run explicitly against a refreshed origin/main. oxlint cannot load its config there (the package is absent from that checkout's node_modules), so the lint and type stages were run on a clean Ubuntu 24.04 x86_64 host from a fresh clone of this branch plus npm ci: npx oxlint --config oxlint.config.ts bin/nemoclaw.js test/package-contract/cli/top-level-error.test.ts reports 0 warnings and 0 errors, and npm run typecheck:cli passes. npx commitlint --from origin/main --to HEAD reports 0 problems.
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — command/result or justification: npx vitest run --project package-contract test/package-contract/cli/top-level-error.test.ts — 10/10 passed on the same clean host at commit a172d3465. Verified by mutation: with the new branch removed from bin/nemoclaw.js, both new tests fail.
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — command/result:
  • Quality Gates section completed with required justifications or waivers
  • No secrets, API keys, or credentials committed
  • npm run docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Host verification of the reported symptom

On the same host, with the compiled entrypoint made unresolvable:

=== whole dist missing — BEFORE ===
Error: Command failed.
exit=1
=== whole dist missing — AFTER ===
Error: NemoClaw's compiled CLI is missing or incomplete, so no command can run.
  An install or upgrade did not finish.
  Rerun the installer command you used to install NemoClaw; it resumes and recovers existing sandboxes.
exit=1

nemoclaw credentials list reports the same guidance, matching the issue's second failing command. With dist/ restored, nemoclaw --version returns to normal output and exit 0. The host clone was removed afterward.


Signed-off-by: Jason Ma [email protected]

Summary by CodeRabbit

  • Bug Fixes

    • Improved error handling for incomplete installations.
    • Displays clear, recovery-focused guidance when required CLI components are missing.
    • Prevents internal file paths and technical module-loading details from appearing in user-facing errors.
  • Tests

    • Added coverage to verify safe, user-friendly messaging for missing installation components across supported launchers.

An interrupted install or upgrade leaves the compiled CLI unresolvable, so
the launcher's require throws MODULE_NOT_FOUND and the redacting fallback
prints "Error: Command failed." Every state-inspection command a user
reaches for then reports the same contextless line, naming neither the
half-finished install nor the rerun that repairs it. Detect that one load
failure and report it, without echoing the unresolved module path (#10372).

Signed-off-by: Jason Ma <[email protected]>
`ReturnType<typeof spawnSync<string>>` does not type-check: the overloaded
signature accepts no type argument in that position, so `tsc -p
tsconfig.cli.json` failed on the new helper. Annotate it with the
`SpawnSyncReturns<string>` type Node already exports (#10372).

Signed-off-by: Jason Ma <[email protected]>
@jason-ma-nv jason-ma-nv self-assigned this Aug 27, 2026
@github-code-quality

github-code-quality Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall line coverage in commit 6905fe9 in the fix/10372-incomplete... branch remains at 96%, unchanged from commit 0bf091c in the main branch.

TypeScript / code-coverage/cli

The overall line coverage in commit 6905fe9 in the fix/10372-incomplete... branch remains at 84%, unchanged from commit 0bf091c in the main branch.

Show a line coverage summary of the most impacted files.
File main 0bf091c fix/10372-incomplete... 6905fe9 +/-
src/lib/state/o...oint-migrate.ts 94% 89% -5%
src/lib/onboard...on-bootstrap.ts 85% 83% -2%
src/lib/onboard...get-identity.ts 100% 98% -2%
src/lib/onboard...y-management.ts 95% 94% -1%
src/lib/onboard...al-inference.ts 90% 90% 0%
src/lib/onboard...eway-process.ts 91% 91% 0%
src/lib/onboard...uild-context.ts 74% 75% +1%
src/lib/inferen...anaged-state.ts 73% 77% +4%
src/lib/onboard...esume-intent.ts 85% 94% +9%
src/lib/onboard...y-checkpoint.ts 83% 96% +13%

Updated September 01, 2026 23:23 UTC

@coderabbitai

coderabbitai Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: ddb47b70-6a06-418a-91ed-54fea90d1c0f

📥 Commits

Reviewing files that changed from the base of the PR and between 5667b6b and dc9a54c.

📒 Files selected for processing (1)
  • test/package-contract/cli/top-level-error.test.ts
💤 Files with no reviewable changes (1)
  • test/package-contract/cli/top-level-error.test.ts

Included review availability: Your plan provides up to 12 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The CLI reports recovery guidance when the compiled CLI is missing, sets a failing exit code, and hides internal module-loading details. Both NemoClaw and Hermes launcher paths are covered by tests.

Changes

Incomplete-install error handling

Layer / File(s) Summary
Missing CLI error reporting
bin/nemoclaw.js, bin/nemohermes.js
MODULE_NOT_FOUND errors now produce recovery guidance and set process.exitCode to 1. Other load errors retain existing handling. Hermes now loads the sibling NemoClaw launcher.
Missing CLI validation
test/package-contract/cli/top-level-error.test.ts
Tests simulate missing compiled CLI errors through both launchers. Assertions verify recovery guidance without internal paths or raw module-load details.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to dc9a5

The PR adds a localized diagnostic for incomplete installs while preserving existing handling for other startup failures; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. 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 clearly describes the primary change: the CLI now reports an unfinished installation instead of a generic command failure.
Linked Issues check ✅ Passed The changes satisfy issue #10372 by detecting a missing compiled CLI, reporting an interrupted or unfinished installation, and directing users to rerun the installer. Tests cover the Hermes launcher a…
Out of Scope Changes check ✅ Passed All changes support the linked issue. The NemoHermes launcher update routes execution through the updated NemoClaw error handling, and the added tests validate the recovery behavior. No unrelated chan…
Full details: Linked Issues check

Explanation

The changes satisfy issue #10372 by detecting a missing compiled CLI, reporting an interrupted or unfinished installation, and directing users to rerun the installer. Tests cover the Hermes launcher and verify that recovery guidance excludes internal paths and raw module errors.

Full details: Out of Scope Changes check

Explanation

All changes support the linked issue. The NemoHermes launcher update routes execution through the updated NemoClaw error handling, and the added tests validate the recovery behavior. No unrelated changes are evident.

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/10372-incomplete-install-hint

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

@jason-ma-nv

Copy link
Copy Markdown
Collaborator Author

Merged current main into the branch (94095e963).

codebase-growth-guardrails failed on the first push with three violations in files this PR never touches — nemoclaw-start.test.ts size, and launchable-smoke.test.ts conditionals and loops. The cause was the branch base, not the change: the branch started at b16793702, main had moved to 583331a10, and the guardrail's PR diff therefore counted everything merged in between as this PR's own edits. The merge reduces the diff to the two files actually changed.

Re-ran the guardrail locally against the real PR diff at the new head: 2 files, and empty violation lists for size, conditionals, and loops.

@wscurran wscurran added area: cli Command line interface, flags, terminal UX, or output bug-fix PR fixes a bug or regression labels Aug 28, 2026
@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor finished for commit 6905fe9. Include the Advisor findings in the complete PR feedback collection. Verify and group valid findings before repair.

All previous runs

@prekshivyas prekshivyas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed final head 6905fe9. All 64 current checks pass; the trusted merge-gate checker reports allPass=true. PR Review Advisor completed all nine specialists with no findings. Verified direct-entrypoint versus nested-dependency handling, Hermes launcher coverage, fixed diagnostics without path disclosure, DCO, signatures, and mergeability.

@prekshivyas
prekshivyas merged commit 887efa8 into main Sep 1, 2026
76 checks passed
@prekshivyas
prekshivyas deleted the fix/10372-incomplete-install-hint branch September 1, 2026 23:42
@wscurran wscurran added the area: install Install, setup, prerequisites, or uninstall flow label Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli Command line interface, flags, terminal UX, or output area: install Install, setup, prerequisites, or uninstall flow bug-fix PR fixes a bug or regression

Projects

None yet

4 participants