Skip to content

test(e2e): add diagnostics, debug tarball, and credential E2E tests - #2243

Merged
ericksoa merged 1 commit into
NVIDIA:mainfrom
TruongNguyenG:feat/e2e-diagnostics
Apr 22, 2026
Merged

ericksoa merged 1 commit into
NVIDIA:mainfrom
TruongNguyenG:feat/e2e-diagnostics

Conversation

@TruongNguyenG

@TruongNguyenG TruongNguyenG commented Apr 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add test/e2e/test-diagnostics.sh with 5 end-to-end test cases covering CLI version output, debug snapshots, credential sanitization in debug tarballs, sandbox inference config visibility, and credential list safety. Integrates as diagnostics-e2e job in nightly-e2e.yaml.

Related Issue

Closes #2242

Changes

  • Version output (TC-DIAG-04): Runs nemoclaw --version, verifies output matches semver pattern and exits with code 0. No sandbox needed.
  • Quick debug snapshot (TC-DIAG-02): Runs nemoclaw debug --quick --output <path>, verifies a non-empty archive is produced within 30 seconds. No sandbox needed.
  • Full debug tarball + credential sanitization (TC-DIAG-01): Runs nemoclaw debug --output <path>, extracts the tarball, greps all files for the real API key value and nvapi- patterns. Verifies no credentials found in any collected file.
  • Sandbox inference config (TC-DIAG-05): Reads openclaw.json inside the sandbox via SSH, verifies the model field is present. Runs nemoclaw status from the host and verifies the Model field appears in output.
  • Credentials list safety (TC-DIAG-03): Runs nemoclaw credentials list, verifies key names are shown but the real API key value is not exposed. Handles the CI case where the credential store is empty (API key passed via env var).
  • Nightly integration: Added diagnostics-e2e job to nightly-e2e.yaml with 45-minute timeout, artifact upload on failure, and wired into notify-on-failure.

Type of Change

  • Code change (feature, bug fix, or refactor)

Verification

  • npx prek run --all-files passes
  • Tests added or updated for new or changed behavior
  • No secrets, API keys, or credentials committed
  • Verified on CI: all PASS on ubuntu-latest

AI Disclosure

  • AI-assisted — tool: Cursor

Signed-off-by: Truong Nguyen tgnguyen@nvidia.com

Made with Cursor

Summary by CodeRabbit

  • Tests

    • Added an end-to-end diagnostics test suite covering version checks, debug/export operations, credential handling (preventing secret leakage), sandbox onboarding/status, per-test PASS/FAIL/SKIP reporting, timestamped logs, and overall timeout support.
  • Chores

    • Nightly CI now runs diagnostics, uploads diagnostic logs on failure, and extends failure notifications so diagnostics failures trigger the existing alert workflow.

@coderabbitai

coderabbitai Bot commented Apr 22, 2026 •

Copy link
Copy Markdown
Contributor

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

Added a new diagnostics end-to-end Bash test script and a guarded nightly CI job to run it; CI uploads logs on failure and the failure-notification job now considers the diagnostics job result.

Changes

Cohort / File(s) Summary
CI Workflow Updates
.github/workflows/nightly-e2e.yaml
Added diagnostics-e2e job (guarded by github.repository == 'NVIDIA/NemoClaw') that checks out the repo, runs bash test/e2e/test-diagnostics.sh with NVIDIA_API_KEY and NEMOCLAW_NON_INTERACTIVE/NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE, and uploads test-diagnostics-*.log artifact only on failure. Updated notify-on-failure needs and if to include diagnostics-e2e result.
Diagnostics E2E Test Suite
test/e2e/test-diagnostics.sh
New strict Bash E2E runner with timestamped logging and PASS/FAIL/SKIP counters, optional overall timeout, Docker and NVIDIA_API_KEY preflight checks, optional on-demand nemoclaw install, sandbox onboarding/teardown, and five test cases: TC-DIAG-04 (version), TC-DIAG-02 (quick debug), TC-DIAG-01 (full debug tarball + credential sanitization), TC-DIAG-05 (sandbox inference/openclaw.json), TC-DIAG-03 (credentials list/reset). Exits non-zero on failures and produces test-diagnostics-*.log.

Sequence Diagram(s)

sequenceDiagram
    participant CI as CI Runner
    participant Script as test-diagnostics.sh
    participant Host as Host (nemoclaw CLI)
    participant Sandbox as Sandbox (onboarded env)
    participant Artifacts as GitHub Artifacts

    CI->>Script: checkout repo + env (NVIDIA_API_KEY, CI flags)
    Script->>Host: ensure `nemoclaw` present (install/adjust PATH)
    Script->>Host: run TC-DIAG-04 (version) and TC-DIAG-02 (quick debug)
    Script->>Host: run `nemoclaw onboard` (clear lock, provision sandbox)
    Script->>Sandbox: read `openclaw.json`, verify model
    Script->>Host: run full `nemoclaw debug --output`, extract & scan tarball
    Script->>Host: run credentials list/reset checks
    Script->>CI: return aggregated result & logs
    CI-->>Artifacts: upload `test-diagnostics-*.log` on failure
    CI->>CI: notify-on-failure evaluates diagnostics-e2e result
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I hopped through logs at dawn's first light,

spun tarballs, probed sandboxes late at night;
I sniffed for secrets, counted passes with care,
nudged onboarding locks, then vanished into air;
a tiny guard for nightly code's delight.

🚥 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 clearly and concisely summarizes the main change: adding E2E tests for diagnostics, debug tarball, and credential functionality to the NemoClaw test suite.
Linked Issues check ✅ Passed The PR implementation comprehensively addresses all five test case objectives from issue #2242: TC-DIAG-04 (version output), TC-DIAG-02 (quick debug snapshot), TC-DIAG-01 (full debug tarball credential sanitization), TC-DIAG-05 (sandbox inference config), and TC-DIAG-03 (credentials list verification).
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing the E2E diagnostics tests: the new test-diagnostics.sh script and nightly-e2e.yaml workflow integration align with the linked issue objectives without unrelated modifications.
Docstring Coverage ✅ Passed Docstring coverage is 100.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.

@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 the current code and only fix it if needed.

Inline comments:
In `@test/e2e/test-diagnostics.sh`:
- Line 287: The grep that sets pattern_leaks currently uses
"nvapi-[A-Za-z0-9_-]{20,}" which is too permissive on length and can miss
shorter nvapi- tokens; update the grep regex used in the pattern_leaks
assignment to match the same nvapi redaction regex used in src/lib/debug.ts
(i.e., replace the "{20,}" segment with the length constraint/pattern from the
debug.ts redaction rule) so the test detects the same nvapi token lengths as the
runtime redactor.
- Around line 314-321: The current check uses grep on config_output and then
allows an empty model_name to pass TC-DIAG-05, causing false positives; change
the logic in test-diagnostics.sh to bypass the initial grep and instead parse
config_output with python3 (the existing model_name extraction) and require the
parsed value to be non-empty: call python3 to load json and print
d.get('model','') (or better print d['model'] if you want a hard error when
missing) into model_name, then if [[ -n "$model_name" ]]; do pass "TC-DIAG-05:
Model configured in openclaw.json ($model_name)"; else fail "TC-DIAG-05: missing
or empty model field in openclaw.json" fi, ensuring you reference the variables
config_output and model_name and the test identifier TC-DIAG-05 to locate and
update the code.
🪄 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: Pro Plus

Run ID: f2caf48e-8e3f-42e0-8b2b-e92be2efa33f

📥 Commits

Reviewing files that changed from the base of the PR and between 946387a and 016fc33.

📒 Files selected for processing (2)
  • .github/workflows/nightly-e2e.yaml
  • test/e2e/test-diagnostics.sh

Comment thread test/e2e/test-diagnostics.sh Outdated
Comment thread test/e2e/test-diagnostics.sh Outdated
@TruongNguyenG
TruongNguyenG force-pushed the feat/e2e-diagnostics branch 3 times, most recently from b26d7d2 to 7ad8224 Compare April 22, 2026 09:52

@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 the current code and only fix it if needed.

Inline comments:
In @.github/workflows/nightly-e2e.yaml:
- Around line 452-457: Add NEMOCLAW_RECREATE_SANDBOX=1 to the environment block
for the "Run diagnostics E2E test" job so the diagnostics test rebuilds the
sandbox instead of reusing the install-time one; update the env section where
NVIDIA_API_KEY, NEMOCLAW_NON_INTERACTIVE and
NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE are set to include
NEMOCLAW_RECREATE_SANDBOX: "1" (this is needed because install.sh
--non-interactive / nemoclaw onboard --non-interactive reads that env var and
controls sandbox recreation for test/e2e/test-diagnostics.sh).

In `@test/e2e/test-diagnostics.sh`:
- Around line 303-320: The test currently fails TC-DIAG-05 if the sandbox
openclaw.json lacks a non-empty model field (the model_name extraction and
subsequent fail), but that field isn't authoritative; remove or neutralize the
model field assertion: delete or comment out the model_name extraction block
(the model_name=$(echo "$config_output" | python3 ...) and the if [[ -n
"$model_name" ]] ... else fail ... fi) and keep only the check that
openclaw.json is readable (sandbox_exec + pass for openclaw.json readable);
ensure TC-DIAG-05 no longer fails based on the model field so downstream
host-side `nemoclaw status` can assert model visibility.
- Around line 208-233: The test currently waits indefinitely for the `nemoclaw
debug --quick` call (line using debug_output=$(nemoclaw debug --quick --output
"$output_file" 2>&1) || debug_rc=$?) so enforce the 30s budget at the command
boundary by running the command through a timeout (e.g. `timeout 30s ...`) or
equivalent, capture both stdout/stderr into `debug_output`, set `debug_rc` to a
distinct non-zero value when timeout occurs, and ensure the rest of the logic
(checks on `debug_rc`, `output_file`, and elapsed) still works; update
references to `debug_output`, `debug_rc`, and the command invocation so a
hung/long-running `nemoclaw debug` triggers failure at 30s instead of waiting
for the process to finish.
🪄 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: Pro Plus

Run ID: 703ab754-f3d9-426f-a8dd-e4506669c9e0

📥 Commits

Reviewing files that changed from the base of the PR and between 7ad8224 and 9dd600b.

📒 Files selected for processing (2)
  • .github/workflows/nightly-e2e.yaml
  • test/e2e/test-diagnostics.sh

Comment thread .github/workflows/nightly-e2e.yaml
Comment thread test/e2e/test-diagnostics.sh
Comment thread test/e2e/test-diagnostics.sh Outdated
Comment on lines +303 to +320
log " Checking openclaw.json config inside sandbox..."
local config_output
config_output=$(sandbox_exec "cat /sandbox/.openclaw/openclaw.json 2>/dev/null" 2>&1) || true

if [[ -z "$config_output" ]]; then
fail "TC-DIAG-05: Config" "Could not read openclaw.json inside sandbox"
return
fi

pass "TC-DIAG-05: openclaw.json readable inside sandbox"

local model_name
model_name=$(echo "$config_output" | python3 -c "import sys,json; d=json.load(sys.stdin); v=d.get('model'); print(v.strip() if isinstance(v,str) else '')" 2>/dev/null) || true
if [[ -n "$model_name" ]]; then
pass "TC-DIAG-05: Model configured in openclaw.json ($model_name)"
else
fail "TC-DIAG-05: Model" "No non-empty model field in openclaw.json"
fi

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.

⚠️ Potential issue | 🟠 Major

Don't fail TC-DIAG-05 on a field that isn't guaranteed to live in openclaw.json.

The host-side nemoclaw status check below is the right place to assert model visibility. Requiring a non-empty model field inside /sandbox/.openclaw/openclaw.json can turn this into a false negative, because the sandbox config file is not the authoritative source for model metadata.

Suggested fix
-  local model_name
-  model_name=$(echo "$config_output" | python3 -c "import sys,json; d=json.load(sys.stdin); v=d.get('model'); print(v.strip() if isinstance(v,str) else '')" 2>/dev/null) || true
-  if [[ -n "$model_name" ]]; then
-    pass "TC-DIAG-05: Model configured in openclaw.json ($model_name)"
-  else
-    fail "TC-DIAG-05: Model" "No non-empty model field in openclaw.json"
-  fi
+  if echo "$config_output" | python3 -c "import sys, json; json.load(sys.stdin)" >/dev/null 2>&1; then
+    pass "TC-DIAG-05: openclaw.json is valid JSON"
+  else
+    fail "TC-DIAG-05: Config" "openclaw.json is not valid JSON"
+  fi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/e2e/test-diagnostics.sh` around lines 303 - 320, The test currently
fails TC-DIAG-05 if the sandbox openclaw.json lacks a non-empty model field (the
model_name extraction and subsequent fail), but that field isn't authoritative;
remove or neutralize the model field assertion: delete or comment out the
model_name extraction block (the model_name=$(echo "$config_output" | python3
...) and the if [[ -n "$model_name" ]] ... else fail ... fi) and keep only the
check that openclaw.json is readable (sandbox_exec + pass for openclaw.json
readable); ensure TC-DIAG-05 no longer fails based on the model field so
downstream host-side `nemoclaw status` can assert model visibility.

Add test/e2e/test-diagnostics.sh with 5 test cases:
- TC-DIAG-04: nemoclaw --version semver output
- TC-DIAG-02: nemoclaw debug --quick fast archive
- TC-DIAG-01: nemoclaw debug --output tarball + credential sanitization
- TC-DIAG-05: sandbox inference config (openclaw.json + nemoclaw status)
- TC-DIAG-03: credentials list (no values exposed)

Integrates diagnostics-e2e job into nightly-e2e.yaml.

Closes NVIDIA#2242
Signed-off-by: Truong Nguyen <tgnguyen@nvidia.com>
Made-with: Cursor

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

Well-structured diagnostics E2E suite. Credential sanitization test (TC-DIAG-01) is good security coverage. Destructive test correctly ordered last. LGTM.

@ericksoa
ericksoa merged commit 7957889 into NVIDIA:main Apr 22, 2026
15 checks passed
@wscurran wscurran added area: e2e End-to-end tests, nightly failures, or validation infrastructure feature PR adds or expands user-visible functionality and removed enhancement: testing labels Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: e2e End-to-end tests, nightly failures, or validation infrastructure feature PR adds or expands user-visible functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(e2e): add diagnostics, debug tarball, and credential E2E tests

3 participants