diff --git a/.agents/skills/verify-fabric-boundary/features/lifecycle-and-retention.md b/.agents/skills/verify-fabric-boundary/features/lifecycle-and-retention.md index 1cc4b2eec52..e14d87e2f78 100644 --- a/.agents/skills/verify-fabric-boundary/features/lifecycle-and-retention.md +++ b/.agents/skills/verify-fabric-boundary/features/lifecycle-and-retention.md @@ -55,7 +55,7 @@ Each transition uses steps 3, 4, and 5 around its own commands. Result: two `match` lines, `skill read exit 0`, and the mounts name `$WORKSPACE_VOLUME` at `/sandbox/workspace` and `$ARTIFACTS_VOLUME` at `/sandbox/artifacts`. A missing or changed marker, or a missing skill, is Failed. Changed skill bytes alone do not fail retention; keep the snapshot for diagnosis. This check doesn't need the runtime, so run it even when the runtime is unusable. Native discovery, loading, and fresh skill output remain separate checks. - After config change has no `retention` check: for both harnesses, the live `docker-openclaw-hermes-interfaces` scenario replaces the sandbox with a change to only its agent, then reads the workspace and artifacts markers and the supplied skills' hashes from the caller's volumes in the new sandbox ([Agent Interfaces](../../../../internal-docs/contributing/live-tests.md#agent-interfaces)). + After config change has no `retention` check: for both harnesses, the live `docker-openclaw-hermes-interfaces` scenario replaces each harness's sandbox with a change to its agent's instructions, then reads the workspace and artifacts markers and the supplied skills' hashes from the caller's volumes in the new sandbox ([Agent Interfaces](../../../../internal-docs/contributing/live-tests.md#agent-interfaces)). 3. **Before a transition:** set `PHASE` to the transition's directory and `CASE` to its check, then record what it should keep or replace: ```sh diff --git a/crates/nemoclaw-e2e/tests/e2e/hcl/tests/docker-openclaw-hermes-interfaces.tftest.hcl b/crates/nemoclaw-e2e/tests/e2e/hcl/tests/docker-openclaw-hermes-interfaces.tftest.hcl index 3b7e67ca128..8dcf9adc420 100644 --- a/crates/nemoclaw-e2e/tests/e2e/hcl/tests/docker-openclaw-hermes-interfaces.tftest.hcl +++ b/crates/nemoclaw-e2e/tests/e2e/hcl/tests/docker-openclaw-hermes-interfaces.tftest.hcl @@ -33,22 +33,21 @@ # write to each skill volume except OpenClaw's read-only one, which refuses # the write with EROFS. # -# Then the hermes sandbox, and after it the claw sandbox, is replaced by a -# change to only its agent's instructions, as a person edits the document; the -# sibling's binding stays as it was and it keeps answering. Before the first -# change, apply records each sandbox's ID and its agent's runtime ID, the -# agent's user writes a marker in its workspace and artifacts volumes, each -# sandbox reads its supplied skills' hashes, each agent answers through -# Fabric from its recorded runtime, and a plan has no changes. After each -# change, the target's state names a new sandbox and runtime, and its agent -# answers from that runtime with the stub's reply, which names the skills it -# found again and the changed instructions. Its interface answers through the -# forward and token file that the change's apply reports, and the gateway no -# longer lists the old sandbox, whose runtime went with it. In the new -# sandbox, the markers and the skills' hashes are as before, and Hermes's kept -# native home still holds what its first runtime recorded of an earlier -# request. Destroy keeps the caller's volumes, which tofu test removes after -# the case. +# Then one change to the claw and hermes agents' instructions, as a person +# edits the document, replaces both their sandboxes, and hermes-messages's +# binding stays as it was. Before the change, apply records each sandbox's ID +# and its agent's runtime ID, the agent's user writes a marker in each +# workspace and artifacts volume, each sandbox reads its supplied skills' +# hashes, each agent answers through Fabric from its recorded runtime, and a +# plan has no changes. After the change, state names a new sandbox and +# runtime for each changed agent, and every agent answers from its recorded +# runtime, a changed one with the stub's reply naming the skills it found +# again and the changed instructions. Their interfaces answer through the +# forwards and token files that the change's apply reports, and the gateway +# no longer lists the old sandboxes, whose runtimes went with them. In the new +# sandboxes, the markers and the skills' hashes are as before, and Hermes's +# kept native home still holds what its first runtime recorded of an earlier +# request. tofu test removes the caller's volumes after the case. # The skills volumes, which a platform provides before apply. The agent images # run agents as 10001:10001 (image/fabric/Dockerfile). OpenClaw's bundled @@ -410,9 +409,11 @@ run "unchanged_plan" { } # Changing an agent's instructions replaces only its sandbox -# (crates/nemoclaw-sdk/src/compile.rs). The stub names the instructions' -# marker, so a reply shows that the runtime which gave it started with them. -run "replace_hermes" { +# (crates/nemoclaw-sdk/src/compile.rs), so one change to both agents' replaces +# both their sandboxes and leaves hermes-messages's as it was. The stub names +# the instructions' marker, so a reply shows that the runtime which gave it +# started with them. +run "replace" { module { source = "./cli" } @@ -420,7 +421,9 @@ run "replace_hermes" { variables { operation = "apply" agent_changes = { - hermes = { instructions = { system = { mode = "replace", content = "Answer as the nemoclaw-instructions-changed agent." } } } + for name in ["claw", "hermes"] : name => { + instructions = { system = { mode = "replace", content = "Answer as the nemoclaw-instructions-changed agent." } } + } } baseline = run.unchanged_plan.baseline } @@ -431,27 +434,27 @@ run "replace_hermes" { } assert { - condition = output.bindings.hermes.sandbox != var.baseline.hermes.sandbox - error_message = "The change did not replace hermes's sandbox." + condition = alltrue([for name in ["claw", "hermes"] : output.bindings[name].sandbox != var.baseline[name].sandbox]) + error_message = "The change did not replace both changed agents' sandboxes." } assert { - condition = output.bindings.hermes.runtime != var.baseline.hermes.runtime - error_message = "hermes's agent still records the runtime from before the change." + condition = alltrue([for name in ["claw", "hermes"] : output.bindings[name].runtime != var.baseline[name].runtime]) + error_message = "A changed agent still records the runtime from before the change." } assert { - condition = output.bindings.hermes.agent_sandbox == output.bindings.hermes.sandbox - error_message = "hermes's agent does not name its new sandbox." + condition = alltrue([for name in ["claw", "hermes"] : output.bindings[name].agent_sandbox == output.bindings[name].sandbox]) + error_message = "A changed agent does not name its new sandbox." } assert { - condition = output.bindings.claw == var.baseline.claw - error_message = "The change to hermes replaced claw's sandbox or restarted its agent." + condition = output.bindings["hermes-messages"] == var.baseline["hermes-messages"] + error_message = "The change replaced hermes-messages's sandbox or restarted its agent." } } -run "replies_after_hermes_replacement" { +run "replies_after_replacement" { module { source = "./verifier" } @@ -462,7 +465,7 @@ run "replies_after_hermes_replacement" { agent = "main" request = "Reply to this NemoClaw live test." response_pointer = "/output/response" - answer = "nemoclaw-stub-reply digest review translate" + answer = "nemoclaw-stub-reply digest instructions review translate" } hermes = { agent = "hermes" @@ -470,6 +473,12 @@ run "replies_after_hermes_replacement" { response_pointer = "/output/response" answer = "nemoclaw-stub-reply instructions notes" } + hermes-messages = { + agent = "hermes-messages" + request = "Reply to this NemoClaw live test." + response_pointer = "/output/response" + answer = "nemoclaw-stub-reply" + } } } @@ -479,20 +488,22 @@ run "replies_after_hermes_replacement" { } } -# Hermes's API server answers with the token in the file that the change's -# apply reports, and its dashboard opens notes again from its volume. -run "access_after_hermes_replacement" { +# Each changed agent's interfaces answer through the port and token file that +# the change's apply reports: Hermes's API server with the new instructions, +# its dashboard opening notes again from its volume, and OpenClaw's Control +# UI. +run "access_after_replacement" { module { source = "./interface" } variables { - connection = run.replace_hermes.result.connection + connection = run.replace.result.connection targets = { api_chat = { sandbox = "hermes" - port = one([for access in run.replace_hermes.result.interfaces : access.port if access.sandbox == "hermes" && access.interface == "api"]) - token_path = one([for access in run.replace_hermes.result.interfaces : access.tokenPath if access.sandbox == "hermes" && access.interface == "api"]) + port = one([for access in run.replace.result.interfaces : access.port if access.sandbox == "hermes" && access.interface == "api"]) + token_path = one([for access in run.replace.result.interfaces : access.tokenPath if access.sandbox == "hermes" && access.interface == "api"]) path = "/v1/chat/completions" body = { model = "hermes-agent" @@ -502,12 +513,19 @@ run "access_after_hermes_replacement" { } dashboard_skill = { sandbox = "hermes" - port = one([for access in run.replace_hermes.result.interfaces : access.port if access.sandbox == "hermes" && access.interface == "dashboard"]) + port = one([for access in run.replace.result.interfaces : access.port if access.sandbox == "hermes" && access.interface == "dashboard"]) token_path = null page_token = "__HERMES_SESSION_TOKEN__" path = "/api/skills/content?name=notes" contains = "\"content\":${jsonencode(run.volume.files["hermes:/sandbox/notes-skill"]["SKILL.md"])},\"path\":\"/sandbox/notes-skill/SKILL.md\"" } + control_ui_config = { + sandbox = "claw" + port = one([for access in run.replace.result.interfaces : access.port if access.sandbox == "claw"]) + token_path = one([for access in run.replace.result.interfaces : access.tokenPath if access.sandbox == "claw"]) + path = "/control-ui-config.json" + contains = "basePath" + } } } @@ -517,23 +535,33 @@ run "access_after_hermes_replacement" { } } -# Read without the agent, in the new sandbox and through the gateway. The +# Read without the agents, in the new sandboxes and through the gateway. The # kept native home is /.fabric/state// # (NeMo Fabric's runtime.keep_state), which Hermes's first runtime wrote the # earlier request into. -run "kept_after_hermes_replacement" { +run "kept_after_replacement" { module { source = "./command" } variables { - connection = run.replace_hermes.result.connection + connection = run.replace.result.connection targets = { + claw_markers = { + sandbox = "claw" + command = ["cat", "/sandbox/workspace/nemoclaw-live-test", "/sandbox/artifacts/nemoclaw-live-test"] + contains = "nemoclaw-live-test\nnemoclaw-live-test\n" + } hermes_markers = { sandbox = "hermes" command = ["cat", "/sandbox/workspace/nemoclaw-live-test", "/sandbox/artifacts/nemoclaw-live-test"] contains = "nemoclaw-live-test\nnemoclaw-live-test\n" } + claw_skill_hashes = { + sandbox = "claw" + command = ["sha256sum", "/sandbox/review-skill/SKILL.md", "/sandbox/skills/digest/SKILL.md", "/sandbox/skills/translate/SKILL.md"] + contains = "${sha256(run.volume.files["claw:/sandbox/review-skill"]["SKILL.md"])} /sandbox/review-skill/SKILL.md\n${sha256(run.volume.files["claw:/sandbox/skills"]["digest/SKILL.md"])} /sandbox/skills/digest/SKILL.md\n${sha256(run.volume.files["claw:/sandbox/skills"]["translate/SKILL.md"])} /sandbox/skills/translate/SKILL.md\n" + } hermes_skill_hashes = { sandbox = "hermes" command = ["sha256sum", "/sandbox/notes-skill/SKILL.md"] @@ -544,139 +572,17 @@ run "kept_after_hermes_replacement" { command = ["grep", "-rlF", "nemoclaw-kept-home-check", "/sandbox/artifacts/.fabric/state/nvidia.fabric.hermes/hermes"] contains = "/sandbox/artifacts/.fabric/state/nvidia.fabric.hermes/hermes/" } - old_hermes_sandbox = { + old_claw_sandbox = { sandbox = null command = ["sandbox", "list", "--ids"] - contains = run.replace_hermes.bindings.hermes.sandbox - excludes = run.replace_hermes.baseline.hermes.sandbox - } - } - } - - assert { - condition = length(output.failed) == 0 - error_message = "failed: ${join(", ", output.failed)}" - } -} - -# The second change keeps Hermes's, so it replaces only OpenClaw's sandbox. -run "replace_claw" { - module { - source = "./cli" - } - - variables { - operation = "apply" - agent_changes = { - hermes = { instructions = { system = { mode = "replace", content = "Answer as the nemoclaw-instructions-changed agent." } } } - claw = { instructions = { system = { mode = "replace", content = "Answer as the nemoclaw-instructions-changed agent." } } } - } - baseline = run.replace_hermes.bindings - } - - assert { - condition = output.exit_code == 0 && output.result.outcome == "succeeded" - error_message = "The change's apply failed: ${output.error}" - } - - assert { - condition = output.bindings.claw.sandbox != var.baseline.claw.sandbox - error_message = "The change did not replace claw's sandbox." - } - - assert { - condition = output.bindings.claw.runtime != var.baseline.claw.runtime - error_message = "claw's agent still records the runtime from before the change." - } - - assert { - condition = output.bindings.claw.agent_sandbox == output.bindings.claw.sandbox - error_message = "claw's agent does not name its new sandbox." - } - - assert { - condition = output.bindings.hermes == var.baseline.hermes - error_message = "The change to claw replaced hermes's sandbox or restarted its agent." - } -} - -run "replies_after_claw_replacement" { - module { - source = "./verifier" - } - - variables { - targets = { - claw = { - agent = "main" - request = "Reply to this NemoClaw live test." - response_pointer = "/output/response" - answer = "nemoclaw-stub-reply digest instructions review translate" - } - hermes = { - agent = "hermes" - request = "Reply to this NemoClaw live test." - response_pointer = "/output/response" - answer = "nemoclaw-stub-reply instructions notes" + contains = run.replace.bindings.claw.sandbox + excludes = run.replace.baseline.claw.sandbox } - } - } - - assert { - condition = length(output.failed) == 0 - error_message = "failed: ${join(", ", output.failed)}" - } -} - -# OpenClaw's Control UI accepts the token in the file that the change's apply -# reports. -run "access_after_claw_replacement" { - module { - source = "./interface" - } - - variables { - connection = run.replace_claw.result.connection - targets = { - control_ui_config = { - sandbox = "claw" - port = one([for access in run.replace_claw.result.interfaces : access.port if access.sandbox == "claw"]) - token_path = one([for access in run.replace_claw.result.interfaces : access.tokenPath if access.sandbox == "claw"]) - path = "/control-ui-config.json" - contains = "basePath" - } - } - } - - assert { - condition = length(output.failed) == 0 - error_message = "failed: ${join(", ", output.failed)}" - } -} - -run "kept_after_claw_replacement" { - module { - source = "./command" - } - - variables { - connection = run.replace_claw.result.connection - targets = { - claw_markers = { - sandbox = "claw" - command = ["cat", "/sandbox/workspace/nemoclaw-live-test", "/sandbox/artifacts/nemoclaw-live-test"] - contains = "nemoclaw-live-test\nnemoclaw-live-test\n" - } - claw_skill_hashes = { - sandbox = "claw" - command = ["sha256sum", "/sandbox/review-skill/SKILL.md", "/sandbox/skills/digest/SKILL.md", "/sandbox/skills/translate/SKILL.md"] - contains = "${sha256(run.volume.files["claw:/sandbox/review-skill"]["SKILL.md"])} /sandbox/review-skill/SKILL.md\n${sha256(run.volume.files["claw:/sandbox/skills"]["digest/SKILL.md"])} /sandbox/skills/digest/SKILL.md\n${sha256(run.volume.files["claw:/sandbox/skills"]["translate/SKILL.md"])} /sandbox/skills/translate/SKILL.md\n" - } - old_claw_sandbox = { + old_hermes_sandbox = { sandbox = null command = ["sandbox", "list", "--ids"] - contains = run.replace_claw.bindings.claw.sandbox - excludes = run.replace_claw.baseline.claw.sandbox + contains = run.replace.bindings.hermes.sandbox + excludes = run.replace.baseline.hermes.sandbox } } } @@ -704,23 +610,3 @@ run "destroy" { error_message = "Destroy failed or retained other resources: ${output.error}" } } - -# A plan of the volumes refreshes them from the engine; a volume that destroy -# removed would have no mountpoint until apply created it again. -run "volumes_after_destroy" { - command = plan - - module { - source = "./volume" - } - - variables { - owner = "10001:10001" - files = run.volume.files - } - - assert { - condition = alltrue([for volume in docker_volume.mounted : volume.mountpoint != ""]) - error_message = "NemoClaw's destroy removed a caller volume." - } -} diff --git a/internal-docs/contributing/live-tests.md b/internal-docs/contributing/live-tests.md index bb047532e21..4b5dd32bd76 100644 --- a/internal-docs/contributing/live-tests.md +++ b/internal-docs/contributing/live-tests.md @@ -124,7 +124,7 @@ Run blocks call these modules: | `docker-openclaw-vllm` | Live / HCL, NVIDIA GPU runner | OpenClaw on a [vLLM model](#generic-models) the deployment serves; any reply. | | `docker-openclaw-vllm-shared` | Live / HCL, NVIDIA GPU runner | Two OpenClaw agents sharing one vLLM model with bearer authentication; any reply from each. | | `docker-openclaw-hermes-ollama` | Live / HCL, NVIDIA GPU runner | OpenClaw on NVIDIA hosted inference, `FOUR`; Hermes on a managed Ollama model, any reply. | -| `docker-openclaw-hermes-interfaces` | `cargo ci live-docker` | OpenClaw's Control UI and Hermes's API server and dashboard through the reported forward and token, and OpenClaw's terminal UI through `openshell sandbox exec --tty`, on a stub model that requires the run's key, with replies that name the skills each harness offers from its mounted volumes, and Hermes's dashboard opening a skill as its volume holds it; a second Hermes agent's API server answering through an `anthropic` provider, which sends the key in `x-api-key`; in OpenClaw's sandbox and the first Hermes sandbox, a writable workspace, skill volumes that are writable or read-only as mounted, and no model key in the environment; in that Hermes sandbox, a pseudo-terminal; in OpenClaw's sandbox, a granted endpoint reached and an undeclared host refused. Then a change to the `hermes` agent's instructions, and after it to the `claw` agent's, replaces only that agent's sandbox: the agent answers from its new runtime, the sibling keeps its binding, and the new sandbox keeps the caller's volumes and, for Hermes, its kept native home ([Agent Interfaces](#agent-interfaces)). | +| `docker-openclaw-hermes-interfaces` | `cargo ci live-docker` | OpenClaw's Control UI and Hermes's API server and dashboard through the reported forward and token, and OpenClaw's terminal UI through `openshell sandbox exec --tty`, on a stub model that requires the run's key, with replies that name the skills each harness offers from its mounted volumes, and Hermes's dashboard opening a skill as its volume holds it; a second Hermes agent's API server answering through an `anthropic` provider, which sends the key in `x-api-key`; in OpenClaw's sandbox and the first Hermes sandbox, a writable workspace, skill volumes that are writable or read-only as mounted, and no model key in the environment; in that Hermes sandbox, a pseudo-terminal; in OpenClaw's sandbox, a granted endpoint reached and an undeclared host refused. Then one change to the `claw` and `hermes` agents' instructions replaces both their sandboxes: each agent answers from its new runtime, `hermes-messages` keeps its binding, and each new sandbox keeps the caller's volumes and, for Hermes, its kept native home ([Agent Interfaces](#agent-interfaces)). | | `docker-dummy` | `cargo ci live-docker` | The [dummy agent](#dummy-agent-lifecycle); its configured reply before and after a redeploy that reuses the gateway's storage, a workspace file on a named volume that survives the destroy and redeploy, and sandbox requests that an external middleware allows, denies, fails on (blocked by the fail-closed binding), or, for an excluded destination, never sees. | | `kind-kubernetes-development` | `cargo ci live-kind` | One agent with the default [kubernetes runtime and development authentication profiles on kind](#kubernetes-gateway-without-the-helm-cli), applied with no `PATH`; it answers with the stub's reply before and after a redeploy that reuses the gateway's storage, and its sandbox's explicit policy lets `python3` reach the stub's `/health` and refuses an undeclared in-cluster address. | | `kind-kubernetes-oidc` | `cargo ci live-kind` | Two agents [on kind](#kubernetes-gateway-without-the-helm-cli) in a namespace with OpenShift's UID range, from a private registry's image, behind a gateway that accepts an existing OIDC issuer's tokens and that the chart's NodePort Service publishes at the node's address; apply goes through the port-forward, and each agent answers the stub's reply through the published address. | @@ -317,14 +317,14 @@ Hermes's browser chat runs its terminal UI in a pseudo-terminal, so one more com The chat itself, behind the dashboard's `/api/pty` WebSocket, is not checked live. Rejected interfaces, refused tokens, a killed dashboard process, and tokens kept out of output and state are integration checks ([#14060](https://github.com/NVIDIA/NemoClaw/issues/14060)). -Next, the `hermes` sandbox, and after it the `claw` sandbox, is replaced by a change to only its agent's `instructions`, which the `tests/e2e/hcl/cli` module applies as a copy of the case's document; a changed agent replaces its sandbox, and the later change keeps the earlier one. -Before the first change, the `command` module also writes a marker in each sandbox's artifacts volume and reads the SHA-256 of each supplied skill; the `tests/e2e/hcl/verifier` module invokes each agent through Fabric, and the answer must come from the runtime that state records. +Next, one change to the `instructions` of the `claw` and `hermes` agents, which the `tests/e2e/hcl/cli` module applies as a copy of the case's document, replaces both their sandboxes; a changed agent replaces its sandbox. +Before the change, the `command` module also writes a marker in each sandbox's artifacts volume and reads the SHA-256 of each supplied skill; the `tests/e2e/hcl/verifier` module invokes each agent through Fabric, and the answer must come from the runtime that state records. A plan must then report no changes. -After each change, the state must record a new sandbox and runtime for the target, its agent must name the new sandbox, and the sibling's sandbox and runtime must be as they were. -The stub also names a marker in the changed instructions, so each target's reply through Fabric must name the instructions with its skills, and the sibling's must not change; Hermes's API server must answer the same way through the port and token file that the change's apply reports, and its dashboard must open `notes` again; OpenClaw's Control UI must accept its newly reported token. -In the new sandbox, the workspace and artifacts markers and the skills' hashes must be as before, and for Hermes, its kept native home, `/sandbox/artifacts/.fabric/state/nvidia.fabric.hermes/hermes`, must still hold the request that its first runtime answered. -`openshell sandbox list --ids` must list the new sandbox and not the old one, whose runtime ran in it. -After destroy, a plan of the `volume` module must still find every caller volume; `tofu test` then removes them. +After the change, the state must record a new sandbox and runtime for each changed agent, each such agent must name its new sandbox, and the sandbox and runtime of `hermes-messages`, whose agent didn't change, must be as they were. +The stub also names a marker in the changed instructions, so each changed agent's reply through Fabric must name the instructions with its skills, and `hermes-messages` must still answer through Fabric with the stub's reply alone; Hermes's API server must answer the same way through the port and token file that the change's apply reports, and its dashboard must open `notes` again; OpenClaw's Control UI must accept its newly reported token. +In each new sandbox, the workspace and artifacts markers and the skills' hashes must be as before, and for Hermes, its kept native home, `/sandbox/artifacts/.fabric/state/nvidia.fabric.hermes/hermes`, must still hold the request that its first runtime answered. +`openshell sandbox list --ids` must list each new sandbox and not the old one, whose runtime ran in it. +`tofu test` removes the caller's volumes after the case; `docker-dummy` checks that destroy keeps a caller's volume. Conversation continuity after a replacement is out of scope ([#14495](https://github.com/NVIDIA/NemoClaw/issues/14495)), and a skill that Hermes creates through its native file tools isn't checked yet ([#14289](https://github.com/NVIDIA/NemoClaw/issues/14289)). The SDK, contract, and integration suites own the rest: which changes replace a sandbox, plan and apply agreement, the order in which the old runtime stops and the new one starts, and an unchanged apply after a replacement ([#14290](https://github.com/NVIDIA/NemoClaw/issues/14290)).