fix(hermes): use invoked CLI name in onboard next-steps output (#3358)#3382
Conversation
…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>
|
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 (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThe PR separates CLI binary name resolution from agent/product branding. ChangesBranding isolation and launcher integration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 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 |
There was a problem hiding this comment.
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
📒 Files selected for processing (4)
bin/nemohermes.jssrc/lib/cli/branding.test.tssrc/lib/cli/branding.tstest/nemohermes-alias.test.ts
…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>
Summary
Fixes #3358 (NV QA NVB#6165494). On Brev v0.0.38, running
NEMOCLAW_AGENT=hermes nemoclaw onboardprintedRun: nemohermes <name> connectin the post-onboard next-steps message — but users who launched via thenemoclawbinary may not have thenemohermesalias on their PATH, so copy-pasting the suggestion hitnemohermes: 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 setsNEMOCLAW_INVOKED_AS=nemohermesso the runtime can distinguish "alias-invoked" from "base-binary-invoked with env-var".src/lib/cli/branding.ts—getAgentBranding()derivesclifromNEMOCLAW_INVOKED_AS(with a known-name allowlist, defaulting tonemoclaw);display/product/uninstallGoodbyecontinue to be agent-driven so Hermes branding stays correct everywhere else. All 142 existingcliName()/CLI_NAMEcallsites 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 buggynemoclaw onboard --agent hermes->nemohermes onboardassertion, and added two regression tests covering the exact NV QA repro (NEMOCLAW_AGENT=hermes nemoclaw onboard) plus the--agent hermesflag path.2.
chore(ci): allowlist NEMOCLAW_INVOKED_AS as internal launcher marker (#3358)— CI follow-up. Theenv-var-docsgate caught the new variable insrc/.NEMOCLAW_INVOKED_ASis internal-only (set bybin/nemohermes.js, value constrained to a known-name allowlist), so it's listed inci/env-var-doc-allowlist.jsonrather than documented for users.3.
test(hermes): clear NEMOCLAW_INVOKED_AS from helper env for hermeticity— addresses CodeRabbit's review feedback. TherunHermes/runNemoClawtest helpers inheritprocess.env; an accidentally-setNEMOCLAW_INVOKED_ASin the parent process could flip CLI branding and make the regression assertions environment-dependent. Both helpers now explicitly clear the marker alongsideNEMOCLAW_AGENT.Behaviour matrix after this PR:
nemohermes onboard(alias bin)nemohermes onboardNEMOCLAW_AGENT=hermes nemoclaw onboard(NV QA repro)nemoclaw onboardnemoclaw onboard --agent hermesnemoclaw onboardOut of scope (filed as a follow-up consideration):
src/lib/actions/update.ts:60-68has the same conceptualcliNameresolution 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.mdparity, not onboard runtime output strings.Type of Change
Verification
npx prek run --all-filespasses (local env has Python 3.8; prek requires >=3.9 — relying on CI)npm testpasses for the impacted suites (208/208 across 9 nemohermes-related files; 5/5 in the newbranding.test.ts; 8/8 innemohermes-alias.test.ts). 16 unrelated failures inruntime-shell/ssrf-parity/generate-openclaw-config/secret-redactionconfirmed pre-existing onupstream/main.npm run typecheck:clipassestsc --noEmitpassesnpx tsx scripts/check-env-var-docs.tspasses after the allowlist entryManual repro on the built CLI, all three invocation paths verified directly:
Fail-condition counters (
grep -c 'nemohermes'on full output):nemohermes onboardNEMOCLAW_AGENT=hermes nemoclaw onboardnemoclaw onboard --agent hermesSigned-off-by: Dongni Yang dongniy@nvidia.com
Summary by CodeRabbit
New Features
Tests
Documentation