Skip to content

fix(cli): accept OpenShell Server endpoint output - #8758

Merged
apurvvkumaria merged 12 commits into
mainfrom
codex/fix-gateway-server-endpoint
Aug 10, 2026
Merged

fix(cli): accept OpenShell Server endpoint output#8758
apurvvkumaria merged 12 commits into
mainfrom
codex/fix-gateway-server-endpoint

Conversation

@jyaunches

@jyaunches jyaunches commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

OpenShell v0.0.101 reports its active gateway endpoint as Server:, while NemoClaw readiness accepted only Gateway endpoint:. This companion to #8757 accepts both producer labels, requires every recognized HTTP(S) loopback endpoint to agree with the expected port, and restores reuse of a healthy managed gateway.

The first trusted PR E2E run also exposed a registered-but-stopped gateway state: OpenShell returned a connection error without repeating the gateway name, and public readiness classified the selected gateway as unknown instead of stale. The revised collector scopes status to the exact gateway and carries that authority into the existing stale-state classifier.

The escaped regression had two detection gaps: the parser unit fixture modeled only the older label, and the live double-onboard target did not explicitly assert the producer label or the reuse outcome.

Changes

  • Parse the exact Gateway endpoint: and Server: labels, failing closed on empty, malformed, off-host, off-port, non-HTTP(S), trailing, or conflicting evidence.
  • Scope public readiness status to the selected gateway and preserve registered connection failures as stale lifecycle state.
  • Add deterministic coverage across repeated production readiness probes sharing the same healthy gateway fixture.
  • Strengthen the live double-onboard target to prove the first invocation starts the gateway and the second reuses the same runtime.

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:
  • Docs updated for user-facing behavior changes
  • Docs not applicable — justification: this restores the documented existing-gateway reuse behavior and does not change a command, flag, configuration, default, output, or supported workflow.
  • Sensitive paths changed
  • Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification: an independent nine-category review passed for the production change; endpoint text remains supplementary to authoritative listener and runtime ownership evidence, and the stale-state probe is explicitly scoped to the selected gateway. The later exact-head change only linearizes a test mock for the repository growth guardrail.
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Documentation Writer Review

  • Documentation writer subagent reviewed the completed changes
  • Result: no-docs-needed
  • Evidence: The change restores the documented NemoClaw-managed OpenShell gateway readiness contract for OpenShell v0.0.101. It accepts Server: endpoint output, scopes status probes to the resolved gateway, and preserves a registered gateway as stale after a connection error. It does not change a NemoClaw command, flag, configuration, default, output, or supported workflow. docs/reference/system-readiness.mdx already documents canonical gateway ownership, stale reuse state, and loopback/port endpoint binding. docs/reference/commands.mdx already documents existing-gateway reuse and stale reconciliation. docs/changelog/2026-08-10.mdx already covers v0.0.106 readiness with OpenShell v0.0.101.
  • Agent: Codex Desktop

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
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — command/result:
    • npm exec -- vitest run --project cli src/lib/readiness/gateway-production.test.ts — 51/51 passed
    • npm exec -- vitest run --project integration test/onboard-gateway-port-conflict-fast-fail.test.ts — 2/2 passed
    • npm run typecheck:cli — passed
    • npm run checks:repository — passed
    • npm run test:e2e-phases:check — passed across 125 tests in 81 files
    • repository test-title checks — passed in the normal commit hooks
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — command/result: not applicable; focused validation covers the changed readiness and E2E contracts.
  • 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)

Signed-off-by: Julie Yaunches jyaunches@nvidia.com

Summary by CodeRabbit

  • Bug Fixes

    • Improved gateway endpoint detection across supported HTTP(S) formats.
    • Correctly identifies invalid, malformed, mismatched, or conflicting endpoints.
    • Prevents incorrect gateway status results when endpoint information is incomplete or unrelated.
  • Reliability

    • Re-onboarding now validates the active gateway endpoint and configured port.
    • NemoClaw reuses a healthy gateway only when its verified listener and endpoint own the configured gateway port.

senthilr-nv and others added 4 commits August 10, 2026 12:46
Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
@jyaunches jyaunches self-assigned this Aug 10, 2026
@coderabbitai

coderabbitai Bot commented Aug 10, 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
📝 Walkthrough

Walkthrough

The change strengthens managed gateway endpoint classification, scopes gateway status probes, preserves stale reuse state on connection failures, and expands onboarding coverage for endpoint reporting and healthy gateway reuse.

Changes

Gateway readiness and onboarding reuse

Layer / File(s) Summary
Endpoint classification and scoped readiness
src/lib/readiness/gateway-production.ts, src/lib/readiness/gateway-production.test.ts
The classifier validates labeled local HTTP(S) endpoints and ports. Tests cover malformed, conflicting, and unrelated output, scoped status probes, and stale state preservation after connection failures.
Live endpoint and reuse validation
test/e2e/live/double-onboard.test.ts
The live test validates the reported server endpoint, configured port, healthy reuse message, and reuse metadata.
Healthy gateway conflict scenario
test/onboard-gateway-port-conflict-fast-fail.test.ts
The integration test simulates healthy gateway and port evidence, then verifies repeated onboarding reuses the gateway without a port conflict.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested labels: area: cli, bug-fix, area: e2e

Suggested reviewers: cv, prekshivyas

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: accepting OpenShell Server endpoint output in the CLI.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-gateway-server-endpoint

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

@github-code-quality

github-code-quality Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in commit 04228c9 in the codex/fix-gateway-se... branch remains at 96%, unchanged from commit 430406f in the main branch.

TypeScript / code-coverage/cli

The overall coverage in commit 04228c9 in the codex/fix-gateway-se... branch remains at 82%, unchanged from commit 430406f in the main branch.

Show a code coverage summary of the most impacted files.
File main 430406f codex/fix-gateway-se... 04228c9 +/-
src/lib/messagi...annel-config.ts 99% 95% -4%
src/lib/onboard...eway-service.ts 90% 90% 0%
src/lib/onboard...host-runtime.ts 87% 87% 0%
src/lib/onboard/preflight.ts 82% 82% 0%
src/lib/sandbox...rce-identity.ts 86% 86% 0%
src/lib/actions...x/mcp-bridge.ts 33% 34% +1%
src/lib/adapter...ateway-drift.ts 56% 60% +4%
src/lib/core/bo...e-transcript.ts 93% 97% +4%
src/lib/actions...-add-restart.ts 12% 20% +8%
src/lib/readine...y-production.ts 50% 66% +16%

Updated August 10, 2026 22:09 UTC

@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: 3

🤖 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/readiness/gateway-production.ts`:
- Around line 308-311: Update the endpoint parsing loop around
stripAnsi(output).matchAll in src/lib/readiness/gateway-production.ts#L308-L311
to match labeled lines with empty values and pass an empty fallback to new
URL(), so empty or trailing-data values return "mismatch" rather than "unknown".
Add empty-value and trailing-data cases expecting "mismatch" in
src/lib/readiness/gateway-production.test.ts#L293-L301.

In `@test/e2e/live/double-onboard.test.ts`:
- Around line 565-567: Update the gateway endpoint assertion around new URL so
an empty URL.port is normalized to the protocol’s default port before
comparison. Treat HTTP as 80 and HTTPS as 443, while preserving the configured
NEMOCLAW_GATEWAY_PORT or 8080 fallback for non-default ports.

In `@test/onboard-gateway-port-conflict-fast-fail.test.ts`:
- Around line 216-224: In the result-validation loop for the two onboarding
invocations, add an assertion that each child process exits successfully with
status 0, alongside the existing result.error and result.signal checks. Keep the
output assertions unchanged.
🪄 Autofix

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: cb5b326f-1094-4f60-880a-9d30eeebae70

📥 Commits

Reviewing files that changed from the base of the PR and between 63f8847 and 616b3c9.

📒 Files selected for processing (4)
  • src/lib/readiness/gateway-production.test.ts
  • src/lib/readiness/gateway-production.ts
  • test/e2e/live/double-onboard.test.ts
  • test/onboard-gateway-port-conflict-fast-fail.test.ts

Comment thread src/lib/readiness/gateway-production.ts Outdated
Comment thread test/e2e/live/double-onboard.test.ts Outdated
Comment thread test/onboard-gateway-port-conflict-fast-fail.test.ts Outdated
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — No blocking findings reported

Advisor assessment: No blocking advisor findings reported
Next action: No advisor follow-up needed.
Findings: 0 blockers · 0 warnings · 0 suggestions

Model lanes

  • GPT-5.6 Terra (primary): Completed · high confidence · 0 blockers · 0 warnings · 0 suggestions
  • Nemotron 3 Ultra (second opinion): Completed · high confidence · 0 blockers · 1 warning · 0 suggestions
  • Model comparison: normalized findings differ; normalized terminology decisions differ; normalized E2E selections differ; Nemotron reported the same number of blockers, 1 more warning, the same number of suggestions.
1 terminology difference from the second opinion

Advisory only. These are normalized differences from the primary terminology receipt.

  • Server endpoint at test/e2e/live/double-onboard.test.ts:531: primary classified it as justified; the second opinion classified it as define.
2 additional E2E selections from the second opinion

Advisory only. The primary lane did not select these E2E jobs or targets.

  • concurrent-gateway-ports: The completed second-opinion lane identified E2E coverage that the primary lane omitted.
  • onboard-repair: The completed second-opinion lane identified E2E coverage that the primary lane omitted.

Second-opinion terminology and E2E selections are advisory. Live E2E does not run automatically for pull requests.

2 semantic terminology decisions

Terminology decisions are advisory. They affect the assessment only when a separate finding identifies concrete semantic impact.

  • justified — Server endpoint at test/e2e/live/double-onboard.test.ts:531: Keep Server endpoint where the test must identify the OpenShell Server: output label.
  • established — stale gateway state at src/lib/readiness/gateway-production.test.ts:383: Keep stale gateway state with its established meaning.

E2E guidance

Advisory only. A maintainer can dispatch the default E2E suite against this exact revision.

Recommended E2E: double-onboard

Workflow run details

This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge.

@senthilr-nv

Copy link
Copy Markdown
Collaborator

Holding approval for the three unresolved CodeRabbit findings on the current head:

  • Treat empty or trailing-data Gateway endpoint: / Server: values as mismatches so malformed managed endpoint evidence fails closed.
  • Normalize default HTTP(S) ports in the live endpoint assertion.
  • Assert both onboarding child processes exit with status 0.

The installer failure passed on rerun; CLI shard 3 is still running. Once these findings are addressed and required checks are green, this should be ready for approval.

Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>

@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: 2

🤖 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/readiness/gateway-production.test.ts`:
- Around line 392-400: Update the subprocess.spawnSync mock implementation in
the readiness test to match the exact production openshell command forms,
including the expected arguments for both status and info invocations. Return
the appropriate connection-refused result only for those exact forms, and make
every other command or argument combination fail closed rather than returning a
successful default result.
- Around line 392-400: Reset the standalone mock implementation after each test
by adding subprocess.spawnSync.mockReset() to the file’s existing afterEach
cleanup. Keep the current vi.restoreAllMocks() behavior and ensure the reset
targets the subprocess.spawnSync mock used by the test setup.
🪄 Autofix

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: 576f8b39-6f49-40db-946e-1386e8f11637

📥 Commits

Reviewing files that changed from the base of the PR and between 616b3c9 and c0216a1.

📒 Files selected for processing (3)
  • src/lib/readiness/gateway-production.test.ts
  • src/lib/readiness/gateway-production.ts
  • test/onboard-gateway-port-conflict-fast-fail.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • test/onboard-gateway-port-conflict-fast-fail.test.ts
  • src/lib/readiness/gateway-production.ts

Comment thread src/lib/readiness/gateway-production.test.ts
jyaunches and others added 3 commits August 10, 2026 17:36
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>
Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>

@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/onboard-gateway-port-conflict-fast-fail.test.ts`:
- Around line 199-209: Add or retain an integration test that invokes the public
onboarding flow twice and verifies both calls succeed by reusing the gateway
without a port-conflict failure. Keep the existing observeManagedGateway
readiness assertions as lower-level coverage, but ensure the onboarding test
validates the observable repeated-invocation behavior rather than only readiness
state.
🪄 Autofix

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: 5a75806a-4ed9-412b-8b35-8515043b1053

📥 Commits

Reviewing files that changed from the base of the PR and between ce6cb0d and 744ad3d.

📒 Files selected for processing (2)
  • test/e2e/live/double-onboard.test.ts
  • test/onboard-gateway-port-conflict-fast-fail.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/e2e/live/double-onboard.test.ts

Comment thread test/onboard-gateway-port-conflict-fast-fail.test.ts
Signed-off-by: Senthil Ravichandran <senthilr@nvidia.com>

@senthilr-nv senthilr-nv 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.

Approved — review findings are addressed with focused regression coverage.

Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
@apurvvkumaria
apurvvkumaria merged commit 9079100 into main Aug 10, 2026
88 of 90 checks passed
@apurvvkumaria
apurvvkumaria deleted the codex/fix-gateway-server-endpoint branch August 10, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants