Skip to content

Complete reboot persistence by conservatively restoring sandboxes and host forwards #7174

Closed as not planned

Description

@ericksoa

Problem Statement

NemoClaw does not provide a complete boot-persistence contract for an always-on headless deployment.

#6903 and draft PR #6905 cover installing and owning a persistent OpenShell gateway service. That is necessary but not sufficient: after the gateway returns, NemoClaw must decide which registered sandboxes should run, wait for authoritative sandbox and agent readiness, and restore recorded host forwards without restarting healthy components or creating a recovery loop.

Current main (4deebcf9cfd0d54c9b9b5fb1907d153a462818f3) has useful pieces but no end-to-end mode:

  • src/lib/onboard/docker-driver-gateway-service.ts can use a trusted packaged user unit.
  • Standalone gateway launch remains a detached process when no unit is available.
  • src/lib/actions/sandbox/start.ts is a one-shot start/probe.
  • src/lib/actions/sandbox/forward-recovery.ts can reconcile one exact-owner forward and fails closed on foreign port ownership.
  • docs/manage-sandboxes/run-sandboxes.mdx, docs/get-started/quickstart-hermes.mdx, and docs/reference/commands.mdx require manual sandbox/forward recovery after reboot.

A naive Restart=always unit around nemoclaw <name> recover is unsafe because repair currently spans gateway, sandbox, agent, and forward mutation. #7173 is therefore a prerequisite.

Desired Behavior

Provide an opt-in Linux service mode, naming TBD, that converges after reboot without an interactive login:

  • one declared gateway lifecycle authority starts;
  • only explicitly boot-enabled sandboxes start;
  • intentionally stopped and already-healthy sandboxes are left alone;
  • OpenShell Ready and agent readiness are awaited with a bounded slow-boot budget;
  • recorded forwards are restored only after readiness;
  • exact target-owned forwards are reused and foreign listeners are never killed/adopted;
  • ambiguous states fail visibly without restarting the host gateway;
  • uninstall removes only NemoClaw-owned artifacts.

Example product shape:

nemoclaw <name> service install
nemoclaw <name> service status
nemoclaw <name> service uninstall

Build two explicit layers:

  1. Keep Install and uninstall a managed OpenShell gateway service for reboot persistence #6903 as gateway-service authority and prevent duplicate gateway owners.
  2. Add a narrow per-sandbox boot reconciler whose only mutation authority is to start an explicitly enabled stopped sandbox, wait for readiness, and restore exact-owner forwards.

Do not implement this as an infinite loop around current recover. Prefer a dedicated reconciliation action plus either a low-frequency conservative keeper/timer or a supervised foreground-forward contract.

Persist an explicit desired-running/service-enabled bit. Do not infer operator intent from Docker restart policy. Define how manual stop, start, rebuild, and maintenance interact with that bit and lock concurrent mutation.

Constraints and Non-goals

  • Prefer user services; require explicit operator approval before enabling lingering and document its security implications.
  • Use validated absolute executable paths and direct argv, not shell interpolation or inherited caller environments.
  • Persist only non-secret identifiers/state; never provider credentials, bearer tokens, or arbitrary onboarding environment.
  • Validate unit ownership/modes, reject unsafe symlinks, write atomically, and verify identity before uninstall.
  • Never modify vendor units or compete with an external supervisor.
  • No Kubernetes orchestration, macOS LaunchAgent in the first slice, automatic rebuild at boot, policy/credential repair, or public remote exposure.

Implementation Idea

A user template unit could depend on Docker/network and the single gateway authority, then invoke a dedicated boot-reconcile action:

gateway healthy -> start boot-enabled sandbox -> wait OpenShell Ready
-> wait agent health -> reconcile recorded forwards -> verify ownership/reachability

Use bounded retry/backoff and a start limit that leaves a failed unit visible rather than flapping. Maintenance/rebuild must suppress keeper mutations.

Test pure unit rendering/escaping, desired-state transitions, lifecycle idempotency, foreign port conflicts, slow boot, multi-sandbox/custom-port isolation, systemd adapter states, tamper-safe uninstall, and a real reboot E2E without login.

Acceptance Criteria

Category

Platform

Related work

#6903 and draft PR #6905 own gateway service installation. PR #6842 and #6576 concern lifecycle authority. #6972 is a separate post-reboot volume issue. #7173 blocks safe supervision.

Activity

  1. added
    area: install
    area: networking
    area: sandbox
    needs: design
    needs: triage
    platform: linux
    area: architecture
    on Jul 19, 2026
  2. removed
    needs: triage
    on Jul 20, 2026
  3. wscurran commented on Nov 17, 2026

    @wscurran
    Contributor

    Hi Aaron, thanks for the work and discussion here. We’re planning an updated architecture for NemoClaw, so we’re closing this remaining work for the earlier implementation as not planned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: architecturearea: installarea: networkingarea: sandboxneeds: designplatform: linux

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions