Skip to content

test(e2e): fix reboot service and TUI status checks - #7618

Merged
cv merged 2 commits into
mainfrom
codex/fix-e2e-reboot-tui
Jul 27, 2026
Merged

test(e2e): fix reboot service and TUI status checks#7618
cv merged 2 commits into
mainfrom
codex/fix-e2e-reboot-tui

Conversation

@sandl99

@sandl99 sandl99 commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Repairs two deterministic false failures from E2E run 30228379802. Source-checkout reboot recovery now supplies the managed gateway user service that the scenario requires, and the OpenClaw TUI check now correlates status output with a response-only sentinel instead of echoed input or an earlier idle redraw.

Changes

  • Stage and enable the existing repository-managed OpenShell gateway user service for the source-checkout reboot fixture, then remove it and restore the previous runtime during cleanup.
  • Wait for Sandbox: and then the subsequent connected/idle redraw after /nemoclaw status.
  • Extend E2E support contracts for service ownership, cleanup, status correlation, and phase sequencing.

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 changes only E2E setup, cleanup, and result correlation; supported commands and user workflows are unchanged.
  • 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: Codex CLI security review passed with no findings: test(e2e): fix reboot service and TUI status checks #7618 (comment)
  • 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: No documentation paths changed. The PR updates only E2E reboot fixture setup, failure rollback, cleanup, bounded test subprocesses, TUI response correlation, and support tests. Supported user behavior and documentation remain unchanged.
  • Agent: Codex CLI

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 check:diff passed when hooks were skipped or unavailable
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — npx vitest run --project e2e-support test/e2e/support/lifecycle-user-service.test.ts test/e2e/support/e2e-phase-lifecycle.test.ts test/e2e/support/issue-6194-tui-post-idle-contract.test.ts (34 passed, 7 skipped)
  • Applicable broad gate passed — npm run test:e2e-phases:check (125 tests across 82 files)
  • 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: San Dang sdang@nvidia.com

Summary by CodeRabbit

  • Bug Fixes

    • Improved post-reboot recovery for the OpenShell gateway by conditionally staging the user service and performing targeted cleanup afterward.
    • Restores the original gateway runtime after staging and ensures staged-only removal behaves safely.
    • Enhanced TUI status sequencing by validating sandbox output and the connected-idle transition separately.
    • Prevented replacing existing foreign user services during gateway setup.
  • Tests

    • Added end-to-end coverage for staging, removal, upstream detection, stage failure behavior, and foreign-service protection.
    • Updated lifecycle and TUI expect flows to match the new post-recovery workflow.

Signed-off-by: San Dang <sdang@nvidia.com>
@sandl99 sandl99 added integration: openclaw OpenClaw integration behavior 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 platform: linux Affects non-Ubuntu Linux environments labels Jul 27, 2026
@sandl99 sandl99 self-assigned this Jul 27, 2026
@copy-pr-bot

copy-pr-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds OpenShell gateway user-service staging and cleanup to reboot lifecycle fixtures, adds coverage for service ownership and failure outcomes, and separates /nemoclaw status TUI output matching from the subsequent connected-idle assertion.

Changes

Gateway service lifecycle

Layer / File(s) Summary
Gateway service scripts and coverage
test/e2e/fixtures/phases/lifecycle.ts, test/e2e/support/lifecycle-user-service.test.ts
Adds scripts to stage and remove marked gateway user services, with coverage for staged, upstream, failure, and foreign-unit cases.
Post-reboot recovery integration
test/e2e/fixtures/phases/lifecycle.ts, test/e2e/support/e2e-phase-lifecycle.test.ts
Stages the service during recovery, tracks the prior runtime, removes fixture-staged state, restores the runtime, and updates lifecycle command and cleanup expectations.

TUI status flow

Layer / File(s) Summary
Status and idle assertions
test/e2e/live/issue-6194-tui-expect.ts, test/e2e/support/issue-6194-tui-post-idle-contract.test.ts
Separates sandbox status matching from the subsequent connected-idle transition and rejects the previous combined status pattern.

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

Sequence Diagram(s)

sequenceDiagram
  participant LifecyclePhaseFixture
  participant OpenShellInstaller
  participant Docker
  participant GatewayRuntime
  LifecyclePhaseFixture->>OpenShellInstaller: stage gateway user service
  LifecyclePhaseFixture->>Docker: stop and recover containers
  LifecyclePhaseFixture->>GatewayRuntime: restart and wait for connectivity
  LifecyclePhaseFixture->>OpenShellInstaller: remove staged service
  LifecyclePhaseFixture->>GatewayRuntime: restore previous runtime
Loading

Possibly related PRs

Suggested labels: area: sandbox

Suggested reviewers: prekshivyas, cv, laitingsheng, senthilr-nv

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
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 (4 passed)
Check name Status Explanation
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 accurately summarizes the main E2E fixes for reboot service handling and TUI status checks.
✨ 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 codex/fix-e2e-reboot-tui

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

@github-code-quality

github-code-quality Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in commit 2d30fa4 in the codex/fix-e2e-reboot... branch remains at 96%, unchanged from commit 77e6e38 in the main branch.

TypeScript / code-coverage/cli

The overall coverage in commit 2d30fa4 in the codex/fix-e2e-reboot... branch is 80%. The coverage in commit 77e6e38 in the main branch is 81%.

Show a code coverage summary of the most impacted files.
File main 77e6e38 codex/fix-e2e-reboot... 2d30fa4 +/-
src/lib/actions...time-command.ts 100% 82% -18%
src/lib/actions...-add-restart.ts 19% 10% -9%
src/lib/actions...on-readiness.ts 100% 91% -9%
src/lib/actions...lution-probe.ts 95% 88% -7%
src/lib/actions...x/mcp-bridge.ts 41% 35% -6%
src/lib/state/o...oint-migrate.ts 96% 92% -4%
src/lib/actions...e-validation.ts 84% 81% -3%
src/lib/onboard...shboard-port.ts 93% 90% -3%
src/lib/actions...dbox/destroy.ts 95% 93% -2%
src/lib/onboard...eway-service.ts 82% 81% -1%

Updated July 27, 2026 07:40 UTC

@sandl99

sandl99 commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator Author

Verdict

PASS. The PR is safe to merge from a security perspective. It changes only live-E2E orchestration and support tests, reuses the repository installer’s guarded user-service staging, refuses foreign or symlinked units, and does not alter a supported product runtime or credential boundary.

Findings Table

The review found no security findings.

Detailed Analysis

  1. Secrets and Credentials — PASS: No secrets, tokens, keys, or credential fixtures were added.
  2. Input Validation and Data Sanitization — PASS: The installer path is a repository-derived constant, command arguments remain separated, stage outcomes are allow-listed, and foreign service units fail closed.
  3. Authentication and Authorization — PASS: No authentication or authorization behavior changes.
  4. Dependencies and Third-Party Libraries — PASS: No dependency or third-party source changes.
  5. Error Handling and Logging — PASS: Failures use bounded artifacts and fixed diagnostics without exposing credentials.
  6. Cryptography and Data Protection — PASS: No cryptographic or sensitive-data handling changes.
  7. Configuration and Security Headers — PASS: The fixture uses a user-level systemd service, preserves the existing managed marker, and does not broaden ports or privileges.
  8. Security Testing — PASS: Tests cover managed staging and cleanup, upstream-service reuse, foreign-unit refusal, and the response-only TUI oracle.
  9. System Security — PASS: Staging delegates to the installer’s existing guarded implementation; cleanup refuses symlinked, non-regular, or unmarked units and restores the prior runtime shape.

Files Reviewed

  • test/e2e/fixtures/phases/lifecycle.ts
  • test/e2e/live/issue-6194-tui-expect.ts
  • test/e2e/support/e2e-phase-lifecycle.test.ts
  • test/e2e/support/issue-6194-tui-post-idle-contract.test.ts
  • test/e2e/support/lifecycle-user-service.test.ts

Reviewed head: f9c4d315aecc608fb4af88af56fc38680d5e631b

@sandl99
sandl99 marked this pull request as ready for review July 27, 2026 07:04
@github-actions

github-actions Bot commented Jul 27, 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 · 0 warnings · 0 suggestions
  • Model comparison: normalized findings match; normalized E2E selections differ; severity counts match.

Nemotron output stays in workflow artifacts and does not change the assessment above.

E2E guidance

Advisory only. E2E / PR Gate selects and runs jobs independently.

Recommended E2E: cloud-onboard, credential-sanitization, security-posture

4 optional E2E recommendations
  • openclaw-tui-chat-correlation
  • ubuntu-repo-cloud-openclaw
  • gateway-guard-recovery
  • ubuntu-repo-docker-post-reboot-recovery

Workflow run details

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

@cv cv added the v0.0.96 label Jul 27, 2026

@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

🧹 Nitpick comments (1)
test/e2e/fixtures/phases/lifecycle.ts (1)

415-438: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Derive the stage-result regex from USER_SERVICE_STAGE_RESULT_PREFIX instead of hardcoding the literal.

Line 432 hardcodes NEMOCLAW_E2E_GATEWAY_USER_SERVICE= again even though USER_SERVICE_STAGE_RESULT_PREFIX (Line 46) already defines it. If the prefix constant ever changes, this parser silently stops matching and ensureOpenShellGatewayUserService throws "did not report its outcome" instead of failing at the source of the mismatch.

♻️ Proposed fix
-    const match = result.stdout.match(
-      /(?:^|\n)NEMOCLAW_E2E_GATEWAY_USER_SERVICE=(upstream|existing|staged)(?:\n|$)/u,
-    );
+    const match = result.stdout.match(
+      new RegExp(`(?:^|\\n)${USER_SERVICE_STAGE_RESULT_PREFIX}(upstream|existing|staged)(?:\\n|$)`, "u"),
+    );
🤖 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/fixtures/phases/lifecycle.ts` around lines 415 - 438, Update
ensureOpenShellGatewayUserService to construct the stage-result regex from the
existing USER_SERVICE_STAGE_RESULT_PREFIX constant rather than hardcoding
NEMOCLAW_E2E_GATEWAY_USER_SERVICE=. Preserve the current matching boundaries and
accepted outcomes (upstream, existing, and staged).
🤖 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/e2e/support/issue-6194-tui-post-idle-contract.test.ts`:
- Around line 78-82: Update the assertions in the issue-6194 test to verify that
the `Sandbox:` status expectation occurs before the connected-idle expectation,
rather than only checking that both strings are present. Preserve the existing
absence assertion for `{NemoClaw Status}` and validate the ordering through the
script’s behavioral sequence where possible.

In `@test/e2e/support/lifecycle-user-service.test.ts`:
- Around line 49-53: Update all four synchronous execFileSync invocations in
lifecycle-user-service.test.ts to include a positive timeout and killSignal set
to "SIGKILL" in their options objects, preserving the existing encoding and
environment settings.

---

Nitpick comments:
In `@test/e2e/fixtures/phases/lifecycle.ts`:
- Around line 415-438: Update ensureOpenShellGatewayUserService to construct the
stage-result regex from the existing USER_SERVICE_STAGE_RESULT_PREFIX constant
rather than hardcoding NEMOCLAW_E2E_GATEWAY_USER_SERVICE=. Preserve the current
matching boundaries and accepted outcomes (upstream, existing, and staged).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ef751b7b-4da3-4845-910c-c605d06b097a

📥 Commits

Reviewing files that changed from the base of the PR and between 87270de and f9c4d31.

📒 Files selected for processing (5)
  • test/e2e/fixtures/phases/lifecycle.ts
  • test/e2e/live/issue-6194-tui-expect.ts
  • test/e2e/support/e2e-phase-lifecycle.test.ts
  • test/e2e/support/issue-6194-tui-post-idle-contract.test.ts
  • test/e2e/support/lifecycle-user-service.test.ts

Comment thread test/e2e/support/issue-6194-tui-post-idle-contract.test.ts
Comment thread test/e2e/support/lifecycle-user-service.test.ts
@cv
cv merged commit f4d7c5a into main Jul 27, 2026
119 of 124 checks passed
@cv
cv deleted the codex/fix-e2e-reboot-tui branch July 27, 2026 16:06
cv pushed a commit that referenced this pull request Jul 27, 2026
<!-- markdownlint-disable MD041 -->
## Summary
<!-- 1-3 plain sentences: what changes and why. Describe
before-and-after behavior when it applies. Follow the NemoClaw Writing
Guide: https://github.com/NVIDIA/NemoClaw/blob/main/WRITING.md. Do not
add unrelated prose cleanup. -->
Recover three current-lifecycle E2E regressions from run
[30283434843](https://github.com/NVIDIA/NemoClaw/actions/runs/30283434843).
Recreated sandboxes now tolerate the exact transient OpenShell `Error`
phase, current-lifecycle EXDEV coverage uses the current CLI's
compatible base image, and successful post-reboot service staging no
longer invokes the sourced installer's process-level cleanup trap.

## Related Issue
<!-- Fixes #NNN or Closes #NNN. Remove this section if none. -->
Follow-up to #7618. Related to #7273 and #6108.

## Changes
<!-- List concrete changes. If this adds an abstraction, configuration,
fallback, migration, or compatibility path, name its current requirement
and consumer, explain why a direct change is insufficient, and identify
the test that protects it. -->
- Retry only the exact same-sandbox `phase: Error` readiness response
inside the existing recreated-sandbox health guard and timeout; foreign
sandboxes and other phases remain terminal.
- Clear the E2E staging fixture's inherited `EXIT` trap after successful
upstream or NemoClaw service staging, while preserving rollback on
staging failures.
- Keep the release EXDEV baseline pinned to its historical sandbox image
and let the current-lifecycle target use the current CLI's validated
base-image resolution.
- Add focused regressions for each behavior.

## 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 one tests line and one docs line. Check other lines when
applicable. Add every requested justification or approval reference. -->
- [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 recovery behavior
and E2E fixture coverage changed without changing a user-facing command,
configuration, output, or supported workflow.
- [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: [PASS with no
findings](#7650 (comment));
exact same-sandbox matching remains behind existing health and timeout
guards.
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:

## Documentation Writer Review
<!-- Required for code and documentation changes after the changes and
applicable validation are complete. Keep one review checkbox and one
instance of each visible or hidden field. For Evidence, list changed
documentation paths. For documentation-only changes, also state that the
writing rules and documentation style were reviewed. For other results,
explain why no documentation change is needed or why the review is
blocked. For Agent, use a consistent product and surface name, such as
Codex Desktop, Codex CLI, Claude Code, or Cursor. After committing all
review changes, put `git rev-parse --short HEAD` and `git rev-parse
--short HEAD:AGENTS.md` in the hidden metadata below. Rerun the review
and refresh that metadata after any new commit. This receipt is advisory
during the data-collection pilot. -->
- [x] Documentation writer subagent reviewed the completed changes
- Result: `no-docs-needed`
- Evidence: Reviewed all seven committed files; the changes are internal
recovery behavior and E2E fixtures/tests with no user-facing
documentation contract change. `git diff --check origin/main...HEAD`
passed.
- Agent: Codex documentation-writer subagent
<!-- docs-review-head-sha: 497ca2d -->
<!-- docs-review-agents-blob-sha: be20a09 -->

## DGX Station Hardware Evidence
<!-- Required only when scripts/prepare-dgx-station-host.sh changes.
Maintainers must review the linked evidence before approving or merging.
This is human-reviewed evidence, not authenticated hardware provenance.
Exceptional bypasses use existing repository governance and must be
documented on the PR. -->
- [ ] Tested on DGX Station
- Tested commit:
- Station profile/scenario:
- Result:
- Supporting evidence:

## Verification
<!-- Check each applicable item only when supported by the requested
evidence. Run targeted tests once per relevant change set and rerun
after later edits or hook autofixes that can affect the tested behavior.
Do not rerun hook-covered checks. -->
- [x] PR description includes a `Signed-off-by:` line and every commit
appears as `Verified` in GitHub
- [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or
`npm run check:diff` passed when hooks were skipped or unavailable
- [x] Targeted behavior tests pass for the current change set, or tests
are marked not applicable above — command/result or justification: `npx
vitest run --project cli
src/lib/actions/sandbox/process-recovery.test.ts` (41 passed); focused
E2E-support tests (7 passed); full `e2e-support` project (1,744 passed,
17 skipped).
- [ ] Applicable broad gate passed — `npm test` for broad
runtime/test-harness changes; `npm run check` for repo-wide
validation/coverage changes — command/result:
- [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)

---
<!-- 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: San Dang <sdang@nvidia.com>


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

## Summary by CodeRabbit

* **Bug Fixes**
* Improved sandbox recovery when OpenShell reports a temporary error
state, allowing readiness checks to retry until the sandbox becomes
available.
* Prevented unrelated sandbox errors and failed states from being
retried incorrectly.
* Preserved installer cleanup sentinel files during gateway service
staging.

* **Tests**
* Expanded coverage for sandbox recovery, lifecycle behavior, and
runtime base-image selection.
* Added validation for release-baseline and current-lifecycle deployment
scenarios.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: San Dang <sdang@nvidia.com>
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 integration: openclaw OpenClaw integration behavior platform: linux Affects non-Ubuntu Linux environments

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants