Skip to content

fix(onboard): reject the Hermes dashboard internal port when it collides with the dashboard port#4931

Open
latenighthackathon wants to merge 1 commit into
NVIDIA:mainfrom
latenighthackathon:fix/hermes-dashboard-internal-port-check
Open

fix(onboard): reject the Hermes dashboard internal port when it collides with the dashboard port#4931
latenighthackathon wants to merge 1 commit into
NVIDIA:mainfrom
latenighthackathon:fix/hermes-dashboard-internal-port-check

Conversation

@latenighthackathon
Copy link
Copy Markdown
Contributor

@latenighthackathon latenighthackathon commented Jun 8, 2026

Summary

A Hermes agent's dashboard uses two ports: an external one people connect to and an internal one it serves on. Before creating the sandbox, NemoClaw already refuses to continue if the external dashboard port clashes with the resolved chat-UI port or with the internal port. It never ran the same check for the internal port, so setting the internal port to the chat-UI port's value slipped through onboarding validation and only failed later, when NemoClaw tried to open the dashboard forward on a port that was already in use. This adds the missing symmetric check so the conflict is reported up front with a clear message, the same way the external port already is.

Related Issue

Closes #4930

Changes

  • In resolveHermesDashboardOnboardState (src/lib/onboard/hermes-dashboard.ts), reject the internal Hermes dashboard port when it equals the resolved dashboard port (config.internalPort === effectivePort), mirroring the existing external-port guard.
  • Add a unit test covering the new case.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Verification

  • New and existing unit tests pass locally.

Ran: npx vitest run src/lib/onboard/hermes-dashboard.test.ts (4 passed), npx tsc -p tsconfig.src.json, npm run typecheck:cli, and Biome lint on the changed files, all clean.

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

Summary by CodeRabbit

  • Bug Fixes

    • Configuration validation now prevents port conflicts between dashboard and API settings.
  • Tests

    • Added test case validating port conflict detection.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 8, 2026

Review Change Stack

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: 46f3a38c-27bf-44d8-a5f6-084024afce28

📥 Commits

Reviewing files that changed from the base of the PR and between 0e8cbfa and fd0e9c2.

📒 Files selected for processing (2)
  • src/lib/onboard/hermes-dashboard.test.ts
  • src/lib/onboard/hermes-dashboard.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/lib/onboard/hermes-dashboard.ts
  • src/lib/onboard/hermes-dashboard.test.ts

📝 Walkthrough

Walkthrough

This PR adds a validation check to reject Hermes dashboard onboarding configurations where the internal port equals the resolved Hermes API port. The validation mirrors existing external port checks and is covered by a new test case exercising the collision scenario.

Changes

Hermes Dashboard Internal Port Validation

Layer / File(s) Summary
Internal port collision validation and test
src/lib/onboard/hermes-dashboard.ts, src/lib/onboard/hermes-dashboard.test.ts
Adds a check in resolveHermesDashboardOnboardState that rejects configs where internalPort equals effectivePort, failing via the optional fail callback or throwing an error with a port-conflict message. Test case verifies the rejection with expected error text.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested labels

bug, integration: hermes, bug-fix

Suggested reviewers

  • miyoungc
  • cv

Poem

A dashboard port, once left unguarded,
Could forward where it shouldn't be started—
Now validation stands firm and true,
Catching collisions before they're due! 🐰✨

🚥 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 a validation check to reject when the Hermes dashboard internal port collides with the dashboard port.
Linked Issues check ✅ Passed The PR implements the exact fix specified in issue #4930: adding a symmetric check to reject when config.internalPort equals effectivePort, with corresponding unit test coverage.
Out of Scope Changes check ✅ Passed All changes are directly related to the stated objective of validating Hermes dashboard internal port against the resolved dashboard port; no extraneous modifications detected.
Docstring Coverage ✅ Passed Docstring coverage is 80.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.

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 `@src/lib/state/registry.ts`:
- Around line 217-257: The current lock-break path compares only the owner PID
before calling fs.rmSync(LOCK_DIR), which can mistakenly remove a newly-created
lock with the same PID; fix by capturing the original fs.statSync(LOCK_DIR)
result (e.g., lockStat) when you first read lockMtimeMs and then, inside the
"break" branch before rmSync, re-stat LOCK_DIR and require the identity to match
(compare fields like ino and dev, or at minimum mtimeMs and size) in addition to
rechecking LOCK_OWNER/ownerPid; only call fs.rmSync(LOCK_DIR, ...) when both the
owner check (recheck === ownerPid) and the stat identity check indicate the lock
is unchanged.
🪄 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: 65c26c19-63b4-418f-a1bf-000e77bc6bd2

📥 Commits

Reviewing files that changed from the base of the PR and between 4307f43 and 0e8cbfa.

📒 Files selected for processing (4)
  • src/lib/onboard/hermes-dashboard.test.ts
  • src/lib/onboard/hermes-dashboard.ts
  • src/lib/state/registry-lock.test.ts
  • src/lib/state/registry.ts

Comment thread src/lib/state/registry.ts Outdated
@cv cv added the v0.0.61 Release target label Jun 8, 2026
…des with the dashboard port

resolveHermesDashboardOnboardState guarded the external Hermes dashboard port
(NEMOCLAW_HERMES_DASHBOARD_PORT) against both the resolved dashboard/chat-UI port
and the internal port, but the internal port (NEMOCLAW_HERMES_DASHBOARD_INTERNAL_PORT)
was only checked against the external port. Setting it equal to the dashboard port
passed onboarding validation and then collided when the forward was started.

Add the missing symmetric check so the internal port is rejected up front, matching
the existing external-port guard, with a unit test.

Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com>
@latenighthackathon latenighthackathon force-pushed the fix/hermes-dashboard-internal-port-check branch from 0e8cbfa to fd0e9c2 Compare June 8, 2026 02:54
@wscurran wscurran added area: onboarding Onboarding FSM, provider setup, sandbox launch, or first-run flow bug-fix PR fixes a bug or regression integration: hermes Hermes integration behavior labels Jun 8, 2026
@wscurran
Copy link
Copy Markdown
Contributor

wscurran commented Jun 8, 2026

✨ Thanks for submitting this detailed PR about adding a check for the Hermes dashboard internal port collision during onboarding. This proposes a way to fix the regression in the onboarding flow for Hermes integration.


Related open issues:

1 similar comment
@wscurran
Copy link
Copy Markdown
Contributor

wscurran commented Jun 8, 2026

✨ Thanks for submitting this detailed PR about adding a check for the Hermes dashboard internal port collision during onboarding. This proposes a way to fix the regression in the onboarding flow for Hermes integration.


Related open issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: onboarding Onboarding FSM, provider setup, sandbox launch, or first-run flow bug-fix PR fixes a bug or regression integration: hermes Hermes integration behavior v0.0.61 Release target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hermes dashboard internal port is not validated against the dashboard port during onboarding

3 participants