Skip to content

fix(onboard): persist OpenClaw startup across restarts - #7970

Closed
sandl99 wants to merge 2 commits into
mainfrom
codex/fix-openclaw-startup-persistence
Closed

fix(onboard): persist OpenClaw startup across restarts#7970
sandl99 wants to merge 2 commits into
mainfrom
codex/fix-openclaw-startup-persistence

Conversation

@sandl99

@sandl99 sandl99 commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

An OpenShell Docker-driver sandbox can restart when its OpenShell gateway restarts. Default OpenClaw onboarding represented the agent as null, so startup-command persistence skipped OpenClaw and left the container command as sleep infinity. This change uses the existing nemoclaw-start persistence path for default OpenClaw sandboxes.

Changes

  • Treat the canonical null agent value as OpenClaw when Docker startup-command persistence is selected.
  • Model the OpenShell-managed Docker container in onboarding subprocess fixtures.
  • Assert that default OpenClaw onboarding persists nemoclaw-start in the recreated container.
  • Capture credential-free container, process, service, health, and startup diagnostics around the gateway restart.
  • Verify registry identity, writable state, sandbox access, inference, and OpenClaw gateway health after restart.

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: Existing gateway lifecycle and recovery docs describe OpenShell PID 1, nemoclaw-start, and legacy startup-command recovery. No command, option, configuration contract, or recovery procedure changed.
  • 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: The change reuses the existing validated Docker startup-command recreation path. E2E diagnostics classify the command without printing its text or process arguments.
  • 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: Reviewed exact head 6a474f3a29784546e9caf28bd8de72341ea4386d. Existing docs cover OpenShell PID 1 launching nonroot nemoclaw-start and legacy startup-command recovery. The change adds no user command, option, configuration contract, recovery procedure, or support claim.
  • Agent: Codex CLI

DGX Station Hardware Evidence

  • Tested on DGX Station
  • Tested commit:
  • Station profile/scenario:
  • Result:
  • Supporting evidence:

Verification

  • PR description includes a Signed-off-by: line and every commit appears as Verified in GitHub
  • Normal pre-commit, commit-msg, and pre-push hooks passed, or npm run validate:pr passed after refreshing origin/main when hooks were skipped or unavailable
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — command/result or justification: sandbox-create-step.test.ts passed 11 tests; the affected onboarding integration cluster passed 49 tests; npm run typecheck:cli passed.
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — command/result: Required CI and exact-head live E2E are pending.
  • 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

    • OpenClaw sandboxes now retain their startup command when created or recreated.
    • Startup-command persistence also remains supported for Hermes and DCode agents.
    • Missing agent configuration now defaults to OpenClaw.
  • Tests

    • Expanded onboarding coverage for OpenClaw and Hermes.
    • Added recovery validation and detailed diagnostics for sandbox survival scenarios.
    • Added integration checks confirming recreated sandboxes start correctly.

Signed-off-by: San Dang <sdang@nvidia.com>
@sandl99 sandl99 self-assigned this Jul 31, 2026
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

OpenClaw is now the default agent for Docker startup-command persistence. Onboard recreation tests verify the persisted command. Live survival tests capture diagnostics, run recovery, and validate restored OpenClaw state.

Changes

OpenClaw sandbox persistence and recovery

Layer / File(s) Summary
Startup command persistence
src/lib/onboard/docker-startup-command-agent.ts, src/lib/onboard/sandbox-create-step.test.ts
The startup patch defaults the agent to openclaw and persists startup commands for OpenClaw, Hermes, and DCode. Tests cover OpenClaw and Hermes contexts.
Sandbox recreation validation
test/helpers/onboard-script-mocks.cjs, test/onboard-sandbox-build.test.ts
Onboard mocks provide container discovery and inspection data. Integration tests verify that recreation persists nemoclaw-start through OPENSHELL_SANDBOX_COMMAND.
Live recovery diagnostics
test/e2e/live/sandbox-survival.test.ts
The survival test captures diagnostics around gateway restart and recovery, invokes nemoclaw recover, and validates the cloud-openclaw-ready state.

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

Sequence Diagram(s)

sequenceDiagram
  participant SurvivalTest
  participant HostCliClient
  participant NemoClaw
  participant CloudOpenClaw
  SurvivalTest->>HostCliClient: Capture survival diagnostics
  SurvivalTest->>HostCliClient: Restart gateway
  SurvivalTest->>NemoClaw: Recover named sandbox
  NemoClaw->>CloudOpenClaw: Restore sandbox state
  SurvivalTest->>CloudOpenClaw: Validate cloud-openclaw-ready
Loading

Possibly related PRs

  • NVIDIA/NemoClaw#6625: Extends startup-command persistence to OpenClaw and related sandbox recreation tests.
  • NVIDIA/NemoClaw#7128: Modifies the same startup-command patch and OpenClaw persistence paths.
  • NVIDIA/NemoClaw#7856: Updates the sandbox survival recovery flow to validate OpenClaw restoration.

Suggested labels: integration: openclaw, area: onboarding, area: e2e, bug-fix, platform: container

Suggested reviewers: cv, cjagwani, prekshivyas

🚥 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 describes the main change: persisting OpenClaw startup behavior across restarts.
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.
✨ 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-openclaw-startup-persistence

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

@github-code-quality

github-code-quality Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in commit 6a474f3 in the codex/fix-openclaw-s... branch remains at 96%, unchanged from commit 91fc63e in the main branch.

TypeScript / code-coverage/cli

The overall coverage in commit 6a474f3 in the codex/fix-openclaw-s... branch remains at 81%, unchanged from commit 91fc63e in the main branch.

Show a code coverage summary of the most impacted files.
File main 91fc63e codex/fix-openclaw-s... 6a474f3 +/-
src/lib/onboard...flight-ports.ts 67% 33% -34%
src/lib/onboard...box-prebuild.ts 92% 74% -18%
src/lib/actions...ocker-health.ts 82% 65% -17%
src/lib/actions...confirmation.ts 79% 69% -10%
src/lib/onboard...box-gpu-mode.ts 97% 92% -5%
src/lib/actions...orchestrator.ts 87% 83% -4%
src/lib/onboard...al-inference.ts 93% 91% -2%
src/lib/onboard/preflight.ts 80% 80% 0%
src/lib/onboard...host-anchors.ts 90% 94% +4%
src/lib/onboard/docker-cdi.ts 70% 80% +10%

Updated July 31, 2026 04:49 UTC

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/e2e/live/sandbox-survival.test.ts`:
- Around line 37-115: Replace raw journal, Docker, process, and application log
collection in SURVIVAL_DIAGNOSTICS_SCRIPT with bounded, content-free metadata
such as statuses, identifiers, exit codes, and health results. Do not emit
credentials, tokens, request content, or unredacted child-process output; if any
raw output remains necessary, register every possible sensitive value with the
artifact redactor before collection, including values handled by the existing
apiKey redaction logic.
🪄 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: 3b002bea-65ed-4fc8-82d2-de88fa19e505

📥 Commits

Reviewing files that changed from the base of the PR and between 91fc63e and 6a474f3.

📒 Files selected for processing (5)
  • src/lib/onboard/docker-startup-command-agent.ts
  • src/lib/onboard/sandbox-create-step.test.ts
  • test/e2e/live/sandbox-survival.test.ts
  • test/helpers/onboard-script-mocks.cjs
  • test/onboard-sandbox-build.test.ts

Comment thread test/e2e/live/sandbox-survival.test.ts
@github-actions

github-actions Bot commented Jul 31, 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: onboard-repair, onboard-resume, sandbox-survival, cloud-onboard

1 optional E2E recommendation
  • gateway-guard-recovery

Workflow run details

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

@copy-pr-bot

copy-pr-bot Bot commented Jul 31, 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.

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