Skip to content

fix(e2e): stage device auth through hosted inference - #6071

Merged
jyaunches merged 1 commit into
mainfrom
fix/e2e-device-auth-hosted-wiring
Jun 30, 2026
Merged

fix(e2e): stage device auth through hosted inference#6071
jyaunches merged 1 commit into
mainfrom
fix/e2e-device-auth-hosted-wiring

Conversation

@jyaunches

@jyaunches jyaunches commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the device-auth-health live E2E wiring so the repo NVIDIA_INFERENCE_API_KEY is staged through the shared hosted-compatible inference config instead of being validated as the public NVIDIA endpoint provider. The install helper now starts each install attempt with --fresh so Vitest retries do not fail on leftover failed onboarding session state.

Related Issue

Fixes #2342

Changes

  • Stage device-auth-health installs with requireHostedInferenceConfig, including COMPATIBLE_API_KEY, NEMOCLAW_PROVIDER=custom, and the hosted-compatible default endpoint/model.
  • Run the live install path with install.sh --non-interactive --fresh to prevent retry attempts from tripping the failed-session guard.
  • Add E2E support coverage for the helper env contract and install arguments.

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: internal E2E CI wiring only; no user-facing behavior change
  • 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: self-reviewed credential/inference test wiring; secrets are still passed only via fixture env and redaction values
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

Verification

  • PR description includes the DCO sign-off declaration and every commit appears as Verified in GitHub
  • Git hooks passed during commit and push, or npx prek run --from-ref main --to-ref HEAD passes
  • Targeted tests pass for changed behavior
  • Full npm test passes (broad runtime changes only)
  • 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)

Verification run:

  • npx @biomejs/biome check test/e2e/live/device-auth-health-helpers.ts test/e2e/support/device-auth-health-helpers.test.ts
  • npx vitest run --project e2e-support test/e2e/support/device-auth-health-helpers.test.ts test/e2e/support/hosted-inference.test.ts --silent=false --reporter=default
  • npm run build:cli && npm run typecheck:cli
  • Commit hook ran with SKIP=test-cli; the broad CLI coverage hook failed unrelated local macOS environment checks requiring GNU timeout, privileged control paths, and shell assumptions. Push TypeScript hooks passed, and targeted tests above passed.

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

Summary by CodeRabbit

  • Bug Fixes
    • Improved device auth health setup to correctly use hosted inference credentials when available.
    • Updated sandbox installation to use a fresh install path during retries, helping avoid stale setup issues.
    • Added coverage for hosted inference environment wiring and install behavior to improve reliability of end-to-end checks.

@jyaunches jyaunches self-assigned this Jun 30, 2026
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Device-auth health E2E helper now builds environment variables via requireHostedInferenceConfig when an API key is supplied, merging hosted.env instead of setting only NVIDIA_INFERENCE_API_KEY. The sandbox install command now includes a --fresh flag. A new test file validates both the environment wiring and the install invocation.

Changes

Device-auth Health Hosted Inference Wiring

Layer / File(s) Summary
Hosted inference env construction and fresh install flag
test/e2e/live/device-auth-health-helpers.ts
commandEnv imports and calls requireHostedInferenceConfig({ required: () => apiKey }), merging hosted.env into the returned environment instead of only setting NVIDIA_INFERENCE_API_KEY; the install.sh invocation now includes a --fresh flag.
Test coverage for env wiring and install invocation
test/e2e/support/device-auth-health-helpers.test.ts
New test suite verifies commandEnv stages expected hosted-inference variables (NEMOCLAW_E2E_USE_HOSTED_INFERENCE, provider/model/endpoint, NVIDIA_INFERENCE_API_KEY, COMPATIBLE_API_KEY) and confirms installDeviceAuthSandbox invokes install.sh with --non-interactive and --fresh using a stubbed HostCliClient, with temp-dir setup/cleanup.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The changes only update E2E helpers and tests, not the actual launchable deployment path behind the dashboard health issue. Update the deployment/onboarding code that leaves the dashboard offline, or show how this helper change fixes the connected-agent regression.
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 (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the main change to staged hosted inference for device auth.
Out of Scope Changes check ✅ Passed The edits stay focused on the device-auth E2E helper and its tests, with no clear unrelated additions.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/e2e-device-auth-hosted-wiring

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

@github-code-quality

github-code-quality Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in the fix/e2e-device-auth-... branch is 96%. Coverage data for the main branch is not yet available.

Show a code coverage summary of the most covered files.
File main fix/e2e-device-auth-... 1b4da13 +/-
nemoclaw/src/se...cret-scanner.ts 100%
nemoclaw/src/commands/slash.ts 100%
nemoclaw/src/li...bprocess-env.ts 100%
nemoclaw/src/bl...eprint/state.ts 98%
nemoclaw/src/onboard/config.ts 98%
nemoclaw/src/bl...int/snapshot.ts 97%
nemoclaw/src/bl...print/runner.ts 95%
nemoclaw/src/co...ration-state.ts 94%
nemoclaw/src/bl...ate-networks.ts 94%
nemoclaw/src/index.ts 94%

TypeScript / code-coverage/cli

The overall coverage in the fix/e2e-device-auth-... branch is 68%. Coverage data for the main branch is not yet available.

Show a code coverage summary of the most covered files.
File main fix/e2e-device-auth-... 1b4da13 +/-
src/lib/shields...nsition-lock.ts 86%
src/lib/actions...dbox/rebuild.ts 80%
src/lib/actions...all/run-plan.ts 80%
src/lib/state/o...oard-session.ts 79%
src/lib/state/sandbox.ts 72%
src/lib/onboard/preflight.ts 69%
src/lib/shields/index.ts 67%
src/lib/onboard...er-gpu-patch.ts 59%
src/lib/actions...licy-channel.ts 58%
src/lib/onboard.ts 20%

Updated June 30, 2026 22:19 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@github-actions

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: None
Optional E2E: device-auth-health

Dispatch hint: device-auth-health

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E

  • None. No merge-blocking E2E is required because this PR is tests-only and cannot affect production installer, onboarding, sandbox lifecycle, credential, security, network-policy, inference-routing, deployment, or assistant user-flow behavior. The touched live helper can be validated with the optional device-auth-health job.

Optional E2E

  • device-auth-health (high; live Docker/OpenShell install/onboard flow, timeout 40 minutes): Optional confidence check for the modified live E2E helper: validates that the changed hosted inference env wiring and fresh install invocation still support the real device-auth health flow.

New E2E recommendations

  • None.

Dispatch hint

  • Workflow: .github/workflows/e2e.yaml
  • jobs input: device-auth-health

@github-actions

Copy link
Copy Markdown
Contributor

E2E Target Recommendation

Required E2E targets: device-auth-health
Optional E2E targets: None

Dispatch required E2E targets:

  • gh workflow run e2e.yaml --ref <pr-head-ref> --field jobs=device-auth-health

Workflow run

Full E2E target advisor summary

E2E Target Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E targets

  • device-auth-health: The PR changes the live helper used by test/e2e/live/device-auth-health.test.ts, including hosted inference environment wiring and install.sh invocation. That live test is wired as the free-standing device-auth-health job in e2e.yaml, so dispatch that job directly.
    • Dispatch: gh workflow run e2e.yaml --ref <pr-head-ref> --field jobs=device-auth-health

Optional E2E targets

  • None.

Relevant changed files

  • test/e2e/live/device-auth-health-helpers.ts
  • test/e2e/support/device-auth-health-helpers.test.ts

@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — Changes requested

Merge posture: Do not merge yet
Primary next action: Fix PRA-1: PR closes #2342 without changing the user-facing Brev/dashboard behavior; then add or justify PRA-T1.
Open items: 1 required · 1 warning · 0 suggestions · 6 test follow-ups
Top item: PR closes #2342 without changing the user-facing Brev/dashboard behavior

Action checklist

  • PRA-1 Fix: PR closes [NemoClaw][Brev Launchable] OpenClaw Gateway Dashboard shows "Version n/a" and "Health Offline" after Brev Launchable deployment succeeds #2342 without changing the user-facing Brev/dashboard behavior
  • PRA-2 Resolve or justify: New default-env assertions can fail when hosted-inference override env vars are present in test/e2e/support/device-auth-health-helpers.test.ts:25
  • PRA-T1 Add or justify test follow-up: New default-env assertions can fail when hosted-inference override env vars are present
  • PRA-T2 Add or justify test follow-up: Acceptance clause
  • PRA-T3 Add or justify test follow-up: Acceptance clause
  • PRA-T4 Add or justify test follow-up: Acceptance clause
  • PRA-T5 Add or justify test follow-up: Acceptance clause
  • PRA-T6 Add or justify test follow-up: Acceptance clause

Findings index

ID Severity Category Location Required action
PRA-1 Required acceptance Either narrow the PR description/closing keyword to state that this fixes the device-auth-health E2E wiring for the #2342 regression test, or add the product/Brev Launchable changes and regression evidence that satisfy the linked issue's user-facing clauses.
PRA-2 Resolve/justify tests test/e2e/support/device-auth-health-helpers.test.ts:25 Make the test environment explicit: save and clear the hosted-inference override variables around the default-value assertions, or use Vitest env stubbing/restoration. Optionally add a separate test that documents `commandEnv()` honoring explicit hosted-inference overrides.

🚨 Required before merge

Address these before merging unless a maintainer explicitly overrides the advisor with rationale.

PRA-1 Required — PR closes #2342 without changing the user-facing Brev/dashboard behavior

  • Location: not file-specific
  • Category: acceptance
  • Problem: The linked issue and comments describe user-facing Brev Launchable/dashboard failures: `Version n/a`, `Health Offline`, disconnected chat, stale launchable version, and gateway token startup issues. This diff only changes `test/e2e/live/device-auth-health-helpers.ts` and adds support coverage for the E2E helper's hosted-inference env and `--fresh` installer args. That is useful for keeping the existing live E2E runnable, but it does not implement or prove the linked issue's product/Brev clauses.
  • Impact: Using `Fixes [NemoClaw][Brev Launchable] OpenClaw Gateway Dashboard shows "Version n/a" and "Health Offline" after Brev Launchable deployment succeeds #2342` can auto-close a broader user-facing issue while this PR only repairs test setup. Maintainers may lose tracking for the Brev/dashboard/version/chat readiness clauses that are not addressed by the changed code.
  • Required action: Either narrow the PR description/closing keyword to state that this fixes the device-auth-health E2E wiring for the [NemoClaw][Brev Launchable] OpenClaw Gateway Dashboard shows "Version n/a" and "Health Offline" after Brev Launchable deployment succeeds #2342 regression test, or add the product/Brev Launchable changes and regression evidence that satisfy the linked issue's user-facing clauses.
  • Expected follow-up: Fix before merge or get explicit maintainer override.
  • Verification: Read the changed-file list and diff: only `test/e2e/live/device-auth-health-helpers.ts` and `test/e2e/support/device-auth-health-helpers.test.ts` changed; no Brev Launchable, dashboard, status implementation, gateway token, or version-publishing code changed.
  • Missing regression test: If this PR is intended to close [NemoClaw][Brev Launchable] OpenClaw Gateway Dashboard shows "Version n/a" and "Health Offline" after Brev Launchable deployment succeeds #2342, add automated coverage that proves the launchable/dashboard contract: current NemoClaw version is installed, dashboard health is online/live with device auth, and the auto-opened TUI/chat connects without a gateway-token-missing error. If this PR is only an E2E setup fix, no additional product regression is required, but remove or reword the closing keyword.
  • Done when: The required change is committed and verification passes: Read the changed-file list and diff: only `test/e2e/live/device-auth-health-helpers.ts` and `test/e2e/support/device-auth-health-helpers.test.ts` changed; no Brev Launchable, dashboard, status implementation, gateway token, or version-publishing code changed.
  • Evidence: PR body says `Fixes [NemoClaw][Brev Launchable] OpenClaw Gateway Dashboard shows "Version n/a" and "Health Offline" after Brev Launchable deployment succeeds #2342`; linked issue expected result says `Dashboard shows OpenClaw version, Health Online, and chat is connected and ready to use.` The diff only stages hosted-compatible env for the live E2E install helper and adds support tests for that helper.
Review findings by urgency: 1 required fix, 1 item to resolve/justify, 0 in-scope improvements

⚠️ Resolve or justify before merge

Investigate these in the current review; either fix them, explain why they are not applicable, or document the accepted risk.

PRA-2 Resolve/justify — New default-env assertions can fail when hosted-inference override env vars are present

  • Location: test/e2e/support/device-auth-health-helpers.test.ts:25
  • Category: tests
  • Problem: `commandEnv(apiKey)` calls `requireHostedInferenceConfig()` with its default `process.env`, and that fixture intentionally honors `NEMOCLAW_ENDPOINT_URL`, `NEMOCLAW_MODEL`, `NEMOCLAW_COMPAT_MODEL`, and `NEMOCLAW_PREFERRED_API`. The new test asserts the default endpoint, model, and preferred API without clearing or stubbing those variables, so the test result depends on the runner environment.
  • Impact: A developer or CI lane with hosted-inference override variables set can get a false test failure even though the helper is behaving correctly by honoring overrides.
  • Recommended action: Make the test environment explicit: save and clear the hosted-inference override variables around the default-value assertions, or use Vitest env stubbing/restoration. Optionally add a separate test that documents `commandEnv()` honoring explicit hosted-inference overrides.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Read `test/e2e/fixtures/hosted-inference.ts`: `requireHostedInferenceConfig()` uses `env.NEMOCLAW_ENDPOINT_URL`, `env.NEMOCLAW_MODEL`, `env.NEMOCLAW_COMPAT_MODEL`, and `env.NEMOCLAW_PREFERRED_API` before defaults; then compare the hard-coded default expectations in `device-auth-health-helpers.test.ts`.
  • Missing regression test: Add a deterministic support test named like `commandEnv uses hosted inference defaults when override env vars are absent` that clears/stubs the override env vars before asserting defaults, and, if override behavior matters for this helper, add `commandEnv preserves explicit hosted inference endpoint/model overrides`.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Read `test/e2e/fixtures/hosted-inference.ts`: `requireHostedInferenceConfig()` uses `env.NEMOCLAW_ENDPOINT_URL`, `env.NEMOCLAW_MODEL`, `env.NEMOCLAW_COMPAT_MODEL`, and `env.NEMOCLAW_PREFERRED_API` before defaults; then compare the hard-coded default expectations in `device-auth-health-helpers.test.ts`.
  • Evidence: `device-auth-health-helpers.test.ts` expects `https://inference-api.nvidia.com/v1\`, `nvidia/nvidia/nemotron-3-ultra`, and `openai-completions`; `hosted-inference.ts` returns environment-provided values when present.

💡 In-scope improvements

These are lower-risk, not throwaway. Prefer fixing them in this PR when they are local to changed code; defer only with rationale or a linked follow-up.

  • None.
Test follow-ups to resolve or justify

If these cover changed behavior, prefer adding them in this PR; otherwise state why existing coverage is enough or link the follow-up.

  • PRA-T1 New default-env assertions can fail when hosted-inference override env vars are present — Make the test environment explicit: save and clear the hosted-inference override variables around the default-value assertions, or use Vitest env stubbing/restoration. Optionally add a separate test that documents `commandEnv()` honoring explicit hosted-inference overrides.
  • PRA-T2 Acceptance clause — After deploying NemoClaw via Brev Launchable, the agent creation completes successfully (Step 03/03 YOUR AGENT IS LIVE ). However, clicking CHAT WITH AGENT opens the OpenClaw Gateway Dashboard showing Version n/a and Health Offline in the top-right corner, with Disconnected from gateway in the chat area. — add test evidence or identify existing coverage. No Brev Launchable, dashboard, TUI/chat, version reporting, or product health implementation changed; the diff only updates E2E helper setup.
  • PRA-T3 Acceptance clause — Actual Result <pre> - Top-right: Version n/a · Health Offline - Chat area: Disconnected from gateway. </code></pre> — add test evidence or identify existing coverage. The existing live test asserts status output is not offline, but this PR only changes the test's install env/args and does not change user-facing dashboard/chat behavior.
  • PRA-T4 Acceptance clause — Expected Result Dashboard shows OpenClaw version, Health Online, and chat is connected and ready to use. — add test evidence or identify existing coverage. No product code or Brev launchable code changed to prove version display, Health Online display, or chat readiness.
  • PRA-T5 Acceptance clause — 1. **Change only `isSandboxGatewayRunning()`** to probe `/health` (returns 200 even with device auth) or accept 401 as alive — without rewriting the entire recovery chain — add test evidence or identify existing coverage. `isSandboxGatewayRunning()` is not changed in this PR. The existing live E2E checks the contract once setup succeeds, but the implementation clause is not part of this diff.
  • PRA-T6 Acceptance clause — 3. **Validate with the nightly E2E** before merging — the unit tests do not catch this class of hang because they mock all openshell calls — add test evidence or identify existing coverage. The repository contains `test/e2e/live/device-auth-health.test.ts`, which is the relevant live E2E contract. This review does not evaluate external/nightly E2E execution status.

Workflow run details

This is an automated, non-binding review; it still expects maintainers and agents to respond to each required or warning item. Treat suggestions as current-PR improvements when they touch changed code; defer only with maintainer rationale or a linked follow-up. A human maintainer must make the final merge decision.

@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor (Nemotron Ultra) — No blocking findings

Merge posture: No blocking advisor findings
Primary next action: Add or justify PRA-T1 and any related test follow-ups.
Open items: 0 required · 0 warnings · 5 suggestions · 2 test follow-ups
Since last review: 0 prior items resolved · 0 still apply · 0 new items found

Action checklist

  • PRA-T1 Add or justify test follow-up: Test mock doesn't verify redactionValues propagation
  • PRA-T2 Add or justify test follow-up: Missing negative tests for commandEnv and install retry paths
  • PRA-1 In-scope improvement: Inline secrets object closure capture in commandEnv in test/e2e/live/device-auth-health-helpers.ts:27
  • PRA-2 In-scope improvement: install.sh --fresh idempotency under retry not verified in test/e2e/live/device-auth-health-helpers.ts:89
  • PRA-3 In-scope improvement: Missing module-level documentation in test/e2e/live/device-auth-health-helpers.ts:1
  • PRA-4 In-scope improvement: Test mock doesn't verify redactionValues propagation in test/e2e/support/device-auth-health-helpers.test.ts:30
  • PRA-5 In-scope improvement: Missing negative tests for commandEnv and install retry paths in test/e2e/support/device-auth-health-helpers.test.ts:1

Findings index

ID Severity Category Location Required action
PRA-1 Improvement security test/e2e/live/device-auth-health-helpers.ts:27 No change needed — apiKey is a string primitive, closure capture is safe. Consider extracting the secrets object to a named constant if this pattern spreads to production code.
PRA-2 Improvement correctness test/e2e/live/device-auth-health-helpers.ts:89 Confirm install.sh --fresh is idempotent. If not, the retry loop may need adjustment (e.g., skip --fresh on retries after first attempt).
PRA-3 Improvement correctness test/e2e/live/device-auth-health-helpers.ts:1 Add a 1-2 line JSDoc comment at top describing this module's role (device auth health E2E helper utilities).
PRA-4 Improvement tests test/e2e/support/device-auth-health-helpers.test.ts:30 Extend the mock to capture options.redactionValues and assert it contains the apiKey.
PRA-5 Improvement tests test/e2e/support/device-auth-health-helpers.test.ts:1 Add test for commandEnv(undefined) asserting NEMOCLAW_E2E_USE_HOSTED_INFERENCE is absent. Add test mocking transient failure to verify retry/backoff logic.
Review findings by urgency: 0 required fixes, 0 items to resolve/justify, 5 in-scope improvements

⚠️ Resolve or justify before merge

Investigate these in the current review; either fix them, explain why they are not applicable, or document the accepted risk.

  • None.

💡 In-scope improvements

These are lower-risk, not throwaway. Prefer fixing them in this PR when they are local to changed code; defer only with rationale or a linked follow-up.

PRA-1 Improvement — Inline secrets object closure capture in commandEnv

  • Location: test/e2e/live/device-auth-health-helpers.ts:27
  • Category: security
  • Problem: commandEnv() uses requireHostedInferenceConfig({ required: () => apiKey }) which constructs a secrets object inline. While fine for test code, the inline arrow function captures the apiKey parameter; verify no closure-related leakage in async retry loops.
  • Impact: Low — apiKey is a string primitive, closure capture is safe in this context. Only relevant if pattern spreads to production code with async secret resolution.
  • Suggested action: No change needed — apiKey is a string primitive, closure capture is safe. Consider extracting the secrets object to a named constant if this pattern spreads to production code.
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Read test/e2e/live/device-auth-health-helpers.ts:27-29 and confirm apiKey is a string primitive.
  • Missing regression test: Existing test at test/e2e/support/device-auth-health-helpers.test.ts:12-22 already verifies env staging.
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: Line 27-29: const hosted = requireHostedInferenceConfig({ required: () => apiKey }); Object.assign(env, hosted.env);

PRA-2 Improvement — install.sh --fresh idempotency under retry not verified

  • Location: test/e2e/live/device-auth-health-helpers.ts:89
  • Category: correctness
  • Problem: installDeviceAuthSandbox adds `--fresh` flag to install.sh but the retry loop logic (lines 89-101) reuses the same attempt counter and backoff. The `--fresh` flag should make retries idempotent; verify install.sh --fresh is truly idempotent on re-run.
  • Impact: Medium — if --fresh is not idempotent, retries could leave sandbox in inconsistent state or fail differently on subsequent attempts, masking transient failures.
  • Suggested action: Confirm install.sh --fresh is idempotent. If not, the retry loop may need adjustment (e.g., skip --fresh on retries after first attempt).
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Read install.sh to verify --fresh flag behavior on re-run.
  • Missing regression test: No existing test verifies install.sh --fresh idempotency under retry conditions.
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: Line 89: install = await host.command("bash", ["install.sh", "--non-interactive", "--fresh"], {...});

PRA-3 Improvement — Missing module-level documentation

  • Location: test/e2e/live/device-auth-health-helpers.ts:1
  • Category: correctness
  • Problem: File has no module-level doc comment explaining its purpose in the E2E test hierarchy. Given the recent migrations (test(e2e): migrate device auth health to vitest #5543, ci(e2e): use canonical inference key in Vitest #5688, test(e2e): retire legacy shell lanes #5756), a brief header would aid future maintainers.
  • Impact: Low — maintainability only, no runtime effect.
  • Suggested action: Add a 1-2 line JSDoc comment at top describing this module's role (device auth health E2E helper utilities).
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Check file header for description comment.
  • Missing regression test: N/A — documentation only.
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: File starts directly with imports, no JSDoc header.

PRA-4 Improvement — Test mock doesn't verify redactionValues propagation

  • Location: test/e2e/support/device-auth-health-helpers.test.ts:30
  • Category: tests
  • Problem: Test mocks HostCliClient.command but doesn't verify redactionValues propagation. The production code passes `redactionValues: [apiKey]` (line 95 in helpers.ts); the mock should assert this is passed through.
  • Impact: Low — CI log redaction is a defense-in-depth measure. Missing assertion means redaction could be accidentally removed without test failure.
  • Suggested action: Extend the mock to capture options.redactionValues and assert it contains the apiKey.
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Read test file line 30-50 and helpers.ts line 95.
  • Missing regression test: Add assertion for redactionValues in the second test case.
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: helpers.ts line 95: redactionValues: [apiKey]; test.ts mock at line 30-35 doesn't capture options.redactionValues

PRA-5 Improvement — Missing negative tests for commandEnv and install retry paths

  • Location: test/e2e/support/device-auth-health-helpers.test.ts:1
  • Category: tests
  • Problem: New test file covers commandEnv and installDeviceAuthSandbox happy paths but lacks negative tests: (a) commandEnv with no apiKey should not set hosted inference env vars, (b) installDeviceAuthSandbox retry behavior on transient failure.
  • Impact: Medium — without negative tests, regressions in env staging logic or retry behavior could go undetected.
  • Suggested action: Add test for commandEnv(undefined) asserting NEMOCLAW_E2E_USE_HOSTED_INFERENCE is absent. Add test mocking transient failure to verify retry/backoff logic.
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Run test suite and verify no test covers these negative cases.
  • Missing regression test: Two new test cases: commandEnv without apiKey, and install retry on transient failure.
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: Test file only has 2 'it' blocks covering happy paths. No test for commandEnv(undefined) or isTransientProviderValidationFailure mock.
Test follow-ups to resolve or justify

If these cover changed behavior, prefer adding them in this PR; otherwise state why existing coverage is enough or link the follow-up.

  • PRA-T1 Test mock doesn't verify redactionValues propagation — Extend the mock to capture options.redactionValues and assert it contains the apiKey.
  • PRA-T2 Missing negative tests for commandEnv and install retry paths — Add test for commandEnv(undefined) asserting NEMOCLAW_E2E_USE_HOSTED_INFERENCE is absent. Add test mocking transient failure to verify retry/backoff logic.
Since last review details

Current findings, using the urgency labels above:

PRA-1 Improvement — Inline secrets object closure capture in commandEnv

  • Location: test/e2e/live/device-auth-health-helpers.ts:27
  • Category: security
  • Problem: commandEnv() uses requireHostedInferenceConfig({ required: () => apiKey }) which constructs a secrets object inline. While fine for test code, the inline arrow function captures the apiKey parameter; verify no closure-related leakage in async retry loops.
  • Impact: Low — apiKey is a string primitive, closure capture is safe in this context. Only relevant if pattern spreads to production code with async secret resolution.
  • Suggested action: No change needed — apiKey is a string primitive, closure capture is safe. Consider extracting the secrets object to a named constant if this pattern spreads to production code.
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Read test/e2e/live/device-auth-health-helpers.ts:27-29 and confirm apiKey is a string primitive.
  • Missing regression test: Existing test at test/e2e/support/device-auth-health-helpers.test.ts:12-22 already verifies env staging.
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: Line 27-29: const hosted = requireHostedInferenceConfig({ required: () => apiKey }); Object.assign(env, hosted.env);

PRA-2 Improvement — install.sh --fresh idempotency under retry not verified

  • Location: test/e2e/live/device-auth-health-helpers.ts:89
  • Category: correctness
  • Problem: installDeviceAuthSandbox adds `--fresh` flag to install.sh but the retry loop logic (lines 89-101) reuses the same attempt counter and backoff. The `--fresh` flag should make retries idempotent; verify install.sh --fresh is truly idempotent on re-run.
  • Impact: Medium — if --fresh is not idempotent, retries could leave sandbox in inconsistent state or fail differently on subsequent attempts, masking transient failures.
  • Suggested action: Confirm install.sh --fresh is idempotent. If not, the retry loop may need adjustment (e.g., skip --fresh on retries after first attempt).
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Read install.sh to verify --fresh flag behavior on re-run.
  • Missing regression test: No existing test verifies install.sh --fresh idempotency under retry conditions.
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: Line 89: install = await host.command("bash", ["install.sh", "--non-interactive", "--fresh"], {...});

PRA-3 Improvement — Missing module-level documentation

  • Location: test/e2e/live/device-auth-health-helpers.ts:1
  • Category: correctness
  • Problem: File has no module-level doc comment explaining its purpose in the E2E test hierarchy. Given the recent migrations (test(e2e): migrate device auth health to vitest #5543, ci(e2e): use canonical inference key in Vitest #5688, test(e2e): retire legacy shell lanes #5756), a brief header would aid future maintainers.
  • Impact: Low — maintainability only, no runtime effect.
  • Suggested action: Add a 1-2 line JSDoc comment at top describing this module's role (device auth health E2E helper utilities).
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Check file header for description comment.
  • Missing regression test: N/A — documentation only.
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: File starts directly with imports, no JSDoc header.

PRA-4 Improvement — Test mock doesn't verify redactionValues propagation

  • Location: test/e2e/support/device-auth-health-helpers.test.ts:30
  • Category: tests
  • Problem: Test mocks HostCliClient.command but doesn't verify redactionValues propagation. The production code passes `redactionValues: [apiKey]` (line 95 in helpers.ts); the mock should assert this is passed through.
  • Impact: Low — CI log redaction is a defense-in-depth measure. Missing assertion means redaction could be accidentally removed without test failure.
  • Suggested action: Extend the mock to capture options.redactionValues and assert it contains the apiKey.
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Read test file line 30-50 and helpers.ts line 95.
  • Missing regression test: Add assertion for redactionValues in the second test case.
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: helpers.ts line 95: redactionValues: [apiKey]; test.ts mock at line 30-35 doesn't capture options.redactionValues

PRA-5 Improvement — Missing negative tests for commandEnv and install retry paths

  • Location: test/e2e/support/device-auth-health-helpers.test.ts:1
  • Category: tests
  • Problem: New test file covers commandEnv and installDeviceAuthSandbox happy paths but lacks negative tests: (a) commandEnv with no apiKey should not set hosted inference env vars, (b) installDeviceAuthSandbox retry behavior on transient failure.
  • Impact: Medium — without negative tests, regressions in env staging logic or retry behavior could go undetected.
  • Suggested action: Add test for commandEnv(undefined) asserting NEMOCLAW_E2E_USE_HOSTED_INFERENCE is absent. Add test mocking transient failure to verify retry/backoff logic.
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Run test suite and verify no test covers these negative cases.
  • Missing regression test: Two new test cases: commandEnv without apiKey, and install retry on transient failure.
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: Test file only has 2 'it' blocks covering happy paths. No test for commandEnv(undefined) or isTransientProviderValidationFailure mock.

Workflow run details

This is an automated, non-binding review; it still expects maintainers and agents to respond to each required or warning item. Treat suggestions as current-PR improvements when they touch changed code; defer only with maintainer rationale or a linked follow-up. A human maintainer must make the final merge decision.

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

🧹 Nitpick comments (1)
test/e2e/support/device-auth-health-helpers.test.ts (1)

26-65: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Missing coverage for the "no API key" branch.

Per the AI summary, commandEnv/the hosted env merge happens "when an API key is supplied," implying a conditional branch. Both tests here only exercise the happy path with "repo-hosted-key". Since this PR's objective is specifically to stop staging the key as the public NVIDIA provider, a test asserting behavior when no key is provided (e.g., env omits hosted/provider overrides, or throws as expected) would more fully prove the superseded path is gone, per the path instructions for migration tests.

🤖 Prompt for 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.

In `@test/e2e/support/device-auth-health-helpers.test.ts` around lines 26 - 65,
The hosted inference tests only cover the branch where an API key is present, so
add coverage for the no-key path in the device auth helpers. Extend the
assertions around `commandEnv` and `installDeviceAuthSandbox` to verify what
happens when no hosted credential is supplied, using the existing `commandEnv`
and `installDeviceAuthSandbox` symbols to locate the logic. The new test should
confirm the merged hosted/provider overrides are not staged without an API key,
or that the expected fallback/error behavior is triggered, so the conditional
path is fully exercised.

Source: Path instructions

🤖 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.

Nitpick comments:
In `@test/e2e/support/device-auth-health-helpers.test.ts`:
- Around line 26-65: The hosted inference tests only cover the branch where an
API key is present, so add coverage for the no-key path in the device auth
helpers. Extend the assertions around `commandEnv` and
`installDeviceAuthSandbox` to verify what happens when no hosted credential is
supplied, using the existing `commandEnv` and `installDeviceAuthSandbox` symbols
to locate the logic. The new test should confirm the merged hosted/provider
overrides are not staged without an API key, or that the expected fallback/error
behavior is triggered, so the conditional path is fully exercised.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: fcfbd374-1709-4ac6-859d-f3506bb0dc8d

📥 Commits

Reviewing files that changed from the base of the PR and between 45d38f7 and 1b4da13.

📒 Files selected for processing (2)
  • test/e2e/live/device-auth-health-helpers.ts
  • test/e2e/support/device-auth-health-helpers.test.ts

@github-actions

Copy link
Copy Markdown
Contributor

Vitest E2E Target Results — ✅ All requested jobs passed

Run: 28479446004
Workflow ref: fix/e2e-device-auth-hosted-wiring
Requested targets: (default — all supported)
Requested jobs: device-auth-health
Summary: 1 passed, 0 failed, 0 cancelled, 0 skipped

Job Result
device-auth-health ✅ success

@jyaunches
jyaunches merged commit e4b9111 into main Jun 30, 2026
124 checks passed
@jyaunches
jyaunches deleted the fix/e2e-device-auth-hosted-wiring branch June 30, 2026 22:46
Hadar301 pushed a commit to Hadar301/NemoClaw-OpenShift that referenced this pull request Jul 12, 2026
<!-- markdownlint-disable MD041 -->
## Summary
Fixes the `device-auth-health` live E2E wiring so the repo
`NVIDIA_INFERENCE_API_KEY` is staged through the shared
hosted-compatible inference config instead of being validated as the
public NVIDIA endpoint provider. The install helper now starts each
install attempt with `--fresh` so Vitest retries do not fail on leftover
failed onboarding session state.

## Related Issue
Fixes NVIDIA#2342

## Changes
- Stage `device-auth-health` installs with
`requireHostedInferenceConfig`, including `COMPATIBLE_API_KEY`,
`NEMOCLAW_PROVIDER=custom`, and the hosted-compatible default
endpoint/model.
- Run the live install path with `install.sh --non-interactive --fresh`
to prevent retry attempts from tripping the failed-session guard.
- Add E2E support coverage for the helper env contract and install
arguments.

## Type of Change

- [x] 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
<!-- Check all that apply. For any "covered by existing tests", "not
applicable", or waiver entry, add a brief justification on the same line
or in the Changes section. -->
- [x] Tests added or updated for changed behavior
- [ ] Existing tests cover changed behavior — justification:
- [ ] Tests not applicable — justification:
- [ ] Docs updated for user-facing behavior changes
- [x] Docs not applicable — justification: internal E2E CI wiring only;
no user-facing behavior change
- [x] Sensitive paths changed (security, policy, credentials, preflight,
onboarding, inference, runner, sandbox, or messaging)
- [x] Sensitive-path review completed or maintainer-approved waiver
recorded — reviewer/approval link/justification: self-reviewed
credential/inference test wiring; secrets are still passed only via
fixture env and redaction values
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:

## Verification
<!-- Check each item you ran and confirmed. Leave unchecked items you
skipped. Doc-only changes do not require npm test unless you ran it. -->
- [x] PR description includes the DCO sign-off declaration and every
commit appears as `Verified` in GitHub
- [ ] Git hooks passed during commit and push, or `npx prek run
--from-ref main --to-ref HEAD` passes
- [x] Targeted tests pass for changed behavior
- [ ] Full `npm test` passes (broad runtime changes only)
- [x] Quality Gates section completed with required justifications or
waivers
- [x] No secrets, API keys, or credentials committed
- [ ] `npm run docs` builds without warnings (doc changes only)
- [ ] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)


Verification run:
- `npx @biomejs/biome check test/e2e/live/device-auth-health-helpers.ts
test/e2e/support/device-auth-health-helpers.test.ts`
- `npx vitest run --project e2e-support
test/e2e/support/device-auth-health-helpers.test.ts
test/e2e/support/hosted-inference.test.ts --silent=false
--reporter=default`
- `npm run build:cli && npm run typecheck:cli`
- Commit hook ran with `SKIP=test-cli`; the broad CLI coverage hook
failed unrelated local macOS environment checks requiring GNU `timeout`,
privileged control paths, and shell assumptions. Push TypeScript hooks
passed, and targeted tests above passed.

---
<!-- DCO sign-off is required in this PR description, and every commit
must appear as Verified in GitHub. Run: git config user.name && git
config user.email -->
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Improved device auth health setup to correctly use hosted inference
credentials when available.
* Updated sandbox installation to use a fresh install path during
retries, helping avoid stale setup issues.
* Added coverage for hosted inference environment wiring and install
behavior to improve reliability of end-to-end checks.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@wscurran wscurran added area: ci CI workflows, checks, release automation, or GitHub Actions area: e2e End-to-end tests, nightly failures, or validation infrastructure bug-fix PR fixes a bug or regression labels Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci CI workflows, checks, release automation, or GitHub Actions area: e2e End-to-end tests, nightly failures, or validation infrastructure bug-fix PR fixes a bug or regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[NemoClaw][Brev Launchable] OpenClaw Gateway Dashboard shows "Version n/a" and "Health Offline" after Brev Launchable deployment succeeds

2 participants