Skip to content

fix(hermes): use invoked CLI name in onboard next-steps output (#3358)#3382

Merged
ericksoa merged 5 commits into
NVIDIA:mainfrom
Dongni-Yang:fix/hermes-onboard-cli-name-3358
May 13, 2026
Merged

fix(hermes): use invoked CLI name in onboard next-steps output (#3358)#3382
ericksoa merged 5 commits into
NVIDIA:mainfrom
Dongni-Yang:fix/hermes-onboard-cli-name-3358

Conversation

@Dongni-Yang

@Dongni-Yang Dongni-Yang commented May 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #3358 (NV QA NVB#6165494). On Brev v0.0.38, running NEMOCLAW_AGENT=hermes nemoclaw onboard printed Run: nemohermes <name> connect in the post-onboard next-steps message — but users who launched via the nemoclaw binary may not have the nemohermes alias on their PATH, so copy-pasting the suggestion hit nemohermes: command not found. The fix decouples the suggested CLI binary name from agent product branding, so the message reflects whichever binary the user actually invoked.

Related Issue

Fixes #3358

Changes

Three commits on this branch:

1. fix(hermes): use invoked CLI name in onboard next-steps output (#3358) — the core fix.

  • bin/nemohermes.js — launcher now also sets NEMOCLAW_INVOKED_AS=nemohermes so the runtime can distinguish "alias-invoked" from "base-binary-invoked with env-var".
  • src/lib/cli/branding.tsgetAgentBranding() derives cli from NEMOCLAW_INVOKED_AS (with a known-name allowlist, defaulting to nemoclaw); display / product / uninstallGoodbye continue to be agent-driven so Hermes branding stays correct everywhere else. All 142 existing cliName() / CLI_NAME callsites pick up the new behaviour transparently.
  • src/lib/cli/branding.test.ts (new) — 5 unit tests covering the four invocation paths plus an unknown-value safety fallback.
  • test/nemohermes-alias.test.ts — replaced the test that codified the buggy nemoclaw onboard --agent hermes -> nemohermes onboard assertion, and added two regression tests covering the exact NV QA repro (NEMOCLAW_AGENT=hermes nemoclaw onboard) plus the --agent hermes flag path.

2. chore(ci): allowlist NEMOCLAW_INVOKED_AS as internal launcher marker (#3358) — CI follow-up. The env-var-docs gate caught the new variable in src/. NEMOCLAW_INVOKED_AS is internal-only (set by bin/nemohermes.js, value constrained to a known-name allowlist), so it's listed in ci/env-var-doc-allowlist.json rather than documented for users.

3. test(hermes): clear NEMOCLAW_INVOKED_AS from helper env for hermeticity — addresses CodeRabbit's review feedback. The runHermes / runNemoClaw test helpers inherit process.env; an accidentally-set NEMOCLAW_INVOKED_AS in the parent process could flip CLI branding and make the regression assertions environment-dependent. Both helpers now explicitly clear the marker alongside NEMOCLAW_AGENT.

Behaviour matrix after this PR:

Invocation Suggested command Status
nemohermes onboard (alias bin) nemohermes onboard unchanged
NEMOCLAW_AGENT=hermes nemoclaw onboard (NV QA repro) nemoclaw onboard fixed
nemoclaw onboard --agent hermes nemoclaw onboard fixed

Out of scope (filed as a follow-up consideration): src/lib/actions/update.ts:60-68 has the same conceptual cliName resolution but a separate code path, and the NV QA repro did not exercise it. Keeping the diff narrow per the literal issue scope.

The recently-merged docs/CLI parity check from #3234 would not have caught this — it validates --help <-> docs/reference/commands.md parity, not onboard runtime output strings.

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)

Verification

  • npx prek run --all-files passes (local env has Python 3.8; prek requires >=3.9 — relying on CI)
  • npm test passes for the impacted suites (208/208 across 9 nemohermes-related files; 5/5 in the new branding.test.ts; 8/8 in nemohermes-alias.test.ts). 16 unrelated failures in runtime-shell / ssrf-parity / generate-openclaw-config / secret-redaction confirmed pre-existing on upstream/main.
  • npm run typecheck:cli passes
  • Plugin tsc --noEmit passes
  • Biome lint + format clean on all modified files
  • npx tsx scripts/check-env-var-docs.ts passes after the allowlist entry
  • Tests added or updated for new or changed behavior
  • No secrets, API keys, or credentials committed
  • Docs updated for user-facing behavior changes (N/A — docs/quickstart-hermes.md describes the alias-bin path which is unchanged; the fix corrects an unintended divergence in the base-bin path; the new env var is internal-only and allowlisted)

Manual repro on the built CLI, all three invocation paths verified directly:

$ HOME=/tmp/v1 node bin/nemohermes.js onboard --resume --non-interactive --yes-i-accept-third-party-software 2>&1 | grep -A1 "rebuild it"
  To change configuration on an existing sandbox, rebuild it:
    nemohermes onboard          <- unchanged (alias-bin path stays correct)

$ HOME=/tmp/v2 NEMOCLAW_AGENT=hermes node bin/nemoclaw.js onboard --resume --non-interactive --yes-i-accept-third-party-software 2>&1 | grep -A1 "rebuild it"
  To change configuration on an existing sandbox, rebuild it:
    nemoclaw onboard            <- NV QA repro, was 'nemohermes onboard' before the fix

$ HOME=/tmp/v3 node bin/nemoclaw.js onboard --agent hermes --resume --non-interactive --yes-i-accept-third-party-software 2>&1 | grep -A1 "rebuild it"
  To change configuration on an existing sandbox, rebuild it:
    nemoclaw onboard            <- --agent flag path, also fixed

Fail-condition counters (grep -c 'nemohermes' on full output):

Path Count Expected
nemohermes onboard 1 >0 (alias is what user invoked)
NEMOCLAW_AGENT=hermes nemoclaw onboard 0 0 (no leaked alias)
nemoclaw onboard --agent hermes 0 0 (no leaked alias)

Signed-off-by: Dongni Yang dongniy@nvidia.com

Summary by CodeRabbit

  • New Features

    • CLI now correctly identifies and applies proper branding based on which binary (nemohermes or nemoclaw) you invoke, ensuring accurate display names and help text.
  • Tests

    • Added comprehensive test coverage for environment-based branding behavior and CLI launcher detection.
  • Documentation

    • Updated environment variable documentation to include internal launcher marker.

Review Change Stack

…A#3358)

When a user ran `NEMOCLAW_AGENT=hermes nemoclaw onboard` (NV QA repro
NVB#6165494 on Brev v0.0.38), the post-onboard "Run/Status/Logs" message
advertised `nemohermes <name> connect` even though the user invoked via
`nemoclaw` and may not have the alias installed on PATH.

The root cause was that `getAgentBranding()` derived the CLI binary name
from `NEMOCLAW_AGENT` alongside product/display branding, so any
`hermes` agent — regardless of how the user invoked the CLI — produced
`nemohermes` suggestions.

Decouple invocation-binary name from agent product branding:

- `bin/nemohermes.js` now sets `NEMOCLAW_INVOKED_AS=nemohermes`
  alongside the existing `NEMOCLAW_AGENT=hermes`.
- `getAgentBranding()` derives `cli` from `NEMOCLAW_INVOKED_AS` (with
  a known-name allowlist, defaulting to `nemoclaw`) and continues to
  derive `display` / `product` / `uninstallGoodbye` from the agent.

All 142 existing `cliName()` / `CLI_NAME` callsites pick up the
invocation-aware behaviour transparently. The alias path
(`nemohermes onboard`) still suggests `nemohermes`; the base paths
(`nemoclaw onboard --agent hermes` and `NEMOCLAW_AGENT=hermes nemoclaw
onboard`) now suggest `nemoclaw`.

Note: the updater branding in `src/lib/actions/update.ts` has the same
conceptual pattern but is out of scope for this NV QA repro fix.

Signed-off-by: Dongni Yang <dongniy@nvidia.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 12, 2026

Copy link
Copy Markdown
Contributor

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: d1d988ee-cf49-40cc-8d21-547b5e932eee

📥 Commits

Reviewing files that changed from the base of the PR and between c9ee6a0 and c2d554f.

📒 Files selected for processing (1)
  • ci/env-var-doc-allowlist.json
✅ Files skipped from review due to trivial changes (1)
  • ci/env-var-doc-allowlist.json

📝 Walkthrough

Walkthrough

The PR separates CLI binary name resolution from agent/product branding. NEMOCLAW_INVOKED_AS signals how the CLI was invoked; agent identity drives product messaging. Onboarding now correctly shows nemoclaw commands for Hermes agent instead of the non-existent nemohermes binary.

Changes

Branding isolation and launcher integration

Layer / File(s) Summary
Branding data model and types
src/lib/cli/branding.ts (lines 9–55)
Documentation clarified that AgentBranding.cli reflects the invoked launcher binary. Internal ProductBranding type introduced, and branding maps split by agent name (DEFAULT_PRODUCT_BRANDING, AGENT_PRODUCT_BRANDING) for display, product, and uninstall messaging.
CLI name resolution and agent branding composition
src/lib/cli/branding.ts (lines 56–76), src/lib/cli/branding.test.ts
resolveInvokedCliName() derives the CLI binary name from NEMOCLAW_INVOKED_AS; getAgentBranding() composes the result by merging resolved CLI name with agent-selected product branding. Unit tests verify default, agent-specific, alias-invoked, fallback, and override scenarios.
Launcher environment signaling
bin/nemohermes.js, ci/env-var-doc-allowlist.json
nemohermes shim sets NEMOCLAW_INVOKED_AS = "nemohermes" before importing the nemoclaw module; CI allowlist documents the new env var.
Onboarding integration tests
test/nemohermes-alias.test.ts
Test harnesses clear inherited alias markers for spawned processes; tests updated to assert nemohermes branding requires both NEMOCLAW_AGENT and NEMOCLAW_INVOKED_AS, and onboarding output preserves nemoclaw onboard (no nemohermes suggestion).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 I hop through envs with a tiny task,
Marking how the launcher chose its mask.
Whether hermes runs or nemoclaw leads,
The onboarding hints now match their deeds.
A clear invoked-as keeps the CLI brisk and bright.

🚥 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 describes the main fix: using the invoked CLI name in onboard next-steps output for the Hermes agent.
Linked Issues check ✅ Passed The PR comprehensively addresses issue #3358 by detecting the invoked CLI binary, tracking it via NEMOCLAW_INVOKED_AS, and using it in onboard suggestions.
Out of Scope Changes check ✅ Passed All changes directly support fixing the identified issue; noted out-of-scope code path (src/lib/actions/update.ts) was explicitly excluded as intended.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/nemohermes-alias.test.ts`:
- Around line 108-129: The tests are non-hermetic because the parent process may
set NEMOCLAW_INVOKED_AS; update the test helper runNemoClaw (or the env baseline
it uses) to explicitly clear NEMOCLAW_INVOKED_AS before spawning the child
process — e.g., ensure the env object merged in runNemoClaw deletes or sets
NEMOCLAW_INVOKED_AS to undefined (and do the same for the call that passes {
NEMOCLAW_AGENT: "hermes" }) so the assertions in the two tests consistently
observe only the intended environment.
🪄 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: 3b8c2b5d-4af1-4675-b886-8784bc2b775d

📥 Commits

Reviewing files that changed from the base of the PR and between 4b47ab4 and 17224e0.

📒 Files selected for processing (4)
  • bin/nemohermes.js
  • src/lib/cli/branding.test.ts
  • src/lib/cli/branding.ts
  • test/nemohermes-alias.test.ts

Comment thread test/nemohermes-alias.test.ts
Dongni-Yang and others added 2 commits May 12, 2026 12:44
…VIDIA#3358)

The env-var-docs hook gates new NEMOCLAW_* variables read from src/.
NEMOCLAW_INVOKED_AS is set only by bin/nemohermes.js to tell the
runtime which binary the user invoked, and its value is constrained to
a known-name allowlist in src/lib/cli/branding.ts. Users should never
set it directly, so documenting it in docs/reference/commands.md would
be misleading. Allowlist it as internal-only.

Signed-off-by: Dongni Yang <dongniy@nvidia.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Address CodeRabbit feedback on NVIDIA#3382: the runHermes and runNemoClaw
helpers inherit process.env, so an accidentally-set NEMOCLAW_INVOKED_AS
in the parent test process could flip CLI branding and make the
regression assertions for NVIDIA#3358 environment-dependent. Explicitly clear
the marker alongside NEMOCLAW_AGENT in both helpers.

Signed-off-by: Dongni Yang <dongniy@nvidia.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@wscurran wscurran added fix integration: hermes Hermes integration behavior NV QA Bugs found by the NVIDIA QA Team and removed NV QA Bugs found by the NVIDIA QA Team labels May 12, 2026

@ericksoa ericksoa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed live at 2102322: focused CLI branding fix, checks green, low regression risk.

@ericksoa ericksoa merged commit 7f6da90 into NVIDIA:main May 13, 2026
25 checks passed
@wscurran wscurran added area: cli Command line interface, flags, terminal UX, or output bug-fix PR fixes a bug or regression and removed NemoClaw CLI labels Jun 3, 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 bug-fix PR fixes a bug or regression integration: hermes Hermes integration behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Nemoclaw][Hermes][Onboard] Hermes onboard has references to nemohermes cli which doesnt exist

4 participants