Repository navigation
feat: replace an agent's sandbox when its configuration changes - #13375
Merged
Merged
Conversation
Fabric v0.5.0's fabric-agent-ctl starts one agent runtime per sandbox, so a changed agent needs a new sandbox. Prepare for it on the current bridge: - Sandboxes are reconstructible: no prevent_destroy in generated graphs, and the openshell provider no longer refuses their replacement or removal. Durable data belongs on mounted volumes. - fabric_agent replaces on any configuration change, and planning refuses a replacement while its sandbox stays the same, explaining how to replace it. - Generated graphs hold each agent's configuration in a terraform_data that replaces its sandbox through replace_triggered_by. - fabric_agent no longer reports configuration changed inside the sandbox as drift; Fabric reports no applied configuration.
cv
enabled auto-merge (squash)
October 17, 2026 00:22
…acement # Conflicts: # crates/nemoclaw-openshell/src/lifecycle.rs
…acement # Conflicts: # docs/state.md
Contributor
The contract binary gained the sandbox replacement and agent removal tests, and measured 41.1 s summed on linux_arm64 against a 40 s budget.
The binary has grown to 62 tests and measured 197 s summed on linux_amd64 (175 s on linux_arm64) against a 190 s budget; this change adds the sandbox replacement tests.
…t size" This reverts commit 85ed9e8.
This reverts commit 38a231f.
cv
added a commit
that referenced
this pull request
Oct 17, 2026
## Failure Every provider call from OpenTofu took about 40 ms, regardless of the work it did. `tf-provider`, which serves all our providers' gRPC, listens on TCP and never sets `TCP_NODELAY` on accepted connections. So each small reply waits on Nagle's algorithm and OpenTofu's delayed acknowledgment. In the OpenShell contract tests, OpenTofu commands took 223 of 227 seconds: 140 applies at about 1.0 s and 120 plans at about 0.6 s. A trace of one apply shows 24 schema calls and other provider calls, each about 40 ms apart, while the provider's own schema work takes microseconds. Users pay this on every plan, apply, and destroy. The stall also pushed #13375's contract binaries over their CI test-duration budgets. ## Decision Vendor `tf-provider` at its pinned revision under `crates/vendor/tf-provider`, as `openshell-sdk` is, and set `TCP_NODELAY` on each accepted connection (`without_delay` in `src/server.rs`). The root manifest patches `tf-provider` to the copy. `NOTICE.md` records the source revision, the omitted files, and the changes. The fix is also reported upstream in aneoconsulting/tf-provider#21; remove the copy once upstream sets `TCP_NODELAY`. ## Validation - **Regression test:** the new test in the vendored crate (`cargo test --manifest-path crates/vendor/tf-provider/Cargo.toml`) failed against the unchanged behavior and passes with the fix. `cargo ci` doesn't run vendored crates' tests. - **OpenShell contract tests,** run serially: 227 s before, 86.7 s after. - **`cargo ci`** passes locally: 1543 unit tests and 152 lifecycle tests. The lifecycle step took 91 s, against 144 s for a comparable `v1` run.
FabricCatalog::bundled() parsed and checked the 50 KB generated catalog on every call, and every deployment compile reached it. That was about 40% of compiling the objects graph: the test compiling every example's deployment and teardown graphs dropped from 1.17 s to 0.86 s locally, and ran 8.7 s under CI load, over its 8 s budget.
cv
added a commit
that referenced
this pull request
Oct 17, 2026
Part of #13318. Closes #13031. Stacked on #13375; review that first. ## Failure Agent images ran NemoClaw's own Python bridge (`fabric.py`, `backend.py`, and the bridge protocol, about 2,100 lines with tests) between OpenShell and Fabric. Fabric v0.5.0 ships its own sandbox bridge, `fabric-agent-ctl`, so NemoClaw was maintaining a second implementation of Fabric's job. Its health path also made every apply fail at the pinned Fabric, which has no health API (#13031). ## Decision **Images.** `runtime.json`'s command is `/opt/fabric/bin/fabric-agent-ctl`; sandboxes launch `fabric-agent-ctl serve`. NemoClaw's bridge, its tests, and the `io.nemoclaw.fabric.bridge` label are gone. `ADAPTER_PYTHON` stays: Fabric reads it to choose the interpreter for Python adapters. **Dummy reference image.** It now runs Fabric's real runtime and `fabric-agent-ctl`, with a NemoClaw test-only adapter (`image/fabric/test-adapter`) packaged like Fabric's own adapters. Catalogs come from `catalog.py` for every image; an `adapters.json` entry may name the descriptor file of an adapter Fabric's catalog package doesn't publish. **`fabric_agent`.** - *Create:* waits for the sandbox, then `start --config -`, retrying only while `serve` isn't listening yet (`host_unavailable` with no effects). It stores the returned `runtime_id`, replacing the `running` attribute. - *Read:* checks only the sandbox. Fabric reports neither applied configuration nor runtime status (NVIDIA/NeMo-Fabric#420). - *Remove:* `stop --runtime-id`. A runtime already gone counts as stopped. - *`runtime_exists`:* reported with guidance to replace the sandbox. **One runtime per sandbox.** A sandbox runs one runtime in its lifetime. After a stop, or a start that failed or lost its reply, it can't start another. When a plan would create an agent in a sandbox that already exists, the SDK plans again with that sandbox replaced (`-replace`), and the plan shows it. Hand-written HCL users get the guidance instead. **Readiness and health removed.** This covers `fabric_agent_readiness`, `OperationResult.health`, `nemoclaw-backend`'s health types, the CLI's health output, and the plan's "agent runtime is not running" note. Apply now completes once agents start. **Docs.** `design/fabric-management.md` is rewritten around `fabric-agent-ctl`. The provider, usage, SDK, CLI, build, getting-started, Kubernetes and contributor docs are updated. ## Validation - `cargo ci` passes locally: 1530 unit tests, 149 lifecycle tests. - `cargo ci live-docker` passes, 8 tests. This includes the dummy agent's full lifecycle through a managed Docker gateway with a real `fabric-agent-ctl`. - `cargo ci live-kind` passes, 5 tests. - `docker buildx bake check` passes: lint, 15 unit tests, 5 reference tests driving `fabric-agent-ctl`. - `cargo images qualify --lifecycle` passes for the dummy, Pi, Hermes and OpenClaw images: each starts, invokes and stops a runtime, and refuses a second. - `fern check` reports 0 errors. Not run: the Brev, Spark and hosted-parity live tests (hardware). They now expect a completed apply, and their health assertions are removed. ## Follow-ups - Invoking an agent by hand needs its `runtime_id`, which the docs read from OpenTofu state with `jq`. A CLI command to show it, or to invoke, would remove that step. - A read-only runtime status in Fabric would let refresh find a stopped runtime (NVIDIA/NeMo-Fabric#420).
cv
added a commit
that referenced
this pull request
Oct 19, 2026
## Failure `nemoclaw apply` refused any authored change that would replace or remove a bound sandbox, before planning: > apply cannot replace sandbox 'assistant'; its files and conversation history are not separately retained This covered a different harness adapter, sandbox image or network policy, and removing a sandbox from the configuration. The guard (`State::validate_bound_sandboxes`, added in September) predates #13375, which made sandboxes replaceable. It contradicted: - **#13375's design:** a change that needs a new sandbox replaces it, and the plan shows it. - **The docs:** the change-path table in `docs/usage.md` says a harness, image or driver configuration change "replaces the sandbox" and removing a sandbox "deletes it". - **Hand-written HCL,** which replaces sandboxes normally. Only changes to an agent's configuration got through, because they live in a separate target. It surfaced while switching the harness of a running DGX Spark deployment. ## Decision Remove the guard, its error variant and the CLI help text for it. OpenTofu plans the replacement or deletion like any other change, and the existing plan output warns that it "deletes sandbox files and conversation history". Files that must outlive a sandbox belong on mounted volumes (#13425). The unrelated check that keeps an unfinished creation's configuration stays. ## Validation - **Rewritten SDK test (`sandbox_admission`):** removing, re-imaging or re-policing a bound sandbox reaches planning without changing intent or state. It failed before the change with the refusal error. - **Lifecycle tests:** - **`fabric_deployment`:** an adapter change applies, replacing the sandbox, and changing it back replaces it again. - **`remote_service`:** a replacement whose new images fail their checks stops before any change, keeping intent and state. It's renamed from "refused" to "failed". - **The live shared-service test (`shared_service`):** removing one consumer now deletes only that sandbox, leaving the shared model service and the other consumer untouched, and re-adding it creates a new sandbox. It's ignored by default and wasn't run here. - `cargo ci` passes locally: 1,598 unit tests and 149 lifecycle tests.
This was referenced Nov 11, 2026
cv
added a commit
that referenced
this pull request
Nov 11, 2026
Brings the platform guides under `docs/` in line with `v1` at `637bdb6276`: they now name that revision and OpenShell 0.1.7, publish the generated configuration reference instead of a stale snapshot, restore guide text that the reorganization dropped, and correct what they say about policy changes, OpenShell resource schemas, and onboarding. ## Problem The reorganization in #14195 pinned the guides to `86b8d94273` and still describes that revision, 114 commits behind `v1`: - The published "YAML Configuration Reference" is a hand-kept snapshot of the generated reference at `86b8d94273`. It predates the typed application container options (#14166), network middleware bindings, the dropped Deep Agents Code harness, and the multi-GPU fields, and says that `docs/reference/configuration.md` differs from it on three field types. - The guides name OpenShell 0.1.6 and link its `ac7f615` sources, while `versions.json` pins 0.1.7 (`5d25211b`, #14245). #14245 left this for the next refresh of the inspected revision. - #14195 was written at `86b8d94273` and merged after #14186, #14132, and #14166, so it overwrote their guide changes: the `agents` field with each agent's runtime ID, the OIDC sign-in details for a managed Kubernetes gateway, and the application container example. - `docs/security/sandbox-network.md` and `docs/security/security.md` say apply rejects a policy change that needs a new sandbox. Since #13375, a changed sandbox specification, policy included, replaces the sandbox, as the same page's recovery section and `docs/build-deploy/usage.md` already say. - `docs/references/provider.md` says the OpenShell resource schemas are version 1; they're version 2 since #13157. - `docs/references/cli.md` says onboarding needs a verified bundle to read the target; since #12579 it reads the target directly, with no bundle or OpenTofu. - `docs/references/fabric-harnesses.md` says onboarding offers every catalog harness; since #14233 it offers OpenClaw and Hermes, and keeps a template's other harness as the suggestion. - The troubleshooting table lacks the errors that #14141 and #14133 added for retained gateway storage owned by another state directory and a missing kubeconfig context. ## Change - **Revision:** `docs/README.md`, the architecture overview, the container services page, and the first-deployment tutorial and its prerequisites now name `637bdb6276`, with OpenShell 0.1.7 and `5d25211b` from its `versions.json`. Links to NemoClaw sources at the old revision become repository-relative links, and the two test fixtures they named moved to `crates/nemoclaw-e2e/tests/integration/rust/`. - **OpenShell links:** every OpenShell link in these pages moves from `ac7f615` to `5d25211b`. The line ranges for the Docker, Podman, and Kubernetes proxy settings in OpenShell's `configuration.mdx` are recomputed for the new file; they cover the same blocks. - **Field reference:** `fern/pages.json` publishes `docs/reference/configuration.md`, which `cargo run -p nemoclaw-build -- schema` generates and CI checks, and `docs/references/v1-configuration.md` is removed. Links to it, including one in `docs/agents-inference/inference.md` and one in the user-guide skill, point at the generated reference. Refreshing the snapshot instead would keep a hand-copied file that goes stale with the next schema change. - **Restored from #14186:** the tutorial and the headless OpenClaw example in `docs/agents-inference/agents.md` read the runtime ID from `nemoclaw plan -o json` instead of `terraform.tfstate`; `docs/references/cli.md` lists the `agents` field and the **Agents** text; `docs/references/sdk.md` names `agents` in plan and apply results (`OperationResult::agents`). - **Restored from #14132:** the OIDC steps in `docs/build-deploy/kubernetes.md` cite the manual run in #14131 and describe the CLI's `http://127.0.0.1:<port>/callback` redirect and `SSL_CERT_FILE` trust, and the matching row in `docs/resources/limits.md` no longer says the steps never ran. OpenShell 0.1.7's `oidc_auth.rs` still builds that redirect. - **Restored from #14166:** `docs/build-deploy/usage.md` links `examples/application-container.yaml`. - **Policy changes:** both security pages and the change table in `usage.md` say a policy change replaces the sandbox, deleting its files and conversations (except on mounted volumes), the wording of #14141's CLI warning; `openshell_sandbox` has no mutable fields (`crates/openshell-provider/src/lib.rs`). - **Schema version:** `docs/references/provider.md` says version 2, as `crates/openshell-provider/tests/schema.txt` records, and drops the repeated sentence. - **Onboarding:** `docs/references/cli.md` says onboarding reads the target without a bundle (`nemoclaw_onboarding::author`) and that the saved file holds only authored values, a sentence #13978 added to the tutorial before #14195 replaced onboarding there with a copied example. - **Onboarding harnesses and troubleshooting:** `fabric-harnesses.md` names the harnesses onboarding offers and drops a past rehearsal list; the troubleshooting table gains rows for the two errors above, with their messages from `gateway_storage.rs` and `observation.rs`. - **Smaller fixes:** `tls: terminate` and `passthrough` are rejected by OpenShell 0.1.7 (its `l7/mod.rs` is unchanged from 0.1.6); OpenShell 0.1.7 still keeps GPU filesystem additions local to the workload (`boundary_server.rs`); `interfaces.md` points to the prerequisites for the tutorial's OpenShell version; `migration.md` links the onboarding guide; the internal evidence pages record that this change removed the snapshot; the prerequisites table no longer limits non-OpenClaw, non-Deep Agents images to ARM64, which `docker-bake.hcl` and `docs/build-deploy/build.md` contradict. Checked against the code and left unchanged: the Kubernetes namespace binding after #13756 (`operations.rs` binds an existing namespace by UID), agent replacement rules (`fabric-provider/src/agent.rs`), state paths and Fabric adapter pins in `docs/build-deploy/state.md` (`f33fa19a`, as `versions.json`), the harness table and its examples, CLI options against `args.rs`, SDK signatures and timeouts, provider versions, the 32-sandbox and 32-provider limits, the multi-GPU limit (#14384 is open, and `container.gpuDevices` still takes one entry), the compatibility page's state-version error, and the threat model. ## Beyond CI - The first-deployment tutorial hasn't been rerun at `637bdb6276`; its commands were checked against the CLI parser, `examples/openclaw.yaml`, and the result types. - The OIDC `SSL_CERT_FILE` behavior was observed in #14131 with OpenShell 0.1.6 and hasn't been rechecked with 0.1.7.
cv
added a commit
that referenced
this pull request
Nov 11, 2026
Corrects the inference, model, recipe, SSH placement, and limits pages, the inference parts of the provider reference, and the generated configuration reference where they disagree with `v1`, for users who configure managed or external inference. ## Problem An audit of these pages against the commits since `v0.1.0-rc9` and the current code found statements that `v1` contradicts. For example, `inference.md` says a model change restarts the runtime inside the existing sandbox, but a changed agent configuration replaces the sandbox and deletes its files and conversations. Several limits link issues that are resolved or decided, and two describe gaps that CI's live cases now cover. ## Change Each change and what makes it necessary: - **Sandbox replacement** (`inference.md`, twice): a model, settings, or image change replaces the agent's sandbox. `compile.rs` sets `replace_triggered_by` on the agent configuration (#13375), and `usage.md`'s change path already says so. - **Default memory limit** (`inference.md`, `ServiceContainer.memoryLimitGiB` doc comment): NemoClaw sets the 104 GiB limit (`DEFAULT_MEMORY_LIMIT_GIB`); Docker has no such default. - **Fields Ollama rejects** (`inference.md`): `kind: ollama` has no `kvCacheGiB`, `batchTokens`, `recipe`, `serving.modelName`, or `authentication`, and its schema objects set `additionalProperties: false`, so a zero value is rejected too; the page said only nonzero values were. - **GPU selection** (`inference.md` managed Ollama prerequisites, `models.md` Nemotron example): a host with several GPUs works when `container.gpuDevices` selects one (#13929). - **Managed Ollama replies** (`inference.md`, `limits.md`): CI's `docker-openclaw-hermes-ollama` live case gets a Hermes reply through managed Ollama with `qwen3:0.6b` on the Linux AMD64 GPU runner, so "GPU inference and agent replies have not been tested" is replaced by what the case covers; tool use and other GPUs stay limits. The Hermes context section now says only what was observed: `Qwen/Qwen3-4B` can't meet Hermes's 64,000-token minimum, and Hermes replied with `qwen3:0.6b` at 32,768 tokens in that case; it no longer states an unverified mechanism. The limits row also covers harnesses other than Hermes. - **Linux AMD64 row removed** (`limits.md`): the hosted live cases reach agent replies on Linux AMD64 on every CI run. - **SSH engines** (`remote-service.md`, `limits.md`): retained-data removal on SSH engines is verified and the Docker procedure covers it (#12640, completed); the SSH capacity collector is a POSIX shell script, not Python (`hardware/ssh.rs`); SSH placement on GPU hardware has no live test (#12641). - **Decided issues** (`inference.md`, `limits.md`): a managed NIM service is not planned, and NIM works as an external endpoint (#12649); network-request approval and policy explanation belong to OpenShell's policy advisor, and `grants` replace presets (#12651), now two rows. The DGX Station rows, whose issues closed for replanning, point to #12641. - **Provider reference** (`provider.md`): `openshell_inference` takes a readiness `ref` as `server` (#13252), so the "until inference registrations take the ref" workaround is gone. Each deployment is one OpenTofu root (#13254, #13286), so the readiness and gateway sections describe one generated graph, in which OpenShell objects wait for every runtime resource and readiness read, instead of separate runtime and OpenShell graphs. Not checking external servers is by design (#13256). - **Plan-time configuration checks** (`agents.md`): #13319 is closed; #14148 tracks checking at plan time. - **Diagnostic limit** (`models.md`, `limits.md`): once a command's OpenTofu diagnostics exceed 16 KiB, the SDK replaces them with `child output exceeds the supported limit` (`process.rs`, #14399), which can hide vLLM's exit excerpt. - **Parser names** (`models.md`): NemoClaw checks only a parser name's form (`PARSER` in `vllm/constraints.rs`); vLLM rejects an unknown parser at startup, and the stop detail carries its error (#14397). - **Several GPUs** (`inference.md`, `models.md`): the statements about several selected GPUs apply once #14384 lifts `container.gpuDevices`'s one-entry limit, and the pages say so. - **Speculative tokens** (`recipes.md`): `serving.speculativeTokens` works only with a recipe and passes `--speculative-config` with the `mtp` method (`arguments.rs`, `vllm/schema.rs`); no guide described it. - **Configuration reference**: the container descriptions mention GPU selection, and the guide links for `ServiceContainer`, `ServiceUpdatePolicy`, the Ollama types, `ExternalOllama`, and `ServiceAuthentication` point to their sections instead of the general usage page. `Overrides.model` names each managed service's served model (`served_model` in `vllm/config.rs`, `services/registry.rs`); it named only vLLM's. The generator's dead `OllamaProxy` arm is removed. Regenerated with `nemoclaw-build schema`. Checked and left unchanged: the recent multi-GPU changes (#14388 to #14401), the vLLM bearer route filter, timeout budgets, profile catalog, memory reserves, hardware profiles, onboarding catalogs, Ollama and vLLM pins, image tags, interface pages, and the OAuth-refresh guide match `v1`. Left for follow-up, because no open issue tracks them: - Limits and `inference.md` sentences link issues closed for replanning with no successor: #12035 (llama.cpp, Model Router, Gemini), #12038 (hosted-provider guides), #12144, #12037, #12137, and #12042. - `agents.md` links #13313 for Hermes not sending API placeholders to MCP servers; #13313 tracked the `api` credential type. - The OpenClaw walkthrough row links #13372, which is fixed; whether the walkthrough was rehearsed afterward is unrecorded.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #13318.
Failure
Fabric v0.5.0's
fabric-agent-ctl, which will replace NemoClaw's own bridge, starts one agent runtime per sandbox: a secondstartfails withruntime_exists, even afterstop. So any change to an agent's configuration needs a new sandbox. NemoClaw instead protected sandboxes from replacement and reconfigured agents in place, so moving tofabric-agent-ctlas things stood would refuse every configuration change.Decision
This prepares for that move on the current bridge, so the switch itself stays small.
prevent_destroyon them, and theopenshellprovider no longer refuses their replacement or removal. Replacing or removing a sandbox deletes its files and conversation history; the plan shows it, and the CLI says so. Data that must survive belongs on a mounted volume (driver_config). The workspace stays retained.fabric_agentreplaces on change. Its configuration sections and description force replacement. A new framework hook,refuse_replacement_when, lets it refuse a replacement while the sandbox's ID stays the same, with a message explaining how to replace the sandbox too.terraform_data.agent_<sandbox>, and its sandbox haslifecycle { replace_triggered_by = [...] }on it. A spike with the bundled OpenTofu showed that triggering on thefabric_agentitself is a dependency cycle, because the agent refers to its sandbox. Theterraform_datawaits for the apply-time gateway check like the objects do, so a failed runtime leaves none behind.fabric_agentno longer reports a configuration changed inside the sandbox as drift. Restoring it would need a new sandbox, andfabric-agent-ctlcan't read a configuration back (fabric-agent-ctl: read-only status command for the owned runtime NeMo-Fabric#420).docs/provider.mdshows theterraform_datapattern, andexamples/hcl/traveluses it. The docs warn that theterraform_datainput must be known at plan time, or every apply replaces the sandbox.Still done in place on the current bridge: restarting a stopped agent. With
fabric-agent-ctlthat will need a new sandbox too, which the switch will handle.Validation
cargo cipasses: 1528 unit tests and 148 lifecycle tests.cargo ci live-dockerpasses all 8 tests.fern checkreports 0 errors.Tests were changed where they encoded the old behavior:
The fake gateway's injected configuration error now affects only
configure, so stopping an agent still succeeds, matching what it simulates.