Skip to content

test(e2e): migrate onboard repair flow to Vitest#5496

Open
cv wants to merge 5 commits into
mainfrom
e2e-migrate/test-onboard-repair
Open

test(e2e): migrate onboard repair flow to Vitest#5496
cv wants to merge 5 commits into
mainfrom
e2e-migrate/test-onboard-repair

Conversation

@cv

@cv cv commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Migrate test-onboard-repair.sh into the live Vitest E2E system. Adds test/e2e-scenario/live/onboard-repair.test.ts and onboard-repair-vitest workflow wiring. The Vitest test uses a fake OpenAI-compatible endpoint, creates interrupted resumable state, deletes the recorded sandbox, verifies resume repair, rejects conflicting sandbox names, rejects provider/model conflicts, and cleans up session state.

Related Issue

Refs #5098

Changes

  • Adds or wires the free-standing live Vitest scenario onboard-repair.
  • Adds selective workflow dispatch via onboard-repair-vitest in .github/workflows/e2e-vitest-scenarios.yaml.
  • Preserves the legacy system boundaries from test-onboard-repair.sh while leaving legacy shell retirement to Epic: Migrate legacy bash E2E into the Vitest E2E system #5098 Phase 11.

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)

Verification

  • 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)
  • Tests added or updated for new or changed behavior
  • No secrets, API keys, or credentials committed
  • Docs updated for user-facing behavior changes
  • 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)

Targeted local checks run while preparing these branches:

  • npx vitest run --project e2e-vitest-support test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts --silent=false --reporter=default
  • npm run typecheck:cli for branches adding new TypeScript tests
  • git diff --check

Selective same-runner dispatch: https://github.com/NVIDIA/NemoClaw/actions/runs/27649247386 — passed after merge-from-main refresh


Signed-off-by: Carlos Villela cvillela@nvidia.com

Summary by CodeRabbit

  • Tests

    • Added a new live end-to-end scenario for onboarding repair, verifying recovery when a recorded sandbox is missing and ensuring --resume correctly rejects conflicting sandbox and override inputs.
  • CI / Automation

    • Added an on-demand GitHub Actions job to run the new live E2E scenario and upload its artifacts.
    • Updated PR reporting to include this scenario’s results in the PR comment table.

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv cv self-assigned this Jun 16, 2026
@copy-pr-bot

copy-pr-bot Bot commented Jun 16, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a new live Vitest E2E scenario (onboard-repair.test.ts) that tests onboard resume/repair behavior including sandbox recreation and conflict rejection. A new standalone CI workflow job onboard-repair-vitest is wired into .github/workflows/e2e-vitest-scenarios.yaml and included in the report-to-pr aggregation.

Changes

Onboard Repair E2E Test and CI Wiring

Layer / File(s) Summary
Test harness utilities and live E2E scenario body
test/e2e-scenario/live/onboard-repair.test.ts
Defines repo-path constants, sandbox/session config, environment builder, nemoclaw CLI wrapper, cleanup helper, and sandbox-absent polling helper. The test body executes forced-failure onboarding to record a session, deletes the sandbox and waits for deletion, verifies --resume repairs by recreating the sandbox and passes status, reinjects failure to confirm non-zero exit, then asserts resume rejects a conflicting sandbox name and conflicting provider/model overrides; concludes with cleanup, session-file removal check, and artifact write.
CI workflow job and report-to-pr wiring
.github/workflows/e2e-vitest-scenarios.yaml
Adds the onboard-repair-vitest standalone job (checkout, Node setup, dependency install, CLI build, OpenShell install, npx vitest run, artifact upload) and appends onboard-repair-vitest to the report-to-pr job's needs list.

Sequence Diagram

sequenceDiagram
  participant Test as onboard-repair.test.ts
  participant FakeAI as Fake OpenAI Server
  participant nemoclaw as nemoclaw CLI
  participant Sandbox as Sandbox API

  Test->>FakeAI: start fake OpenAI-compatible server
  Test->>nemoclaw: onboard (forced policy-step failure, record session)
  nemoclaw-->>Test: non-zero exit, session file written
  Test->>Sandbox: delete recorded sandbox
  Test->>Sandbox: poll until sandbox absent
  Test->>nemoclaw: onboard --resume (repair: recreate missing sandbox)
  nemoclaw-->>Test: zero exit
  Test->>nemoclaw: status
  nemoclaw-->>Test: success
  Test->>nemoclaw: onboard (reinjected failure)
  nemoclaw-->>Test: non-zero exit
  Test->>nemoclaw: onboard --resume (conflicting sandbox name)
  nemoclaw-->>Test: rejected
  Test->>nemoclaw: onboard --resume (conflicting provider/model)
  nemoclaw-->>Test: rejected
  Test->>Test: cleanup, verify session file removed, write artifact
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related issues

  • Epic: Migrate legacy bash E2E into the Vitest E2E system #5098: This PR directly fulfills one of the specific migration tasks described in the Epic by converting a legacy bash E2E test to a Vitest test (onboard-repair.test.ts) and wiring the corresponding dispatch job into .github/workflows/e2e-vitest-scenarios.yaml.

Possibly related PRs

  • NVIDIA/NemoClaw#5243: Both PRs modify the same e2e-vitest-scenarios.yaml workflow by adding/wiring free-standing Vitest jobs (including report-to-pr dependencies), so the main PR's new onboard-repair-vitest job is directly part of the jobs-selector-driven structure introduced in #5243.

  • NVIDIA/NemoClaw#5218: Both PRs add standalone live Vitest E2E jobs to .github/workflows/e2e-vitest-scenarios.yaml and extend the same report-to-pr job needs list (one with onboard-repair-vitest, the other with double-onboard-vitest).

  • NVIDIA/NemoClaw#5219: Both PRs extend .github/workflows/e2e-vitest-scenarios.yaml's report-to-pr job dependency list by adding a new Vitest scenario job (onboard-repair-vitest vs launchable-smoke-vitest), so the changes are related at the workflow wiring level.

Suggested labels

area: e2e, chore

Poem

🐇 Hop hop, the sandbox went missing one day,
But --resume came bounding to save the way!
Conflicting inputs? Rejected with flair,
A forced failure patched with utmost care.
The CI job wired, the artifacts gleam—
This bunny approves the whole repair scheme! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: migrating the onboard repair test from shell script to Vitest, which directly reflects the content of both modified files.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 e2e-migrate/test-onboard-repair

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

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: onboard-repair-vitest
Optional E2E: onboard-resume-vitest

Dispatch hint: onboard-repair-vitest

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E

  • onboard-repair-vitest (high): Required to validate the newly added E2E job and live scenario wiring. It directly runs the new onboard repair scenario added by this PR and verifies the workflow can dispatch it successfully.

Optional E2E

  • onboard-resume-vitest (high): Adjacent confidence check for the broader onboarding resume path. Useful if reviewers want to compare the new repair scenario against the existing resume scenario, but not merge-blocking because runtime onboarding code was not changed.

New E2E recommendations

  • None.

Dispatch hint

  • Workflow: .github/workflows/e2e-vitest-scenarios.yaml
  • jobs input: onboard-repair-vitest

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Vitest E2E Scenario Recommendation

Required Vitest E2E scenarios: onboard-repair-vitest
Optional Vitest E2E scenarios: None

Dispatch required Vitest E2E scenarios:

  • gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref> --field jobs=onboard-repair-vitest

Workflow run

Full Vitest E2E advisor summary

Vitest E2E Scenario Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required Vitest E2E scenarios

  • onboard-repair-vitest: Focused free-standing Vitest job wired for changed live test test/e2e-scenario/live/onboard-repair.test.ts.
    • Dispatch: gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref> --field jobs=onboard-repair-vitest

Optional Vitest E2E scenarios

  • None.

Relevant changed files

  • .github/workflows/e2e-vitest-scenarios.yaml
  • test/e2e-scenario/live/onboard-repair.test.ts

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor

Findings: 0 needs attention, 1 worth checking, 0 nice ideas
Since last review: 0 prior items resolved, 1 still applies, 0 new items found

Review findings

🛠️ Needs attention

  • None.

🔎 Worth checking

  • Restore the gateway-skip assertion during sandbox repair (test/e2e-scenario/live/onboard-repair.test.ts:183): The legacy onboard-repair script asserted that resume repair skips the already-running gateway before recreating only the missing sandbox. The migrated Vitest test asserts skipped preflight, missing sandbox recreation, and sandbox creation, but it still does not verify `[resume] Skipping gateway (running)` or otherwise prove the gateway stayed cached/running. This lets the migrated lane pass if resume starts rebuilding the gateway unnecessarily while repairing a deleted sandbox.
    • Recommendation: Add an assertion on the repair output for `[resume] Skipping gateway (running)` or another direct check proving the gateway remains cached/running while only the recorded sandbox is recreated.
    • Evidence: Legacy `test/e2e/test-onboard-repair.sh` checks `grep -q "\[resume\] Skipping gateway (running)"`; new `onboard-repair.test.ts` only checks `[resume] Skipping preflight (cached)`, `Recorded sandbox state is unavailable; recreating it`, and `Creating sandbox` at lines 183-185.

🌱 Nice ideas

  • None.
Consider writing more tests for
  • **Runtime validation** — onboard-repair resume keeps the gateway cached/running while recreating only the missing recorded sandbox. This PR changes a GitHub Actions live E2E workflow and a real OpenShell/Docker sandbox lifecycle test. The main repair and conflict paths are covered, but one legacy behavioral assertion is still missing and infrastructure cleanup paths benefit from explicit runtime validation.
  • **Runtime validation** — onboard-repair cleanup removes NemoClaw and OpenShell sandbox records plus the onboard session file after a successful run. This PR changes a GitHub Actions live E2E workflow and a real OpenShell/Docker sandbox lifecycle test. The main repair and conflict paths are covered, but one legacy behavioral assertion is still missing and infrastructure cleanup paths benefit from explicit runtime validation.
  • **Runtime validation** — onboard-repair provider/model conflict reports both exact recorded conflict fields. This PR changes a GitHub Actions live E2E workflow and a real OpenShell/Docker sandbox lifecycle test. The main repair and conflict paths are covered, but one legacy behavioral assertion is still missing and infrastructure cleanup paths benefit from explicit runtime validation.
  • **Runtime validation** — onboard-repair fake-compatible migration proves the repair lane does not require a host-side hosted inference secret, if that is the intended replacement for the legacy prerequisite. This PR changes a GitHub Actions live E2E workflow and a real OpenShell/Docker sandbox lifecycle test. The main repair and conflict paths are covered, but one legacy behavioral assertion is still missing and infrastructure cleanup paths benefit from explicit runtime validation.
  • **Restore the gateway-skip assertion during sandbox repair** — Add an assertion on the repair output for `[resume] Skipping gateway (running)` or another direct check proving the gateway remains cached/running while only the recorded sandbox is recreated.
  • **Acceptance clause:** No trusted linked issue clauses were available from the deterministic context. — add test evidence or identify existing coverage. The validation context reported `linkedIssues: []`. The PR body references `Refs Epic: Migrate legacy bash E2E into the Vitest E2E system #5098`, but PR-provided text is untrusted and no issue clauses or comments were available to map.
  • **Acceptance clause:** Repair resume skipped gateway — add test evidence or identify existing coverage. The legacy script asserted `[resume] Skipping gateway (running)`, but the new Vitest repair assertions omit that check. This is represented by the tests finding.
Since last review details

Current findings:

  • Restore the gateway-skip assertion during sandbox repair (test/e2e-scenario/live/onboard-repair.test.ts:183): The legacy onboard-repair script asserted that resume repair skips the already-running gateway before recreating only the missing sandbox. The migrated Vitest test asserts skipped preflight, missing sandbox recreation, and sandbox creation, but it still does not verify `[resume] Skipping gateway (running)` or otherwise prove the gateway stayed cached/running. This lets the migrated lane pass if resume starts rebuilding the gateway unnecessarily while repairing a deleted sandbox.
    • Recommendation: Add an assertion on the repair output for `[resume] Skipping gateway (running)` or another direct check proving the gateway remains cached/running while only the recorded sandbox is recreated.
    • Evidence: Legacy `test/e2e/test-onboard-repair.sh` checks `grep -q "\[resume\] Skipping gateway (running)"`; new `onboard-repair.test.ts` only checks `[resume] Skipping preflight (cached)`, `Recorded sandbox state is unavailable; recreating it`, and `Creating sandbox` at lines 183-185.

Workflow run details

This is an automated advisory review. A human maintainer must make the final merge decision.

@github-code-quality

github-code-quality Bot commented Jun 16, 2026

Copy link
Copy Markdown

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in the branch is 96%. Coverage data for the branch is not yet available.

Show a code coverage summary of the most covered files.
File 988519e +/-
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 branch is 46%. Coverage data for the branch is not yet available.

Show a code coverage summary of the most covered files.
File 988519e +/-
src/lib/state/o...oard-session.ts 90%
src/lib/inference/local.ts 76%
src/lib/sandbox/config.ts 72%
src/lib/actions...dbox/rebuild.ts 67%
src/lib/onboard/preflight.ts 64%
src/lib/actions...licy-channel.ts 56%
src/lib/state/sandbox.ts 55%
src/lib/policy/index.ts 49%
src/lib/onboard...er-gpu-patch.ts 44%
src/lib/onboard.ts 18%

Updated June 16, 2026 21:28 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@github-actions

Copy link
Copy Markdown
Contributor

Vitest E2E Scenario Results — ✅ All jobs passed

Run: 27629705352
Workflow ref: e2e-migrate/test-onboard-repair
Requested scenarios: (default — all supported)
Requested jobs: onboard-repair-vitest
Summary: 2 passed, 0 failed, 35 skipped

Job Result
bedrock-runtime-compatible-anthropic-vitest ⏭️ skipped
channels-add-remove-vitest ⏭️ skipped
cloud-inference-vitest ⏭️ skipped
common-egress-agent-vitest ⏭️ skipped
credential-migration-vitest ⏭️ skipped
credential-sanitization-vitest ⏭️ skipped
double-onboard-vitest ⏭️ skipped
gateway-drift-preflight-vitest ⏭️ skipped
gateway-guard-recovery ⏭️ skipped
gateway-health-honest-vitest ⏭️ skipped
generate-matrix ✅ success
hermes-e2e-vitest ⏭️ skipped
hermes-root-entrypoint-smoke-vitest ⏭️ skipped
inference-routing-vitest ⏭️ skipped
issue-2478-crash-loop-recovery-vitest ⏭️ skipped
issue-4434-tui-unreachable-inference-vitest ⏭️ skipped
launchable-smoke-vitest ⏭️ skipped
live-scenarios ⏭️ skipped
messaging-compatible-endpoint-vitest ⏭️ skipped
messaging-providers-vitest ⏭️ skipped
model-router-provider-routed-inference-vitest ⏭️ skipped
network-policy-vitest ⏭️ skipped
onboard-negative-paths-vitest ⏭️ skipped
onboard-repair-vitest ✅ success
openclaw-inference-switch-vitest ⏭️ skipped
openclaw-skill-cli-vitest ⏭️ skipped
openclaw-tui-chat-correlation-vitest ⏭️ skipped
openshell-version-pin-vitest ⏭️ skipped
rebuild-openclaw-vitest ⏭️ skipped
runtime-overrides-vitest ⏭️ skipped
sandbox-rebuild-vitest ⏭️ skipped
sandbox-survival-vitest ⏭️ skipped
sessions-agents-cli-vitest ⏭️ skipped
shields-config-vitest ⏭️ skipped
skill-agent-vitest ⏭️ skipped
state-backup-restore-vitest ⏭️ skipped
token-rotation-vitest ⏭️ skipped

@cv cv marked this pull request as ready for review June 16, 2026 17:03
…ard-repair

# Conflicts:
#	.github/workflows/e2e-vitest-scenarios.yaml
@github-actions

Copy link
Copy Markdown
Contributor

Vitest E2E Scenario Results — ✅ All jobs passed

Run: 27638945931
Workflow ref: e2e-migrate/test-onboard-repair
Requested scenarios: (default — all supported)
Requested jobs: onboard-repair-vitest
Summary: 2 passed, 0 failed, 36 skipped

Job Result
bedrock-runtime-compatible-anthropic-vitest ⏭️ skipped
channels-add-remove-vitest ⏭️ skipped
cloud-inference-vitest ⏭️ skipped
common-egress-agent-vitest ⏭️ skipped
credential-migration-vitest ⏭️ skipped
credential-sanitization-vitest ⏭️ skipped
double-onboard-vitest ⏭️ skipped
gateway-drift-preflight-vitest ⏭️ skipped
gateway-guard-recovery ⏭️ skipped
gateway-health-honest-vitest ⏭️ skipped
generate-matrix ✅ success
hermes-e2e-vitest ⏭️ skipped
hermes-root-entrypoint-smoke-vitest ⏭️ skipped
inference-routing-vitest ⏭️ skipped
issue-2478-crash-loop-recovery-vitest ⏭️ skipped
issue-4434-tui-unreachable-inference-vitest ⏭️ skipped
launchable-smoke-vitest ⏭️ skipped
live-scenarios ⏭️ skipped
messaging-compatible-endpoint-vitest ⏭️ skipped
messaging-providers-vitest ⏭️ skipped
model-router-provider-routed-inference-vitest ⏭️ skipped
network-policy-vitest ⏭️ skipped
onboard-negative-paths-vitest ⏭️ skipped
onboard-repair-vitest ✅ success
onboard-resume-vitest ⏭️ skipped
openclaw-inference-switch-vitest ⏭️ skipped
openclaw-skill-cli-vitest ⏭️ skipped
openclaw-tui-chat-correlation-vitest ⏭️ skipped
openshell-version-pin-vitest ⏭️ skipped
rebuild-openclaw-vitest ⏭️ skipped
runtime-overrides-vitest ⏭️ skipped
sandbox-rebuild-vitest ⏭️ skipped
sandbox-survival-vitest ⏭️ skipped
sessions-agents-cli-vitest ⏭️ skipped
shields-config-vitest ⏭️ skipped
skill-agent-vitest ⏭️ skipped
state-backup-restore-vitest ⏭️ skipped
token-rotation-vitest ⏭️ skipped

cv added 2 commits June 16, 2026 14:04
…ard-repair

# Conflicts:
#	.github/workflows/e2e-vitest-scenarios.yaml
…ard-repair

# Conflicts:
#	.github/workflows/e2e-vitest-scenarios.yaml
@github-actions

Copy link
Copy Markdown
Contributor

Vitest E2E Scenario Results — ✅ All jobs passed

Run: 27649247386
Workflow ref: e2e-migrate/test-onboard-repair
Requested scenarios: (default — all supported)
Requested jobs: onboard-repair-vitest
Summary: 2 passed, 0 failed, 38 skipped

Job Result
bedrock-runtime-compatible-anthropic-vitest ⏭️ skipped
channels-add-remove-vitest ⏭️ skipped
cloud-inference-vitest ⏭️ skipped
cloud-onboard-vitest ⏭️ skipped
common-egress-agent-vitest ⏭️ skipped
credential-migration-vitest ⏭️ skipped
credential-sanitization-vitest ⏭️ skipped
double-onboard-vitest ⏭️ skipped
full-e2e-vitest ⏭️ skipped
gateway-drift-preflight-vitest ⏭️ skipped
gateway-guard-recovery ⏭️ skipped
gateway-health-honest-vitest ⏭️ skipped
generate-matrix ✅ success
hermes-e2e-vitest ⏭️ skipped
hermes-root-entrypoint-smoke-vitest ⏭️ skipped
inference-routing-vitest ⏭️ skipped
issue-2478-crash-loop-recovery-vitest ⏭️ skipped
issue-4434-tui-unreachable-inference-vitest ⏭️ skipped
launchable-smoke-vitest ⏭️ skipped
live-scenarios ⏭️ skipped
messaging-compatible-endpoint-vitest ⏭️ skipped
messaging-providers-vitest ⏭️ skipped
model-router-provider-routed-inference-vitest ⏭️ skipped
network-policy-vitest ⏭️ skipped
onboard-negative-paths-vitest ⏭️ skipped
onboard-repair-vitest ✅ success
onboard-resume-vitest ⏭️ skipped
openclaw-inference-switch-vitest ⏭️ skipped
openclaw-skill-cli-vitest ⏭️ skipped
openclaw-tui-chat-correlation-vitest ⏭️ skipped
openshell-version-pin-vitest ⏭️ skipped
rebuild-openclaw-vitest ⏭️ skipped
runtime-overrides-vitest ⏭️ skipped
sandbox-rebuild-vitest ⏭️ skipped
sandbox-survival-vitest ⏭️ skipped
sessions-agents-cli-vitest ⏭️ skipped
shields-config-vitest ⏭️ skipped
skill-agent-vitest ⏭️ skipped
state-backup-restore-vitest ⏭️ skipped
token-rotation-vitest ⏭️ skipped

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.

1 participant