NemoClaw icon indicating copy to clipboard operation
NemoClaw copied to clipboard

Shields-up stop/start regression leaves OpenClaw and Hermes sandboxes unready

Open apurvvkumaria opened this issue 3 months ago • 1 comments

Contributor preflight (required)

Before investigating or changing code:

  1. Read WRITING.md in full.
  2. Read CONTRIBUTING.md in full.
  3. Run npm run dev:doctor from a clean checkout before creating a branch.
  4. Follow both guides for code, tests, issue updates, commit messages, DCO, commit verification, and the pull request.

Problem

The protected stop/start lifecycle has regressed on current main. A sandbox with Shields up can stop successfully, but start does not return the sandbox to OpenShell Ready.

This reproduces independently for OpenClaw and Hermes in E2E run 31337932239 at commit 1a8e6bd3198ec54c7682f98b23141bdaac716160.

Confirmed evidence

OpenClaw

The shields-config job onboarded the sandbox, established mutable configuration, and raised Shields. The failure occurred during the Shields-up restart:

Container 'openshell-default--e2e-shields-...' started.
Restoring sandbox startup state…
Checking gateway health and host forwards…
Sandbox 'e2e-shields' is stuck in 'Provisioning' phase.

nemoclaw e2e-shields start exited 1. Cleanup also found the container restarting, so it could not read the sealed configuration hashes. The failure artifact is available here.

Hermes

The hermes-shields-config job onboarded Hermes and completed the first Shields cycle. The failure occurred while restarting Hermes with Shields up. The container started, but the sandbox did not become Ready before the five-minute timeout:

start Hermes with shields up failed:
Container 'openshell-default--e2e-hermes-shields-...' started.
Restoring sandbox startup state…
Checking gateway health and host forwards…
Waiting for sandbox 'e2e-hermes-shields' to be ready...

The failure artifact is available here.

Expected behavior

For OpenClaw and Hermes:

  1. stop exits successfully.
  2. start restarts the existing sandbox without rebuild or destroy.
  3. OpenShell returns the sandbox to Ready.
  4. The managed gateway and required host forwards become healthy.
  5. Workspace state, registered configuration, inference configuration, and Shields posture remain unchanged.
  6. Shields-up ownership, modes, hashes, and confidentiality boundaries remain enforced.

Reproduction matrix

Run the existing live scenarios for all four cases:

Agent Shields posture
OpenClaw Up
OpenClaw Down
Hermes Up
Hermes Down

For each case, onboard a fresh Docker-driver sandbox, wait for Ready, record a workspace marker and configuration hashes, stop it, start it, and verify status, gateway health, host forwards, state, and filesystem posture. The Shields-up cases currently fail. Keep the Shields-down cases in the matrix to prevent a posture-specific fix from breaking the mutable path.

Likely cause — hypothesis, not confirmed

The common suspect is the shared Docker stop/start and managed-startup recovery boundary. startSandbox() starts the stopped container, restores startup state, and then verifies gateway and forward health. Startup-state recovery may be unable to recreate the readiness lease and managed gateway while OpenShell is still Provisioning, or its recovery result may not reach the caller.

Capture container state, OpenShell phase history, startup logs, managed-control results, readiness markers, and gateway logs before choosing a fix.

Code to inspect

  • src/lib/actions/sandbox/start.ts
  • src/lib/onboard/runtime-provider/docker.ts
  • src/lib/onboard/docker-driver-sandbox-recovery.ts
  • src/lib/actions/sandbox/connect.ts
  • src/lib/actions/sandbox/process-recovery.ts
  • src/lib/shields/index.ts
  • scripts/nemoclaw-start.sh
  • agents/hermes/start.sh
  • scripts/lib/gateway-supervisor.sh
  • scripts/managed-gateway-control.py
  • test/e2e/live/shields-config.test.ts
  • test/e2e/live/hermes-shields-config.test.ts

Related work

  • #8112 described the original stop/start failure.
  • #8146 fixed #8112 by restoring startup state before final readiness verification.
  • #8304 described an OpenClaw Shields-up sandbox that was already stuck after failed startup.
  • #8488 fixed #8304 by allowing guarded Shields-down recovery after terminal startup failure.

This issue tracks a regression of the normal start path after #8146. It is not a duplicate of #8304 because the required outcome is successful start, and Hermes is also affected.

Acceptance criteria

  • [ ] OpenClaw with Shields up survives stop/start and returns to Ready.
  • [ ] Hermes with Shields up survives stop/start and returns to Ready.
  • [ ] Shields-down stop/start continues to pass for both agents.
  • [ ] start returns success only after verifying the managed gateway and required host forwards.
  • [ ] Startup recovery failures produce a specific actionable error.
  • [ ] Stop/start does not replace, rebuild, or destroy the sandbox or lose workspace state.
  • [ ] Configuration hashes and registered inference configuration remain unchanged.
  • [ ] Shields-up files and directories retain their required owners and modes.
  • [ ] The fix does not weaken configuration seals, confidentiality roots, readiness leases, or PID 1 authentication.
  • [ ] Unit or integration coverage exercises the public startSandbox path and the real managed recovery result.
  • [ ] Both live E2E targets pass on the same commit.

Targeted verification

npx vitest run --project cli \
  src/lib/actions/sandbox/start.test.ts \
  src/lib/actions/sandbox/process-recovery.test.ts \
  src/lib/onboard/docker-driver-sandbox-recovery.test.ts \
  src/lib/shields/state-dir-lock.test.ts

npx vitest run --project integration \
  test/nemoclaw-start-sealed-restart.test.ts \
  test/hermes-gateway-supervisor-recovery.test.ts \
  test/gateway-supervisor-control.test.ts \
  test/state-dir-guard.test.ts \
  test/hermes-restart-config-seal-recovery.test.ts

npm run typecheck:cli

Run both protected live targets through the existing E2E workflow and confirm that they pass on the same commit.

apurvvkumaria avatar Aug 10 '26 00:08 apurvvkumaria

on it

souvikDevloper avatar Aug 10 '26 04:08 souvikDevloper