Skip to content

[All Platforms][Recovery] Sandbox gateway cannot be recovered after a container restart: every managed recovery path requires the supervisor it is supposed to start #6635

Closed

Description

@Hokonoken

Description

After a sandbox's Docker container restarts (host reboot, Docker daemon restart, docker restart), the
in-sandbox nemoclaw-start supervisor and the OpenClaw gateway are gone and no CLI path can bring them
back
. recover, gateway restart, and connect's auto-recovery all fail with SUPERVISOR_UNAVAILABLE,
and the advice they print is circular: connect says to run gateway restart, which is the command that
just failed. On the sandbox I tested, the last suggestion (rebuild --yes) failed too, in its preflight —
though for a reason that looks specific to snapshot-clones (see Actual Result), so I can't claim rebuild is
broken in general.

The root of the dead end is structural:

  • The container's Docker-level workload is only a keepalive (OPENSHELL_SANDBOX_COMMAND=sleep infinity);
    nemoclaw-start runs as an OpenShell session started at onboard time. A container restart kills that
    session and nothing respawns it — after the restart the process table contains only PID 1
    (openshell-sandbox) and sleep infinity.
  • Every managed recovery path funnels into executeGatewaySupervisorAction
    (src/lib/actions/sandbox/process-recovery.ts:238), which runs
    /usr/local/bin/nemoclaw-gateway-control <action> in the container. That helper delegates to
    scripts/managed-gateway-control.py, whose _discover_supervisor (:751) requires a running
    nemoclaw-start process owned by the sandbox user — and raises SUPERVISOR_UNAVAILABLE when there is
    none (:775). So the recovery contract requires the very process the recovery is supposed to restore.
  • Starting nemoclaw-start by hand is (correctly) rejected by the security design:
    openclaw-config-guard.py refuses revoke-startup-ready outside "the PID 1 startup transaction"
    (scripts/openclaw-config-guard.py:1333), so an ad-hoc exec nemoclaw-start dies during startup.

Observed twice: on a v0.0.78-5 onboarded sandbox after a WSL2/Docker daemon restart (the sandbox then
crash-looped policy fetch until the host gateway was brought back — RestartCount reached 4469 — and stayed
gateway-less afterwards), and again today on a snapshot-clone from a fresh main onboard, with a plain
docker restart while the host gateway stayed up throughout.

Environment

Host:          Ubuntu 24.04 (WSL2), x86_64
Docker:        29.2.1
OpenShell CLI: 0.0.72
NemoClaw:      main @ 9dec1fb89 (onboarded 2026-07-10)
Agent:         openclaw, --no-gpu, provider ollama-local

Steps to Reproduce

  1. Any healthy openclaw sandbox (today's run used a snapshot-clone, snapshot restore baseline --to clone-test;
    the v0.0.78-5 observation was a plain onboarded sandbox)
  2. docker restart <sandbox container> (stand-in for a host reboot / Docker daemon restart)
  3. Inside the container: ps -eo pid,user,args → only PID 1 and sleep infinity; container health goes unhealthy
  4. nemoclaw clone-test gateway restart
  5. nemoclaw clone-test recover
  6. nemoclaw clone-test connect

Expected Result

At least one managed path (recover being the natural one — "Repair a stopped sandbox gateway") relaunches
the supervisor + gateway after a container restart, or the failure message points at a working remediation.

Actual Result

Step 4:

  Restarting OpenClaw gateway in 'clone-test'...
  Failure layer: privileged control unavailable - gateway restart failed for 'clone-test'.
  SUPERVISOR_UNAVAILABLE

(exit 1)

Step 5:

  Probe failed: OpenClaw gateway is not running in 'clone-test' and automatic recovery failed.
  Check /tmp/gateway.log inside the sandbox for details.

(exit 1 — and /tmp/gateway.log only contains the pre-restart gateway's log)

Step 6 (auto-recovery inside connect):

  SUPERVISOR_UNAVAILABLE
  Could not restart OpenClaw gateway automatically.
  Retry the managed restart from the host:
    nemoclaw 'clone-test' gateway restart
  If the sandbox image is incompatible or restart still fails, rebuild it:
    nemoclaw 'clone-test' rebuild --yes

The suggested rebuild --yes (exit 1, sandbox untouched):

  Rebuild preflight failed: the replacement onboarding host/runtime checks did not pass.
  Dashboard port 18790 belongs to sandbox 'my-assistant'.
  Sandbox is untouched — no data was lost.
  Replacement onboarding preflight failed

Caveat: this sandbox is a snapshot-clone (snapshot restore baseline --to clone-test), and nemoclaw list
shows the clone registered with the source's dashboard port (both list http://127.0.0.1:18790/), which
is presumably what the rebuild preflight collides with. That looks like a separate clone-registry artifact
rather than a generic rebuild failure — I have not run rebuild on a non-clone sandbox. Either way, for this
sandbox every suggested path is a dead end short of destroy + re-onboard.

Notes / possible directions

  • Same family as [All Platforms][Onboard] onboard --resume can never recover after the sandbox image build fails: the route reservation it requires is already gone #6563 (onboard --resume dead end): a recovery path whose precondition is destroyed by
    the failure it recovers from.
  • Possible directions (maintainers' call): have recover bootstrap the supervisor session through the same
    privileged path onboard uses when _discover_supervisor finds no candidate (distinguishing "no
    supervisor at all" from "supervisor present but wedged", which the current SUPERVISOR_UNAVAILABLE
    collapses); or run nemoclaw-start as the container workload so a container restart restarts it; or at
    minimum make connect/gateway restart stop suggesting each other and point at the working remediation.
  • Happy to help validate a fix on this lab (x86_64/WSL2, repro is deterministic).

Activity

  1. self-assigned this
    on Jul 10, 2026
  2. mikemason commented on Jul 11, 2026

    @mikemason

    I'm just getting started with NemoClaw and ran into this same issue on a fresh Linode:

    • NemoClaw 0.0.79
    • OpenShell 0.0.72 (docker driver)
    • Ubuntu 24.04
    • OpenClaw, inference via Anthropic API

    I used Claude Code to install NemoClaw and get it working, but then after an apt upgrade and a reboot, OpenClaw didn't come back up correctly.

    Claude spent quite a while spelunking to try to get things back up, and ended up writing its own restart script to patch around the lack of a supervisor, which I think is fixed by #6677.

    One additional nit worth pointing out: when Claude hand-started the gateway, it came up and served the OpenClaw dashboard fine, but every Anthropic API call failed with SELF_SIGNED_CERT_IN_CHAIN. Again, I think #6677 likely fixes this, but there might remain a failure mode where the dashboard is being served but actual LLM calls fail. At the time OpenClaw couldn't reach the model, nemoclaw status was reporting healthy inference, so whatever it's checking is slightly different than what OpenClaw actually uses to hit the model.

  3. added a commit that references this issue on Jul 12, 2026
    5638148
  4. added a commit that references this issue on Jul 12, 2026
    9eade31
  5. Hokonoken commented on Jul 13, 2026

    @Hokonoken
    ContributorAuthor

    Came back to verify #6677 against the original scenario and found a residual gap: the new
    relaunch path cannot trigger for any sandbox whose image predates #6677
    , which is the
    population #6635 was about. Full chain below, all steps executed live (Ubuntu 24.04/WSL2 x86_64,
    Docker 29.2.1, OpenShell CLI 0.0.72, host CLI built from main @ deed1aaa3, 2026-07-13).

    The gap

    recover's relaunch gate opens only when the in-sandbox controller answers exactly
    SUPERVISOR_NOT_RUNNING:

    • isExactlyMissingManagedSupervisor requires stderr to be that single line
      (src/lib/actions/sandbox/process-recovery.ts:375), and
      classifyGatewayRestartFailure maps only that marker to the supervisor not running layer
      the relaunch requires (src/lib/actions/sandbox/gateway-restart.ts:131).
    • SUPERVISOR_NOT_RUNNING is emitted by the post-fix(sandbox): recover relaunches a restart-killed gateway supervisor #6677 controller
      (scripts/managed-gateway-control.py:805, the attested stable no-supervisor scan). It does
      not exist in the pre-fix(sandbox): recover relaunches a restart-killed gateway supervisor #6677 controller: the embedded copy in my sandbox (image built 07-10)
      has 0 occurrences of SUPERVISOR_NOT_RUNNING and 36 of SUPERVISOR_UNAVAILABLE.
    • The controller is baked into the sandbox image (Dockerfile; staged into the build context at
      src/lib/sandbox/build-context.ts:171) and the host CLI execs the embedded copy
      (/usr/local/bin/nemoclaw-gateway-control, argv built in process-recovery.ts
      executeGatewaySupervisorActionPinned). I found no code path that refreshes it inside an
      existing container — the image build is its only delivery.

    So on a pre-#6677 sandbox with a dead supervisor, the controller can only say
    SUPERVISOR_UNAVAILABLE — which the CLI treats as retryable-transient and then classifies as
    privileged control unavailable. The relaunch never fires.

    Observed live (post-#6677 host CLI, pre-#6677 sandbox, supervisor killed by container restart)

    Process table after docker stop/docker start: PID 1 + sleep infinity only — the #6635
    state. Then:

    $ nemoclaw <name> recover
      Probe failed: OpenClaw gateway is not running in '<name>' and automatic recovery failed.
      Check /tmp/gateway.log inside the sandbox for details.
    EXIT=1
    

    (That message is connect.ts:297 — the recover flow funnels through the connect probe's
    recovery printer.)

    docker events during the run shows only nemoclaw-gateway-control recover <nonce> execs
    (three in the run where I captured the full retry loop — the documented "at most three
    controller attempts"), no probe, and no container recreate (the container's Created
    timestamp is unchanged after every attempt) — the transactional relaunch was never attempted.
    Running the embedded controller directly with a valid nonce confirms the answer:
    SUPERVISOR_UNAVAILABLE, exit 1.

    (Two side notes from the same session: /tmp/gateway.log, which the failure message points at,
    contains nothing about the recovery — it is frozen at the pre-restart workload's last output.
    And injecting the new controller into the old container by hand does not help either: its
    file-trust validation answers SUPERVISOR_REBUILD_REQUIRED, which also maps to
    privileged control unavailable. That injection is not a supported path, but it shows the old
    image cannot produce the attestation either way.)

    Why this matters

    The upgrade population #6635 described — existing sandboxes broken by a host reboot or Docker
    restart — cannot benefit from #6677 by upgrading NemoClaw: their embedded controller predates
    the attestation vocabulary. And the circular escape is back in a new form: to make recover
    work the sandbox needs a rebuilt image, but rebuild is the heavier operation recover exists
    to avoid (and it has its own gates).

    Possible directions, whichever fits your intent for #6677:

    1. Let the host CLI treat the legacy answer as relaunch-eligible: when the container's
      persisted OPENSHELL_SANDBOX_COMMAND is the legacy keepalive AND the controller answers
      SUPERVISOR_UNAVAILABLE stably across the retry loop, proceed to the same attested recreate
      (the host can perform the double-scan attestation itself via the pinned container id).
    2. Or refresh the controller before asking: push the current managed-gateway-control.py into
      the container (same trusted-uid/mode contract) and re-run the probe, so the attestation
      comes from the new code even on old images.
    3. Or, if rebuilding is the intended path for pre-fix(sandbox): recover relaunches a restart-killed gateway supervisor #6677 sandboxes, make recover say so:
      detect the legacy controller (no SUPERVISOR_NOT_RUNNING in its vocabulary / legacy
      keepalive command) and print the rebuild command instead of Check /tmp/gateway.log, which
      currently points at a log that contains nothing relevant.

    Happy to help with a PR for whichever direction you prefer — I have a live legacy-image sandbox
    in this state to test against.

  6. added theissue type on Jul 17, 2026
  7. added
    area: sandbox
    area: security
    integration: openclaw
    platform: container
    on Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: sandboxarea: securityintegration: openclawplatform: container

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions