Skip to navigation

Recover and Rebuild Sandboxes

View as Markdown

Use the lightest recovery operation that repairs the sandbox while preserving its supported state.

Upgrade from a Release That Used Shields

Shields has been retired from NemoClaw. The current CLI has no Shields commands, status, timers, or supported locked posture. After an upgrade, NemoClaw prints a retirement notice while it still finds legacy Shields state and identifies the affected sandbox records when possible.

If the sandbox has only an inert legacy state record, create an independent trusted backup. Then rebuild the affected sandbox before running further mutations.

If NemoClaw blocks an operation because it found an old timer, transition, policy snapshot, authority-bearing runtime-provider recovery artifact, or ambiguous recovery state, do not onboard or mutate any sandbox yet. These files can represent detached mutation authority that the current CLI deliberately does not interpret. A different requested sandbox name does not make onboarding safe.

A notice-only provider intent recorded before mutation authority was granted is preserved for review but does not by itself block lifecycle operations. The retirement notice prints each exact absolute notice-only path and labels it nonblocking. A notice-only path is not part of the quarantine inventory unless a later blocking error explicitly lists that same path.

Use the active state directory and exact blocking paths printed in the error as the complete quarantine inventory. A provider path can name a whole lifecycle transaction directory; treat the whole printed path as one unit.

  1. Record the active state directory and every printed blocking path.
  2. Reboot the host. Before continuing, ensure that no older NemoClaw binary restarts. Stopping selected processes without a reboot is not sufficient authority-stop proof.
  3. Create trusted backup storage and a quarantine directory outside the printed active state directory. Back up each listed path, then move the original whole path into that outside quarantine. Do not delete, edit, or interpret any artifact, and do not move only selected files from a printed transaction directory.
  4. Confirm that none of the printed paths remains in the active state directory. Only then retry the current-version rebuild or recreate flow. For recreation, use the manual transfer workflow to copy only trusted user data.

If you cannot complete the reboot, backup, or full quarantine, leave every artifact untouched. NemoClaw continues to block ordinary mutations while any listed path remains in active state.

The current CLI does not expose cross-sandbox recovery-backup restore. It deliberately does not interpret, resume, or delete ambiguous legacy recovery state.

Restart a Stopped Sandbox

If NemoClaw reports that a standard sandbox is stopped, ask OpenShell to restart that exact sandbox:

nemo-deepagents <sandbox-name> start

This path preserves the sandbox workspace and leaves lifecycle ownership with OpenShell. start and recover resolve a sandbox from the local registry that owns it, even when another local OpenShell gateway is active. They reconcile a sandbox that OpenShell still reports as Stopped, including when its provider container is already running. Neither command directly restarts or unpauses the provider container. If the container is paused, follow the printed provider guidance instead.

Before destructive replacement, run nemo-deepagents <sandbox-name> status. If the owning gateway reports the registered sandbox missing, NemoClaw leaves any provider container and registry entry untouched. Retry after the gateway reconnects. If the sandbox was intentionally deleted, preserve any separate backup and use nemo-deepagents <sandbox-name> destroy --yes to retire the stale entry when the command can prove the OpenShell resource absent. Then onboard a clean replacement and use the manual transfer workflow to copy only reviewed, credential-free user data from an independently maintained backup. Rebuild cannot recover a workspace or live OpenShell policy that no longer exists.

Recover the Agent Runtime

Deep Agents uses a terminal runtime without an in-sandbox agent gateway or host-side port forward. The OpenShell ownership and local endpoint reachability prerequisites for an active port forward do not apply. Use nemo-deepagents <sandbox-name> status, logs, connect, and rebuild for recovery. If the terminal runtime reports degraded health, rebuild the sandbox instead of using recover or gateway restart.

Understand Launch Readiness Leases

A successful complete preflight for nemo-deepagents launch <sandbox-name> can publish a credential-free launch-readiness lease on Linux. Linux infrastructure can publish the same evidence with nemo-deepagents <sandbox-name> connect --probe-only. The lease has a fixed 24-hour lifetime that repeated launches do not extend. Leaving the agent with /exit does not revoke it, and users do not refresh it manually.

During the lease, launch still verifies the owning OpenShell gateway, exact live sandbox identity, registry and agent configuration, effective policy, inference route, required forwards, and semantic runtime health.

Every configured route must serve a valid response to a bounded request for the recorded model before NemoClaw accepts or publishes launch readiness. For retained legacy, custom, and local shared routes, the models probe must return HTTP 2xx, except that a legacy openrouter-api route can return HTTP 404 for GET /v1/models when the model request succeeds. NVIDIA Endpoints and supported fixed hosted selections instead verify the recorded native attachment and request the model through its native endpoint. A failed request rejects launch readiness and identifies the inference request as the failed check. Hermes and LangChain Deep Agents Code retain their existing session setup on the lease-accepted path. When those checks pass, it can skip duplicate recovery, readiness polling, and inference-route repair. The lease is not a health guarantee or repair authority.

For missing, unsafe, malformed, expired, mismatched, changed, or unhealthy evidence, NemoClaw fences any prior acceptable evidence before it runs the complete preflight. Ordinary launch continues only when NemoClaw proves that no old authority or evidence can exist, or durably rotates the runtime epoch. If an old epoch might exist and cannot be durably rotated, launch and connect --probe-only stop before complete preflight or recovery. Their redacted guidance asks you to repair the current user’s secure OS runtime authority and NemoClaw state permissions, then retry. If NemoClaw securely proves that both the authority and receipt are absent but cannot create new authority, ordinary launch can run the complete preflight without optimization; on Linux, connect --probe-only exits nonzero because it could not publish evidence. If that preflight succeeds before the lease expires, replacement evidence keeps the original start and expiry time. After expiry, a successful complete preflight starts a new 24-hour lease only when publication succeeds.

Before the first mutation in the complete preflight, the producer revalidates its sandbox-global runtime epoch under the sandbox lifecycle lock followed by the owning gateway lock. It holds both locks through all mutations in the complete preflight, final state capture, and publication. A stale producer makes no changes and re-inspects the newer lease.

If unsafe or malformed authority history makes the prior lease timeline untrustworthy, NemoClaw durably invalidates the old epoch and starts one conservative 24-hour quarantine. Publication remains disabled until both wall time and monotonic uptime span the full quarantine. Repeated attempts do not extend it. After it elapses, the next successful complete preflight can publish a new fixed 24-hour lease.

Lease acceptance and publication are currently Linux-only and require a secure, independently writable OS per-user runtime authority under /run/user/<numeric-uid>. It never uses caller-provided environment variables to select this authority.

On macOS, launch runs the complete preflight every time and does not publish a launch-readiness lease. connect --probe-only also runs the complete preflight, including recovery and probes. After a successful probe and recovery, it prints a note that launch-readiness evidence is unavailable on this platform and exits zero. On Linux, unsafe launch-readiness diagnostics can report the affected path, owner UID, permissions, a bounded error code, and repair guidance. They exclude receipt contents, environment values, and raw OS error messages.

Infrastructure must run connect --probe-only as the same final numeric user that later runs launch. Run it after the final durable home and state volume is mounted and after policy and network provisioning is complete. On completion, connect --probe-only writes one credential-free Probe timing: line with elapsed milliseconds for readiness, authority, lifecycle, gateway, processes, forward, inference, pairing, and publication stages. The line also reports the lifecycle and forward actions, the result, and the failed stage when the probe fails. Timing output is diagnostic only and does not change probe success or failure. NemoClaw rejects evidence after a bound sandbox, configuration, policy, or network identity changes. Deployment ordering remains responsible for external changes that OpenShell and NemoClaw cannot observe. Refer to the probe timing reference for observation counts and readiness decisions.

Rebuild While Preserving State

If you changed the underlying Dockerfile, upgraded Deep Agents Code, enabled Tavily Search, or want to pick up a new base image without losing the complete native home, use rebuild instead of destroying and recreating.

nemo-deepagents <sandbox-name> rebuild

On WSL with Docker Desktop, a generated replacement image build uses a temporary credential-free Docker configuration when the configured Docker Desktop credential helper is unavailable. NemoClaw removes the temporary configuration after the build and does not modify your Docker configuration. An explicit custom Dockerfile continues to use your configured Docker credentials because its base image or build steps might require a private registry. If that custom rebuild cannot reach the credential helper, restore the Docker Desktop session or credential-helper access before retrying.

Generated-image rebuilds use the base image selected during preflight, even when the source sandbox records an older base-image hint. Custom Dockerfile rebuilds use the recorded Dockerfile source.

If replacement onboarding returns a nonzero status, rebuild stops before post-create state restoration and preserves the backup and registry recovery state. It does not report a successful rebuild.

When NemoClaw can identify the exact stopped Docker container and prove its immutable runtime authority, rebuild captures the complete native root through the Docker provider without starting or executing inside the source. This recovery path supports stopped OpenClaw and Deep Agents Code sandboxes.

When that provider-owned capture is not available, rebuild asks OpenShell to start the exact stopped sandbox for the duration of the pre-recreate state backup and asks OpenShell to return it to Stopped afterward, the same lifecycle path nemo-deepagents backup-all uses. If OpenShell cannot start the sandbox, or the retried backup still fails, rebuild aborts without recreating the sandbox; it reports an incomplete-backup notice only when a partial backup was retained. If the backup succeeds but OpenShell cannot return the sandbox to Stopped, rebuild also aborts and reports the failed transition. If neither path can establish stopped-source authority, repair the OpenShell lifecycle state or recover the data manually before retrying; NemoClaw does not fall back to a selective directory copy.

If OpenShell still reports the sandbox in Phase: Error but its Docker-driver container is missing, rebuild cannot back up its live workspace and stops before replacement. Recover the workspace from an independently maintained backup before creating a clean replacement.

When the target manifest declares an agent version, NemoClaw runs a fresh live version probe after state restoration. It records the replacement version and reports success only when the observed version matches the rebuild target. An unavailable or different version ends the rebuild with a nonzero status instead of recording the target version as observed.

Resolve Rebuild Preflight Stops

Before it backs up or deletes the existing sandbox, rebuild validates the recorded sandbox, gateway, inference route, policy, MCP, agent, and operation-lock state. When one of these checks fails, NemoClaw prints Rebuild preflight failed, explains how to recover, and ends with Aborting rebuild. At this boundary, the existing sandbox is unchanged and no sandbox data has been removed.

For a remote inference provider other than Hermes Provider, preflight checks the selected credential’s non-secret expiration metadata from OpenShell. For these providers, a provider that no longer exposes the recorded credential key, an expired credential, or expiration metadata that NemoClaw cannot verify stops rebuild before backup or deletion, including with --force. A provider that exposes the recorded credential key without an expiration entry is treated as non-expiring. That credential or one with a future expiration continues through the remaining preflight checks. Hermes Provider uses its separate authentication and credential-binding checks; this expiration-metadata guard does not apply to it.

For remote providers other than Hermes Provider and Amazon Bedrock, preflight validates a nonempty API key supplied through the host environment. NemoClaw checks that key against the provider endpoint before replacement-image preparation or backup. It validates the key again immediately before sandbox deletion. When validation fails, rebuild stops without deleting the existing sandbox, including with --force. A valid credential stored in OpenShell does not bypass validation of a supplied host key.

Use the recovery guidance that matches the reported check:

  • Verify the sandbox name when its registry entry is missing.
  • Follow the printed OpenShell gateway recovery steps when the gateway schema is incompatible.
  • Correct the exported API key when rebuild reports the host inference credential could not be validated. To reuse a credential already stored in OpenShell, unset its host environment variable instead. For NVIDIA Endpoints, this variable is NVIDIA_INFERENCE_API_KEY. Confirm that the provider endpoint is reachable. Then retry rebuild.
  • Refresh the named OpenShell credential or rerun nemo-deepagents onboard when rebuild reports an expired provider credential.
  • Re-register the provider or rerun nemo-deepagents onboard with the correct credential when the provider no longer exposes the recorded credential key, then retry rebuild.
  • Restore gateway connectivity and authentication when rebuild cannot verify the recorded provider.
  • Restore access to the current OpenShell policy when rebuild reports that the live policy cannot be read, then rerun rebuild. NemoClaw does not reconstruct policy from registry state.
  • Replace literal policy credentials with supported OpenShell credential bindings or resolver placeholders when rebuild refuses the policy handoff. NemoClaw stops before it creates the handoff or changes sandbox resources.
  • Resolve an incomplete MCP destroy transaction before retrying.
  • Back up the sandbox state and recreate it with nemo-deepagents onboard when the record contains multiple agents. Transactional multi-agent rebuild is not supported.
  • Wait for another onboarding or rebuild operation to finish before retrying. If verified stale-lock cleanup is still in progress, wait briefly and rerun the command. Do not delete the lock manually.
  • Set the live OpenShell inference route to the sandbox’s recorded provider and model when rebuild reports route drift.

A gateway that reports no live inference route does not stop the rebuild. Replacement onboarding configures and verifies the recorded route before it recreates the sandbox.

The rebuild command transfers the complete native home, including config.toml, .mcp.json, hooks, skills, memories, histories, packages, and unknown files. It also passes the complete current OpenShell policy to replacement creation.

Continue an Interrupted Replacement

Before rebuild deletes the existing sandbox, NemoClaw records a replacement journal in the active onboarding session. The journal binds the operation to the sandbox name, recorded OpenShell gateway, source identity, and replacement settings. It stores fingerprints instead of credential values or raw OpenShell sandbox IDs.

Rebuilding another sandbox can retain this session in .onboard-rebuild-<sandbox>.json under the selected NemoClaw state directory. Rerunning the affected sandbox’s rebuild restores its retained session automatically. For a non-default gateway port, these files reside under ~/.nemoclaw/gateways/<port>/. Resume or clear an unfinished ordinary onboarding session before retrying retained rebuild recovery. To discard that ordinary onboarding attempt and start over, run nemo-deepagents onboard --fresh as described in Previous onboarding session failed.

Preserve Rebuild Recovery Files

Do not manually delete onboard-session.json or retained .onboard-rebuild-<sandbox>.json files to resolve an interrupted replacement. Keep the recovery files and rerun the affected sandbox’s rebuild with the same settings.

If rebuild stops after recording the journal, rerun the command with the same replacement settings. The rerun takes one of these actions:

  • It continues deletion when the live sandbox still has the journaled source identity.
  • It continues creation when the recorded OpenShell gateway explicitly reports the source sandbox as absent.
  • It accepts an existing replacement only after its live identity and sandbox registry generation match the journal and it completes or verifies the recorded final handoff.
  • It starts a new replacement when the journaled replacement provably never took effect.

An older recovery marker can lack an MCP handoff, as can an interruption before NemoClaw records the handoff. NemoClaw reads MCP state again only when the source still exists and the matching journal remains in the planned or deleting phase. If either check fails, the rerun stops without another delete attempt.

NemoClaw treats a journaled replacement as void when the sandbox registry row and the live same-name sandbox report the same OpenShell identity on the journaled gateway, and that identity is not the journaled replacement. A registry row or a live sandbox on any other gateway leaves the journal in place, because that journal may still own an unregistered replacement on its own gateway. The rerun atomically replaces the void journal with a fresh journal against that live source, without leaving an unjournaled interval. It then reports Replaced the void replacement journal for '<name>'; its source sandbox is registered and live. A journal whose replacement never took therefore stops blocking rebuild for the rest of the session.

The journal binds the durable source registry row and normally does not resume after a command rewrites that row. For an older N1x Docker managed-vLLM journal, recovery can continue only while the row contains the matching active route reservation. Other changes to the fingerprinted source row remain fail-closed. Messaging channel state is exempt: channels add, channels stop, channels start, and channels remove rewrite the recorded messaging plan, and the journal ignores that field.

Recover an Unsafe Retained Policy Handoff

Do not retry rebuild when a retained policy handoff contains a literal credential. Recover any required data from the backup before deletion, and keep the backup and handoff until that recovery is complete. Restore or select the recorded gateway and confirm openshell status is healthy. Only then use the ordinary fail-closed destroy flow and confirm OpenShell reports the sandbox deleted:

openshell gateway select <recorded-gateway>
openshell status
nemo-deepagents <sandbox-name> destroy --yes

Do not use --force for this recovery. If deletion is unconfirmed, preserve the local recovery state and restore gateway access. After confirmed deletion, run nemo-deepagents onboard --name <new-sandbox-name>. Use a new sandbox name: recovery retirement refuses while the failed sandbox name is still present on its recorded gateway.

The printed backup path contains a validated native-home.tar and its bound rebuild-manifest.json. Before uploading any required data, verify that the retained archive still matches the manifest, extract it into a new private host directory, and inspect the paths you intend to recover:

BACKUP=<printed-backup-path>
RECOVERY_DIR="$(mktemp -d "${TMPDIR:-/tmp}/nemoclaw-native-recovery.XXXXXX")"
chmod 700 "$RECOVERY_DIR"
EXPECTED_SHA256="$(node -e 'const m=require(process.argv[1]); process.stdout.write(m.nativeState.sha256)' "$BACKUP/rebuild-manifest.json")"
ACTUAL_SHA256="$(node -e 'const c=require("node:crypto"),f=require("node:fs"),h=c.createHash("sha256"),s=f.createReadStream(process.argv[1]); s.on("data",d=>h.update(d)); s.on("end",()=>process.stdout.write(h.digest("hex"))); s.on("error",e=>{console.error(e.message);process.exitCode=1})' "$BACKUP/native-home.tar")"
test "$ACTUAL_SHA256" = "$EXPECTED_SHA256"
tar --no-same-owner -xf "$BACKUP/native-home.tar" -C "$RECOVERY_DIR"
find "$RECOVERY_DIR" -mindepth 1 -maxdepth 3 -print

Stop if the digest differs, the manifest has no nativeState.sha256, or extraction fails. The archive was published only after NemoClaw’s credential scan passed; do not copy the adjacent policy handoff, recovery marker, manifest, or any newly added credential material into the replacement. For each reviewed regular file or directory you need—including an unknown benign native-home path—use the validated upload wrapper and preserve its path below /sandbox:

nemo-deepagents <new-sandbox-name> upload "$RECOVERY_DIR/<relative-path>" "/sandbox/<destination>"

The upload wrapper refuses symbolic links and special files. Preserve the retained backup and ask a NemoClaw maintainer to review those entries instead of bypassing that check. Verify the recovered files in the replacement before continuing. Remove the private extraction only after verification:

rm -rf -- "$RECOVERY_DIR"

Only after the old sandbox is confirmed absent and required data recovery is complete, retire the exact failed transaction printed by rebuild:

nemo-deepagents <failed-sandbox-name> rebuild --retire-recovery <transaction-id> --yes

--yes confirms that required data recovery is complete. The command rechecks the old sandbox on the transaction’s recorded gateway, binds cleanup to the exact sandbox and transaction, and removes that transaction’s retained policy handoff and recovery marker. It cannot retire another sandbox or transaction. Retirement does not need the sandbox to still be registered: the printed guidance runs it after nemo-deepagents <failed-sandbox-name> destroy --yes has removed the registry entry, and the command binds to the retained backup record and its recorded gateway instead. On failure, it prints the exact backup path that remains retained; preserve that path and retry only after correcting the reported condition. Keep the remaining backup until it is no longer needed.

If retirement reports that the recovery marker is invalid or unreadable, preserve the printed backup path, marker, and policy handoff. Do not edit the marker JSON or delete either recovery file. If only the marker’s mode or ownership changed, restore mode 0600 and ownership by the current NemoClaw user. Otherwise, restore the exact marker from a trusted backup of the same backup directory. Then rerun the same retirement command; it rechecks deletion on the recorded gateway before removing the handoff. If no trusted marker is available, preserve the backup and ask a NemoClaw maintainer to inspect it.

A mount-free journal written before NemoClaw bound host-mount identity remains resumable. An older journal for a rebuild with one or more host mounts stops as incompatible, even when the visible mount settings are unchanged, because it cannot prove the original host source identity. Preserve the live sandbox, onboarding session, printed backup, exact error, and the sandbox name, gateway, and journal phase from the Journaled replacement diagnostic. Do not change the target settings, edit the session, or delete the same-name sandbox. Ask a NemoClaw maintainer to review that retained recovery state before taking another recovery action.

An accepted replacement is not deleted again.

The command reports Sandbox '<name>' already holds the replacement from the interrupted rebuild. and preserves the state backup path when one exists. Pass --verbose to include the replacement identifier, OpenShell gateway, and journal phase in rebuild diagnostics.

After the sandbox registry proves the journaled replacement identity and generation, NemoClaw removes an obsolete source image that it owns. It retains the image when the source is shared or the registered replacement reuses it. If image removal fails, NemoClaw keeps the accepted replacement and tells you to run nemo-deepagents gc for cleanup.

NemoClaw fails closed when the selected gateway, replacement settings, durable source registry fields, or live source or target identity no longer matches the journal. The error names the sandbox and the mismatch that stopped recovery. Do not delete a same-name sandbox to bypass this check. Inspect the named OpenShell gateway and sandbox, correct the reported drift, and rerun the original command. Visible settings cannot correct the legacy host-mount journal case described above.

A same-name recreation started by nemo-deepagents onboard uses the same replacement journal. If that recreation is interrupted after the Journaled replacement message, rerun the original onboarding command with the same target settings. The active replacement can continue without adding --resume. Use --resume for interrupted onboarding steps that occur before a replacement journal exists.

If the complete native home/workspace cannot be archived, NemoClaw reports the transfer failure and stops before deleting the original sandbox. This fail-closed behavior also applies to rebuild --force; NemoClaw never publishes a partial native-home archive as a restore source. NemoClaw removes failed native-state captures when cleanup succeeds instead of retaining them as incomplete recovery archives. If that cleanup also fails, NemoClaw reports and retains the incomplete backup path. Preserve that path while investigating the reported failure, or remove it only after the failure is resolved and you have confirmed that the original sandbox remains intact. Repair source access, free backup-disk space, or remove credential-bearing content identified by the error, then rerun the rebuild while the original sandbox remains intact.

Forced Rebuild Scope

rebuild --force skips the confirmation prompt. When the sandbox has MCP servers, NemoClaw must read the agent-native MCP source before any destructive step. --force does not bypass an unavailable, unsafe, or conflicting source. NemoClaw rechecks that source-derived bridge snapshot immediately before deletion and stops if the source, target, policy, provider, or recorded gateway changed. The independently captured live OpenShell policy is handed to replacement creation unchanged. NemoClaw sends the delete request and every deletion-confirmation lookup to the sandbox’s exact recorded gateway. Across every rebuild path, NemoClaw does not attempt to stop the local NVIDIA NIM through the delete attempt. Cleanup is attempted on a best-effort basis only after deletion is positively confirmed. After a nonzero delete, an explicit missing result converges as deleted. A Ready or Running result triggers an attempt to restore prepared MCP state. NemoClaw reports any MCP restoration failure and does not present the operation as a successful rollback. Any partial or unreachable result remains ambiguous. NemoClaw preserves the bounded MCP handoff and rebuild-recovery record, does not attempt to stop NIM, and does not claim that the original sandbox is intact. Inspect the live sandbox and gateway state before retrying recovery. This recovery also stops for incomplete MCP adds or ambiguous ownership. An error after a successful no-op does not fall back to the host-side path.

Refer to nemo-deepagents <name> rebuild for flag details.

Use the Canonical Configuration Workflows