Skip to content

fix: replace sandboxes that exited - #13493

Merged
cv merged 5 commits into
v1from
fix/replace-exited-sandboxes
Oct 19, 2026
Merged

cv merged 5 commits into
v1from
fix/replace-exited-sandboxes

Conversation

@cv

@cv cv commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

Failure

When OpenShell reports a sandbox in a terminal phase, every refresh failed with sandbox unavailable: SANDBOX_PHASE_ERROR, so the deployment could neither plan nor apply. Only destroying the whole deployment recovered it (#13467).

This happens after any gateway restart: OpenShell restarts its sandboxes, and Fabric's fabric-agent-ctl serve refuses to start again ("Previous runtime cleanup is unconfirmed; replace the sandbox"). A host reboot is enough, and #13473's follow-up makes gateway restarts routine for configuration changes.

Decision

  • The provider records the exit: a terminal phase becomes the sandbox's exited attribute (phase, reason, and exit code), instead of an error.
  • The plan replaces the sandbox: a new resource-framework rule, replace_on_change, plans a replacement when that observation changes. The sandbox's agent runtime is replaced with it.
  • The plan says why: planned changes carry an optional reason, and the CLI prints it under the action, for example sandbox exited: SANDBOX_PHASE_ERROR, reason unknown, exit code 1. The backend's message stays private.
  • Reapplying after a failed start now replaces the failed sandbox rather than refusing without changes. The replacement fails again with the same reason until the cause is fixed.
  • Docs: usage and troubleshooting describe the replacement and its data loss. The whole-deployment procedure remains for a runtime that is unusable while its sandbox runs.

Validation

  • New tests:
    • the framework rule (an_observation_that_asks_for_replacement_plans_one);
    • the provider observation (an_exited_sandbox_is_observed_with_its_exit);
    • the plan reason (a_replaced_exited_sandbox_reports_why);
    • CLI rendering (a_planned_replacement_shows_its_reason).
  • Updated lifecycle tests: plan now proposes the replacement with its reason, and reapply replaces the sandbox.
  • Checks: cargo ci passed, including the bundle and lifecycle steps.
  • Live, on a DGX Spark with a managed Docker gateway and a Deep Agents sandbox:
    • restarting the gateway container left the sandbox in Error;
    • nemoclaw plan showed delete → create for the sandbox and its agent runtime, with the reason above;
    • apply recreated the sandbox, which reached Ready, and the next plan was empty;
    • the deployment was destroyed and its retained objects removed afterwards.

After merge, close #13467 by hand.

cv added 5 commits October 19, 2026 12:10
A sandbox that OpenShell reports in a terminal phase failed every refresh with SANDBOX_PHASE_ERROR, so the deployment could neither plan nor apply; only whole-deployment destroy recovered it. Observe the exit instead, as the sandbox's exited attribute, and plan a replacement of that sandbox. The plan reports why (#13467).
@cv
cv enabled auto-merge (squash) October 19, 2026 19:23
@github-actions

Copy link
Copy Markdown
Contributor

@cv
cv merged commit d065274 into v1 Oct 19, 2026
@cv
cv deleted the fix/replace-exited-sandboxes branch October 19, 2026 19:36
cv added a commit that referenced this pull request Oct 19, 2026
## Failure

An exited sandbox reported `reason unknown` unless OpenShell's condition
reason was one of four codes NemoClaw recognized. After a gateway
restart, the plan from #13493 said `sandbox exited: SANDBOX_PHASE_ERROR,
reason unknown, exit code 1`, although OpenShell reported a specific
reason.

## Decision

- **Pass the reason through:** report OpenShell's reason code as it
reports it, rather than keeping NemoClaw's own list of codes it
recognizes.
- **Keep the message private:** the condition's message can contain
credentials and never crosses. A reason that isn't shaped like a code
(ASCII letters and digits, at most 64 characters) still appears as
`unknown`.
- **Unchanged:** the explanations for `IdentityResolutionFailed` and
`ControlSupervisorStartFailed` remain; other reasons point to `openshell
logs SANDBOX --source sandbox`.

## Validation

- `terminal_sandbox_reports_known_failure_without_backend_text` gained
cases: a reason NemoClaw doesn't explain (`ImagePullBackOff`) passes
through, while text with spaces or hyphens, or longer than 64
characters, doesn't. It failed before the change.
- `cargo ci` passed, including the bundle and lifecycle steps.
cv added a commit that referenced this pull request Oct 19, 2026
…#13497)

## Failure

Managed Docker and Podman gateways kept `gateway.toml` in retained
storage, written once when the deployment was created. Storage compared
it on every refresh, so any change to `spec.gateway.config` from #13492
failed with "gateway storage configuration differs" and needed a fresh
deployment UID. Completes #13473.

## Decision

The file now belongs to the gateway container, and storage holds only
data and credentials.

- **Docker:** the launch data source renders the file, and
`docker_container` uploads it when it creates the gateway container. The
Docker provider replaces a container when its uploads change.
- **Podman:** the provider writes the file into the gateway container
before each start. The Podman gateway resource keeps `gateway_config` as
an attribute, so a change replaces it.
- **Storage** no longer writes or compares the file, and loses the
`gateway_config` attribute, so a configuration change never replaces
storage. Podman observation stops comparing the file too.
- **Docs:** a configuration change replaces the gateway container and
keeps its data. The restarted gateway restarts its sandboxes, where
Fabric agents don't start again, so the next plan replaces them through
#13493.

## Validation

- **Tests:**
  - the compile test checks the upload;
- a new data-source test checks the rendered file and rejection of keys
NemoClaw owns;
- the Podman mutation test checks that the file is written before each
start;
  - the storage tests check that storage never reads it;
  - the lifecycle contract and readiness fixtures follow the new owner.
- **Checks:** `cargo ci` (including the bundle and lifecycle steps),
`cargo ci live-docker` (11 tests), and `cargo ci live-kind` (7 tests)
passed after rebasing onto #13493.
- **Live, on a DGX Spark with a managed Docker gateway and a Deep Agents
sandbox:**
- changing `openshell.gateway.log_level` planned only `delete → create`
of the gateway container;
- the new container's file had the new level, and the gateway's data was
kept;
- the sandbox then exited, and the next plan replaced it with its
reason;
- after apply the sandbox was `Ready` and the following plan was empty;
  - the deployment was destroyed and its objects removed.
- **Not run live:** the Podman path.

After merge, close #13473 by hand.
cv added a commit that referenced this pull request Oct 19, 2026
)

## Failure

After any gateway restart, Fabric's `fabric-agent-ctl serve` refuses to
start in the restarted sandbox (`cleanup_unconfirmed`), so NemoClaw
replaces the sandbox, deleting its files and conversation history
(#13493). `docs/limits.md` didn't list this gap, which is Fabric's to
fix.

## Decision

Add it to the Inference limits beside NeMo-Fabric#420, linking
NVIDIA/NeMo-Fabric#437, the replacement procedure, and the gateway
configuration section.

## Validation

`fern check` and `git diff --check` passed. Docs only.
@wscurran wscurran added area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery bug-fix PR fixes a bug or regression v1 NemoClaw v1 branch labels Oct 23, 2026
@cv cv added this to the Roadmap: GTC DC 2026 milestone Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery bug-fix PR fixes a bug or regression v1 NemoClaw v1 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants