From 89f469b01b5b6dd55e55a208059e79cb4739341b Mon Sep 17 00:00:00 2001 From: Apurv Kumaria Date: Thu, 6 Aug 2026 20:45:49 -0700 Subject: [PATCH 01/18] feat(openshell): upgrade managed runtime to v0.0.99 Signed-off-by: Apurv Kumaria --- .github/workflows/e2e.yaml | 26 ++-- agents/hermes/Dockerfile | 6 +- agents/hermes/mcp-config-transaction.py | 4 +- docs/deployment/set-up-mcp-bridge.mdx | 26 ++-- docs/manage-sandboxes/add-mcp-server.mdx | 8 +- docs/reference/commands.mdx | 12 +- docs/reference/configure-runtime-identity.mdx | 2 +- docs/reference/troubleshoot-mcp-servers.mdx | 2 +- docs/reference/troubleshooting.mdx | 4 +- docs/security/best-practices.mdx | 4 +- .../openshell-0.0.99-migration-review.md | 139 ++++++++++++++++++ nemoclaw-blueprint/blueprint.yaml | 4 +- scripts/brev-launchable-ci-cpu.sh | 10 +- scripts/install-openshell.sh | 50 +++---- scripts/update-hermes-agent.sh | 2 +- .../mcp-bridge-input-validation.test.ts | 2 +- .../actions/sandbox/mcp-bridge-validation.ts | 2 +- ...ell-child-visible-credentials.v0.0.99.json | 109 ++++++++++++++ .../docker-driver-gateway-runtime.test.ts | 12 +- .../onboard/docker-driver-gateway-runtime.ts | 2 +- src/lib/onboard/docker-gpu-patch-types.ts | 1 + .../onboard/openshell-feature-gate.test.ts | 12 +- src/lib/onboard/openshell-feature-gate.ts | 6 +- src/lib/onboard/openshell-install.test.ts | 4 +- src/lib/onboard/openshell-install.ts | 2 +- src/lib/onboard/openshell-version.ts | 2 +- test/brev-launchable-ci-cpu-checksum.test.ts | 10 +- test/candidate-compat.test.ts | 2 +- test/deepagents-mcp-legacy-lifecycle.test.ts | 2 +- test/e2e/live/network-policy.test.ts | 2 +- .../openclaw-plugin-runtime-exdev.test.ts | 4 +- ...ll-gateway-auth-source-contract-helpers.ts | 2 +- ...shell-gateway-auth-source-contract.test.ts | 2 +- .../live/openshell-gateway-upgrade.test.ts | 2 +- test/fixtures/openshell-v0.0.99 | 8 + test/hermes-doctor-config-hash.test.ts | 2 +- test/hermes-final-image-layout.test.ts | 2 +- ...s-mcp-credential-boundary-manifest.test.ts | 4 +- test/install-openshell-version-check.test.ts | 46 +++--- test/mcp-add-crash-consistency.test.ts | 2 +- test/mcp-destroy-lifecycle.test.ts | 2 +- test/mcp-openshell-workflow.test.ts | 2 +- test/mcp-policy-key-ownership.test.ts | 4 +- test/mcp-restart-policy-order.test.ts | 2 +- .../openshell-0.0.99-migration-review.test.ts | 55 +++++++ test/openshell-channel-workflow.test.ts | 4 +- test/pr-workflow-contract.test.ts | 2 +- test/sandbox-provisioning.test.ts | 2 +- test/sandbox-rlimit-hooks.test.ts | 4 +- test/update-hermes-agent-script.test.ts | 4 +- tools/e2e/mcp-workflow-boundary.mts | 12 +- 51 files changed, 473 insertions(+), 163 deletions(-) create mode 100644 docs/security/openshell-0.0.99-migration-review.md create mode 100644 src/lib/actions/sandbox/openshell-child-visible-credentials.v0.0.99.json create mode 100755 test/fixtures/openshell-v0.0.99 create mode 100644 test/openshell-0.0.99-migration-review.test.ts diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 1c0e06319fd..78fe289419c 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -994,7 +994,7 @@ jobs: E2E_ARTIFACT_DIR: ${{ github.workspace }}/e2e-artifacts/live/openshell-gateway-auth-contract NEMOCLAW_RUN_LIVE_E2E: "1" NEMOCLAW_NON_INTERACTIVE: "1" - NEMOCLAW_OPENSHELL_PIN_VERSION: "0.0.85" + NEMOCLAW_OPENSHELL_PIN_VERSION: "0.0.99" DOCKER_GRPC_PROBE_IMAGE: "node:22-trixie-slim@sha256:e6d9a389d34ff9678438af985c9913fbd1eb6ed36e80fea56644f4b4f6dd70ba" steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -1079,7 +1079,7 @@ jobs: NEMOCLAW_OPENSHELL_CHANNEL: stable NEMOCLAW_OPENSHELL_EXACT_MAIN_PROOF: "1" NEMOCLAW_RUN_LIVE_E2E: "1" - OPENSHELL_DOCKER_SUPERVISOR_IMAGE: ghcr.io/nvidia/openshell/supervisor@sha256:f4226253a3525c3832adac5b38b419a0f27d1e915effe565b5885e20f93cd5e9 + OPENSHELL_DOCKER_SUPERVISOR_IMAGE: ghcr.io/nvidia/openshell/supervisor@sha256:ea3632b6e9528e2309103af5b6949606fcdc83ca1f69e8db81482a25bea84bb6 steps: - id: trusted_hermes_swap name: Provision trusted Hermes E2E swap @@ -1332,12 +1332,12 @@ jobs: jq -n '{ schemaVersion: 1, sourceRepository: "NVIDIA/OpenShell", - releaseTag: "v0.0.85", - sourceSha: "3dee5570a46076a57a3b056f35f35ebc0861ac85", + releaseTag: "v0.0.99", + sourceSha: "8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032", artifacts: { - cli: {binarySha256: "222d9d53a142691d7a7de2c692f38e52d24066f9f633d53746c5fef775861bc8"}, - gateway: {binarySha256: "33bb479d936c3c1b17dd475df05747be9de74564fb67d69a4c33cdd01181d02f"}, - standaloneSandbox: {binarySha256: "863ef21ab7ef623f5e7a8728c4e5532b46bfbae3ace3b800665a1c6353a1f7d2"} + cli: {binarySha256: "5c0dabb90152a3cfae9005731771da99f00a22403080c81952c7be8ba4b5728f"}, + gateway: {binarySha256: "05bd6c982dd72b73364b91ab694487c026bc56d0cd869f4289b44cc392a5c2ba"}, + standaloneSandbox: {binarySha256: "a4b0c38ed90a6dd4b4f312ad3727824a25ec478d88d4e65d22a82377b18e6214"} } }' > "$E2E_ARTIFACT_DIR/mcp-bridge-deepagents/openshell-exact-main-provenance.json" fi @@ -1401,7 +1401,7 @@ jobs: NEMOCLAW_OPENSHELL_CHANNEL: stable NEMOCLAW_OPENSHELL_EXACT_MAIN_PROOF: "1" NEMOCLAW_RUN_LIVE_E2E: "1" - OPENSHELL_DOCKER_SUPERVISOR_IMAGE: ghcr.io/nvidia/openshell/supervisor@sha256:f4226253a3525c3832adac5b38b419a0f27d1e915effe565b5885e20f93cd5e9 + OPENSHELL_DOCKER_SUPERVISOR_IMAGE: ghcr.io/nvidia/openshell/supervisor@sha256:ea3632b6e9528e2309103af5b6949606fcdc83ca1f69e8db81482a25bea84bb6 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: @@ -1453,12 +1453,12 @@ jobs: jq -n '{ schemaVersion: 1, sourceRepository: "NVIDIA/OpenShell", - releaseTag: "v0.0.85", - sourceSha: "3dee5570a46076a57a3b056f35f35ebc0861ac85", + releaseTag: "v0.0.99", + sourceSha: "8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032", artifacts: { - cli: {binarySha256: "222d9d53a142691d7a7de2c692f38e52d24066f9f633d53746c5fef775861bc8"}, - gateway: {binarySha256: "33bb479d936c3c1b17dd475df05747be9de74564fb67d69a4c33cdd01181d02f"}, - standaloneSandbox: {binarySha256: "863ef21ab7ef623f5e7a8728c4e5532b46bfbae3ace3b800665a1c6353a1f7d2"} + cli: {binarySha256: "5c0dabb90152a3cfae9005731771da99f00a22403080c81952c7be8ba4b5728f"}, + gateway: {binarySha256: "05bd6c982dd72b73364b91ab694487c026bc56d0cd869f4289b44cc392a5c2ba"}, + standaloneSandbox: {binarySha256: "a4b0c38ed90a6dd4b4f312ad3727824a25ec478d88d4e65d22a82377b18e6214"} } }' > "$E2E_ARTIFACT_DIR/openshell-credential-generation-window/openshell-exact-main-provenance.json" diff --git a/agents/hermes/Dockerfile b/agents/hermes/Dockerfile index ee4320830d3..212d187509e 100644 --- a/agents/hermes/Dockerfile +++ b/agents/hermes/Dockerfile @@ -133,7 +133,7 @@ COPY agents/hermes/finalize-tirith-marker.py /usr/local/lib/nemoclaw/finalize-ti COPY agents/hermes/build-mcp-digest.py /usr/local/lib/nemoclaw/build-hermes-mcp-digest.py COPY agents/hermes/mcp-config-transaction.py /usr/local/lib/nemoclaw/hermes-mcp-config-transaction.py COPY agents/hermes/cron-restore-control.py /usr/local/lib/nemoclaw/hermes-cron-restore-control.py -COPY src/lib/actions/sandbox/openshell-child-visible-credentials.v0.0.85.json /usr/local/lib/nemoclaw/openshell-child-visible-credentials.v0.0.85.json +COPY src/lib/actions/sandbox/openshell-child-visible-credentials.v0.0.99.json /usr/local/lib/nemoclaw/openshell-child-visible-credentials.v0.0.99.json COPY scripts/state-dir-guard.py /usr/local/lib/nemoclaw/state-dir-guard.py COPY agents/hermes/state-lock-plan.json /usr/local/share/nemoclaw/state-lock-plan.json COPY nemoclaw-blueprint/scripts/*.js /usr/local/lib/nemoclaw/preloads/ @@ -362,12 +362,12 @@ RUN chmod -R a+rX /opt/nemoclaw-blueprint/ # minimum supported Hermes sandbox base tag guarantees those artifacts and # test/sandbox-rlimit-hooks.test.ts covers that base. RUN chmod 755 /usr/local/bin/nemoclaw-start /usr/local/bin/nemoclaw-managed-startup-hold /usr/local/bin/nemoclaw-managed-bootstrap /usr/local/lib/nemoclaw/sandbox-init.sh /usr/local/lib/nemoclaw/validate-hermes-env-secret-boundary.py /usr/local/lib/nemoclaw/patch-hermes-session-list-preview.py /usr/local/lib/nemoclaw/patch-hermes-discord-recovery-permissions.py /usr/local/lib/nemoclaw/patch-hermes-profile-policy-defaults.py /usr/local/lib/nemoclaw/seed-hermes-dashboard-config.py /usr/local/lib/nemoclaw/hermes-runtime-config-guard.py /usr/local/lib/nemoclaw/finalize-tirith-marker.py /usr/local/lib/nemoclaw/hermes-mcp-config-transaction.py \ - && chown root:root /usr/local/bin/nemoclaw-gateway-control /usr/local/lib/nemoclaw/gateway-supervisor.sh /usr/local/lib/nemoclaw/state-dir-guard.py /usr/local/share/nemoclaw/state-lock-plan.json /usr/local/lib/nemoclaw/managed-gateway-control.py /usr/local/lib/nemoclaw/build-hermes-mcp-digest.py /usr/local/lib/nemoclaw/hermes-cron-restore-control.py /usr/local/lib/nemoclaw/openshell-child-visible-credentials.v0.0.85.json \ + && chown root:root /usr/local/bin/nemoclaw-gateway-control /usr/local/lib/nemoclaw/gateway-supervisor.sh /usr/local/lib/nemoclaw/state-dir-guard.py /usr/local/share/nemoclaw/state-lock-plan.json /usr/local/lib/nemoclaw/managed-gateway-control.py /usr/local/lib/nemoclaw/build-hermes-mcp-digest.py /usr/local/lib/nemoclaw/hermes-cron-restore-control.py /usr/local/lib/nemoclaw/openshell-child-visible-credentials.v0.0.99.json \ && chmod 700 /usr/local/bin/nemoclaw-gateway-control /usr/local/lib/nemoclaw/hermes-cron-restore-control.py \ && chmod 500 /usr/local/lib/nemoclaw/state-dir-guard.py /usr/local/lib/nemoclaw/managed-gateway-control.py \ && chmod 444 /usr/local/lib/nemoclaw/entrypoint-env-wrapper.sh /usr/local/share/nemoclaw/state-lock-plan.json /usr/local/lib/nemoclaw/gateway-supervisor.sh /usr/local/lib/nemoclaw/build-hermes-mcp-digest.py /usr/local/lib/nemoclaw/managed_policy.py \ && chmod 444 /usr/local/lib/nemoclaw/patch-hermes-langfuse-credentials.mts \ - && chmod 444 /usr/local/lib/nemoclaw/openshell-child-visible-credentials.v0.0.85.json \ + && chmod 444 /usr/local/lib/nemoclaw/openshell-child-visible-credentials.v0.0.99.json \ && if [ -d /usr/local/lib/nemoclaw/preloads ]; then \ chown -R 0:0 /usr/local/lib/nemoclaw/preloads \ && find /usr/local/lib/nemoclaw/preloads -type f -exec chmod 444 {} + \ diff --git a/agents/hermes/mcp-config-transaction.py b/agents/hermes/mcp-config-transaction.py index 9244a7dc4f3..a0b43d06fef 100755 --- a/agents/hermes/mcp-config-transaction.py +++ b/agents/hermes/mcp-config-transaction.py @@ -59,7 +59,7 @@ r"^Bearer openshell:resolve:env:([A-Za-z_][A-Za-z0-9_]{0,127})$" ) OPENSHELL_REVISIONED_CREDENTIAL_NAME_RE = re.compile(r"^v[0-9]+_[A-Za-z0-9_]+$") -BOUNDARY_MANIFEST_NAME = "openshell-child-visible-credentials.v0.0.85.json" +BOUNDARY_MANIFEST_NAME = "openshell-child-visible-credentials.v0.0.99.json" ANSI_ESCAPE_RE = re.compile( r"\x1b(?:\[[0-?]*[ -/]*[@-~]|\][^\x07]*(?:\x07|\x1b\\)|[@-_])" ) @@ -146,7 +146,7 @@ def _load_credential_boundary_manifest() -> dict[str, object]: manifest = json.loads(manifest_path.read_text(encoding="utf-8")) if ( not isinstance(manifest, dict) - or manifest.get("openshellVersion") != "0.0.85" + or manifest.get("openshellVersion") != "0.0.99" ): raise RuntimeError("Hermes MCP credential boundary manifest is invalid") return manifest diff --git a/docs/deployment/set-up-mcp-bridge.mdx b/docs/deployment/set-up-mcp-bridge.mdx index 06c270ecb95..0a26a797a16 100644 --- a/docs/deployment/set-up-mcp-bridge.mdx +++ b/docs/deployment/set-up-mcp-bridge.mdx @@ -29,7 +29,7 @@ The integration has three parts: This integration depends on the OpenShell MCP/JSON-RPC L7 policy support from [NVIDIA/OpenShell#1865](https://github.com/NVIDIA/OpenShell/pull/1865). -Current NemoClaw builds default to the pinned stable OpenShell `0.0.85` release, which exposes native `protocol: mcp` policy handling and provider-backed credential replacement. +Current NemoClaw builds default to the pinned stable OpenShell `0.0.99` release, which exposes native `protocol: mcp` policy handling and provider-backed credential replacement. The optional OpenShell development channel is compatibility evidence only and is not a shipping target. NemoClaw accepts Streamable HTTP MCP endpoints only. @@ -69,34 +69,32 @@ NemoClaw accepts canonical HTTPS MCP URLs and writes the credential placeholder ### DNS Pinning Contract -The MCP integration pins its OpenShell DNS enforcement contract to [`NVIDIA/OpenShell@3dee5570a46076a57a3b056f35f35ebc0861ac85`](https://github.com/NVIDIA/OpenShell/tree/3dee5570a46076a57a3b056f35f35ebc0861ac85). +The MCP integration pins its OpenShell DNS enforcement contract to [`NVIDIA/OpenShell@8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032`](https://github.com/NVIDIA/OpenShell/tree/8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032). OpenShell uses one socket-address list throughout resolution, validation, and connection: -- [`crates/openshell-supervisor-network/src/proxy.rs:2648-2674`](https://github.com/NVIDIA/OpenShell/blob/3dee5570a46076a57a3b056f35f35ebc0861ac85/crates/openshell-supervisor-network/src/proxy.rs#L2648-L2674) produces the list. -- [`crates/openshell-supervisor-network/src/proxy.rs:2699-2739`](https://github.com/NVIDIA/OpenShell/blob/3dee5570a46076a57a3b056f35f35ebc0861ac85/crates/openshell-supervisor-network/src/proxy.rs#L2699-L2739) validates every address. -- [`crates/openshell-supervisor-network/src/proxy.rs:2794-2803`](https://github.com/NVIDIA/OpenShell/blob/3dee5570a46076a57a3b056f35f35ebc0861ac85/crates/openshell-supervisor-network/src/proxy.rs#L2794-L2803) returns the validated list unchanged. +- [`crates/openshell-supervisor-network/src/proxy.rs:3030-3055`](https://github.com/NVIDIA/OpenShell/blob/8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032/crates/openshell-supervisor-network/src/proxy.rs#L3030-L3055) produces the list. +- [`crates/openshell-supervisor-network/src/proxy.rs:3060-3115`](https://github.com/NVIDIA/OpenShell/blob/8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032/crates/openshell-supervisor-network/src/proxy.rs#L3060-L3115) validates every address. +- [`crates/openshell-supervisor-network/src/proxy.rs:3130-3211`](https://github.com/NVIDIA/OpenShell/blob/8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032/crates/openshell-supervisor-network/src/proxy.rs#L3130-L3211) connects through the validated list. -The CONNECT path passes that list directly to [`TcpStream::connect` at `crates/openshell-supervisor-network/src/proxy.rs:1079-1081`](https://github.com/NVIDIA/OpenShell/blob/3dee5570a46076a57a3b056f35f35ebc0861ac85/crates/openshell-supervisor-network/src/proxy.rs#L1079-L1081). -The explicit HTTP-forward path carries the same list from [`crates/openshell-supervisor-network/src/proxy.rs:4093-4100`](https://github.com/NVIDIA/OpenShell/blob/3dee5570a46076a57a3b056f35f35ebc0861ac85/crates/openshell-supervisor-network/src/proxy.rs#L4093-L4100) to [`crates/openshell-supervisor-network/src/proxy.rs:4340-4342`](https://github.com/NVIDIA/OpenShell/blob/3dee5570a46076a57a3b056f35f35ebc0861ac85/crates/openshell-supervisor-network/src/proxy.rs#L4340-L4342). +The CONNECT path passes that validated connector to the direct or operator-configured upstream dial path. +The explicit HTTP-forward path carries the same connector from [`crates/openshell-supervisor-network/src/proxy.rs:4650-4656`](https://github.com/NVIDIA/OpenShell/blob/8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032/crates/openshell-supervisor-network/src/proxy.rs#L4650-L4656) to [`crates/openshell-supervisor-network/src/proxy.rs:4697-4705`](https://github.com/NVIDIA/OpenShell/blob/8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032/crates/openshell-supervisor-network/src/proxy.rs#L4697-L4705). There is no second hostname resolution between validation and connection in either path. -### Stable OpenShell 0.0.85 Limitations +### Stable OpenShell 0.0.99 Limitations -OpenShell v0.0.85 attributes network policy with `/proc//exe` and process ancestors, so script-based adapters require Node or Python interpreter grants rather than immutable package-entrypoint identities. +OpenShell v0.0.99 attributes network policy with `/proc//exe` and process ancestors, so script-based adapters require Node or Python interpreter grants rather than immutable package-entrypoint identities. NemoClaw compensates with an exact HTTPS destination, path, MCP method profile, DNS pins, and a unique least-privilege credential for each server. Remove the interpreter grants when OpenShell exposes stable script or package entrypoint attribution. -OpenShell v0.0.85 attaches static provider credentials at sandbox scope rather than reserving a credential key exclusively for one endpoint. -It also does not expose an immutable provider binding on an attachment, provide a `tls: require` policy mode, bind the HTTP `Host` header to the policy destination, or include query parameters in MCP path matching. +OpenShell v0.0.99 attaches static provider credentials at sandbox scope rather than reserving a credential key exclusively for one endpoint. +It also does not expose an immutable provider binding on an attachment. NemoClaw rejects credential-key reuse between managed MCP servers, creates a dedicated provider for each definition, reports the residual risk in `status`, and requires a unique least-privilege token and environment key. Do not grant a broader inspected-HTTP route to the same adapter runtime because that route could resolve the sandbox-scoped placeholder. -The generated configuration uses the canonical HTTPS URL, but malicious code running as an allowed interpreter can deliberately change the scheme, `Host` header, or query string within the supported OpenShell policy contract. - -OpenShell v0.0.85 updates, attaches, detaches, and deletes providers by mutable name instead of an atomic immutable identity. +OpenShell v0.0.99 updates, attaches, detaches, and deletes providers by mutable name instead of an atomic immutable identity. NemoClaw compensates with randomized provider names, the per-sandbox lifecycle lock, and immediate ownership checks against the recorded provider ID, type, and credential-key metadata before mutations. NemoClaw fails closed and preserves retryable state when those checks do not match, but the checks do not provide compare-and-swap behavior against another OpenShell client. diff --git a/docs/manage-sandboxes/add-mcp-server.mdx b/docs/manage-sandboxes/add-mcp-server.mdx index e15dc0c3fe4..29a19822548 100644 --- a/docs/manage-sandboxes/add-mcp-server.mdx +++ b/docs/manage-sandboxes/add-mcp-server.mdx @@ -71,7 +71,7 @@ Bind the proxy to the exact private interface instead of every host interface. NemoClaw preserves the URL hostname for TLS Server Name Indication and certificate validation. A direct private IPv4 URL requires a certificate with the matching IP subject alternative name. Use a DNS hostname for an IPv6 unique local address. -OpenShell `v0.0.85` cannot safely represent a direct IPv6 literal as a proxy target, so NemoClaw rejects that URL form. +NemoClaw has not qualified direct IPv6-literal MCP URLs and rejects that URL form. Direct `127.0.0.1`, `::1`, and hostnames that resolve to loopback remain rejected. Sandbox loopback is not the host service, and trusted-private admission does not create a route to it. @@ -126,7 +126,7 @@ Do not reuse OpenShell Google Cloud compatibility names such as `GCP_PROJECT_ID` NemoClaw rejects them because OpenShell exposes those non-secret configuration names as child-process values. It also rejects `GCE_METADATA_HOST`, `GCE_METADATA_IP`, and `METADATA_SERVER_DETECTION`, which OpenShell rewrites for its metadata emulator. -NemoClaw pins the child-visible compatibility list to OpenShell `v0.0.85` commit `3dee5570a46076a57a3b056f35f35ebc0861ac85`. +NemoClaw pins the child-visible compatibility list to OpenShell `v0.0.99` commit `8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032`. Review this list with every OpenShell version change. OpenShell reserves credential names matching `v[0-9]+_[A-Za-z0-9_]+` for revisioned placeholders. @@ -169,8 +169,8 @@ Cloudflare Quick Tunnels and other endpoints with rotating address sets are not A named tunnel can stabilize the hostname without stabilizing its exact address set. Use stable private DNS and a routed private HTTPS endpoint when you operate the MCP server locally. -Authenticated MCP rejects `host.openshell.internal`, `host.docker.internal`, and `host.containers.internal` on stable OpenShell `v0.0.85`. -That release has a trusted-gateway branch for one narrow link-local topology, but it does not expose an attested driver gateway address that NemoClaw can pin. +Authenticated MCP rejects `host.openshell.internal`, `host.docker.internal`, and `host.containers.internal`. +OpenShell `v0.0.99` has a trusted-gateway branch for a narrow driver-provided topology, but it does not expose an attested driver gateway address that NemoClaw can pin for this flow. Use a routed HTTPS endpoint on a stable private address instead. ## Understand the Generated Method Profile diff --git a/docs/reference/commands.mdx b/docs/reference/commands.mdx index e94d7476f4c..579f453e97d 100644 --- a/docs/reference/commands.mdx +++ b/docs/reference/commands.mdx @@ -2527,7 +2527,7 @@ Add an MCP Streamable HTTP server to a sandbox. Pass `--url` for the MCP endpoint and the required single `--env KEY` bearer credential for the sandbox-side MCP client. Pass a repeatable `--trusted-private-host ` option to admit an exact RFC1918, CGNAT, or IPv6 unique local destination for the current command. The declaration must equal the normalized host from `--url`. -For managed MCP, use a DNS hostname for an IPv6 unique local address because OpenShell `v0.0.85` cannot represent a direct IPv6 literal proxy target. +For managed MCP, use a DNS hostname for an IPv6 unique local address because NemoClaw has not qualified direct IPv6-literal MCP URLs. You can supply exact hosts through `NEMOCLAW_TRUSTED_PRIVATE_HOSTS` instead, and NemoClaw combines the variable with command options. NemoClaw records the resulting exact trust intent and address pins, so restart, rebuild, and restore do not depend on the ambient environment. NemoClaw registers that credential in an OpenShell provider, installs a generated OpenShell `protocol: mcp` policy for the target endpoint, attaches the provider to the running sandbox, and writes only an `openshell:resolve:env:KEY` placeholder into the agent config. @@ -2538,7 +2538,7 @@ The full URL and path are persisted and displayed, so URLs cannot contain userin Server names must start with a letter and contain at most 64 letters, digits, hyphens, or underscores, and endpoint hostnames must use canonical lowercase DNS labels. NemoClaw rejects invalid names and endpoints before it writes lifecycle state or changes OpenShell resources. NemoClaw generates a narrow `protocol: mcp` policy for the destination, literal path, adapter binaries, pinned addresses, explicit MCP methods, and a 131,072-byte request-body limit. -OpenShell `0.0.85` evaluates that policy before replacing the attached provider placeholder in the allowed request header. +OpenShell `0.0.99` evaluates that policy before replacing the attached provider placeholder in the allowed request header. Static provider placeholders are sandbox-scoped rather than endpoint-exclusive, so do not grant broader inspected-HTTP routes to the same adapter runtime and credential key. The sandbox client connects directly through OpenShell's existing egress path, and NemoClaw does not run a host-side MCP data-plane bridge, proxy, relay, or listener. After the add commits, NemoClaw freshly verifies the exact generated policy, expected provider attachment, recorded provider ID, generic type, valid resource version, and exactly one credential key matching the recorded key. @@ -2673,7 +2673,7 @@ For a v1 image, NemoClaw removes the exact registry-owned entry from the legacy The command fails closed on observed drift. `--force` may remove a modified same-name agent adapter entry, but provider deletion still requires the exact recorded ID, type, and credential key and policy deletion still requires exact owned content. Residuals preserve registry state. -OpenShell `0.0.85` mutates providers by name, so do not concurrently replace a managed provider through another OpenShell client during this command. +OpenShell `0.0.99` mutates providers by name, so do not concurrently replace a managed provider through another OpenShell client during this command. When an interrupted destroy leaves a prepared-only transaction, deletion is not durably confirmed. If the sandbox is still live, run `$$nemoclaw mcp remove --force` with the affected server name. @@ -4072,7 +4072,7 @@ Passthrough commands do not consume flags intended for the downstream command as | Variable | Default | Service | |----------|---------|---------| | `NEMOCLAW_GATEWAY_PORT` | 8080 | OpenShell gateway port | -| `NEMOCLAW_GATEWAY_BIND_ADDRESS` | 127.0.0.1 | The OpenShell gateway uses this bind address; Docker-driver gateways on OpenShell 0.0.85 keep it on loopback while gateway JWT auth is active. | +| `NEMOCLAW_GATEWAY_BIND_ADDRESS` | 127.0.0.1 | The OpenShell gateway uses this bind address. NemoClaw keeps Docker-driver gateways on loopback while gateway JWT auth is active. | | `NEMOCLAW_DASHBOARD_PORT` | 18789 (auto-derived from `CHAT_UI_URL` port if set) | Dashboard or API forward | @@ -4099,7 +4099,7 @@ An externally supervised gateway can use any matching configured port and must b On non-WSL hosts, `NEMOCLAW_OLLAMA_PORT` and `NEMOCLAW_OLLAMA_PROXY_PORT` must be different. If you run Ollama on port 11435, set `NEMOCLAW_OLLAMA_PROXY_PORT` to another free port before onboarding. -`NEMOCLAW_GATEWAY_BIND_ADDRESS` accepts only `127.0.0.1` and `0.0.0.0`, but Docker-driver gateways on OpenShell 0.0.85 reject `0.0.0.0` while gateway JWT auth is active. +`NEMOCLAW_GATEWAY_BIND_ADDRESS` accepts only `127.0.0.1` and `0.0.0.0`, but NemoClaw rejects `0.0.0.0` for Docker-driver gateways while gateway JWT auth is active. Keep the OpenShell gateway on loopback and use `NEMOCLAW_DASHBOARD_BIND` when you need remote browser/API access. @@ -4359,7 +4359,7 @@ Set them before running `$$nemoclaw onboard`. | `NEMOCLAW_SANDBOX_BASE_IMAGE_REFRESH` | `1`, `true`, `yes`, or `on` to enable | Bypasses recorded sandbox base-image resolution metadata during onboarding, recreation, and rebuild. NemoClaw reruns candidate resolution but can still use a compatible image from Docker's local image store. Versioned release candidates that exist locally but fail validation are refreshed from the registry once during normal resolution. This setting does not discard onboarding session state. | | `NEMOCLAW_SANDBOX_BASE_LOCAL_BUILD` | unset or `auto` (default); `1`, `true`, `yes`, or `on` to enable; `0`, `false`, `no`, or `off` to disable | Controls whether base-image resolution may build a compatible image locally. The default allows builds during normal CLI runs and disables them when `NODE_ENV=test` or `VITEST=true`. When source inputs or a missing/incompatible release-version base require a fresh build, disabling local builds makes resolution fail instead of using an unproven image. | | `NEMOCLAW_DOCKER_GPU_PATCH` | unset, `auto`, `fallback`, `1`, or `0`; other legacy nonzero values remain accepted through `v0.0.x` and will be removed in `v0.1.0` | Selects Linux Docker-driver GPU routing. Unset, `auto`, or `0` uses native OpenShell GPU injection on ordinary native Linux. `fallback` explicitly opts into one native attempt followed by one bounded compatibility retry when trusted host evidence identifies a GPU-routing failure. `1` and legacy nonzero values select the compatibility patch from the outset. Docker Desktop WSL and Jetson/Tegra use the compatibility path by default; Docker Desktop WSL ignores `0`, while Jetson/Tegra accepts `0` only as a troubleshooting override that bypasses device-group propagation. | -| `NEMOCLAW_OPENSHELL_GATEWAY_CONTAINER_PATCH` | `1` to enable; disabled by default | This setting explicitly opts into the Linux gateway compatibility container for an older host ABI or a diagnostic run; use it only on a trusted local host because it uses host networking and mounts the Docker socket read-only even though the socket still exposes the privileged Docker API; prefer OpenShell 0.0.85's directly supported glibc 2.28+ path; see the [OpenShell gateway compatibility review](/user-guide/openclaw/security/openshell-0.0.72-compatibility-review#source-of-truth-boundaries) for the unchanged container boundary. | +| `NEMOCLAW_OPENSHELL_GATEWAY_CONTAINER_PATCH` | `1` to enable; disabled by default | This setting explicitly opts into the Linux gateway compatibility container for an older host ABI or a diagnostic run; use it only on a trusted local host because it uses host networking and mounts the Docker socket read-only even though the socket still exposes the privileged Docker API; prefer OpenShell 0.0.99's directly supported glibc 2.39+ path; see the [OpenShell gateway compatibility review](/user-guide/openclaw/security/openshell-0.0.72-compatibility-review#source-of-truth-boundaries) for the unchanged container boundary. | | `NEMOCLAW_OPENSHELL_GATEWAY_BIN` | path | Advanced override for the `openshell-gateway` binary used by Linux Docker-driver startup. For the default port, the installer accepts the binary under an absolute `XDG_BIN_HOME` when set, otherwise `~/.local/bin/openshell-gateway`; it also accepts `/usr/local/bin/openshell-gateway` or `/usr/bin/openshell-gateway`. Another path fails service staging. The macOS Homebrew service uses the formula's binary. Defaults to the binary next to `openshell`, then common install paths. | | `NEMOCLAW_OPENSHELL_SANDBOX_BIN` | path | Advanced override for the `openshell-sandbox` binary used by Linux Docker-driver startup. The macOS Homebrew service uses the formula's driver layout. Defaults to the binary next to `openshell`, then common install paths. | | `NEMOCLAW_OPENSHELL_GATEWAY_STATE_DIR` | path | Advanced override for the Linux Docker-driver gateway SQLite state directory and standalone-fallback PID file. Defaults to `~/.local/state/nemoclaw/openshell-docker-gateway`. | diff --git a/docs/reference/configure-runtime-identity.mdx b/docs/reference/configure-runtime-identity.mdx index 0c803cbbc67..1b698411cbb 100644 --- a/docs/reference/configure-runtime-identity.mdx +++ b/docs/reference/configure-runtime-identity.mdx @@ -35,7 +35,7 @@ Runtime identity profiles may use DNS-backed HTTPS only within a provider type's NemoClaw resolves every destination before import and rejects private or internal addresses. OpenShell performs connect-time server-side request forgery (SSRF) and L7 enforcement before it injects the provider credential. -OpenShell 0.0.85 verifies the original hostname's certificate but does not pin the address that NemoClaw resolved. +OpenShell 0.0.99 verifies the original hostname's certificate but does not pin the address that NemoClaw resolved during import. Only identity-platform-controlled DNS namespaces such as `okta.com`, `login.microsoftonline.com`, and `graph.microsoft.com` belong in this trust table. An attacker-controlled or customer-controlled suffix requires a pinning-capable upstream refresh boundary and new conformance evidence. diff --git a/docs/reference/troubleshoot-mcp-servers.mdx b/docs/reference/troubleshoot-mcp-servers.mdx index 1cc158bbf47..dcef8a72521 100644 --- a/docs/reference/troubleshoot-mcp-servers.mdx +++ b/docs/reference/troubleshoot-mcp-servers.mdx @@ -320,7 +320,7 @@ Restrict the proxy listener to the OpenShell gateway or required deployment subn Direct `127.0.0.1`, `::1`, and hostnames that resolve to loopback remain rejected. Sandbox loopback is not the host service, and `--trusted-private-host` does not create a route to it. Use a DNS hostname for an IPv6 unique local address. -OpenShell `v0.0.85` cannot represent a direct IPv6 literal proxy target. +NemoClaw has not qualified direct IPv6-literal MCP URLs and rejects them. See [Add an MCP Server](../manage-sandboxes/mcp-servers/add-an-mcp-server) for the full endpoint requirements. ## DNS Pins Drift diff --git a/docs/reference/troubleshooting.mdx b/docs/reference/troubleshooting.mdx index 8068c3ab5c2..3f783b4a6db 100644 --- a/docs/reference/troubleshooting.mdx +++ b/docs/reference/troubleshooting.mdx @@ -338,7 +338,7 @@ NEMOCLAW_DASHBOARD_BIND=0.0.0.0 NEMOCLAW_GATEWAY_PORT=8990 $$nemoclaw onboard Use `NEMOCLAW_DASHBOARD_BIND=0.0.0.0` again on later `$$nemoclaw connect` calls. If the sandbox was originally created without remote bind, recreate it with the same onboard command plus `--recreate-sandbox` before connecting remotely. -Docker-driver gateways on OpenShell 0.0.85 reject `NEMOCLAW_GATEWAY_BIND_ADDRESS=0.0.0.0` while gateway JWT auth is active. +NemoClaw rejects `NEMOCLAW_GATEWAY_BIND_ADDRESS=0.0.0.0` for Docker-driver gateways while gateway JWT auth is active. Use `NEMOCLAW_GATEWAY_BIND_ADDRESS=0.0.0.0` only on supported gateway modes and only when other hosts on the network should be able to reach the gateway. @@ -346,7 +346,7 @@ Use `NEMOCLAW_GATEWAY_BIND_ADDRESS=0.0.0.0` only on supported gateway modes and ### Older-glibc gateway compatibility container -OpenShell 0.0.85 directly supports Linux hosts with glibc 2.28 or newer. +OpenShell 0.0.99 directly supports Linux hosts with glibc 2.39 or newer. On an older trusted host, `NEMOCLAW_OPENSHELL_GATEWAY_CONTAINER_PATCH=1` explicitly opts into NemoClaw's compatibility container. Leave it unset on supported hosts. diff --git a/docs/security/best-practices.mdx b/docs/security/best-practices.mdx index c77e4b46c0f..7ac2c42c592 100644 --- a/docs/security/best-practices.mdx +++ b/docs/security/best-practices.mdx @@ -690,7 +690,7 @@ NemoClaw binds the OpenShell gateway to loopback by default. |---|---| | Default | `NEMOCLAW_GATEWAY_BIND_ADDRESS=127.0.0.1`. | | What you can change | Keep Docker-driver gateways on loopback. Set `NEMOCLAW_DASHBOARD_BIND=0.0.0.0` during onboarding and on later `connect` calls for remote dashboard/API access. Recreate a local-only sandbox before changing it to a remote bind. | -| Risk if relaxed | Other hosts on the network may be able to reach the OpenShell gateway; Docker-driver gateways on OpenShell 0.0.85 reject wildcard gateway binds while gateway JWT auth is active. | +| Risk if relaxed | Other hosts on the network may be able to reach the OpenShell gateway. NemoClaw rejects wildcard Docker-driver gateway binds while gateway JWT auth is active. | | Recommendation | Keep the gateway loopback default and expose only the dashboard forward when remote access is needed. | ### Gateway Compatibility Container @@ -702,7 +702,7 @@ On Linux hosts whose glibc is older than the OpenShell gateway binary requires, | Default | NemoClaw does not auto-enable the compatibility container on ABI mismatch. If `NEMOCLAW_OPENSHELL_GATEWAY_CONTAINER_PATCH=1` is set, the container keeps the main gateway listener on `127.0.0.1`, uses host networking so OpenShell computes the same Docker bridge callback addresses as a host-side gateway, mounts the Docker socket read-only, drops Linux capabilities, sets `no-new-privileges`, and publishes no extra Docker ports. | | What you can change | Opt in with `NEMOCLAW_OPENSHELL_GATEWAY_CONTAINER_PATCH=1`, keep the path disabled with `NEMOCLAW_OPENSHELL_GATEWAY_CONTAINER_PATCH=0`, or run on a host/OpenShell build combination where the gateway binary launches directly. | | Risk if relaxed | The Docker socket remains a privileged host API even when bind-mounted read-only. Treat this mode as equivalent to trusting the host user that can drive Docker, and do not enable it on untrusted shared hosts. | -| Recommendation | Prefer a host with glibc 2.28 or newer, which OpenShell 0.0.85 supports directly, and use the compatibility container only as an explicit local bridge on an older trusted host. | +| Recommendation | Prefer a host with glibc 2.39 or newer, which OpenShell 0.0.99 supports directly, and use the compatibility container only as an explicit local bridge on an older trusted host. | See [OpenShell Gateway Compatibility Review](./openshell-0.0.72-compatibility-review) for the unchanged compatibility-container source-of-truth boundaries. diff --git a/docs/security/openshell-0.0.99-migration-review.md b/docs/security/openshell-0.0.99-migration-review.md new file mode 100644 index 00000000000..00ae2f25892 --- /dev/null +++ b/docs/security/openshell-0.0.99-migration-review.md @@ -0,0 +1,139 @@ + + + +# OpenShell 0.0.85 to 0.0.99 migration review + +## Status and decision + +This review covers the complete public source boundary from the previously supported OpenShell +`v0.0.85` commit `3dee5570a46076a57a3b056f35f35ebc0861ac85` through the published +`v0.0.99` commit `8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032`. The range contains 117 +commits and 515 distinct changed paths. Source review, release publication, consumed artifact +identity, credential-boundary review, and NemoClaw runtime qualification are separate gates. + +The source and artifact review supports selecting `0.0.99`. Merge remains conditional on the +exact pinned artifacts passing NemoClaw's managed activation and live E2E lanes. In particular, +the previously observed `0.0.85` activation mismatch is part of this upgrade's completion, not a +waived unrelated failure. + +## Audit method and exact boundary + +The repository-owned release-ledger collector enumerated every adjacent tag, commit, and changed +path from a full clone of the canonical `NVIDIA/OpenShell` repository. All 14 adjacent source ranges +resolve into the target ancestry. Tags `v0.0.87`, `v0.0.93`, `v0.0.94`, and `v0.0.95` have no +published GitHub release; they are review boundaries, not consumed release artifacts. + +| Adjacent range | Commits | Paths | Material review result | +| --- | ---: | ---: | --- | +| `v0.0.85 -> v0.0.86` | 12 | 109 | Policy prover removal, persistent labels, Docker discovery, AWS STS refresh, and supervisor middleware/egress were reviewed. | +| `v0.0.86 -> v0.0.87` | 5 | 12 | Upload symlink handling, Kubernetes naming, and build-tool changes were reviewed. | +| `v0.0.87 -> v0.0.88` | 15 | 169 | TTY exec, GitHub provider behavior, workspace authorization, and inode-specific Landlock rights were reviewed. | +| `v0.0.88 -> v0.0.89` | 9 | 49 | OPA deny reasons and sandbox deletion-event isolation were reviewed. | +| `v0.0.89 -> v0.0.90` | 9 | 24 | Read-only mount ownership and internal-IP policy proposal behavior were reviewed. | +| `v0.0.90 -> v0.0.91` | 3 | 33 | Auth status and explicit proposal-state propagation were reviewed. | +| `v0.0.91 -> v0.0.92` | 11 | 55 | Corporate proxy routing, structured output, L7 validation, and parser hardening were reviewed. | +| `v0.0.92 -> v0.0.93` | 7 | 24 | Listener-before-resume ordering, proxy retry, exec stderr, and Podman shutdown handling were reviewed. | +| `v0.0.93 -> v0.0.94` | 12 | 68 | Policy-first OCI identity, gateway-owned readiness, and host-environment isolation were reviewed. | +| `v0.0.94 -> v0.0.95` | 7 | 107 | IPv6 SSH, workspace authorization, and gateway listener isolation were reviewed. | +| `v0.0.95 -> v0.0.96` | 5 | 38 | Atomic policy notification, OTLP export, and dependency/base-image changes were reviewed. | +| `v0.0.96 -> v0.0.97` | 12 | 144 | Callback listener negotiation, proxy-pipeline consolidation, Podman lifecycle, and nft quoting were reviewed. | +| `v0.0.97 -> v0.0.98` | 3 | 50 | VM tracing and build graph changes were reviewed. | +| `v0.0.98 -> v0.0.99` | 7 | 79 | System CA mode, OCI working-directory support, and TCP_NODELAY were reviewed. | + +The complete audited commit set, grouped by adjacent range, is: + +- `85->86`: dd3f27c8 077adb79 008193a2 cf4deccd 1a0c1013 fe7135a2 d0961cdb aa483ecb 32f05244 54025517 d70adafe d5567487 +- `86->87`: 06062027 98f253b8 1fd4d2b9 8cf2673c 9a4f8a80 +- `87->88`: 339eae5a 80987e91 a2cd5f8e a9f71313 f32c46d4 2575585b 9377e0d5 745512e3 ad29ab96 5952a5a2 f1690849 8d9502d9 e9ac0ee6 744a65d5 3ff15a16 +- `88->89`: dae92616 472e23f9 bdd1ce87 396a3b7b d35d52d4 8b0e54b2 2d5652b2 ac3d5c96 cbdeb4d5 +- `89->90`: fd1d3de8 5432d01d ca318058 cd9a0bf2 7b444bd8 0674a00b 8a14b3a4 541b97f0 1d4ac708 +- `90->91`: 75d24688 59f7839f 21da343c +- `91->92`: f7cd9108 b422b678 850bd42e 77e5c322 01daf3a5 deced871 d4cd37be afb462f3 516be602 76a5397e 2d108818 +- `92->93`: 39bf94e5 79bcf296 2022d537 0d5e5c53 52f9e9e9 24d491a0 f00ad23a +- `93->94`: 7e9a7f51 b78c8615 efb2d9c2 b1c7ff68 2b7f04fe 7955c830 bc14018c 101cbc97 8d252f47 662dee68 d0f9301c 1221b586 +- `94->95`: eb380d71 0cecb542 1cbfc0d5 9c019a93 7f53f78b fe15caa8 df698042 +- `95->96`: 28f3bee0 fa242990 02e890cc 596d729e 5541398c +- `96->97`: 1a25439c d220d894 489bb0d5 770d4e6b 905b554c 06c2db75 584f7dbf c42268ba e7533177 736e431d 1959ea19 fde96f04 +- `97->98`: 704880e5 0a3ec7a1 83284129 +- `98->99`: b9818619 0e9a44cf 4d55265f d063751c 53780556 490f66f4 8c7dd148 + +## Consumed release artifacts + +NemoClaw consumes only the published `v0.0.99` release and pins both archive and extracted-binary +identities. Archive SHA-256 values are: + +| Artifact | linux-amd64 | linux-arm64 | darwin-arm64 | +| --- | --- | --- | --- | +| CLI | `35725a358e42ef7f0f0393035536da317706b0febcc459a2011e0555f6c2b71c` | `d00cbf0d8779c01ddea6453ead2ad4db3d89a1f14eb6f0785f7919f42813a279` | `e31cac5360e2adf3c971d5742a516626c58acf2fd3db4dcb0e45804def3dc844` | +| Gateway | `640d204dc3c6bc28bffa1f3d870897fc23bbc5ec0151a6c642083e958455cb49` | `3a5d3092ae34356beb0ff2a920f9a87af4233c7a1086a53cd9429d48358f5c09` | `4340619292ecb565f90eb2250db504baa37dd410361b366b42e174d34512cb6c` | +| Sandbox | `84caed3dec4390e0938e89b38b1256d31e8970b4bfd85437bf92ed79f5b1ff05` | `c758e7dc2b8c904baa01e2ccce0f08daf96ede0c648478b23346d8c4dd16f432` | not published | + +Extracted binary SHA-256 values are: + +| Binary | linux-amd64 | linux-arm64 | darwin-arm64 | +| --- | --- | --- | --- | +| CLI | `5c0dabb90152a3cfae9005731771da99f00a22403080c81952c7be8ba4b5728f` | `9390eac019d2bcabec1cac950ca97982fb3d7bce2560ae00e9c3f237d50b8481` | `578048e527b8fbb6741bbdacd55ac65bf0cb0776964ea8f18cd24cc979a1006f` | +| Gateway | `05bd6c982dd72b73364b91ab694487c026bc56d0cd869f4289b44cc392a5c2ba` | `35c1e1be9c8766de2bfd457e54918d6b2019c16da815ec4c45ce9ebb45aaa571` | `e53b0788d1fdc3e933bb11f13b02c5c1d8c6635bfb3166264558ac3272426113` | +| Sandbox | `a4b0c38ed90a6dd4b4f312ad3727824a25ec478d88d4e65d22a82377b18e6214` | `f60ce5b76e4dbd645f690c8519852d261c8cf6a70b5fc56db329a23d68bc7b2e` | not published | + +The supervisor is pinned by multi-platform index digest +`sha256:ea3632b6e9528e2309103af5b6949606fcdc83ca1f69e8db81482a25bea84bb6`; +its amd64 and arm64 child digests are respectively +`sha256:4adea8392a81ef34b3cc3284e693ac3cc6c13362fad84a492d95b53b3eb403b9` +and `sha256:b548fd939331d830cd9197f20fca9a5d95383c5e67f64929d632a37403115f38`. + +## Credential and policy boundary + +The reviewed credential sources are `google_cloud.rs`, `provider_credentials.rs`, and +`secrets.rs`. The only credential-relevant behavioral delta is safer expiry handling: expired +provider credentials are skipped and expiry subtraction saturates instead of panicking. The +child-visible credential key classes are unchanged. `OPENSHELL_OCI_IMAGE_USER` is new driver +metadata, is covered by NemoClaw's existing `OPENSHELL_` runtime-control prefix, and is overwritten +by the driver rather than accepted as user authority. The regenerated manifest +`openshell-child-visible-credentials.v0.0.99.json` records the exact target commit. + +Policy-first OCI identity, atomic watcher notification, pending internal-IP proposals, callback +listener negotiation, proxy consolidation, Landlock changes, and system CA mode all affect a +security boundary. NemoClaw retains its stricter explicit policy and runtime validation rather +than enabling optional upstream behavior implicitly. + +## Downstream concern ledger + +| ID | Concern | Disposition | +| --- | --- | --- | +| `OS99-01` | Release/tag substitution | Exact source commit, archives, extracted binaries, formula, manifests, and supervisor index are pinned. | +| `OS99-02` | Credential leakage or key-class expansion | Regenerated manifest shows no child-visible key-class expansion; expiry behavior is safer. | +| `OS99-03` | Policy-first OCI image identity | Existing explicit-image and policy tests remain required. | +| `OS99-04` | Workspace authorization | No NemoClaw authority is inferred from the new workspace model. | +| `OS99-05` | Supervisor middleware/egress | Optional middleware is not enabled by the selector update. | +| `OS99-06` | Corporate proxy and consolidated egress | Existing endpoint and allowed-IP checks remain authoritative. | +| `OS99-07` | Internal allowed-IP proposal state | Pending proposals are not treated as effective policy. | +| `OS99-08` | Listener/readiness lifecycle changes | Managed activation, start, stop, rebuild, and gateway health require live evidence. | +| `OS99-09` | Docker activation spec representation | Attach markers and empty port maps are normalized; non-empty port bindings are rejected. | +| `OS99-10` | OCI WorkingDir and image-user metadata | Driver-owned values remain under the runtime-control boundary. | +| `OS99-11` | System CA root mode | Not enabled implicitly; current CA-policy tests remain required. | +| `OS99-12` | Podman lifecycle changes | Podman exact-version live coverage remains an acceptance gate. | + +An unresolved critical or high concern blocks the upgrade. Test selection cannot waive a concern; +conditional skips and expected failures do not count as qualification evidence. + +## The 0.0.85 activation failure + +The failing activation compared Docker inspect output produced through different clients. The +OpenShell API-created held workload serialized `AttachStdout=false`, `AttachStderr=false`, and +`PortBindings=null`; the Docker CLI-created equivalent serialized `true`, `true`, and `{}`. Those +values are creation-client markers or equivalent empty defaults, not durable workload identity. +NemoClaw now normalizes them before hashing. It still refuses any non-empty port binding because +the managed clone cannot reproduce that behavior exactly. Unit coverage proves both equivalence +and the rejection path; exact `0.0.85 -> 0.0.99` live activation remains required. + +## Final acceptance gates + +- All active CLI, blueprint, installer, Brev, workflow, supervisor, and sandbox selectors agree on + `0.0.99` and exact reviewed identities. +- The `v0.0.99` credential-boundary manifest is the active manifest and its source commit is exact. +- Static checks, focused lifecycle tests, CLI/plugin builds, and documentation checks pass. +- Managed Docker and Podman activation, lifecycle, policy, credential, inference, and MCP E2E run + against the exact pinned release without conditional skips or expected failures. +- A supported host with no prior NemoClaw state demonstrates the `0.0.85 -> 0.0.99` activation transition, including the + previously failing Docker-spec comparison. diff --git a/nemoclaw-blueprint/blueprint.yaml b/nemoclaw-blueprint/blueprint.yaml index ea06893b29e..99908a4105b 100644 --- a/nemoclaw-blueprint/blueprint.yaml +++ b/nemoclaw-blueprint/blueprint.yaml @@ -3,8 +3,8 @@ version: "0.1.0" # Requires OpenShell MCP/JSON-RPC L7 policy support from NVIDIA/OpenShell#1865. -min_openshell_version: "0.0.85" -max_openshell_version: "0.0.85" +min_openshell_version: "0.0.99" +max_openshell_version: "0.0.99" min_openclaw_version: "2026.3.11" # Mirrors the components.sandbox.image manifest digest below. Lets a # downstream consumer (or release tooling) verify the blueprint declares diff --git a/scripts/brev-launchable-ci-cpu.sh b/scripts/brev-launchable-ci-cpu.sh index 6a1b65a57af..dff8bc45081 100755 --- a/scripts/brev-launchable-ci-cpu.sh +++ b/scripts/brev-launchable-ci-cpu.sh @@ -73,7 +73,7 @@ assert_openshell_version() { if [ -z "$OPENSHELL_VERSION" ]; then case "${NEMOCLAW_OPENSHELL_CHANNEL:-stable}" in dev) OPENSHELL_VERSION="dev" ;; - stable | auto) OPENSHELL_VERSION="v0.0.85" ;; + stable | auto) OPENSHELL_VERSION="v0.0.99" ;; *) fail "NEMOCLAW_OPENSHELL_CHANNEL must be one of: stable, dev, auto" ;; esac fi @@ -148,11 +148,11 @@ openshell_cli_asset_for_arch() { openshell_cli_pinned_sha256() { local release_tag="$1" asset="$2" case "${release_tag}:${asset}" in - v0.0.85:openshell-x86_64-unknown-linux-musl.tar.gz) - printf '%s\n' "078fa086f506832c3d47d992e6109f26074bdd55916ce268e47c3971423459eb" + v0.0.99:openshell-x86_64-unknown-linux-musl.tar.gz) + printf '%s\n' "35725a358e42ef7f0f0393035536da317706b0febcc459a2011e0555f6c2b71c" ;; - v0.0.85:openshell-aarch64-unknown-linux-musl.tar.gz) - printf '%s\n' "3cf353e7994d5835a233fe0641f9a860779190b054d0f90a04c897be782734b8" + v0.0.99:openshell-aarch64-unknown-linux-musl.tar.gz) + printf '%s\n' "d00cbf0d8779c01ddea6453ead2ad4db3d89a1f14eb6f0785f7919f42813a279" ;; *) return 1 diff --git a/scripts/install-openshell.sh b/scripts/install-openshell.sh index 11751eac1f0..88fc536d47b 100755 --- a/scripts/install-openshell.sh +++ b/scripts/install-openshell.sh @@ -37,16 +37,16 @@ info "Detected $OS_LABEL ($ARCH_LABEL)" # round-trippable base policies: WebSocket text frames, provider-shaped # aliases, REST request bodies, MCP/JSON-RPC L7 enforcement, and # `policy get --base` for MCP/JSON-RPC-safe read-modify-write operations. -MIN_VERSION="0.0.85" +MIN_VERSION="0.0.99" # Maximum version validated for this NemoClaw release. Newer OpenShell builds # may change sandbox semantics; upgrade NemoClaw before upgrading past this. -MAX_VERSION="0.0.85" +MAX_VERSION="0.0.99" # Pin fresh installs to this version. The TS installer normally overrides this # via NEMOCLAW_OPENSHELL_PIN_VERSION after resolving the highest published # OpenShell release that satisfies the blueprint's max_openshell_version # (see #3404). The hardcoded value is the fallback for offline runs. PIN_VERSION="$MAX_VERSION" -DEV_MIN_VERSION="0.0.85" +DEV_MIN_VERSION="0.0.99" CHANNEL="${NEMOCLAW_OPENSHELL_CHANNEL:-auto}" case "$CHANNEL" in @@ -143,32 +143,32 @@ fi openshell_pinned_sha256() { local release_tag="$1" asset="$2" case "${release_tag}:${asset}" in - v0.0.85:openshell-x86_64-unknown-linux-musl.tar.gz) - printf '%s\n' "078fa086f506832c3d47d992e6109f26074bdd55916ce268e47c3971423459eb" + v0.0.99:openshell-x86_64-unknown-linux-musl.tar.gz) + printf '%s\n' "35725a358e42ef7f0f0393035536da317706b0febcc459a2011e0555f6c2b71c" ;; - v0.0.85:openshell-aarch64-unknown-linux-musl.tar.gz) - printf '%s\n' "3cf353e7994d5835a233fe0641f9a860779190b054d0f90a04c897be782734b8" + v0.0.99:openshell-aarch64-unknown-linux-musl.tar.gz) + printf '%s\n' "d00cbf0d8779c01ddea6453ead2ad4db3d89a1f14eb6f0785f7919f42813a279" ;; - v0.0.85:openshell-aarch64-apple-darwin.tar.gz) - printf '%s\n' "522c963f9515c7325b978e89022de76227ac245eefe1371292af1424434e2067" + v0.0.99:openshell-aarch64-apple-darwin.tar.gz) + printf '%s\n' "e31cac5360e2adf3c971d5742a516626c58acf2fd3db4dcb0e45804def3dc844" ;; - v0.0.85:openshell-gateway-x86_64-unknown-linux-gnu.tar.gz) - printf '%s\n' "718cc9f942f88565cacb13c39717b128d6acc8d336212d42d26243f36ab19ece" + v0.0.99:openshell-gateway-x86_64-unknown-linux-gnu.tar.gz) + printf '%s\n' "640d204dc3c6bc28bffa1f3d870897fc23bbc5ec0151a6c642083e958455cb49" ;; - v0.0.85:openshell-gateway-aarch64-unknown-linux-gnu.tar.gz) - printf '%s\n' "09f2823f6e9c5f70f4482b200206eac455d789618da4ebe4acff042d794e7162" + v0.0.99:openshell-gateway-aarch64-unknown-linux-gnu.tar.gz) + printf '%s\n' "3a5d3092ae34356beb0ff2a920f9a87af4233c7a1086a53cd9429d48358f5c09" ;; - v0.0.85:openshell-gateway-aarch64-apple-darwin.tar.gz) - printf '%s\n' "5de3e08ad1bdb0cdd01373999f537edca3d8aca22ae1c29bc9926969fe401e45" + v0.0.99:openshell-gateway-aarch64-apple-darwin.tar.gz) + printf '%s\n' "4340619292ecb565f90eb2250db504baa37dd410361b366b42e174d34512cb6c" ;; - v0.0.85:openshell-sandbox-x86_64-unknown-linux-gnu.tar.gz) - printf '%s\n' "94306f057d862cd5c34a0daa7692491733bc5ca528a7b92f9f62f717fb70a9be" + v0.0.99:openshell-sandbox-x86_64-unknown-linux-gnu.tar.gz) + printf '%s\n' "84caed3dec4390e0938e89b38b1256d31e8970b4bfd85437bf92ed79f5b1ff05" ;; - v0.0.85:openshell-sandbox-aarch64-unknown-linux-gnu.tar.gz) - printf '%s\n' "2c52b2971aecf125e41ed160d8d2f2addf04031906ca88f120ae3d436dd6b8f7" + v0.0.99:openshell-sandbox-aarch64-unknown-linux-gnu.tar.gz) + printf '%s\n' "c758e7dc2b8c904baa01e2ccce0f08daf96ede0c648478b23346d8c4dd16f432" ;; - v0.0.85:openshell.rb) - printf '%s\n' "f53c62777fed23b42427822d231670451ee4358efeb2660c41a7a38919211b23" + v0.0.99:openshell.rb) + printf '%s\n' "8dd34fc17ee9a30327664a18c9509c8a765cb010de38cda8e22841bddbe92713" ;; *) return 1 @@ -291,10 +291,10 @@ pinned_sandbox_build_version() { 76bc19b70d9f1e1e9871307045796cd39cc7b8fc4c08ffc90593cc934f36d500) printf '%s\n' "0.0.82" ;; - # OpenShell v0.0.85 standalone sandbox binaries. - 863ef21ab7ef623f5e7a8728c4e5532b46bfbae3ace3b800665a1c6353a1f7d2 | \ - 680115dbc2affde0e88261ab09f4044726d1cc9e01de55dc5077d1118f52968d) - printf '%s\n' "0.0.85" + # OpenShell v0.0.99 standalone sandbox binaries. + a4b0c38ed90a6dd4b4f312ad3727824a25ec478d88d4e65d22a82377b18e6214 | \ + f60ce5b76e4dbd645f690c8519852d261c8cf6a70b5fc56db329a23d68bc7b2e) + printf '%s\n' "0.0.99" ;; *) return 1 diff --git a/scripts/update-hermes-agent.sh b/scripts/update-hermes-agent.sh index 75b7c8c3a1c..95355bb5b4e 100755 --- a/scripts/update-hermes-agent.sh +++ b/scripts/update-hermes-agent.sh @@ -201,7 +201,7 @@ installed_copy_schema_error() { "COPY agents/hermes/build-mcp-digest.py /usr/local/lib/nemoclaw/build-hermes-mcp-digest.py" \ "/opt/hermes/.venv/bin/python -I /usr/local/lib/nemoclaw/build-hermes-mcp-digest.py --guard /usr/local/lib/nemoclaw/hermes-runtime-config-guard.py" \ "hermes-mcp-config-transaction.py" \ - "openshell-child-visible-credentials.v0.0.85.json" \ + "openshell-child-visible-credentials.v0.0.99.json" \ "HERMES_HOME=/sandbox/.hermes /usr/local/bin/hermes doctor --fix" \ "node --experimental-strip-types /opt/nemoclaw-hermes-config/generate-config.ts" \ "/sandbox/.hermes/profiles/dashboard-home"; do diff --git a/src/lib/actions/sandbox/mcp-bridge-input-validation.test.ts b/src/lib/actions/sandbox/mcp-bridge-input-validation.test.ts index b0c9b4f4d29..fe0924052f6 100644 --- a/src/lib/actions/sandbox/mcp-bridge-input-validation.test.ts +++ b/src/lib/actions/sandbox/mcp-bridge-input-validation.test.ts @@ -14,7 +14,7 @@ import { parseMcpAddArgs, resolveCredentialEnv, } from "./mcp-bridge"; -import childVisibleCredentialManifest from "./openshell-child-visible-credentials.v0.0.85.json"; +import childVisibleCredentialManifest from "./openshell-child-visible-credentials.v0.0.99.json"; describe("MCP CLI input validation", () => { it("parses server, URL, and env references", () => { diff --git a/src/lib/actions/sandbox/mcp-bridge-validation.ts b/src/lib/actions/sandbox/mcp-bridge-validation.ts index 5155ea52ee3..3e0531071b3 100644 --- a/src/lib/actions/sandbox/mcp-bridge-validation.ts +++ b/src/lib/actions/sandbox/mcp-bridge-validation.ts @@ -22,7 +22,7 @@ import { normalizeMcpServerUrl } from "./mcp-bridge-url-validation"; // must reject a missing or malformed security manifest instead of letting the // CLI start with a weakened credential-name denylist. Input, package, image, // and workflow contracts pin its structure, installed path, and version. -import childVisibleCredentialManifest from "./openshell-child-visible-credentials.v0.0.85.json"; +import childVisibleCredentialManifest from "./openshell-child-visible-credentials.v0.0.99.json"; export { MCP_SERVER_URL_MAX_LENGTH, diff --git a/src/lib/actions/sandbox/openshell-child-visible-credentials.v0.0.99.json b/src/lib/actions/sandbox/openshell-child-visible-credentials.v0.0.99.json new file mode 100644 index 00000000000..95312f0bfed --- /dev/null +++ b/src/lib/actions/sandbox/openshell-child-visible-credentials.v0.0.99.json @@ -0,0 +1,109 @@ +{ + "openshellVersion": "0.0.99", + "openshellCommit": "8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032", + "sources": [ + "crates/openshell-core/src/google_cloud.rs", + "crates/openshell-core/src/provider_credentials.rs", + "crates/openshell-core/src/secrets.rs" + ], + "nemoclawSources": [ + "src/lib/subprocess-env.ts", + "src/lib/actions/sandbox/mcp-bridge-validation.ts", + "agents/hermes/mcp-config-transaction.py" + ], + "rawChildValueKeys": [ + "GCP_PROJECT_ID", + "GOOGLE_CLOUD_PROJECT", + "CLOUD_ML_REGION", + "GCP_LOCATION", + "GCP_SERVICE_ACCOUNT_EMAIL", + "GOOSE_PROVIDER", + "ANTHROPIC_VERTEX_PROJECT_ID", + "VERTEX_LOCATION" + ], + "rewrittenChildValueKeys": [ + "GCE_METADATA_HOST", + "GCE_METADATA_IP", + "METADATA_SERVER_DETECTION" + ], + "runtimeControlKeys": [ + "_JAVA_OPTIONS", + "ALL_PROXY", + "all_proxy", + "API_SERVER_KEY", + "BASH_ENV", + "BASHOPTS", + "CDPATH", + "CLASSPATH", + "CONDA_PREFIX", + "CURL_CA_BUNDLE", + "DENO_CERT", + "DOCKER_HOST", + "ENV", + "GCONV_PATH", + "GIT_SSL_CAINFO", + "GIT_SSL_CAPATH", + "GLOBIGNORE", + "grpc_proxy", + "HOME", + "HOSTNAME", + "HTTP_PROXY", + "http_proxy", + "HTTPS_PROXY", + "https_proxy", + "IFS", + "KUBECONFIG", + "LANG", + "LOCPATH", + "LOGNAME", + "NLSPATH", + "NODE_ENV", + "NODE_EXTRA_CA_CERTS", + "NO_PROXY", + "no_proxy", + "PATH", + "PROMPT_COMMAND", + "PS4", + "REQUESTS_CA_BUNDLE", + "RUST_BACKTRACE", + "RUST_LOG", + "SHELL", + "SHELLOPTS", + "SSH_AUTH_SOCK", + "SSL_CERT_DIR", + "SSL_CERT_FILE", + "TEMP", + "TERM", + "TMP", + "TMPDIR", + "USER", + "VIRTUAL_ENV", + "ZDOTDIR" + ], + "runtimeControlPrefixes": [ + "DEEPAGENTS_", + "DYLD_", + "GATEWAY_", + "GLIBC_", + "GRPC_", + "HERMES_", + "JAVA_", + "JDK_", + "LANGCHAIN_", + "LANGGRAPH_", + "LANGSMITH_", + "LC_", + "LD_", + "MALLOC_", + "NEMOCLAW_", + "NODE_", + "OPENAI_", + "OPENCLAW_", + "OPENSHELL_", + "PERL", + "PYTHON", + "RUBY", + "UV_", + "XDG_" + ] +} diff --git a/src/lib/onboard/docker-driver-gateway-runtime.test.ts b/src/lib/onboard/docker-driver-gateway-runtime.test.ts index a6a90aa6fb5..71a5e5dd2f4 100644 --- a/src/lib/onboard/docker-driver-gateway-runtime.test.ts +++ b/src/lib/onboard/docker-driver-gateway-runtime.test.ts @@ -99,7 +99,7 @@ describe("docker-driver gateway runtime helpers", () => { expect(env.OPENSHELL_DOCKER_NETWORK_NAME).toBe("custom-openshell-docker"); expect(env.OPENSHELL_DOCKER_SUPERVISOR_BIN).toBe(path.resolve(sandboxBin)); expect(env.OPENSHELL_DOCKER_SUPERVISOR_IMAGE).toBe( - "ghcr.io/nvidia/openshell/supervisor:0.0.99", + "ghcr.io/nvidia/openshell/supervisor@sha256:ea3632b6e9528e2309103af5b6949606fcdc83ca1f69e8db81482a25bea84bb6", ); expect(env.OPENSHELL_GATEWAY_CONFIG).toBe( path.join(path.resolve(stateDir), "openshell-gateway.toml"), @@ -130,18 +130,18 @@ describe("docker-driver gateway runtime helpers", () => { ).toBe("ghcr.io/nvidia/openshell/supervisor:dev"); }); - it("pins the stable 0.0.85 supervisor default while preserving an explicit override", () => { + it("pins the stable 0.0.99 supervisor default while preserving an explicit override", () => { const image = (fallback: string) => makeHelpers({ - getBlueprintMaxOpenshellVersion: () => "0.0.85", + getBlueprintMaxOpenshellVersion: () => "0.0.99", supportedOpenshellFallbackVersion: fallback, }).helpers.getDockerDriverGatewayEnv(null, "linux").OPENSHELL_DOCKER_SUPERVISOR_IMAGE; - const stable = withEnv({ OPENSHELL_DOCKER_SUPERVISOR_IMAGE: undefined }, () => image("0.0.85")); + const stable = withEnv({ OPENSHELL_DOCKER_SUPERVISOR_IMAGE: undefined }, () => image("0.0.99")); expect(stable).toBe( - "ghcr.io/nvidia/openshell/supervisor@sha256:f4226253a3525c3832adac5b38b419a0f27d1e915effe565b5885e20f93cd5e9", + "ghcr.io/nvidia/openshell/supervisor@sha256:ea3632b6e9528e2309103af5b6949606fcdc83ca1f69e8db81482a25bea84bb6", ); const override = "registry.example.test/supervisor@sha256:override"; - expect(withEnv({ OPENSHELL_DOCKER_SUPERVISOR_IMAGE: override }, () => image("0.0.85"))).toBe( + expect(withEnv({ OPENSHELL_DOCKER_SUPERVISOR_IMAGE: override }, () => image("0.0.99"))).toBe( override, ); }); diff --git a/src/lib/onboard/docker-driver-gateway-runtime.ts b/src/lib/onboard/docker-driver-gateway-runtime.ts index 0b161768be2..5ec56658ec3 100644 --- a/src/lib/onboard/docker-driver-gateway-runtime.ts +++ b/src/lib/onboard/docker-driver-gateway-runtime.ts @@ -35,7 +35,7 @@ import * as vmDriverProcess from "./vm-driver-process"; const OPENSHELL_SUPERVISOR_MANIFEST_DIGESTS: Readonly> = { "0.0.72": "sha256:80ed9cda5bf672fefdb9dcd4604b40a8b09c0891b6eb9d03e10227c7e3dfb49d", - "0.0.85": "sha256:f4226253a3525c3832adac5b38b419a0f27d1e915effe565b5885e20f93cd5e9", + "0.0.99": "sha256:ea3632b6e9528e2309103af5b6949606fcdc83ca1f69e8db81482a25bea84bb6", }; export type DockerDriverGatewayRuntimeDrift = { reason: string }; diff --git a/src/lib/onboard/docker-gpu-patch-types.ts b/src/lib/onboard/docker-gpu-patch-types.ts index f367df0ab22..fb1940fca7f 100644 --- a/src/lib/onboard/docker-gpu-patch-types.ts +++ b/src/lib/onboard/docker-gpu-patch-types.ts @@ -244,6 +244,7 @@ export type DockerContainerInspect = { } | null; }> | null; NetworkMode?: string; + PortBindings?: Record | null> | null; RestartPolicy?: { Name?: string; MaximumRetryCount?: number } | null; CapAdd?: string[] | null; CapDrop?: string[] | null; diff --git a/src/lib/onboard/openshell-feature-gate.test.ts b/src/lib/onboard/openshell-feature-gate.test.ts index 4bdb118e1bc..ea4231c8865 100644 --- a/src/lib/onboard/openshell-feature-gate.test.ts +++ b/src/lib/onboard/openshell-feature-gate.test.ts @@ -81,7 +81,7 @@ describe("OpenShell MCP feature gate", () => { } }); - it("identifies the pinned v0.0.85 sandbox artifacts without executing them", () => { + it("identifies the pinned v0.0.99 sandbox artifacts without executing them", () => { const sandbox = path.join( fs.mkdtempSync(path.join(os.tmpdir(), "nemoclaw-openshell-features-")), "openshell-sandbox", @@ -92,13 +92,13 @@ describe("OpenShell MCP feature gate", () => { `#!/bin/sh\nexit 127\n# ${REQUIRED_OPENSHELL_SANDBOX_MCP_FEATURE}\n`, { mode: 0o755 }, ); - const digest = "863ef21ab7ef623f5e7a8728c4e5532b46bfbae3ace3b800665a1c6353a1f7d2"; - const arm64Digest = "680115dbc2affde0e88261ab09f4044726d1cc9e01de55dc5077d1118f52968d"; + const digest = "a4b0c38ed90a6dd4b4f312ad3727824a25ec478d88d4e65d22a82377b18e6214"; + const arm64Digest = "f60ce5b76e4dbd645f690c8519852d261c8cf6a70b5fc56db329a23d68bc7b2e"; - expect(pinnedOpenShellSandboxBuildVersion(digest)).toBe("0.0.85"); - expect(pinnedOpenShellSandboxBuildVersion(arm64Digest)).toBe("0.0.85"); + expect(pinnedOpenShellSandboxBuildVersion(digest)).toBe("0.0.99"); + expect(pinnedOpenShellSandboxBuildVersion(arm64Digest)).toBe("0.0.99"); expect(resolveOpenShellComponentBuildVersion(sandbox, "sandbox", () => digest)).toBe( - "0.0.85", + "0.0.99", ); } finally { fs.rmSync(path.dirname(sandbox), { recursive: true, force: true }); diff --git a/src/lib/onboard/openshell-feature-gate.ts b/src/lib/onboard/openshell-feature-gate.ts index fb881d669aa..7de53598967 100644 --- a/src/lib/onboard/openshell-feature-gate.ts +++ b/src/lib/onboard/openshell-feature-gate.ts @@ -56,9 +56,9 @@ const PINNED_SANDBOX_BUILD_VERSIONS = new Map([ // OpenShell v0.0.82 standalone sandbox binaries. ["145246049bd73c60452ac3c2b4b1801663196c8e2f80575af820289c78c1cf09", "0.0.82"], ["76bc19b70d9f1e1e9871307045796cd39cc7b8fc4c08ffc90593cc934f36d500", "0.0.82"], - // OpenShell v0.0.85 standalone sandbox binaries. - ["863ef21ab7ef623f5e7a8728c4e5532b46bfbae3ace3b800665a1c6353a1f7d2", "0.0.85"], - ["680115dbc2affde0e88261ab09f4044726d1cc9e01de55dc5077d1118f52968d", "0.0.85"], + // OpenShell v0.0.99 standalone sandbox binaries. + ["a4b0c38ed90a6dd4b4f312ad3727824a25ec478d88d4e65d22a82377b18e6214", "0.0.99"], + ["f60ce5b76e4dbd645f690c8519852d261c8cf6a70b5fc56db329a23d68bc7b2e", "0.0.99"], ]); export function pinnedOpenShellSandboxBuildVersion(sha256: string): string | null { diff --git a/src/lib/onboard/openshell-install.test.ts b/src/lib/onboard/openshell-install.test.ts index 480e295a989..e91b28b9e56 100644 --- a/src/lib/onboard/openshell-install.test.ts +++ b/src/lib/onboard/openshell-install.test.ts @@ -74,7 +74,7 @@ describe("ensureOpenshellForOnboard", () => { ); }); - it("applies the 0.0.85 floor during final validation when the blueprint omits a minimum", () => { + it("applies the 0.0.99 floor during final validation when the blueprint omits a minimum", () => { const deps = makeDeps({ isOpenshellInstalled: () => false, getInstalledOpenshellVersion: () => "0.0.81", @@ -88,6 +88,6 @@ describe("ensureOpenshellForOnboard", () => { expect(deps.error).toHaveBeenCalledWith( " \u2717 openshell 0.0.81 is below the minimum required by this NemoClaw release.", ); - expect(deps.error).toHaveBeenCalledWith(" blueprint.yaml min_openshell_version: 0.0.85"); + expect(deps.error).toHaveBeenCalledWith(" blueprint.yaml min_openshell_version: 0.0.99"); }); }); diff --git a/src/lib/onboard/openshell-install.ts b/src/lib/onboard/openshell-install.ts index 105de2c36e6..e777388ab1c 100644 --- a/src/lib/onboard/openshell-install.ts +++ b/src/lib/onboard/openshell-install.ts @@ -157,7 +157,7 @@ export function ensureOpenshellForOnboard(deps: OpenShellInstallDeps): OpenShell localBin: null, futureShellPathHint: null, }; - const minOpenshellVersion = deps.getBlueprintMinOpenshellVersion() ?? "0.0.85"; + const minOpenshellVersion = deps.getBlueprintMinOpenshellVersion() ?? "0.0.99"; if (!deps.isOpenshellInstalled()) { deps.log(" openshell CLI not found. Installing..."); diff --git a/src/lib/onboard/openshell-version.ts b/src/lib/onboard/openshell-version.ts index 894de51627e..eb6afc970c9 100644 --- a/src/lib/onboard/openshell-version.ts +++ b/src/lib/onboard/openshell-version.ts @@ -7,7 +7,7 @@ import path from "node:path"; import { resolveOpenshell } from "../adapters/openshell/resolve"; import { ROOT, runCapture } from "../runner"; -export const SUPPORTED_OPENSHELL_FALLBACK_VERSION = "0.0.85"; +export const SUPPORTED_OPENSHELL_FALLBACK_VERSION = "0.0.99"; export function getInstalledOpenshellVersion(versionOutput: string | null = null): string | null { const openshellBin = resolveOpenshell(); diff --git a/test/brev-launchable-ci-cpu-checksum.test.ts b/test/brev-launchable-ci-cpu-checksum.test.ts index 682eaf1e574..cabb218dd64 100644 --- a/test/brev-launchable-ci-cpu-checksum.test.ts +++ b/test/brev-launchable-ci-cpu-checksum.test.ts @@ -11,7 +11,7 @@ import { describe, expect, it } from "vitest"; const SCRIPT = path.join(import.meta.dirname, "..", "scripts", "brev-launchable-ci-cpu.sh"); const BREV_LIFECYCLE_SCRIPT_MAX_BYTES = 16 * 1024; const ASSET = "openshell-x86_64-unknown-linux-musl.tar.gz"; -const PINNED_ASSET_SHA256 = "078fa086f506832c3d47d992e6109f26074bdd55916ce268e47c3971423459eb"; +const PINNED_ASSET_SHA256 = "35725a358e42ef7f0f0393035536da317706b0febcc459a2011e0555f6c2b71c"; type FakeSystemOptions = { archiveShape?: @@ -205,7 +205,7 @@ done case "$(basename "$out")" in ${ASSET}) tmp="$(mktemp -d)" - printf '#!/usr/bin/env bash\\nprintf "openshell 0.0.85\\\\n"\\n' > "$tmp/openshell" + printf '#!/usr/bin/env bash\\nprintf "openshell 0.0.99\\\\n"\\n' > "$tmp/openshell" chmod +x "$tmp/openshell" /usr/bin/tar -czf "$out" -C "$tmp" openshell rm -rf "$tmp" @@ -264,7 +264,7 @@ function runLaunchable(options: FakeSystemOptions) { ...process.env, LAUNCH_LOG: fake.launchLog, NEMOCLAW_CLONE_DIR: fake.cloneDir, - OPENSHELL_VERSION: options.openshellVersion ?? "v0.0.85", + OPENSHELL_VERSION: options.openshellVersion ?? "v0.0.99", PATH: options.nodeSourceChecksumTool === false ? fake.fakeBin : `${fake.fakeBin}:/usr/bin:/bin`, SUDO_USER: "tester", @@ -327,7 +327,7 @@ describe("brev-launchable-ci-cpu.sh OpenShell checksum gate", { timeout: 30_000 const out = combinedLaunchableOutput(result, fake.launchLog); expect(result.status, out).toBe(1); expect(out).toContain( - `OpenShell release checksum for ${ASSET} does not match NemoClaw-pinned v0.0.85 digest`, + `OpenShell release checksum for ${ASSET} does not match NemoClaw-pinned v0.0.99 digest`, ); expect(fs.existsSync(fake.tarLog) ? fs.readFileSync(fake.tarLog, "utf-8") : "").toBe(""); expect(fs.existsSync(fake.sudoLog) ? fs.readFileSync(fake.sudoLog, "utf-8") : "").not.toMatch( @@ -363,7 +363,7 @@ describe("brev-launchable-ci-cpu.sh OpenShell checksum gate", { timeout: 30_000 try { const out = combinedLaunchableOutput(result, fake.launchLog); expect(result.status, out).toBe(0); - expect(out).toContain("OpenShell CLI installed: openshell 0.0.85"); + expect(out).toContain("OpenShell CLI installed: openshell 0.0.99"); expect(fs.readFileSync(fake.tarLog, "utf-8")).toContain(`xzf`); const sudoLog = fs.readFileSync(fake.sudoLog, "utf-8"); expect(sudoLog).toMatch(/^install -m 755 .*openshell/m); diff --git a/test/candidate-compat.test.ts b/test/candidate-compat.test.ts index 1cef8def4f3..6536e4fd6a3 100644 --- a/test/candidate-compat.test.ts +++ b/test/candidate-compat.test.ts @@ -25,7 +25,7 @@ import { } from "../tools/candidate-compat.mts"; const SHA = "a".repeat(40); -const VERSION = "0.0.85"; +const VERSION = "0.0.99"; const E2E_SOURCES = readFileSync(resolve(".github/workflows/e2e.yaml"), "utf8"); const ASSETS = [ { name: "openshell-x86_64-unknown-linux-musl.tar.gz", role: "cli" as const }, diff --git a/test/deepagents-mcp-legacy-lifecycle.test.ts b/test/deepagents-mcp-legacy-lifecycle.test.ts index bd4be086f4c..7ab4eec5eb7 100644 --- a/test/deepagents-mcp-legacy-lifecycle.test.ts +++ b/test/deepagents-mcp-legacy-lifecycle.test.ts @@ -38,7 +38,7 @@ vi.mock("../src/lib/actions/sandbox/process-recovery", () => ({ executeSandboxExecCommand: mocks.executeSandboxExecCommand, })); -const MATCHING_OPENSHELL = path.resolve("test/fixtures/openshell-v0.0.85"); +const MATCHING_OPENSHELL = path.resolve("test/fixtures/openshell-v0.0.99"); const ORIGINAL_HOME = process.env.HOME; const ORIGINAL_OPENSHELL_BIN = process.env.NEMOCLAW_OPENSHELL_BIN; const ORIGINAL_OPENSHELL_GATEWAY = process.env.OPENSHELL_GATEWAY; diff --git a/test/e2e/live/network-policy.test.ts b/test/e2e/live/network-policy.test.ts index 894b3a7b731..33e56e5852b 100644 --- a/test/e2e/live/network-policy.test.ts +++ b/test/e2e/live/network-policy.test.ts @@ -561,7 +561,7 @@ test("network-policy: restricted sandbox enforces live allow/deny policy probes" timeoutMs: 30_000, }); expect(openshellVersion.exitCode, text(openshellVersion)).toBe(0); - expect(text(openshellVersion)).toContain("0.0.85"); + expect(text(openshellVersion)).toContain("0.0.99"); const apiKey = secrets.required("NVIDIA_INFERENCE_API_KEY"); cleanup.trackDisposable(`delete OpenShell sandbox ${SANDBOX_NAME}`, () => diff --git a/test/e2e/live/openclaw-plugin-runtime-exdev.test.ts b/test/e2e/live/openclaw-plugin-runtime-exdev.test.ts index ac5c5c9a9a7..0524c42ac7a 100644 --- a/test/e2e/live/openclaw-plugin-runtime-exdev.test.ts +++ b/test/e2e/live/openclaw-plugin-runtime-exdev.test.ts @@ -82,7 +82,7 @@ assert.equal( const NEMOCLAW_RELEASE_TAG = "v0.0.71"; const NEMOCLAW_RELEASE_COMMIT = "e4b9111f5f0535c2fc3d6fbe8dc8dca101a6fdce"; const NEMOCLAW_RELEASE_OPENSHELL_VERSION = "0.0.71"; -const CURRENT_OPENSHELL_VERSION = "0.0.85"; +const CURRENT_OPENSHELL_VERSION = "0.0.99"; const NEMOCLAW_SOURCE_REPOSITORY = "https://github.com/NVIDIA/NemoClaw.git"; const RELEASE_BUILDER_IMAGE_REF = "node:22-trixie-slim@sha256:2d9f5c76c8f4dd36e8f253bee5d828a83a6c09f36188f0b0414325232e0b175d"; @@ -1173,7 +1173,7 @@ test("the current-lifecycle custom plugin survives restart and recreation withou boundary: "fresh-openclaw-sandbox-exec", regressionTargets: ["#6108", "#3513", "#3127"], contract: [ - "the current CLI uses OpenShell 0.0.85 for current lifecycle coverage", + "the current CLI uses OpenShell 0.0.99 for current lifecycle coverage", "the CLI and Dockerfile use the same checkout source and a compatible sandbox base image", "gateway log, runtime inspection, tools.catalog, and tools.invoke prove weather/get_weather", "custom-plugin v1 survives restart and recreation installs v2", diff --git a/test/e2e/live/openshell-gateway-auth-source-contract-helpers.ts b/test/e2e/live/openshell-gateway-auth-source-contract-helpers.ts index 0b49fef55c6..97f78bc4a6d 100644 --- a/test/e2e/live/openshell-gateway-auth-source-contract-helpers.ts +++ b/test/e2e/live/openshell-gateway-auth-source-contract-helpers.ts @@ -615,7 +615,7 @@ async function runOpenShellGatewayAuthSourceContractScenarioUnchecked( const version = run(gatewayBin, ["--version"]); expect(version.status, commandOutput(version)).toBe(0); - expect(commandOutput(version)).toContain(process.env.NEMOCLAW_CANDIDATE_VERSION || "0.0.85"); + expect(commandOutput(version)).toContain(process.env.NEMOCLAW_CANDIDATE_VERSION || "0.0.99"); await requireDockerDaemon({ dockerBin, host, skip }); diff --git a/test/e2e/live/openshell-gateway-auth-source-contract.test.ts b/test/e2e/live/openshell-gateway-auth-source-contract.test.ts index e43249083a9..df947b1a37d 100644 --- a/test/e2e/live/openshell-gateway-auth-source-contract.test.ts +++ b/test/e2e/live/openshell-gateway-auth-source-contract.test.ts @@ -7,7 +7,7 @@ import { test } from "../fixtures/e2e-test.ts"; import { runOpenShellGatewayAuthSourceContractScenario } from "./openshell-gateway-auth-source-contract-helpers.ts"; const LIVE_TIMEOUT_MS = 8 * 60_000; -const OPENSHELL_GATEWAY_AUTH_CONTRACT_VERSION = process.env.NEMOCLAW_CANDIDATE_VERSION ?? "0.0.85"; +const OPENSHELL_GATEWAY_AUTH_CONTRACT_VERSION = process.env.NEMOCLAW_CANDIDATE_VERSION ?? "0.0.99"; test( `OpenShell ${OPENSHELL_GATEWAY_AUTH_CONTRACT_VERSION} Docker-driver gateway auth uses NemoClaw mTLS plus sandbox JWT`, diff --git a/test/e2e/live/openshell-gateway-upgrade.test.ts b/test/e2e/live/openshell-gateway-upgrade.test.ts index ab3fffcc570..60cb61ef529 100644 --- a/test/e2e/live/openshell-gateway-upgrade.test.ts +++ b/test/e2e/live/openshell-gateway-upgrade.test.ts @@ -71,7 +71,7 @@ const OLD_INSTALLER_SHA256 = process.env.NEMOCLAW_OLD_INSTALLER_SHA256 ?? "0c42400a0d3867739f1d75d612e069967be4506e169974bbbebf14b7af39144f"; const OLD_OPENSHELL_VERSION = process.env.NEMOCLAW_OLD_OPENSHELL_VERSION ?? "0.0.36"; -const CURRENT_OPENSHELL_VERSION = process.env.NEMOCLAW_CURRENT_OPENSHELL_VERSION ?? "0.0.85"; +const CURRENT_OPENSHELL_VERSION = process.env.NEMOCLAW_CURRENT_OPENSHELL_VERSION ?? "0.0.99"; const OLD_SANDBOX_BASE_IMAGE_REF = process.env.NEMOCLAW_OLD_SANDBOX_BASE_IMAGE_REF ?? "ghcr.io/nvidia/nemoclaw/sandbox-base@sha256:104151ffadc2ff0b6c815e3c95c2783ced61aee0d0f83fc327cc02be9b7e14e6"; diff --git a/test/fixtures/openshell-v0.0.99 b/test/fixtures/openshell-v0.0.99 new file mode 100755 index 00000000000..e2239f307c4 --- /dev/null +++ b/test/fixtures/openshell-v0.0.99 @@ -0,0 +1,8 @@ +#!/bin/sh +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +if [ "$#" -ne 1 ] || [ "$1" != "--version" ]; then + exit 64 +fi +printf '%s\n' 'openshell 0.0.99' diff --git a/test/hermes-doctor-config-hash.test.ts b/test/hermes-doctor-config-hash.test.ts index c0b9aa8d292..cbd2255ebbe 100644 --- a/test/hermes-doctor-config-hash.test.ts +++ b/test/hermes-doctor-config-hash.test.ts @@ -117,7 +117,7 @@ describe("Hermes doctor and config hash boundary", () => { const managedPolicyReaderPath = path.join(libDir, "managed_policy.py"); const mcpCredentialBoundaryPath = path.join( libDir, - "openshell-child-visible-credentials.v0.0.85.json", + "openshell-child-visible-credentials.v0.0.99.json", ); const stateLockPlanPath = path.join(tmp, "state-lock-plan.json"); const hermesCronRestoreControlPath = path.join(libDir, "hermes-cron-restore-control.py"); diff --git a/test/hermes-final-image-layout.test.ts b/test/hermes-final-image-layout.test.ts index b566d0656e0..35a8efab9bc 100644 --- a/test/hermes-final-image-layout.test.ts +++ b/test/hermes-final-image-layout.test.ts @@ -287,7 +287,7 @@ describe("Hermes final image layout", () => { "COPY agents/hermes/build-mcp-digest.py /usr/local/lib/nemoclaw/build-hermes-mcp-digest.py", "COPY agents/hermes/mcp-config-transaction.py /usr/local/lib/nemoclaw/hermes-mcp-config-transaction.py", "COPY agents/hermes/cron-restore-control.py /usr/local/lib/nemoclaw/hermes-cron-restore-control.py", - "COPY src/lib/actions/sandbox/openshell-child-visible-credentials.v0.0.85.json /usr/local/lib/nemoclaw/openshell-child-visible-credentials.v0.0.85.json", + "COPY src/lib/actions/sandbox/openshell-child-visible-credentials.v0.0.99.json /usr/local/lib/nemoclaw/openshell-child-visible-credentials.v0.0.99.json", "COPY scripts/state-dir-guard.py /usr/local/lib/nemoclaw/state-dir-guard.py", "COPY agents/hermes/state-lock-plan.json /usr/local/share/nemoclaw/state-lock-plan.json", "COPY nemoclaw-blueprint/scripts/*.js /usr/local/lib/nemoclaw/preloads/", diff --git a/test/hermes-mcp-credential-boundary-manifest.test.ts b/test/hermes-mcp-credential-boundary-manifest.test.ts index 70f29be067e..d2b54f13f73 100644 --- a/test/hermes-mcp-credential-boundary-manifest.test.ts +++ b/test/hermes-mcp-credential-boundary-manifest.test.ts @@ -14,9 +14,9 @@ const TRANSACTION = path.join( "hermes", "mcp-config-transaction.py", ); -const MANIFEST_NAME = "openshell-child-visible-credentials.v0.0.85.json"; +const MANIFEST_NAME = "openshell-child-visible-credentials.v0.0.99.json"; const validManifest: Record = { - openshellVersion: "0.0.85", + openshellVersion: "0.0.99", rawChildValueKeys: ["RAW_CHILD_VALUE"], rewrittenChildValueKeys: ["REWRITTEN_CHILD_VALUE"], runtimeControlKeys: ["RUNTIME_CONTROL"], diff --git a/test/install-openshell-version-check.test.ts b/test/install-openshell-version-check.test.ts index d76bbb0b2f1..78df1281f23 100644 --- a/test/install-openshell-version-check.test.ts +++ b/test/install-openshell-version-check.test.ts @@ -7,7 +7,7 @@ import os from "node:os"; import path from "node:path"; import { describe, expect, it } from "vitest"; -import credentialBoundaryManifest from "../src/lib/actions/sandbox/openshell-child-visible-credentials.v0.0.85.json"; +import credentialBoundaryManifest from "../src/lib/actions/sandbox/openshell-child-visible-credentials.v0.0.99.json"; const SCRIPT = path.join(import.meta.dirname, "..", "scripts", "install-openshell.sh"); const CANDIDATE_RUNTIME = { @@ -19,16 +19,16 @@ const CANDIDATE_RUNTIME = { }; const CANDIDATE_RUNTIME_ENABLED = Object.values(CANDIDATE_RUNTIME).every(Boolean); const PINNED_OPEN_SHELL_SHA256 = { - cliDarwinArm64: "522c963f9515c7325b978e89022de76227ac245eefe1371292af1424434e2067", - cliLinuxArm64: "3cf353e7994d5835a233fe0641f9a860779190b054d0f90a04c897be782734b8", - cliLinuxX64: "078fa086f506832c3d47d992e6109f26074bdd55916ce268e47c3971423459eb", - formula: "f53c62777fed23b42427822d231670451ee4358efeb2660c41a7a38919211b23", - gatewayDarwinArm64: "5de3e08ad1bdb0cdd01373999f537edca3d8aca22ae1c29bc9926969fe401e45", - gatewayLinuxArm64: "09f2823f6e9c5f70f4482b200206eac455d789618da4ebe4acff042d794e7162", - gatewayLinuxX64: "718cc9f942f88565cacb13c39717b128d6acc8d336212d42d26243f36ab19ece", - sandboxLinuxArm64: "2c52b2971aecf125e41ed160d8d2f2addf04031906ca88f120ae3d436dd6b8f7", - sandboxLinuxX64: "94306f057d862cd5c34a0daa7692491733bc5ca528a7b92f9f62f717fb70a9be", - sandboxBinaryLinuxX64: "863ef21ab7ef623f5e7a8728c4e5532b46bfbae3ace3b800665a1c6353a1f7d2", + cliDarwinArm64: "e31cac5360e2adf3c971d5742a516626c58acf2fd3db4dcb0e45804def3dc844", + cliLinuxArm64: "d00cbf0d8779c01ddea6453ead2ad4db3d89a1f14eb6f0785f7919f42813a279", + cliLinuxX64: "35725a358e42ef7f0f0393035536da317706b0febcc459a2011e0555f6c2b71c", + formula: "8dd34fc17ee9a30327664a18c9509c8a765cb010de38cda8e22841bddbe92713", + gatewayDarwinArm64: "4340619292ecb565f90eb2250db504baa37dd410361b366b42e174d34512cb6c", + gatewayLinuxArm64: "3a5d3092ae34356beb0ff2a920f9a87af4233c7a1086a53cd9429d48358f5c09", + gatewayLinuxX64: "640d204dc3c6bc28bffa1f3d870897fc23bbc5ec0151a6c642083e958455cb49", + sandboxLinuxArm64: "c758e7dc2b8c904baa01e2ccce0f08daf96ede0c648478b23346d8c4dd16f432", + sandboxLinuxX64: "84caed3dec4390e0938e89b38b1256d31e8970b4bfd85437bf92ed79f5b1ff05", + sandboxBinaryLinuxX64: "a4b0c38ed90a6dd4b4f312ad3727824a25ec478d88d4e65d22a82377b18e6214", }; const ZERO_SHA256 = "0000000000000000000000000000000000000000000000000000000000000000"; const REQUIRED_OPENSHELL_VERSION = credentialBoundaryManifest.openshellVersion; @@ -813,7 +813,7 @@ exit 1`, NEMOCLAW_ACCEPT_DEV_UNVERIFIED_INSTALL: "1", NEMOCLAW_OPENSHELL_CHANNEL: "dev", NEMOCLAW_TEST_BREW_UNTRUST_HELP_STATUS: "1", - NEMOCLAW_TEST_INSTALLED_VERSION: "0.0.85-dev.8+g7bce1223d", + NEMOCLAW_TEST_INSTALLED_VERSION: "0.0.99-dev.8+g7bce1223d", PATH: `${fakeBin}:/usr/bin:/bin`, }, encoding: "utf8", @@ -842,7 +842,7 @@ exit 1`, NEMOCLAW_ACCEPT_DEV_UNVERIFIED_INSTALL: "1", NEMOCLAW_OPENSHELL_CHANNEL: "dev", NEMOCLAW_TEST_BREW_UNTRUST_STATUS: "1", - NEMOCLAW_TEST_INSTALLED_VERSION: "0.0.85-dev.8+g7bce1223d", + NEMOCLAW_TEST_INSTALLED_VERSION: "0.0.99-dev.8+g7bce1223d", PATH: `${fakeBin}:/usr/bin:/bin`, }, encoding: "utf8", @@ -872,7 +872,7 @@ exit 1`, NEMOCLAW_OPENSHELL_CHANNEL: "dev", NEMOCLAW_TEST_BREW_INSTALL_STATUS: "1", NEMOCLAW_TEST_BREW_UNTRUST_CLEANUP_STATUS: "1", - NEMOCLAW_TEST_INSTALLED_VERSION: "0.0.85-dev.8+g7bce1223d", + NEMOCLAW_TEST_INSTALLED_VERSION: "0.0.99-dev.8+g7bce1223d", PATH: `${fakeBin}:/usr/bin:/bin`, }, encoding: "utf8", @@ -908,7 +908,7 @@ exit 1`, NEMOCLAW_ACCEPT_DEV_UNVERIFIED_INSTALL: "1", NEMOCLAW_OPENSHELL_CHANNEL: "dev", NEMOCLAW_TEST_BREW_TRUST_STATUS: "1", - NEMOCLAW_TEST_INSTALLED_VERSION: "0.0.85-dev.8+g7bce1223d", + NEMOCLAW_TEST_INSTALLED_VERSION: "0.0.99-dev.8+g7bce1223d", PATH: `${fakeBin}:/usr/bin:/bin`, }, encoding: "utf8", @@ -1279,7 +1279,7 @@ exit 0`, expect(result.status, `${result.stdout}\n${result.stderr}`).toBe(1); expect(result.stderr).toContain( - "OpenShell release checksum for openshell-x86_64-unknown-linux-musl.tar.gz does not match NemoClaw-pinned v0.0.85 digest", + "OpenShell release checksum for openshell-x86_64-unknown-linux-musl.tar.gz does not match NemoClaw-pinned v0.0.99 digest", ); expect(fs.existsSync(tarLog) ? fs.readFileSync(tarLog, "utf-8") : "").toBe(""); expect(fs.existsSync(installLog) ? fs.readFileSync(installLog, "utf-8") : "").toBe(""); @@ -1314,7 +1314,7 @@ exit 0`, }); it("reinstalls the pinned release when openshell is above MAX_VERSION", () => { - const result = runWithInstalledVersion("0.0.86"); + const result = runWithInstalledVersion("0.0.100"); expect(result.status).not.toBe(0); expect(result.stdout).toContain( `above the maximum (${REQUIRED_OPENSHELL_VERSION}) supported by this NemoClaw release`, @@ -1340,7 +1340,7 @@ exit 0`, }); it("accepts an installed OpenShell dev-channel Docker-driver build", () => { - const result = runWithInstalledVersion("0.0.85.dev84+g6b2180425", { + const result = runWithInstalledVersion("0.0.99.dev84+g6b2180425", { NEMOCLAW_OPENSHELL_CHANNEL: "dev", NEMOCLAW_ACCEPT_DEV_UNVERIFIED_INSTALL: "1", }); @@ -1350,7 +1350,7 @@ exit 0`, }); it("fails closed for dev-channel installs without explicit risk acceptance", () => { - const result = runWithInstalledVersion("0.0.85.dev84+g6b2180425", { + const result = runWithInstalledVersion("0.0.99.dev84+g6b2180425", { NEMOCLAW_OPENSHELL_CHANNEL: "dev", }); expect(result.status).toBe(1); @@ -1361,12 +1361,12 @@ exit 0`, it("accepts coherent dev components with different git-prefix lengths", () => { const result = runWithInstalledVersion( - "0.0.85-dev.8+g7bce1223d", + "0.0.99-dev.8+g7bce1223d", { NEMOCLAW_ACCEPT_DEV_UNVERIFIED_INSTALL: "1", NEMOCLAW_OPENSHELL_CHANNEL: "dev", }, - { driverVersion: "0.0.85-dev.8+g7bce1223" }, + { driverVersion: "0.0.99-dev.8+g7bce1223" }, ); expect(result.status, `${result.stdout}\n${result.stderr}`).toBe(0); expect(result.stdout).toMatch(/dev channel/); @@ -1401,7 +1401,7 @@ exit 0`, it("reuses a macOS dev build with its required Homebrew gateway service", () => { const result = runWithInstalledVersion( - "0.0.85-dev.8+g7bce1223d", + "0.0.99-dev.8+g7bce1223d", { NEMOCLAW_ACCEPT_DEV_UNVERIFIED_INSTALL: "1", NEMOCLAW_OPENSHELL_CHANNEL: "dev", @@ -1413,7 +1413,7 @@ exit 0`, }); it("refreshes an installed dev build when current main is required", () => { - const result = runWithInstalledVersion("0.0.85-dev.8+g7bce1223d", { + const result = runWithInstalledVersion("0.0.99-dev.8+g7bce1223d", { NEMOCLAW_ACCEPT_DEV_UNVERIFIED_INSTALL: "1", NEMOCLAW_OPENSHELL_CHANNEL: "dev", NEMOCLAW_OPENSHELL_FORCE_INSTALL: "1", diff --git a/test/mcp-add-crash-consistency.test.ts b/test/mcp-add-crash-consistency.test.ts index 49454d99525..8036cbac23d 100644 --- a/test/mcp-add-crash-consistency.test.ts +++ b/test/mcp-add-crash-consistency.test.ts @@ -8,7 +8,7 @@ import path from "node:path"; import { describe, expect, it } from "vitest"; -const MATCHING_OPENSHELL = path.resolve("test/fixtures/openshell-v0.0.85"); +const MATCHING_OPENSHELL = path.resolve("test/fixtures/openshell-v0.0.99"); type CrashBoundary = | "provider" diff --git a/test/mcp-destroy-lifecycle.test.ts b/test/mcp-destroy-lifecycle.test.ts index c9c7c8b9982..1bc156ada1e 100644 --- a/test/mcp-destroy-lifecycle.test.ts +++ b/test/mcp-destroy-lifecycle.test.ts @@ -108,7 +108,7 @@ function stubRecreateJournal(): RebuildRecreateJournal { }; } -const MATCHING_OPENSHELL = path.resolve("test/fixtures/openshell-v0.0.85"); +const MATCHING_OPENSHELL = path.resolve("test/fixtures/openshell-v0.0.99"); const bridgeEntries: Record<"github" | "slack", McpBridgeEntry> = { github: { diff --git a/test/mcp-openshell-workflow.test.ts b/test/mcp-openshell-workflow.test.ts index 9d4278a6231..4ceab1d44a7 100644 --- a/test/mcp-openshell-workflow.test.ts +++ b/test/mcp-openshell-workflow.test.ts @@ -5,7 +5,7 @@ import fs from "node:fs"; import { describe, expect, it } from "vitest"; -import credentialBoundaryManifest from "../src/lib/actions/sandbox/openshell-child-visible-credentials.v0.0.85.json"; +import credentialBoundaryManifest from "../src/lib/actions/sandbox/openshell-child-visible-credentials.v0.0.99.json"; import { validateMcpOpenShellWorkflowBoundary } from "../tools/e2e/mcp-workflow-boundary.mts"; describe("MCP OpenShell workflow boundary", () => { diff --git a/test/mcp-policy-key-ownership.test.ts b/test/mcp-policy-key-ownership.test.ts index 532311241e0..1343505c438 100644 --- a/test/mcp-policy-key-ownership.test.ts +++ b/test/mcp-policy-key-ownership.test.ts @@ -8,8 +8,8 @@ import path from "node:path"; import { describe, expect, it } from "vitest"; -const MATCHING_OPENSHELL = path.resolve("test/fixtures/openshell-v0.0.85"); -const MATCHING_OPENSHELL_VERSION_CLAUSE = `if [ "$1" = "--version" ]; then printf '%s\\n' 'openshell 0.0.85'; exit 0; fi`; +const MATCHING_OPENSHELL = path.resolve("test/fixtures/openshell-v0.0.99"); +const MATCHING_OPENSHELL_VERSION_CLAUSE = `if [ "$1" = "--version" ]; then printf '%s\\n' 'openshell 0.0.99'; exit 0; fi`; const PRESET = `network_policies: example: diff --git a/test/mcp-restart-policy-order.test.ts b/test/mcp-restart-policy-order.test.ts index 072384f531f..626bbd6f5fe 100644 --- a/test/mcp-restart-policy-order.test.ts +++ b/test/mcp-restart-policy-order.test.ts @@ -8,7 +8,7 @@ import path from "node:path"; import { describe, expect, it } from "vitest"; -const MATCHING_OPENSHELL = path.resolve("test/fixtures/openshell-v0.0.85"); +const MATCHING_OPENSHELL = path.resolve("test/fixtures/openshell-v0.0.99"); describe("MCP restart policy ordering", () => { it("rejects a foreign attached credential key before policy or provider mutation", () => { diff --git a/test/openshell-0.0.99-migration-review.test.ts b/test/openshell-0.0.99-migration-review.test.ts new file mode 100644 index 00000000000..6f5f2ee80f7 --- /dev/null +++ b/test/openshell-0.0.99-migration-review.test.ts @@ -0,0 +1,55 @@ +// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +import fs from "node:fs"; +import path from "node:path"; +import { describe, expect, it } from "vitest"; + +const repoRoot = path.resolve(import.meta.dirname, ".."); +const review = fs.readFileSync( + path.join(repoRoot, "docs", "security", "openshell-0.0.99-migration-review.md"), + "utf8", +); + +const ranges = [ + ["85", "86", 12, 109], + ["86", "87", 5, 12], + ["87", "88", 15, 169], + ["88", "89", 9, 49], + ["89", "90", 9, 24], + ["90", "91", 3, 33], + ["91", "92", 11, 55], + ["92", "93", 7, 24], + ["93", "94", 12, 68], + ["94", "95", 7, 107], + ["95", "96", 5, 38], + ["96", "97", 12, 144], + ["97", "98", 3, 50], + ["98", "99", 7, 79], +] as const; + +describe("OpenShell 0.0.99 migration review", () => { + it("records every adjacent source range and the complete commit boundary (#8497)", () => { + expect(ranges.reduce((sum, range) => sum + range[2], 0)).toBe(117); + for (const [from, to, commits, paths] of ranges) { + expect(review).toContain(`| \`v0.0.${from} -> v0.0.${to}\` | ${commits} | ${paths} |`); + } + expect(review).toContain("515 distinct changed paths"); + const commitLedger = review + .split("The complete audited commit set")[1] + ?.split("## Consumed release artifacts")[0]; + expect(commitLedger?.match(/\b[0-9a-f]{8}\b/gu)).toHaveLength(117); + }); + + it("keeps provenance, credential, activation, and runtime gates explicit (#8497)", () => { + expect(review).toContain("8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032"); + expect(review).toContain( + "sha256:ea3632b6e9528e2309103af5b6949606fcdc83ca1f69e8db81482a25bea84bb6", + ); + expect(review).toContain("openshell-child-visible-credentials.v0.0.99.json"); + expect(review).toContain("AttachStdout=false"); + expect(review).toContain("non-empty port binding"); + expect(review).toContain("0.0.85 -> 0.0.99"); + expect(review).toContain("without conditional skips or expected failures"); + }); +}); diff --git a/test/openshell-channel-workflow.test.ts b/test/openshell-channel-workflow.test.ts index 44c2fda488b..644304abd86 100644 --- a/test/openshell-channel-workflow.test.ts +++ b/test/openshell-channel-workflow.test.ts @@ -63,8 +63,8 @@ function runLaunchableDevGate() { describe("OpenShell channel workflow boundary", () => { it.each([ { channel: "dev", expected: "dev" }, - { channel: "stable", expected: "v0.0.85" }, - { channel: "auto", expected: "v0.0.85" }, + { channel: "stable", expected: "v0.0.99" }, + { channel: "auto", expected: "v0.0.99" }, { channel: "dev", explicit: "v9.9.9", expected: "v9.9.9" }, ])("resolves launchable channel $channel to $expected", ({ channel, explicit, expected }) => { const result = resolveLaunchableVersion({ channel, explicit }); diff --git a/test/pr-workflow-contract.test.ts b/test/pr-workflow-contract.test.ts index fdaa1d0b081..24549283c2c 100644 --- a/test/pr-workflow-contract.test.ts +++ b/test/pr-workflow-contract.test.ts @@ -656,7 +656,7 @@ describe("pull request and main workflow contracts", () => { "scripts/install-openshell.sh", "scripts/update-hermes-agent.sh", "src/lib/actions/sandbox/mcp-bridge-validation.ts", - "src/lib/actions/sandbox/openshell-child-visible-credentials.v0.0.85.json", + "src/lib/actions/sandbox/openshell-child-visible-credentials.v0.0.99.json", ]) { expect(files.test(path), path).toBe(true); } diff --git a/test/sandbox-provisioning.test.ts b/test/sandbox-provisioning.test.ts index 52d42c3585a..a9cc3cbc81a 100644 --- a/test/sandbox-provisioning.test.ts +++ b/test/sandbox-provisioning.test.ts @@ -1036,7 +1036,7 @@ describe("Hermes sandbox provisioning", () => { "patch-hermes-langfuse-credentials.mts", ); const managedPolicyReaderPath = path.join(localLib, "managed_policy.py"); - const mcpManifest = path.join(localLib, "openshell-child-visible-credentials.v0.0.85.json"); + const mcpManifest = path.join(localLib, "openshell-child-visible-credentials.v0.0.99.json"); const stateDirGuardPath = path.join(localLib, "state-dir-guard.py"); const stateLockPlanPath = path.join( tmp, diff --git a/test/sandbox-rlimit-hooks.test.ts b/test/sandbox-rlimit-hooks.test.ts index db49265afd6..db1ca672055 100644 --- a/test/sandbox-rlimit-hooks.test.ts +++ b/test/sandbox-rlimit-hooks.test.ts @@ -526,7 +526,7 @@ describe("sandbox rlimit system hooks (#2173)", () => { const mcpTransaction = path.join(localLib, "hermes-mcp-config-transaction.py"); const mcpCredentialBoundary = path.join( localLib, - "openshell-child-visible-credentials.v0.0.85.json", + "openshell-child-visible-credentials.v0.0.99.json", ); const preloadDir = path.join(localLib, "preloads"); const safetyNet = path.join(preloadDir, "sandbox-safety-net.js"); @@ -615,7 +615,7 @@ describe("sandbox rlimit system hooks (#2173)", () => { .replaceAll("/usr/local/lib/nemoclaw/build-hermes-mcp-digest.py", buildMcpDigest) .replaceAll("/usr/local/lib/nemoclaw/hermes-mcp-config-transaction.py", mcpTransaction) .replaceAll( - "/usr/local/lib/nemoclaw/openshell-child-visible-credentials.v0.0.85.json", + "/usr/local/lib/nemoclaw/openshell-child-visible-credentials.v0.0.99.json", mcpCredentialBoundary, ) .replaceAll("/usr/local/lib/nemoclaw/preloads/sandbox-safety-net.js", safetyNet) diff --git a/test/update-hermes-agent-script.test.ts b/test/update-hermes-agent-script.test.ts index 25c2445cb8e..ff8f5a98955 100644 --- a/test/update-hermes-agent-script.test.ts +++ b/test/update-hermes-agent-script.test.ts @@ -33,7 +33,7 @@ const CURRENT_INSTALLED_DOCKERFILE = [ "COPY agents/hermes/build-mcp-digest.py /usr/local/lib/nemoclaw/build-hermes-mcp-digest.py", 'RUN mcp_digest="$(/opt/hermes/.venv/bin/python -I /usr/local/lib/nemoclaw/build-hermes-mcp-digest.py --guard /usr/local/lib/nemoclaw/hermes-runtime-config-guard.py --config /sandbox/.hermes/config.yaml)"', "COPY agents/hermes/mcp-config-transaction.py /usr/local/lib/nemoclaw/hermes-mcp-config-transaction.py", - "COPY src/lib/actions/sandbox/openshell-child-visible-credentials.v0.0.85.json /usr/local/lib/nemoclaw/openshell-child-visible-credentials.v0.0.85.json", + "COPY src/lib/actions/sandbox/openshell-child-visible-credentials.v0.0.99.json /usr/local/lib/nemoclaw/openshell-child-visible-credentials.v0.0.99.json", "RUN HERMES_HOME=/sandbox/.hermes /usr/local/bin/hermes doctor --fix \\", " && node --experimental-strip-types /opt/nemoclaw-hermes-config/generate-config.ts", "RUN mkdir -p /sandbox/.hermes/profiles/dashboard-home", @@ -300,7 +300,7 @@ fi expect(run.status).toBe(1); expect(run.stdout).toContain("INVALID: installed copy"); expect(run.stdout).toContain("marker hermes-mcp-config-transaction.py"); - expect(run.stdout).toContain("marker openshell-child-visible-credentials.v0.0.85.json"); + expect(run.stdout).toContain("marker openshell-child-visible-credentials.v0.0.99.json"); expect(run.stdout).toContain("marker COPY agents/hermes/build-mcp-digest.py"); expect(run.stdout).toContain("marker /opt/hermes/.venv/bin/python -I"); expect(fs.readFileSync(installedDockerfile, "utf-8")).toBe(CURRENT_INSTALLED_BASE); diff --git a/tools/e2e/mcp-workflow-boundary.mts b/tools/e2e/mcp-workflow-boundary.mts index a43ecfb5307..259bbcda9d4 100644 --- a/tools/e2e/mcp-workflow-boundary.mts +++ b/tools/e2e/mcp-workflow-boundary.mts @@ -23,15 +23,15 @@ const CREDENTIAL_WINDOW_ARTIFACT_DIR = "e2e-artifacts/live/openshell-credential- const CREDENTIAL_WINDOW_RUN_STEP = "Run OpenShell credential generation-window live test"; const CREDENTIAL_WINDOW_JOB_CONDITION = "${{ (github.event_name != 'workflow_dispatch' || (inputs.jobs == '' && inputs.targets == '')) || contains(format(',{0},', inputs.jobs), ',mcp-bridge,') || contains(format(',{0},', inputs.targets), ',mcp-bridge,') || contains(format(',{0},', inputs.jobs), ',openshell-credential-generation-window,') || contains(format(',{0},', inputs.targets), ',openshell-credential-generation-window,') }}"; -const STABLE_RELEASE_SOURCE_SHA = "3dee5570a46076a57a3b056f35f35ebc0861ac85"; +const STABLE_RELEASE_SOURCE_SHA = "8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032"; const STABLE_RELEASE_SUPERVISOR_INDEX = - "f4226253a3525c3832adac5b38b419a0f27d1e915effe565b5885e20f93cd5e9"; + "ea3632b6e9528e2309103af5b6949606fcdc83ca1f69e8db81482a25bea84bb6"; const STABLE_RELEASE_IDENTITY_TOKENS = [ - 'releaseTag: "v0.0.85"', + 'releaseTag: "v0.0.99"', STABLE_RELEASE_SOURCE_SHA, - "222d9d53a142691d7a7de2c692f38e52d24066f9f633d53746c5fef775861bc8", - "33bb479d936c3c1b17dd475df05747be9de74564fb67d69a4c33cdd01181d02f", - "863ef21ab7ef623f5e7a8728c4e5532b46bfbae3ace3b800665a1c6353a1f7d2", + "5c0dabb90152a3cfae9005731771da99f00a22403080c81952c7be8ba4b5728f", + "05bd6c982dd72b73364b91ab694487c026bc56d0cd869f4289b44cc392a5c2ba", + "a4b0c38ed90a6dd4b4f312ad3727824a25ec478d88d4e65d22a82377b18e6214", ] as const; const STABLE_RELEASE_PROVENANCE_TOKENS = [ ...STABLE_RELEASE_IDENTITY_TOKENS, From 7bac3c0b7dd2c5a9432eb42508ff4951016179dd Mon Sep 17 00:00:00 2001 From: Apurv Kumaria Date: Thu, 6 Aug 2026 21:47:01 -0700 Subject: [PATCH 02/18] fix(openshell): support v0.0.99 activation output Signed-off-by: Apurv Kumaria --- src/lib/inference/config.test.ts | 19 +++++++ src/lib/inference/config.ts | 2 +- test/install-openshell-version-pin.test.ts | 58 +++++++++++----------- 3 files changed, 49 insertions(+), 30 deletions(-) diff --git a/src/lib/inference/config.test.ts b/src/lib/inference/config.test.ts index 4d23cad43c5..1d5ad471053 100644 --- a/src/lib/inference/config.test.ts +++ b/src/lib/inference/config.test.ts @@ -571,6 +571,25 @@ describe("parseGatewayInference", () => { }); }); + it("parses the OpenShell v0.0.99 inference heading", () => { + const output = [ + "Inference:", + "", + " Workspace: default", + " Provider: compatible-endpoint", + " Model: custom-model", + " Version: 1", + "", + "System inference:", + "", + " Not configured", + ].join("\n"); + expect(parseGatewayInference(output)).toEqual({ + provider: "compatible-endpoint", + model: "custom-model", + }); + }); + it("returns null for empty output", () => { expect(parseGatewayInference("")).toBeNull(); expect(parseGatewayInference(null)).toBeNull(); diff --git a/src/lib/inference/config.ts b/src/lib/inference/config.ts index b21fe40c2fd..355278c988f 100644 --- a/src/lib/inference/config.ts +++ b/src/lib/inference/config.ts @@ -363,7 +363,7 @@ export function parseGatewayInference(output: string | null | undefined): Gatewa let provider: string | null = null; let model: string | null = null; for (const line of lines) { - if (/^Gateway inference:\s*$/i.test(line)) { + if (/^(?:Gateway )?Inference:\s*$/i.test(line)) { inGateway = true; continue; } diff --git a/test/install-openshell-version-pin.test.ts b/test/install-openshell-version-pin.test.ts index f1f2efe5d86..0783a625402 100644 --- a/test/install-openshell-version-pin.test.ts +++ b/test/install-openshell-version-pin.test.ts @@ -22,9 +22,9 @@ test("selects the supported OpenShell version when newer releases exist (#3474)" path.join(binDir, "gh"), `#!/bin/sh printf '%s\\n' '${JSON.stringify([ - { tagName: "v0.0.81" }, - { tagName: "v0.0.86" }, - { tagName: "v0.0.85" }, + { tagName: "v0.0.98" }, + { tagName: "v0.0.100" }, + { tagName: "v0.0.99" }, ])}'`, ); @@ -39,17 +39,17 @@ printf '%s\\n' '${JSON.stringify([ const pin = require(${JSON.stringify(path.join(REPO_ROOT, "src/lib/onboard/openshell-pin.ts"))}); const version = require(${JSON.stringify(path.join(REPO_ROOT, "src/lib/onboard/openshell-version.ts"))}); const deps = { - getBlueprintMinOpenshellVersion: () => "0.0.85", - getBlueprintMaxOpenshellVersion: () => "0.0.85", + getBlueprintMinOpenshellVersion: () => "0.0.99", + getBlueprintMaxOpenshellVersion: () => "0.0.99", versionGte: version.versionGte, }; const resolution = pin.resolveOpenshellInstallPin(deps); const replacement = pin.computeOpenshellInstallEnv( - { INSTALLED_OPENSHELL_VERSION: "0.0.81" }, + { INSTALLED_OPENSHELL_VERSION: "0.0.98" }, deps, ); process.stdout.write(JSON.stringify({ - installed: version.getInstalledOpenshellVersion("openshell 0.0.81"), + installed: version.getInstalledOpenshellVersion("openshell 0.0.98"), resolution, replacement: replacement.env, }));`, @@ -64,13 +64,13 @@ process.stdout.write(JSON.stringify({ ); expect(result.status, result.stderr).toBe(0); expect(JSON.parse(result.stdout)).toEqual({ - installed: "0.0.81", - resolution: { kind: "pin", version: "0.0.85", latest: "0.0.86", reason: "max-cap" }, + installed: "0.0.98", + resolution: { kind: "pin", version: "0.0.99", latest: "0.0.100", reason: "max-cap" }, replacement: { - INSTALLED_OPENSHELL_VERSION: "0.0.81", - NEMOCLAW_OPENSHELL_MIN_VERSION: "0.0.85", - NEMOCLAW_OPENSHELL_MAX_VERSION: "0.0.85", - NEMOCLAW_OPENSHELL_PIN_VERSION: "0.0.85", + INSTALLED_OPENSHELL_VERSION: "0.0.98", + NEMOCLAW_OPENSHELL_MIN_VERSION: "0.0.99", + NEMOCLAW_OPENSHELL_MAX_VERSION: "0.0.99", + NEMOCLAW_OPENSHELL_PIN_VERSION: "0.0.99", }, }); } finally { @@ -79,9 +79,9 @@ process.stdout.write(JSON.stringify({ }); const PINNED_OPEN_SHELL_SHA256 = { - cliLinuxX64: "078fa086f506832c3d47d992e6109f26074bdd55916ce268e47c3971423459eb", - gatewayLinuxX64: "718cc9f942f88565cacb13c39717b128d6acc8d336212d42d26243f36ab19ece", - sandboxLinuxX64: "94306f057d862cd5c34a0daa7692491733bc5ca528a7b92f9f62f717fb70a9be", + cliLinuxX64: "35725a358e42ef7f0f0393035536da317706b0febcc459a2011e0555f6c2b71c", + gatewayLinuxX64: "640d204dc3c6bc28bffa1f3d870897fc23bbc5ec0151a6c642083e958455cb49", + sandboxLinuxX64: "84caed3dec4390e0938e89b38b1256d31e8970b4bfd85437bf92ed79f5b1ff05", }; type GhDownloadMode = "success" | "fail"; @@ -91,7 +91,7 @@ function writeExecutable(target: string, contents: string): void { } // Bash helpers shared by the gh and curl stubs: write a fake archive and emit -// the same pinned digest lines the real OpenShell v0.0.85 release uses. A fake +// the same pinned digest lines the real OpenShell v0.0.99 release uses. A fake // sha256sum below keeps this test self-contained even though the tarball bytes are // synthetic. const SHARED_DOWNLOAD_BASH_HELPERS = `\ @@ -328,11 +328,11 @@ function runVersionPinTarget(options: { ghDownloadMode: GhDownloadMode }): void fs.writeFileSync(downloadLog, ""); createFakeUname(fakeBin); - createFakeStickyOpenshell(fakeBin, "0.0.86"); + createFakeStickyOpenshell(fakeBin, "0.0.100"); createFakeHelperBinaries(fakeBin); createFakeGh(fakeBin, downloadLog, options.ghDownloadMode); createFakeCurl(fakeBin, downloadLog); - createFakeTar(fakeBin, "0.0.85"); + createFakeTar(fakeBin, "0.0.99"); createFakeStrings(fakeBin); createFakeSha256sum(fakeBin); @@ -351,36 +351,36 @@ function runVersionPinTarget(options: { ghDownloadMode: GhDownloadMode }): void // "above the maximum" hard-fail before download). expect(result.status, `${result.stdout}\n${result.stderr}`).toBe(0); - // Assertion 2: download-log-contains-v0.0.85 — pinned release tag was + // Assertion 2: download-log-contains-v0.0.99 — pinned release tag was // requested from the release host. const downloads = fs.readFileSync(downloadLog, "utf-8"); - expect(downloads).toContain("v0.0.85"); + expect(downloads).toContain("v0.0.99"); - // Assertion 3: download-log-excludes-v0.0.86 — the too-new sticky version + // Assertion 3: download-log-excludes-v0.0.100 — the too-new sticky version // is never re-fetched. - expect(downloads).not.toContain("v0.0.86"); + expect(downloads).not.toContain("v0.0.100"); if (options.ghDownloadMode === "fail") { // Assertion 3b: curl-fallback-observed — the installer must recover from // gh download failure by re-requesting the pinned assets via curl. - expect(downloads).toContain("gh download-fail v0.0.85"); + expect(downloads).toContain("gh download-fail v0.0.99"); expect(downloads).toContain("curl "); } else { - expect(downloads).toContain("gh download v0.0.85"); + expect(downloads).toContain("gh download v0.0.99"); expect(downloads).not.toContain("curl "); } - // Assertion 4: replaced-openshell-reports-0.0.85 — the binary on disk in + // Assertion 4: replaced-openshell-reports-0.0.99 — the binary on disk in // the active install dir (== fakeBin, since ACTIVE_OPENSHELL_BIN resolved - // there and it is writable) was overwritten with the pinned 0.0.85 build. + // there and it is writable) was overwritten with the pinned 0.0.99 build. const replacedVersion = spawnSync(path.join(fakeBin, "openshell"), ["--version"], { encoding: "utf8", killSignal: "SIGKILL", timeout: 30_000, }); expect(replacedVersion.status).toBe(0); - expect(replacedVersion.stdout).toContain("0.0.85"); - expect(replacedVersion.stdout).not.toContain("0.0.86"); + expect(replacedVersion.stdout).toContain("0.0.99"); + expect(replacedVersion.stdout).not.toContain("0.0.100"); } finally { fs.rmSync(tmp, { recursive: true, force: true }); } From 9eb215cd84399eaa1d2c851e9e26dfa75c51d968 Mon Sep 17 00:00:00 2001 From: Apurv Kumaria Date: Thu, 6 Aug 2026 22:37:57 -0700 Subject: [PATCH 03/18] test(openshell): use valid activation sandbox names Signed-off-by: Apurv Kumaria --- test/e2e/live/managed-image-activation-e2e-helpers.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/e2e/live/managed-image-activation-e2e-helpers.ts b/test/e2e/live/managed-image-activation-e2e-helpers.ts index 9425b164194..3140c148316 100644 --- a/test/e2e/live/managed-image-activation-e2e-helpers.ts +++ b/test/e2e/live/managed-image-activation-e2e-helpers.ts @@ -35,9 +35,9 @@ const GATEWAY = "nemoclaw"; const AGENT_TIMEOUT_MS = 3 * 60_000; const ONBOARD_TIMEOUT_MS = 20 * 60_000; const SANDBOX_NAMES: Record = { - openclaw: "managed-activation-openclaw", - hermes: "managed-activation-hermes", - "langchain-deepagents-code": "managed-activation-dcode", + openclaw: "mi-act-openclaw", + hermes: "mi-act-hermes", + "langchain-deepagents-code": "mi-act-dcode", }; type RuntimeFixtures = { readonly artifacts: ArtifactSink; From 984d7c612420b0bd0d8373c7c7d26eecc60fd48c Mon Sep 17 00:00:00 2001 From: Apurv Kumaria Date: Thu, 6 Aug 2026 23:04:09 -0700 Subject: [PATCH 04/18] fix(openshell): complete v0.0.99 qualification Signed-off-by: Apurv Kumaria --- agents/hermes/mcp-config-transaction.py | 6 +- ci/source-shape-test-budget.json | 5 + docs/deployment/set-up-mcp-bridge.mdx | 10 +- docs/reference/commands.mdx | 4 +- docs/reference/troubleshooting.mdx | 4 +- .../openshell-0.0.99-migration-review.md | 2 + .../src/shared/openshell-policy-boundary.cts | 2 +- nemoclaw/src/shared/sandbox-name.cts | 5 +- .../sandbox/mcp-bridge-url-validation.ts | 8 +- src/lib/deploy/index.test.ts | 2 +- src/lib/onboard/forward-start.ts | 4 +- test/e2e/support/mcp-bridge-sandbox.test.ts | 36 +-- test/installer-hash-check.test.ts | 6 +- test/onboard-sandbox-name.test.ts | 10 +- .../openshell-0.0.85-migration-review.test.ts | 10 +- .../openshell-0.0.99-migration-review.test.ts | 227 +++++++++++++++--- test/repro-5978-policy-denial-hint.test.ts | 2 +- test/runner.test.ts | 28 +-- test/update-hermes-agent-script.test.ts | 2 +- tools/e2e/cli-artifact-workflow-boundary.mts | 2 +- 20 files changed, 280 insertions(+), 95 deletions(-) diff --git a/agents/hermes/mcp-config-transaction.py b/agents/hermes/mcp-config-transaction.py index a0b43d06fef..3c843a66a93 100755 --- a/agents/hermes/mcp-config-transaction.py +++ b/agents/hermes/mcp-config-transaction.py @@ -118,7 +118,7 @@ def _load_credential_boundary_manifest() -> dict[str, object]: # corrupt, or wrong-version OpenShell boundary manifest. # sourceBoundary: NemoClaw owns one reviewed manifest installed beside this # helper in images; the second path is the deterministic source-checkout layout. - # whyNotSourceFix: OpenShell v0.0.85 has no machine-readable child-env contract. + # whyNotSourceFix: OpenShell v0.0.99 has no machine-readable child-env contract. # It also deliberately hides the supervisor identity mount from workload # children and the Hermes image contains no OpenShell CLI. Executing # ``openshell --version`` here would therefore either fail every real @@ -330,7 +330,7 @@ def _validate_payload(action: str, payload: dict[str, object]) -> None: } if action == "add" and hostname in host_aliases: raise ValueError( - "Authenticated MCP OpenShell host aliases are unavailable with OpenShell v0.0.85" + "Authenticated MCP OpenShell host aliases are unavailable with OpenShell v0.0.99" ) if not (action == "remove" and hostname in host_aliases) and ( hostname in {"localhost", "local", "internal", "metadata"} @@ -1099,7 +1099,7 @@ def _assert_non_root_lifecycle_identity() -> None: # topology. # sourceBoundary: OpenShell owns workload topology; NemoClaw owns the # immutable root-lifecycle marker and validates it before mutation. - # whyNotSourceFix: OpenShell 0.0.85 supports both topologies but exposes no + # whyNotSourceFix: OpenShell 0.0.99 supports both topologies but exposes no # attested same-UID capability that this packaged helper can query. # regressionTest: hermes-mcp-config-transaction.test.ts rejects both probe # and add when the root-lifecycle marker identifies the legacy topology. diff --git a/ci/source-shape-test-budget.json b/ci/source-shape-test-budget.json index 59c21b47475..d1d7b386584 100644 --- a/ci/source-shape-test-budget.json +++ b/ci/source-shape-test-budget.json @@ -361,6 +361,11 @@ "test": "keeps the setup docs aligned with the stable default", "category": "compatibility" }, + { + "file": "test/openshell-0.0.99-migration-review.test.ts", + "test": "associates every reviewed release identity with the 0.0.99 manifest (#8497)", + "category": "security" + }, { "file": "test/onboard-performance-config-schema.test.ts", "test": "keeps baseline budgets derived from the checked-in samples", diff --git a/docs/deployment/set-up-mcp-bridge.mdx b/docs/deployment/set-up-mcp-bridge.mdx index 0a26a797a16..bfa9212235c 100644 --- a/docs/deployment/set-up-mcp-bridge.mdx +++ b/docs/deployment/set-up-mcp-bridge.mdx @@ -71,15 +71,19 @@ NemoClaw accepts canonical HTTPS MCP URLs and writes the credential placeholder The MCP integration pins its OpenShell DNS enforcement contract to [`NVIDIA/OpenShell@8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032`](https://github.com/NVIDIA/OpenShell/tree/8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032). -OpenShell uses one socket-address list throughout resolution, validation, and connection: +With `proxy_connect_by_hostname` disabled, OpenShell uses one socket-address list throughout resolution, validation, and connection: - [`crates/openshell-supervisor-network/src/proxy.rs:3030-3055`](https://github.com/NVIDIA/OpenShell/blob/8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032/crates/openshell-supervisor-network/src/proxy.rs#L3030-L3055) produces the list. - [`crates/openshell-supervisor-network/src/proxy.rs:3060-3115`](https://github.com/NVIDIA/OpenShell/blob/8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032/crates/openshell-supervisor-network/src/proxy.rs#L3060-L3115) validates every address. - [`crates/openshell-supervisor-network/src/proxy.rs:3130-3211`](https://github.com/NVIDIA/OpenShell/blob/8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032/crates/openshell-supervisor-network/src/proxy.rs#L3130-L3211) connects through the validated list. The CONNECT path passes that validated connector to the direct or operator-configured upstream dial path. -The explicit HTTP-forward path carries the same connector from [`crates/openshell-supervisor-network/src/proxy.rs:4650-4656`](https://github.com/NVIDIA/OpenShell/blob/8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032/crates/openshell-supervisor-network/src/proxy.rs#L4650-L4656) to [`crates/openshell-supervisor-network/src/proxy.rs:4697-4705`](https://github.com/NVIDIA/OpenShell/blob/8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032/crates/openshell-supervisor-network/src/proxy.rs#L4697-L4705). -There is no second hostname resolution between validation and connection in either path. +By default, direct connections and corporate-proxy CONNECT requests use the validated address list at [`crates/openshell-supervisor-network/src/proxy.rs:3179-3211`](https://github.com/NVIDIA/OpenShell/blob/8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032/crates/openshell-supervisor-network/src/proxy.rs#L3179-L3211). +The explicit HTTP-forward path carries the same connector from [`crates/openshell-supervisor-network/src/proxy.rs:4650-4656`](https://github.com/NVIDIA/OpenShell/blob/8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032/crates/openshell-supervisor-network/src/proxy.rs#L4650-L4656) into the actual connection at [`crates/openshell-supervisor-network/src/proxy.rs:4706-4711`](https://github.com/NVIDIA/OpenShell/blob/8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032/crates/openshell-supervisor-network/src/proxy.rs#L4706-L4711). + +The exception is OpenShell's operator-controlled `proxy_connect_by_hostname` option. +When enabled, OpenShell sends the requested hostname to the corporate proxy instead of the validated address, which reopens proxy-side DNS resolution; the upstream source records that residual risk at [`crates/openshell-supervisor-network/src/proxy.rs:3168-3200`](https://github.com/NVIDIA/OpenShell/blob/8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032/crates/openshell-supervisor-network/src/proxy.rs#L3168-L3200). +NemoClaw does not enable or prohibit that host-level OpenShell option, so operators who require the pinned-address guarantee must leave it disabled and ensure their gateway configuration does not enable it. ### Stable OpenShell 0.0.99 Limitations diff --git a/docs/reference/commands.mdx b/docs/reference/commands.mdx index 0c66b28e8e0..dd41e76e97a 100644 --- a/docs/reference/commands.mdx +++ b/docs/reference/commands.mdx @@ -678,7 +678,7 @@ API-key mode is inference-only and does not enable managed Nous tool gateways. The wizard prompts for a sandbox name. -Names must be 1 to 63 characters, lowercase, start with a letter, contain only letters, numbers, and internal hyphens, and end with a letter or number. +Names must be 1 to 19 characters, lowercase, start with a letter, contain only letters, numbers, and internal hyphens, and end with a letter or number. The CLI rejects names that do not match these rules. It also prints a `Try: ` recovery line whenever it can derive a valid lowercase, hyphen-separated form from the input, so passing `--name MyAssistant` reports `Try: myassistant`. Names that match global CLI commands (`status`, `list`, `debug`, etc.) are rejected to avoid routing conflicts. @@ -861,7 +861,7 @@ If a `--resume` is attempted with a different `--from` path than the original se #### `--name ` Set the sandbox name without going through the interactive prompt. -The same name format and reserved-name rules that the wizard enforces apply here too. Names must be 1 to 63 characters, lowercase, start with a letter, contain only letters, numbers, and internal hyphens, and end with a letter or number. +The same name format and reserved-name rules that the wizard enforces apply here too. Names must be 1 to 19 characters, lowercase, start with a letter, contain only letters, numbers, and internal hyphens, and end with a letter or number. Names that match a NemoClaw CLI command (`status`, `list`, `debug`, etc.) are rejected up front. ```bash diff --git a/docs/reference/troubleshooting.mdx b/docs/reference/troubleshooting.mdx index 3f783b4a6db..cf719b458ac 100644 --- a/docs/reference/troubleshooting.mdx +++ b/docs/reference/troubleshooting.mdx @@ -806,7 +806,7 @@ $$nemoclaw rebuild --yes ### Invalid sandbox name -Sandbox names must be lowercase, start with a letter, contain only letters, numbers, and internal hyphens, and end with a letter or number. +Sandbox names must use 1 to 19 characters, be lowercase, start with a letter, contain only letters, numbers, and internal hyphens, and end with a letter or number. The CLI rejects names that do not match these rules. It prints a `Try: ` recovery line whenever it can derive a valid lowercase, hyphen-separated form from the input, so passing `--name MyAssistant` reports `Try: myassistant` and you can rerun with the suggested slug. @@ -1669,7 +1669,7 @@ The reminder is shown once per top-level interactive session, and only when all Suppress it with `NEMOCLAW_NO_POLICY_HINT=1`. The reminder names the sandbox when NemoClaw receives a valid sandbox name during sandbox creation. If no valid name is available, it shows ``; run `$$nemoclaw list` to see your sandbox names. -If the reported sandbox name contains characters that are not valid in a sandbox name (uppercase letters, underscores, control characters, and similar) or exceeds 63 characters, the reminder shows the `` placeholder for safety rather than echoing the untrusted value. +If the reported sandbox name contains characters that are not valid in a sandbox name (uppercase letters, underscores, control characters, and similar) or exceeds 19 characters, the reminder shows the `` placeholder for safety rather than echoing the untrusted value. The reminder is intentionally proactive: the denial itself is surfaced by the OpenShell proxy, so the `curl`/`git` error text is left unchanged and the reminder points you to the logs instead. To see which rule denied the request, read the merged logs from the host: diff --git a/docs/security/openshell-0.0.99-migration-review.md b/docs/security/openshell-0.0.99-migration-review.md index 00ae2f25892..ce556949e95 100644 --- a/docs/security/openshell-0.0.99-migration-review.md +++ b/docs/security/openshell-0.0.99-migration-review.md @@ -113,6 +113,8 @@ than enabling optional upstream behavior implicitly. | `OS99-10` | OCI WorkingDir and image-user metadata | Driver-owned values remain under the runtime-control boundary. | | `OS99-11` | System CA root mode | Not enabled implicitly; current CA-policy tests remain required. | | `OS99-12` | Podman lifecycle changes | Podman exact-version live coverage remains an acceptance gate. | +| `OS99-13` | Inference status heading changed from `Gateway inference:` to `Inference:` | The parser accepts both headings, with focused regression coverage for the exact v0.0.99 output. | +| `OS99-14` | Routable sandbox names are capped at 19 characters | NemoClaw's canonical validation uses the same 19-character limit, and generated activation names fit it. Exact all-agent activation remains a final acceptance gate. | An unresolved critical or high concern blocks the upgrade. Test selection cannot waive a concern; conditional skips and expected failures do not count as qualification evidence. diff --git a/nemoclaw/src/shared/openshell-policy-boundary.cts b/nemoclaw/src/shared/openshell-policy-boundary.cts index 5f1c0c107fc..5b12d93f165 100644 --- a/nemoclaw/src/shared/openshell-policy-boundary.cts +++ b/nemoclaw/src/shared/openshell-policy-boundary.cts @@ -100,7 +100,7 @@ export function parseOpenShellPolicy(raw: string): ParsedOpenShellPolicy { // regressionTest: the root policy round-trip and plugin runner policy tests. // removalCondition: OpenShell's supported base-policy contract guarantees that // provider-composed entries are absent from every mutation read. -// tracking: revalidated for stable OpenShell 0.0.85; revalidate after 0.0.85. +// tracking: revalidated for stable OpenShell 0.0.99; revalidate after 0.0.99. export function withoutProviderComposedPolicies(policies: Record): Record { return Object.fromEntries( Object.entries(policies).filter(([name]) => !name.startsWith("_provider_")), diff --git a/nemoclaw/src/shared/sandbox-name.cts b/nemoclaw/src/shared/sandbox-name.cts index a4a0a117dc0..291d462458a 100644 --- a/nemoclaw/src/shared/sandbox-name.cts +++ b/nemoclaw/src/shared/sandbox-name.cts @@ -22,7 +22,10 @@ // or provider identifier, or both grammars are enforced by shared upstream // contracts. -export const NAME_MAX_LENGTH = 63; +// OpenShell v0.0.99 routes sandbox and workspace identities through labels +// capped at 19 characters. Keep NemoClaw's canonical sandbox-name boundary at +// that upstream limit so invalid creates fail before any gateway mutation. +export const NAME_MAX_LENGTH = 19; export const PROVIDER_NAME_MAX_LENGTH = 128; // RFC 1035 label: starts with a lowercase letter, then lowercase diff --git a/src/lib/actions/sandbox/mcp-bridge-url-validation.ts b/src/lib/actions/sandbox/mcp-bridge-url-validation.ts index 783c02b9723..36483199a6a 100644 --- a/src/lib/actions/sandbox/mcp-bridge-url-validation.ts +++ b/src/lib/actions/sandbox/mcp-bridge-url-validation.ts @@ -49,12 +49,12 @@ function rejectUnsupportedOpenShellMcpHostAlias(hostname: string): void { // invalidState: a host alias is accepted without an attested gateway address, // forcing broad private-range policy instead of an exact destination pin. // sourceBoundary: the pinned OpenShell release owns gateway-address discovery. - // whyNotSourceFix: v0.0.85 exposes no attested driver gateway address. + // whyNotSourceFix: v0.0.99 exposes no attested driver gateway address. // regressionTest: URL validation and all three live adapters reject aliases. // removalCondition: remove only after a reviewed OpenShell capability exposes // an attested address; a future version number alone is not that capability. throw new McpBridgeError( - `Authenticated MCP OpenShell host alias '${hostname}' is unavailable with OpenShell v0.0.85 because that release does not expose an attested driver gateway address for exact policy pinning. Use a normal HTTPS DNS endpoint with public address records.`, + `Authenticated MCP OpenShell host alias '${hostname}' is unavailable with OpenShell v0.0.99 because that release does not expose an attested driver gateway address for exact policy pinning. Use a normal HTTPS DNS endpoint with public address records.`, 2, ); } @@ -64,7 +64,7 @@ function rejectUnsupportedOpenShellMcpIpv6Literal(hostname: string): void { // invalidState: an IPv6 literal reaches an OpenShell parser that cannot // represent and enforce its exact proxy target safely. // sourceBoundary: the pinned OpenShell proxy parser owns literal support. - // whyNotSourceFix: v0.0.85 does not support this target form. + // whyNotSourceFix: v0.0.99 does not support this target form. // regressionTest: URL normalization and resolved-target preflight both reject // private and public IPv6 literals with this capability-specific result. // removalCondition: remove only with reviewed parser support and parity proof; @@ -221,7 +221,7 @@ export async function preflightMcpServerUrlResolvedTarget( ): Promise { // invalidState: a hostname is public at add time but later rebinds to an // unpinned address. sourceBoundary: NemoClaw pins the add-time public answers; - // OpenShell v0.0.85 resolves, validates every answer against allowed_ips, and + // OpenShell v0.0.99 resolves, validates every answer against allowed_ips, and // connects with that same SocketAddr list. whyNotSourceFix: duplicating DNS // resolution here before each remote connection would create a second, // non-authoritative TOCTOU boundary outside OpenShell's data plane. diff --git a/src/lib/deploy/index.test.ts b/src/lib/deploy/index.test.ts index ff0a84e4c73..794a2e014f6 100644 --- a/src/lib/deploy/index.test.ts +++ b/src/lib/deploy/index.test.ts @@ -275,7 +275,7 @@ describe("executeDeploy", () => { expect(errorText).toContain('Invalid sandbox name: "bad name"'); expect(errorText).toContain("Sandbox names cannot contain spaces."); expect(errorText).toContain( - "Allowed format: 1-63 characters, lowercase, starts with a letter, letters/numbers/internal hyphens only, ends with letter/number.", + "Allowed format: 1-19 characters, lowercase, starts with a letter, letters/numbers/internal hyphens only, ends with letter/number.", ); expect(errorText).toContain( "Brev deploy is non-interactive and cannot prompt for a corrected sandbox name.", diff --git a/src/lib/onboard/forward-start.ts b/src/lib/onboard/forward-start.ts index 0bad39b9b18..64ec4787f9b 100644 --- a/src/lib/onboard/forward-start.ts +++ b/src/lib/onboard/forward-start.ts @@ -110,8 +110,8 @@ export function looksLikeUntrackedForward(diagnostic: string): boolean { * (#6099). * * Compatibility boundary: these exact diagnostics are emitted by the pinned - * OpenShell 0.0.85 forward-start path tracked in #7266. Reassess this matcher - * when NemoClaw's supported OpenShell range moves beyond 0.0.85, and remove it + * OpenShell 0.0.99 forward-start path tracked in #7266. Reassess this matcher + * when NemoClaw's supported OpenShell range moves beyond 0.0.99, and remove it * once OpenShell either keeps the attempt alive until the listener is ready or * exposes a structured retryable outcome. Keep the fragments narrow so an * unrelated SSH or gateway failure cannot enter the listener-retry path. diff --git a/test/e2e/support/mcp-bridge-sandbox.test.ts b/test/e2e/support/mcp-bridge-sandbox.test.ts index 9e43e8fbc1e..5d91251259a 100644 --- a/test/e2e/support/mcp-bridge-sandbox.test.ts +++ b/test/e2e/support/mcp-bridge-sandbox.test.ts @@ -168,26 +168,30 @@ describe("MCP curl policy denial classification", SUITE_OPTIONS, () => { } }); - it("pins the resolve-validate-connect source contract to OpenShell v0.0.85", () => { - const commit = "3dee5570a46076a57a3b056f35f35ebc0861ac85"; + it("pins the resolve-validate-connect source contract to OpenShell v0.0.99", () => { + const commit = "8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032"; const sourcePath = "crates/openshell-supervisor-network/src/proxy.rs"; const citations = [ - `${sourcePath}:2648-2674`, - `${sourcePath}:2699-2739`, - `${sourcePath}:2794-2803`, - `${sourcePath}:1079-1081`, - `${sourcePath}:4093-4100`, - `${sourcePath}:4340-4342`, + `${sourcePath}:3030-3055`, + `${sourcePath}:3060-3115`, + `${sourcePath}:3179-3211`, + `${sourcePath}:3168-3200`, + `${sourcePath}:4650-4656`, + `${sourcePath}:4706-4711`, ]; - for (const docsPath of [ - "docs/deployment/set-up-mcp-bridge.mdx", - "docs/security/openshell-0.0.85-migration-review.md", - ]) { - const docs = fs.readFileSync(docsPath, "utf8"); - expect(docs, docsPath).toContain(commit); - for (const citation of citations) expect(docs, docsPath).toContain(citation); - } + const docsPath = "docs/deployment/set-up-mcp-bridge.mdx"; + const docs = fs.readFileSync(docsPath, "utf8"); + expect(docs, docsPath).toContain(commit); + for (const citation of citations) expect(docs, docsPath).toContain(citation); + expect(docs).toContain("proxy_connect_by_hostname"); + expect(docs).toContain("reopens proxy-side DNS resolution"); + + const migrationReview = fs.readFileSync( + "docs/security/openshell-0.0.99-migration-review.md", + "utf8", + ); + expect(migrationReview).toContain(commit); }); it("adds one raw MCP policy with an exact public IP pin and no adapter identity", () => { diff --git a/test/installer-hash-check.test.ts b/test/installer-hash-check.test.ts index 0702c1dc96e..4aa756d54a4 100644 --- a/test/installer-hash-check.test.ts +++ b/test/installer-hash-check.test.ts @@ -451,14 +451,14 @@ const INSTALLER_MUTATIONS: Partial strin "installer-sandbox-build-pin-change": (source) => mutateSandboxBuildFunction(source, (functionSource) => functionSource.replace( - ` printf '%s\\n' "0.0.85" + ` printf '%s\\n' "0.0.99" ;; *)`, - ` printf '%s\\n' "0.0.85" + ` printf '%s\\n' "0.0.99" ;; aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | \\ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb) - printf '%s\\n' "0.0.83" + printf '%s\\n' "0.0.98" ;; *)`, ), diff --git a/test/onboard-sandbox-name.test.ts b/test/onboard-sandbox-name.test.ts index a94de898519..c2844fa1217 100644 --- a/test/onboard-sandbox-name.test.ts +++ b/test/onboard-sandbox-name.test.ts @@ -97,15 +97,15 @@ describe("onboard sandbox naming helpers", () => { it("exposes the full allowed sandbox name format", () => { expect(NAME_ALLOWED_FORMAT).toBe( - "1-63 characters, lowercase, starts with a letter, letters/numbers/internal hyphens only, ends with letter/number", + "1-19 characters, lowercase, starts with a letter, letters/numbers/internal hyphens only, ends with letter/number", ); }); it("explains sandbox name length and allowed format violations", () => { expect(getNameValidationGuidance("sandbox name", "a".repeat(64))).toEqual([ - "Sandbox names must be 63 characters or fewer.", + "Sandbox names must be 19 characters or fewer.", `Allowed format: ${NAME_ALLOWED_FORMAT}.`, - `Try: ${"a".repeat(63)}`, + `Try: ${"a".repeat(19)}`, ]); expect( getNameValidationGuidance("sandbox name", "bad name", { includeAllowedFormat: false }), @@ -139,8 +139,8 @@ describe("onboard sandbox naming helpers", () => { it("truncates over-length inputs to the max name length", () => { const slug = suggestNameSlug("a".repeat(80)); - expect(slug).toBe("a".repeat(63)); - expect(slug!.length).toBe(63); + expect(slug).toBe("a".repeat(19)); + expect(slug!.length).toBe(19); }); it("returns null when the input is already a valid name", () => { diff --git a/test/openshell-0.0.85-migration-review.test.ts b/test/openshell-0.0.85-migration-review.test.ts index 33135f6582f..c8524d65a47 100644 --- a/test/openshell-0.0.85-migration-review.test.ts +++ b/test/openshell-0.0.85-migration-review.test.ts @@ -248,7 +248,7 @@ describe("OpenShell 0.0.85 migration review", () => { expect(mcpProof).toContain("managed._MCP_PRIVATE_ANONYMOUS_DIRECTORY,"); }); - it("binds stable selectors while keeping the physical Spark proof separate", () => { + it("keeps the historical review separate from the current stable selectors", () => { const blueprint = fs.readFileSync( path.join(repoRoot, "nemoclaw-blueprint", "blueprint.yaml"), "utf8", @@ -261,15 +261,15 @@ describe("OpenShell 0.0.85 migration review", () => { "lib", "actions", "sandbox", - "openshell-child-visible-credentials.v0.0.85.json", + "openshell-child-visible-credentials.v0.0.99.json", ), "utf8", ), ) as { openshellVersion: string }; - expect(blueprint).toContain('min_openshell_version: "0.0.85"'); - expect(blueprint).toContain('max_openshell_version: "0.0.85"'); - expect(manifest.openshellVersion).toBe("0.0.85"); + expect(blueprint).toContain('min_openshell_version: "0.0.99"'); + expect(blueprint).toContain('max_openshell_version: "0.0.99"'); + expect(manifest.openshellVersion).toBe("0.0.99"); expect(review).toContain("binds NemoClaw's `0.0.85` selectors"); expect(review).toContain("physical Docker 27 DGX Spark"); expect(review).toContain("loopback first-byte test"); diff --git a/test/openshell-0.0.99-migration-review.test.ts b/test/openshell-0.0.99-migration-review.test.ts index 6f5f2ee80f7..fd507ad7adf 100644 --- a/test/openshell-0.0.99-migration-review.test.ts +++ b/test/openshell-0.0.99-migration-review.test.ts @@ -5,51 +5,218 @@ import fs from "node:fs"; import path from "node:path"; import { describe, expect, it } from "vitest"; +import { parseGatewayInference } from "../src/lib/inference/config.js"; +import { pinnedOpenShellSandboxBuildVersion } from "../src/lib/onboard/openshell-feature-gate.js"; +import { validateName } from "../src/lib/runner.js"; + const repoRoot = path.resolve(import.meta.dirname, ".."); const review = fs.readFileSync( path.join(repoRoot, "docs", "security", "openshell-0.0.99-migration-review.md"), "utf8", ); +const SOURCE_COMMIT = "8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032"; +const SUPERVISOR_DIGESTS = { + index: "sha256:ea3632b6e9528e2309103af5b6949606fcdc83ca1f69e8db81482a25bea84bb6", + amd64: "sha256:4adea8392a81ef34b3cc3284e693ac3cc6c13362fad84a492d95b53b3eb403b9", + arm64: "sha256:b548fd939331d830cd9197f20fca9a5d95383c5e67f64929d632a37403115f38", +} as const; + const ranges = [ - ["85", "86", 12, 109], - ["86", "87", 5, 12], - ["87", "88", 15, 169], - ["88", "89", 9, 49], - ["89", "90", 9, 24], - ["90", "91", 3, 33], - ["91", "92", 11, 55], - ["92", "93", 7, 24], - ["93", "94", 12, 68], - ["94", "95", 7, 107], - ["95", "96", 5, 38], - ["96", "97", 12, 144], - ["97", "98", 3, 50], - ["98", "99", 7, 79], + [ + "85", + "86", + 109, + "dd3f27c8 077adb79 008193a2 cf4deccd 1a0c1013 fe7135a2 d0961cdb aa483ecb 32f05244 54025517 d70adafe d5567487", + ], + ["86", "87", 12, "06062027 98f253b8 1fd4d2b9 8cf2673c 9a4f8a80"], + [ + "87", + "88", + 169, + "339eae5a 80987e91 a2cd5f8e a9f71313 f32c46d4 2575585b 9377e0d5 745512e3 ad29ab96 5952a5a2 f1690849 8d9502d9 e9ac0ee6 744a65d5 3ff15a16", + ], + [ + "88", + "89", + 49, + "dae92616 472e23f9 bdd1ce87 396a3b7b d35d52d4 8b0e54b2 2d5652b2 ac3d5c96 cbdeb4d5", + ], + [ + "89", + "90", + 24, + "fd1d3de8 5432d01d ca318058 cd9a0bf2 7b444bd8 0674a00b 8a14b3a4 541b97f0 1d4ac708", + ], + ["90", "91", 33, "75d24688 59f7839f 21da343c"], + [ + "91", + "92", + 55, + "f7cd9108 b422b678 850bd42e 77e5c322 01daf3a5 deced871 d4cd37be afb462f3 516be602 76a5397e 2d108818", + ], + ["92", "93", 24, "39bf94e5 79bcf296 2022d537 0d5e5c53 52f9e9e9 24d491a0 f00ad23a"], + [ + "93", + "94", + 68, + "7e9a7f51 b78c8615 efb2d9c2 b1c7ff68 2b7f04fe 7955c830 bc14018c 101cbc97 8d252f47 662dee68 d0f9301c 1221b586", + ], + ["94", "95", 107, "eb380d71 0cecb542 1cbfc0d5 9c019a93 7f53f78b fe15caa8 df698042"], + ["95", "96", 38, "28f3bee0 fa242990 02e890cc 596d729e 5541398c"], + [ + "96", + "97", + 144, + "1a25439c d220d894 489bb0d5 770d4e6b 905b554c 06c2db75 584f7dbf c42268ba e7533177 736e431d 1959ea19 fde96f04", + ], + ["97", "98", 50, "704880e5 0a3ec7a1 83284129"], + ["98", "99", 79, "b9818619 0e9a44cf 4d55265f d063751c 53780556 490f66f4 8c7dd148"], ] as const; +type DigestMatrix = Record<"CLI" | "Gateway" | "Sandbox", readonly [string, string, string | null]>; + +const archiveDigests: DigestMatrix = { + CLI: [ + "35725a358e42ef7f0f0393035536da317706b0febcc459a2011e0555f6c2b71c", + "d00cbf0d8779c01ddea6453ead2ad4db3d89a1f14eb6f0785f7919f42813a279", + "e31cac5360e2adf3c971d5742a516626c58acf2fd3db4dcb0e45804def3dc844", + ], + Gateway: [ + "640d204dc3c6bc28bffa1f3d870897fc23bbc5ec0151a6c642083e958455cb49", + "3a5d3092ae34356beb0ff2a920f9a87af4233c7a1086a53cd9429d48358f5c09", + "4340619292ecb565f90eb2250db504baa37dd410361b366b42e174d34512cb6c", + ], + Sandbox: [ + "84caed3dec4390e0938e89b38b1256d31e8970b4bfd85437bf92ed79f5b1ff05", + "c758e7dc2b8c904baa01e2ccce0f08daf96ede0c648478b23346d8c4dd16f432", + null, + ], +}; + +const binaryDigests: DigestMatrix = { + CLI: [ + "5c0dabb90152a3cfae9005731771da99f00a22403080c81952c7be8ba4b5728f", + "9390eac019d2bcabec1cac950ca97982fb3d7bce2560ae00e9c3f237d50b8481", + "578048e527b8fbb6741bbdacd55ac65bf0cb0776964ea8f18cd24cc979a1006f", + ], + Gateway: [ + "05bd6c982dd72b73364b91ab694487c026bc56d0cd869f4289b44cc392a5c2ba", + "35c1e1be9c8766de2bfd457e54918d6b2019c16da815ec4c45ce9ebb45aaa571", + "e53b0788d1fdc3e933bb11f13b02c5c1d8c6635bfb3166264558ac3272426113", + ], + Sandbox: [ + "a4b0c38ed90a6dd4b4f312ad3727824a25ec478d88d4e65d22a82377b18e6214", + "f60ce5b76e4dbd645f690c8519852d261c8cf6a70b5fc56db329a23d68bc7b2e", + null, + ], +}; + +function parseLedger(): Map { + const parsed = new Map(); + for (const match of review.matchAll(/^- `([0-9]+->[0-9]+)`: ((?:[0-9a-f]{8} ?)+)$/gmu)) { + parsed.set(match[1], match[2].trim().split(/\s+/u)); + } + return parsed; +} + +function parseRangeTable(): Map { + const parsed = new Map(); + for (const match of review.matchAll( + /^\| `(v0\.0\.[0-9]+ -> v0\.0\.[0-9]+)` \| ([0-9]+) \| ([0-9]+) \|/gmu, + )) { + parsed.set(match[1], { commits: Number(match[2]), paths: Number(match[3]) }); + } + return parsed; +} + +function parseDigestTable(start: string, end: string): DigestMatrix { + const section = review.split(start)[1]?.split(end)[0] ?? ""; + const parsed = {} as DigestMatrix; + for (const match of section.matchAll( + /^\| (CLI|Gateway|Sandbox) \| (`[0-9a-f]{64}`|not published) \| (`[0-9a-f]{64}`|not published) \| (`[0-9a-f]{64}`|not published) \|$/gmu, + )) { + const digest = (cell: string): string | null => + cell === "not published" ? null : cell.slice(1, -1); + parsed[match[1] as keyof DigestMatrix] = [ + digest(match[2]), + digest(match[3]), + digest(match[4]), + ] as [string, string, string | null]; + } + return parsed; +} + describe("OpenShell 0.0.99 migration review", () => { - it("records every adjacent source range and the complete commit boundary (#8497)", () => { - expect(ranges.reduce((sum, range) => sum + range[2], 0)).toBe(117); - for (const [from, to, commits, paths] of ranges) { - expect(review).toContain(`| \`v0.0.${from} -> v0.0.${to}\` | ${commits} | ${paths} |`); + it("binds every adjacent range to its declared unique commit ledger (#8497)", () => { + const ledger = parseLedger(); + const table = parseRangeTable(); + const allCommits: string[] = []; + + expect(ledger.size).toBe(ranges.length); + expect(table.size).toBe(ranges.length); + for (const [from, to, paths, commitText] of ranges) { + const key = `${from}->${to}`; + const rangeName = `v0.0.${from} -> v0.0.${to}`; + const commits = commitText.split(" "); + expect(ledger.get(key), `${key} commit membership`).toEqual(commits); + expect(table.get(rangeName), `${rangeName} declared counts`).toEqual({ + commits: commits.length, + paths, + }); + expect(new Set(commits).size, `${key} duplicate commits`).toBe(commits.length); + allCommits.push(...commits); } + + expect(allCommits).toHaveLength(117); + expect(new Set(allCommits).size).toBe(117); expect(review).toContain("515 distinct changed paths"); - const commitLedger = review - .split("The complete audited commit set")[1] - ?.split("## Consumed release artifacts")[0]; - expect(commitLedger?.match(/\b[0-9a-f]{8}\b/gu)).toHaveLength(117); }); - it("keeps provenance, credential, activation, and runtime gates explicit (#8497)", () => { - expect(review).toContain("8c7dd148a9e6360c9d5b2830e339a0dc4b3f3032"); - expect(review).toContain( - "sha256:ea3632b6e9528e2309103af5b6949606fcdc83ca1f69e8db81482a25bea84bb6", + // source-shape-contract: security -- Exact release evidence must stay bound to the independently reviewed manifest identity and artifact digests. + it("associates every reviewed release identity with the 0.0.99 manifest (#8497)", () => { + expect( + parseDigestTable("Archive SHA-256 values are:", "Extracted binary SHA-256 values are:"), + ).toEqual(archiveDigests); + expect( + parseDigestTable("Extracted binary SHA-256 values are:", "The supervisor is pinned"), + ).toEqual(binaryDigests); + for (const digest of Object.values(SUPERVISOR_DIGESTS)) expect(review).toContain(digest); + + const manifest = JSON.parse( + fs.readFileSync( + path.join( + repoRoot, + "src/lib/actions/sandbox/openshell-child-visible-credentials.v0.0.99.json", + ), + "utf8", + ), + ) as { openshellCommit: string; openshellVersion: string; sources: string[] }; + expect(manifest.openshellCommit).toBe(SOURCE_COMMIT); + expect(manifest.openshellVersion).toBe("0.0.99"); + expect(manifest.sources).toEqual([ + "crates/openshell-core/src/google_cloud.rs", + "crates/openshell-core/src/provider_credentials.rs", + "crates/openshell-core/src/secrets.rs", + ]); + expect(review).toContain(SOURCE_COMMIT); + expect(pinnedOpenShellSandboxBuildVersion(binaryDigests.Sandbox[0])).toBe("0.0.99"); + expect(pinnedOpenShellSandboxBuildVersion(binaryDigests.Sandbox[1])).toBe("0.0.99"); + expect(pinnedOpenShellSandboxBuildVersion(binaryDigests.CLI[0])).toBeNull(); + }); + + it("proves the exposed 0.0.99 compatibility contracts through behavior (#8497)", () => { + expect( + parseGatewayInference( + `Inference:\n Workspace: default\n Provider: compatible-endpoint\n Model: review-model\n Version: 1\n\nSystem inference: Not configured`, + ), + ).toMatchObject({ provider: "compatible-endpoint", model: "review-model" }); + + expect(validateName("a".repeat(19), "sandbox name")).toBe("a".repeat(19)); + expect(() => validateName("a".repeat(20), "sandbox name")).toThrow( + "sandbox name too long (max 19 chars)", ); - expect(review).toContain("openshell-child-visible-credentials.v0.0.99.json"); - expect(review).toContain("AttachStdout=false"); - expect(review).toContain("non-empty port binding"); - expect(review).toContain("0.0.85 -> 0.0.99"); expect(review).toContain("without conditional skips or expected failures"); + expect(review).toContain("0.0.85 -> 0.0.99"); }); }); diff --git a/test/repro-5978-policy-denial-hint.test.ts b/test/repro-5978-policy-denial-hint.test.ts index cc0ed0fc484..c661fa67beb 100644 --- a/test/repro-5978-policy-denial-hint.test.ts +++ b/test/repro-5978-policy-denial-hint.test.ts @@ -239,7 +239,7 @@ describe("sandbox policy-denial logs breadcrumb (#5978)", () => { }); it("falls back to when OPENSHELL_SANDBOX exceeds the 63-char name limit", () => { - // NAME_MAX_LENGTH is 63; an over-length value must not be rendered into + // NAME_MAX_LENGTH matches OpenShell's routable-name limit; an over-length value must not be rendered into // the copyable command (it could never be a real sandbox name). const tooLong = "a".repeat(64); const { stdout, status } = gate({ OPENSHELL_SANDBOX: tooLong }); diff --git a/test/runner.test.ts b/test/runner.test.ts index ce39b535f09..3a6cec1e72f 100644 --- a/test/runner.test.ts +++ b/test/runner.test.ts @@ -12,14 +12,14 @@ import { redact, runCapture } from "../src/lib/runner"; const runnerPath = path.join(import.meta.dirname, "..", "src", "lib", "runner.ts"); const PINNED_OPEN_SHELL_SHA256 = { - cliDarwinArm64: "522c963f9515c7325b978e89022de76227ac245eefe1371292af1424434e2067", - cliLinuxArm64: "3cf353e7994d5835a233fe0641f9a860779190b054d0f90a04c897be782734b8", - cliLinuxX64: "078fa086f506832c3d47d992e6109f26074bdd55916ce268e47c3971423459eb", - gatewayDarwinArm64: "5de3e08ad1bdb0cdd01373999f537edca3d8aca22ae1c29bc9926969fe401e45", - gatewayLinuxArm64: "09f2823f6e9c5f70f4482b200206eac455d789618da4ebe4acff042d794e7162", - gatewayLinuxX64: "718cc9f942f88565cacb13c39717b128d6acc8d336212d42d26243f36ab19ece", - sandboxLinuxArm64: "2c52b2971aecf125e41ed160d8d2f2addf04031906ca88f120ae3d436dd6b8f7", - sandboxLinuxX64: "94306f057d862cd5c34a0daa7692491733bc5ca528a7b92f9f62f717fb70a9be", + cliDarwinArm64: "e31cac5360e2adf3c971d5742a516626c58acf2fd3db4dcb0e45804def3dc844", + cliLinuxArm64: "d00cbf0d8779c01ddea6453ead2ad4db3d89a1f14eb6f0785f7919f42813a279", + cliLinuxX64: "35725a358e42ef7f0f0393035536da317706b0febcc459a2011e0555f6c2b71c", + gatewayDarwinArm64: "4340619292ecb565f90eb2250db504baa37dd410361b366b42e174d34512cb6c", + gatewayLinuxArm64: "3a5d3092ae34356beb0ff2a920f9a87af4233c7a1086a53cd9429d48358f5c09", + gatewayLinuxX64: "640d204dc3c6bc28bffa1f3d870897fc23bbc5ec0151a6c642083e958455cb49", + sandboxLinuxArm64: "c758e7dc2b8c904baa01e2ccce0f08daf96ede0c648478b23346d8c4dd16f432", + sandboxLinuxX64: "84caed3dec4390e0938e89b38b1256d31e8970b4bfd85437bf92ed79f5b1ff05", }; type SpawnCallOptions = { @@ -352,7 +352,7 @@ describe("validateName", () => { const { validateName } = require(runnerPath); expect(() => validateName("test; whoami")).toThrow(/Invalid/); expect(() => validateName("test`id`")).toThrow(/Invalid/); - expect(() => validateName("test$(cat /etc/passwd)")).toThrow(/Invalid/); + expect(() => validateName("a$(id)")).toThrow(/Invalid/); expect(() => validateName("../etc/passwd")).toThrow(/Invalid/); }); @@ -365,9 +365,9 @@ describe("validateName", () => { it("rejects excessively long valid-looking names before spawning OpenShell", () => { const { validateName } = require(runnerPath); - expect(validateName("a".repeat(63))).toBe("a".repeat(63)); + expect(validateName("a".repeat(19))).toBe("a".repeat(19)); expect(() => validateName("a".repeat(64 * 1024), "sandbox name")).toThrow( - /sandbox name too long \(max 63 chars\)/, + /sandbox name too long \(max 19 chars\)/, ); }); @@ -397,7 +397,7 @@ describe("validateName", () => { message = (error as Error).message; } - expect(message).toContain("sandbox name too long (max 63 chars)"); + expect(message).toContain("sandbox name too long (max 19 chars)"); expect(message).not.toContain(escapeByte); expect(message).toContain('..."'); }); @@ -796,7 +796,7 @@ describe("regression guards", () => { shift || true done [ -n "$destination" ] || return 2 - printf '%s\n' '#!/bin/sh' 'echo "0.0.85"' > "$destination/$expected" + printf '%s\n' '#!/bin/sh' 'echo "0.0.99"' > "$destination/$expected" chmod +x "$destination/$expected" ;; *) return 2 ;; @@ -898,7 +898,7 @@ describe("regression guards", () => { shift || true done [ -n "$destination" ] || return 2 - printf '%s\n' '#!/bin/sh' 'echo "0.0.85"' > "$destination/$expected" + printf '%s\n' '#!/bin/sh' 'echo "0.0.99"' > "$destination/$expected" chmod +x "$destination/$expected" ;; *) return 2 ;; diff --git a/test/update-hermes-agent-script.test.ts b/test/update-hermes-agent-script.test.ts index ff8f5a98955..63229f1fb3d 100644 --- a/test/update-hermes-agent-script.test.ts +++ b/test/update-hermes-agent-script.test.ts @@ -275,7 +275,7 @@ fi ); const installedAgentDockerfile = path.join(path.dirname(installedDockerfile), "Dockerfile"); const preMcpDockerfile = CURRENT_INSTALLED_DOCKERFILE.replace( - /^(?:COPY (?:agents\/hermes\/(?:build-mcp-digest|mcp-config-transaction)\.py|src\/lib\/actions\/sandbox\/openshell-child-visible-credentials\.v0\.0\.85\.json) .*|RUN mcp_digest=.*build-hermes-mcp-digest\.py.*)\n/gm, + /^(?:COPY (?:agents\/hermes\/(?:build-mcp-digest|mcp-config-transaction)\.py|src\/lib\/actions\/sandbox\/openshell-child-visible-credentials\.v0\.0\.99\.json) .*|RUN mcp_digest=.*build-hermes-mcp-digest\.py.*)\n/gm, "", ); fs.mkdirSync(path.dirname(installedDockerfile), { recursive: true }); diff --git a/tools/e2e/cli-artifact-workflow-boundary.mts b/tools/e2e/cli-artifact-workflow-boundary.mts index 00bcb440235..4296cbf9895 100644 --- a/tools/e2e/cli-artifact-workflow-boundary.mts +++ b/tools/e2e/cli-artifact-workflow-boundary.mts @@ -40,7 +40,7 @@ const CLI_ARTIFACT_PROVENANCE_STEP = "Record CLI artifact provenance"; const CANDIDATE_CHECKOUT_STEP_CONTENT_SHA256 = "3578a053cede863f7aa4814d8399b4ca21ea0b77cee712e6d549c684818f11dd"; const CLI_ARTIFACT_WORKFLOW_CONTRACT_SHA256 = - "5d09301f3d37c6d2f588379fa8c94ef33d00efb8e25dc475bcfba24377fd8365"; + "008ab9ac0866ad564653316aaf6b758743e79c41dd015dc616bd1b99d83a263d"; const CLI_ARTIFACT_CONSUMER_JOB_NAMES = [ "agent-turn-latency", "bedrock-runtime-compatible-anthropic", From ad2044108c269a108186de404721b8ad8327d637 Mon Sep 17 00:00:00 2001 From: Apurv Kumaria Date: Thu, 6 Aug 2026 23:15:51 -0700 Subject: [PATCH 05/18] test(openshell): use valid legacy sandbox name Signed-off-by: Apurv Kumaria --- nemoclaw/src/blueprint/runner-identity.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nemoclaw/src/blueprint/runner-identity.test.ts b/nemoclaw/src/blueprint/runner-identity.test.ts index af060841e1c..260dd2f516b 100644 --- a/nemoclaw/src/blueprint/runner-identity.test.ts +++ b/nemoclaw/src/blueprint/runner-identity.test.ts @@ -853,14 +853,14 @@ describe("blueprint identity wrapper", () => { store.set(stateDir, { type: "dir" }); store.set(`${stateDir}/plan.json`, { type: "file", - content: JSON.stringify({ sandbox_name: "pre-existing-sandbox" }), + content: JSON.stringify({ sandbox_name: "existing-sandbox" }), }); await actionRollback("legacy-run"); const rollbackCommands = mockExeca.mock.calls.map(([, args]) => (args ?? []).join(" ")); - expect(rollbackCommands).not.toContain("sandbox stop pre-existing-sandbox"); - expect(rollbackCommands).not.toContain("sandbox remove pre-existing-sandbox"); + expect(rollbackCommands).not.toContain("sandbox stop existing-sandbox"); + expect(rollbackCommands).not.toContain("sandbox remove existing-sandbox"); expect(store.get(`${stateDir}/rolled_back`)?.content).toBeDefined(); }); From 12b4bca1120536ad3fd5e031424f5c8358c5147c Mon Sep 17 00:00:00 2001 From: Apurv Kumaria Date: Fri, 7 Aug 2026 00:06:39 -0700 Subject: [PATCH 06/18] fix(openshell): verify driver image content identity Signed-off-by: Apurv Kumaria --- .../openshell-0.0.99-migration-review.md | 3 +- .../onboard/managed-bootstrap/docker.test.ts | 35 +++++++++++++++++++ src/lib/onboard/managed-bootstrap/docker.ts | 8 +++-- 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/docs/security/openshell-0.0.99-migration-review.md b/docs/security/openshell-0.0.99-migration-review.md index ce556949e95..9facf419628 100644 --- a/docs/security/openshell-0.0.99-migration-review.md +++ b/docs/security/openshell-0.0.99-migration-review.md @@ -103,7 +103,7 @@ than enabling optional upstream behavior implicitly. | --- | --- | --- | | `OS99-01` | Release/tag substitution | Exact source commit, archives, extracted binaries, formula, manifests, and supervisor index are pinned. | | `OS99-02` | Credential leakage or key-class expansion | Regenerated manifest shows no child-visible key-class expansion; expiry behavior is safer. | -| `OS99-03` | Policy-first OCI image identity | Existing explicit-image and policy tests remain required. | +| `OS99-03` | Policy-first OCI image identity | `Config.Image` may contain only the exact reviewed `repository@manifestDigest` or its exact immutable runtime content ID. Separate Docker image-inspect evidence must prove that the reviewed manifest digest resolves to that same content ID. | | `OS99-04` | Workspace authorization | No NemoClaw authority is inferred from the new workspace model. | | `OS99-05` | Supervisor middleware/egress | Optional middleware is not enabled by the selector update. | | `OS99-06` | Corporate proxy and consolidated egress | Existing endpoint and allowed-IP checks remain authoritative. | @@ -115,6 +115,7 @@ than enabling optional upstream behavior implicitly. | `OS99-12` | Podman lifecycle changes | Podman exact-version live coverage remains an acceptance gate. | | `OS99-13` | Inference status heading changed from `Gateway inference:` to `Inference:` | The parser accepts both headings, with focused regression coverage for the exact v0.0.99 output. | | `OS99-14` | Routable sandbox names are capped at 19 characters | NemoClaw's canonical validation uses the same 19-character limit, and generated activation names fit it. Exact all-agent activation remains a final acceptance gate. | +| `OS99-15` | The Docker driver records the immutable image content ID in `Config.Image` | Managed bootstrap accepts either the reviewed `repository@manifestDigest` or its exact runtime content ID, while separately requiring Docker to prove that the manifest resolves to that content ID. | An unresolved critical or high concern blocks the upgrade. Test selection cannot waive a concern; conditional skips and expected failures do not count as qualification evidence. diff --git a/src/lib/onboard/managed-bootstrap/docker.test.ts b/src/lib/onboard/managed-bootstrap/docker.test.ts index 79f2ab3110d..1007418f30f 100644 --- a/src/lib/onboard/managed-bootstrap/docker.test.ts +++ b/src/lib/onboard/managed-bootstrap/docker.test.ts @@ -49,6 +49,41 @@ describe("Docker managed bootstrap adapter", () => { }); }); + it("accepts the immutable image ID recorded by the OpenShell Docker driver", async () => { + const fake = fixture(); + fake.original!.Config!.Image = fake.original!.Image; + const adapter = createDockerManagedBootstrapAdapter(fake.deps); + const { handle } = authority(); + const discovered = await adapter.discoverHeldWorkload({ + sandbox: handle.sandbox, + bootstrapIdentity: handle.bootstrapIdentity, + expectedImage: handle.plan.image, + metadata: handle.plan.metadata, + }); + + await expect(adapter.inspectHeldWorkload({ handle, discovered })).resolves.toMatchObject({ + runtimeId: OLD_ID, + }); + }); + + it("rejects a configured image outside the reviewed manifest identity", async () => { + const fake = fixture(); + fake.original!.Config!.Image = `sha256:${"9".repeat(64)}`; + const adapter = createDockerManagedBootstrapAdapter(fake.deps); + const { handle } = authority(); + + await expect( + adapter.discoverHeldWorkload({ + sandbox: handle.sandbox, + bootstrapIdentity: handle.bootstrapIdentity, + expectedImage: handle.plan.image, + metadata: handle.plan.metadata, + }), + ).rejects.toThrow( + "Managed bootstrap Docker configured image is neither the exact repository@manifestDigest nor its immutable runtime content ID.", + ); + }); + it("stages Docker-derived console and protected-path defaults before cutover", async () => { const fake = fixture(); Object.assign(fake.original!.HostConfig!, { diff --git a/src/lib/onboard/managed-bootstrap/docker.ts b/src/lib/onboard/managed-bootstrap/docker.ts index 629aeb148f5..908be105621 100644 --- a/src/lib/onboard/managed-bootstrap/docker.ts +++ b/src/lib/onboard/managed-bootstrap/docker.ts @@ -395,9 +395,13 @@ function assertImage( } const expectedReference = expectedImageReference(image.repository, image.manifestDigest); const configuredImage = String(inspect.Config?.Image ?? "").trim(); - if (configuredImage !== expectedReference) { + // OpenShell's Docker driver creates the sandbox from the inspected immutable image ID, so + // Docker records that ID in Config.Image. NemoClaw-created replacements retain the exact + // repository@manifestDigest instead. Accept only those two immutable spellings; the image + // inspection below still proves that the reviewed manifest resolves to this runtime content. + if (configuredImage !== expectedReference && configuredImage !== runtimeContentId) { throw new Error( - "Managed bootstrap Docker configured image is not the exact repository@manifestDigest.", + "Managed bootstrap Docker configured image is neither the exact repository@manifestDigest nor its immutable runtime content ID.", ); } const imageOutput = deps.dockerCapture(["image", "inspect", expectedReference], { From 44d6736e19950be1abc5c09bc92f310c8d00a779 Mon Sep 17 00:00:00 2001 From: Apurv Kumaria Date: Fri, 7 Aug 2026 00:16:05 -0700 Subject: [PATCH 07/18] test(openshell): clarify gateway DNS boundary Signed-off-by: Apurv Kumaria --- src/lib/actions/sandbox/mcp-bridge-url-validation.ts | 10 +++++++--- test/runner.test.ts | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/lib/actions/sandbox/mcp-bridge-url-validation.ts b/src/lib/actions/sandbox/mcp-bridge-url-validation.ts index 36483199a6a..592026e7132 100644 --- a/src/lib/actions/sandbox/mcp-bridge-url-validation.ts +++ b/src/lib/actions/sandbox/mcp-bridge-url-validation.ts @@ -221,10 +221,14 @@ export async function preflightMcpServerUrlResolvedTarget( ): Promise { // invalidState: a hostname is public at add time but later rebinds to an // unpinned address. sourceBoundary: NemoClaw pins the add-time public answers; + // With its operator-controlled proxy_connect_by_hostname option disabled, // OpenShell v0.0.99 resolves, validates every answer against allowed_ips, and - // connects with that same SocketAddr list. whyNotSourceFix: duplicating DNS - // resolution here before each remote connection would create a second, - // non-authoritative TOCTOU boundary outside OpenShell's data plane. + // connects with that same SocketAddr list. This URL validator cannot observe + // gateway configuration; the documented guarantee and residual risk are + // therefore explicitly conditional on that option remaining disabled. + // whyNotSourceFix: duplicating DNS resolution here before each remote + // connection would create a second, non-authoritative TOCTOU boundary outside + // OpenShell's data plane. // regressionTest: e2e/support/mcp-bridge-sandbox.test.ts pins the exact // upstream source contract, and live/mcp-bridge.test.ts remaps DNS and proves // a 403 plus zero upstream requests for all three adapters. diff --git a/test/runner.test.ts b/test/runner.test.ts index 3a6cec1e72f..61c065636e6 100644 --- a/test/runner.test.ts +++ b/test/runner.test.ts @@ -366,6 +366,9 @@ describe("validateName", () => { it("rejects excessively long valid-looking names before spawning OpenShell", () => { const { validateName } = require(runnerPath); expect(validateName("a".repeat(19))).toBe("a".repeat(19)); + expect(() => validateName("a".repeat(20), "sandbox name")).toThrow( + /sandbox name too long \(max 19 chars\)/, + ); expect(() => validateName("a".repeat(64 * 1024), "sandbox name")).toThrow( /sandbox name too long \(max 19 chars\)/, ); From fc1edb54b7dd2204c7ff73992f4f4555aa998655 Mon Sep 17 00:00:00 2001 From: Apurv Kumaria Date: Fri, 7 Aug 2026 00:56:52 -0700 Subject: [PATCH 08/18] test(openshell): complete sandbox limit migration Signed-off-by: Apurv Kumaria --- scripts/nemoclaw-start.sh | 6 +++--- .../actions/sandbox/exec-policy-hint-rendering.test.ts | 6 +++--- src/lib/onboard/managed-workload-clone-handoff.test.ts | 2 +- src/lib/onboard/runtime-provider/podman.test.ts | 2 +- .../runtime-provider/runtime-provider-contract.test.ts | 3 ++- src/lib/shields/flow.test.ts | 4 ++-- src/lib/shields/timer-process.test.ts | 2 +- src/lib/shields/timer-recovery-budget.test.ts | 10 ++++------ src/lib/shields/timer.test.ts | 9 +++------ test/gateway-state-reconcile-2276.test.ts | 4 ++-- test/helpers/managed-image-buildless-e2e.ts | 2 +- test/hermes-mcp-config-transaction.test.ts | 6 +++--- .../package-contract/openshell-policy-boundary.test.ts | 2 +- test/process-recovery-supervisor-relaunch.test.ts | 10 +++++----- test/rebuild-credential-preflight.test.ts | 8 +++++--- test/rebuild-stale-recovery.test.ts | 4 ++-- test/repro-5978-policy-denial-hint.test.ts | 4 ++-- test/shellquote-sandbox.test.ts | 2 +- 18 files changed, 42 insertions(+), 44 deletions(-) diff --git a/scripts/nemoclaw-start.sh b/scripts/nemoclaw-start.sh index efbaadbd968..cfbfc44c8ae 100755 --- a/scripts/nemoclaw-start.sh +++ b/scripts/nemoclaw-start.sh @@ -3469,7 +3469,7 @@ GATEWAYURLENVEOF "" | 0 | 1 | true | TRUE | false | FALSE) ;; [!a-z]* | *- | *[!a-z0-9-]*) ;; *) - if [ "${#_sandbox_label_src}" -le 63 ]; then + if [ "${#_sandbox_label_src}" -le 19 ]; then _sandbox_label="$_sandbox_label_src" fi ;; @@ -3942,7 +3942,7 @@ _nemoclaw_valid_sandbox_label() { # The candidates are untrusted input interpolated into a copyable `nemoclaw …` # command, so allowlist rather than merely strip: only render a value that is # a valid sandbox name. This mirrors NAME_VALID_PATTERN in - # src/lib/name-validation.ts (/^[a-z]([a-z0-9-]*[a-z0-9])?$/, max 63): starts + # src/lib/name-validation.ts (/^[a-z]([a-z0-9-]*[a-z0-9])?$/, max 19): starts # with a lowercase letter, then lowercase alphanumerics/hyphens, no trailing # hyphen. Anything else (digit-leading labels, control characters, ANSI # escapes, shell metacharacters, whitespace) is rejected, and the caller falls @@ -3961,7 +3961,7 @@ _nemoclaw_valid_sandbox_label() { "" | 0 | 1 | true | TRUE | false | FALSE) ;; [!a-z]* | *- | *[!a-z0-9-]*) ;; *) - if [ "${#1}" -le 63 ]; then + if [ "${#1}" -le 19 ]; then printf '%s' "$1" fi ;; diff --git a/src/lib/actions/sandbox/exec-policy-hint-rendering.test.ts b/src/lib/actions/sandbox/exec-policy-hint-rendering.test.ts index a5ff1a3b62d..0f6ae443ea7 100644 --- a/src/lib/actions/sandbox/exec-policy-hint-rendering.test.ts +++ b/src/lib/actions/sandbox/exec-policy-hint-rendering.test.ts @@ -36,8 +36,8 @@ describe("buildPolicyDenialExecHint (#5978)", () => { "a-b-c", "valid-lowercase", "valid-with-hyphens", - "a".repeat(63), - `${"a".repeat(61)}-b`, + "a".repeat(19), + `${"a".repeat(17)}-b`, ])("renders a valid RFC-1123 sandbox name unchanged: %s", (valid) => { const hint = buildPolicyDenialExecHint("nemoclaw", valid, "example.com:443"); expect(hint).toContain(`inside sandbox '${valid}'`); @@ -48,7 +48,7 @@ describe("buildPolicyDenialExecHint (#5978)", () => { ["control characters / TTY escapes", "oc\ninjected"], ["shell metacharacters", "oc; rm -rf /"], ["uppercase (not an RFC-1123 label)", "OC-Fresh"], - ["over-length label", "a".repeat(64)], + ["over-length label", "a".repeat(20)], ])("renders the placeholder for an unsafe sandbox name: %s", (_label, unsafe) => { const hint = buildPolicyDenialExecHint("nemoclaw", unsafe, "example.com:443"); expect(hint).toContain("nemoclaw logs --tail 50"); diff --git a/src/lib/onboard/managed-workload-clone-handoff.test.ts b/src/lib/onboard/managed-workload-clone-handoff.test.ts index 98bb6230a57..b96c4735bf7 100644 --- a/src/lib/onboard/managed-workload-clone-handoff.test.ts +++ b/src/lib/onboard/managed-workload-clone-handoff.test.ts @@ -377,7 +377,7 @@ describe("prepareManagedWorkloadCloneHandoff", () => { tools: { disclosure: "direct", enabledGateways: ["nous-web"] }, }); const entry = source("hermes", "docker", profile); - const longestSandboxName = `a${"b".repeat(62)}`; + const longestSandboxName = `a${"b".repeat(18)}`; expect(() => prepare(entry, provider("docker"), undefined, longestSandboxName)).not.toThrow(); expect(() => prepare(entry, provider("docker"), undefined, "1destination")).toThrow( diff --git a/src/lib/onboard/runtime-provider/podman.test.ts b/src/lib/onboard/runtime-provider/podman.test.ts index becf01ba014..eac3e61d568 100644 --- a/src/lib/onboard/runtime-provider/podman.test.ts +++ b/src/lib/onboard/runtime-provider/podman.test.ts @@ -119,7 +119,7 @@ function lifecycleEngine(sandboxName: string, authorityId = AUTHORITY_ID): Conta } function providerHarness(agent: (typeof AGENTS)[number]) { - const sandboxName = `${agent}-podman`; + const sandboxName = agent === "langchain-deepagents-code" ? "dcode-podman" : `${agent}-podman`; const lifecycle = lifecycleEngine(sandboxName); const bundle = createPodmanRuntimeProviderBundle({ engines: { hostDoctor: hostDoctorEngine(), sandboxLifecycle: lifecycle }, diff --git a/src/lib/onboard/runtime-provider/runtime-provider-contract.test.ts b/src/lib/onboard/runtime-provider/runtime-provider-contract.test.ts index 680bf9bb842..0281d4efc28 100644 --- a/src/lib/onboard/runtime-provider/runtime-provider-contract.test.ts +++ b/src/lib/onboard/runtime-provider/runtime-provider-contract.test.ts @@ -866,7 +866,8 @@ describe("socket-free MXC action contract", () => { recordEvent, }); const providers = createRuntimeProviderBundleRegistry([["mxc", bundle]]); - const sandboxName = `${agent}-sandbox`; + const sandboxName = + agent === "langchain-deepagents-code" ? "dcode-sandbox" : `${agent}-sandbox`; const imageTag = `mxc-memory:${agent}`; const registerSandbox = vi.fn(); const entry = registerCreatedSandbox({ diff --git a/src/lib/shields/flow.test.ts b/src/lib/shields/flow.test.ts index 5fb09fefe32..4b4b7db75fe 100644 --- a/src/lib/shields/flow.test.ts +++ b/src/lib/shields/flow.test.ts @@ -630,7 +630,7 @@ describe("shields command flow", () => { it("preserves a live transition owner instead of attempting portable process-tree takeover", () => { const stateDir = path.join(tmpDir, ".nemoclaw", "state"); fs.mkdirSync(stateDir, { recursive: true }); - const sandboxName = "live-transition-owner"; + const sandboxName = "live-owner"; const processToken = "b".repeat(32); const lockPath = path.join(stateDir, `shields-transition-lock-${sandboxName}.json`); const owner = spawn(process.execPath, ["-e", "setTimeout(() => {}, 5000)"], { @@ -685,7 +685,7 @@ describe("shields command flow", () => { ])("enters durable containment for a %s-token transition whose owner exited in the recovery gap", (_tokenRelationship, transitionOwnerToken) => { const stateDir = path.join(tmpDir, ".nemoclaw", "state"); fs.mkdirSync(stateDir, { recursive: true }); - const sandboxName = "dead-transition-owner"; + const sandboxName = "dead-owner"; const processToken = "c".repeat(32); const transitionLockPath = path.join(stateDir, `shields-transition-lock-${sandboxName}.json`); fs.writeFileSync( diff --git a/src/lib/shields/timer-process.test.ts b/src/lib/shields/timer-process.test.ts index ae3a729470c..e1c61c6c63f 100644 --- a/src/lib/shields/timer-process.test.ts +++ b/src/lib/shields/timer-process.test.ts @@ -31,7 +31,7 @@ describe("detached Shields timer process", () => { async () => { const { killTimer } = await import("./timer-control"); const stateDir = path.join(tmpHome, ".nemoclaw", "state"); - const sandboxName = "cooperative-cancellation"; + const sandboxName = "cooperative-stop"; const snapshotPath = path.join(stateDir, "snapshot.yaml"); const restoreAtIso = new Date(Date.now() + 60_000).toISOString(); const markerPath = path.join(stateDir, `shields-timer-${sandboxName}.json`); diff --git a/src/lib/shields/timer-recovery-budget.test.ts b/src/lib/shields/timer-recovery-budget.test.ts index 6eee12f302f..ca724d5540b 100644 --- a/src/lib/shields/timer-recovery-budget.test.ts +++ b/src/lib/shields/timer-recovery-budget.test.ts @@ -148,7 +148,7 @@ describe("detached Shields recovery budget", { timeout: 15_000 }, () => { }); it("waits beyond the recovery budget for a verified live lifecycle owner, then restores", async () => { - const sandboxName = "healthy-backup-owner"; + const sandboxName = "healthy-owner"; let markOwnerEntered!: () => void; let releaseOwner!: () => void; const ownerEntered = new Promise((resolve) => { @@ -253,9 +253,7 @@ describe("detached Shields recovery budget", { timeout: 15_000 }, () => { }); it("retains its exact deadline when publication and containment both fail", async () => { - const { args, lockPath, markerPath, sandboxName, timer } = await createFixture( - "publication-retained-gate", - ); + const { args, lockPath, markerPath, sandboxName, timer } = await createFixture("publish-gate"); const containmentPath = `${lockPath}.containment`; const deadlinePath = `${lockPath}.deadline`; const originalAsyncLink = fs.promises.link.bind(fs.promises); @@ -292,7 +290,7 @@ describe("detached Shields recovery budget", { timeout: 15_000 }, () => { expect(audits).toHaveLength(1); expect(audits[0]?.error).toContain("recovery failed after 1 attempt"); expect(audits[0]?.error).toContain("Correct the state-directory write failure"); - expect(audits[0]?.error).toContain("`nemoclaw publication-retained-gate shields status`"); + expect(audits[0]?.error).toContain("`nemoclaw publish-gate shields status`"); expect(audits[0]?.error).not.toContain("setup is retrying"); await expect( withMcpLifecycleLock( @@ -307,7 +305,7 @@ describe("detached Shields recovery budget", { timeout: 15_000 }, () => { }); it("exits immediately when durable containment already owns recovery", async () => { - const { args, lockPath, sandboxName, timer } = await createFixture("existing-containment"); + const { args, lockPath, sandboxName, timer } = await createFixture("existing-contain"); beginCommittedMcpLifecycleContainmentSync( sandboxName, PROCESS_TOKEN, diff --git a/src/lib/shields/timer.test.ts b/src/lib/shields/timer.test.ts index ef4dae77a15..2500b75b772 100644 --- a/src/lib/shields/timer.test.ts +++ b/src/lib/shields/timer.test.ts @@ -899,10 +899,7 @@ describe("shields timer authorization", () => { it("retains the exact deadline gates when revoked containment rollback cannot be proven", async () => { const timer = await import("./timer"); - const fixture = createFailedRestoreFixture( - "containment-publication-rollback-failure", - timer.parseTimerArgs, - ); + const fixture = createFailedRestoreFixture("contain-rollback", timer.parseTimerArgs); const { args, containmentPath, deadlinePath, markerPath, mutationLockPath, writeMarker } = fixture; const replacementToken = "e".repeat(32); @@ -944,7 +941,7 @@ describe("shields timer authorization", () => { it("retains the exact deadline gates when durable containment cannot be committed", async () => { const timer = await import("./timer"); const { args, containmentPath, deadlinePath, markerPath, mutationLockPath, stateDir } = - createFailedRestoreFixture("retry-containment-failure", timer.parseTimerArgs); + createFailedRestoreFixture("retry-contain", timer.parseTimerArgs); const originalLink = fs.linkSync.bind(fs); const rejectContainment = (): never => { const error = new Error("simulated containment commit failure") as NodeJS.ErrnoException; @@ -981,7 +978,7 @@ describe("shields timer authorization", () => { it("stops retrying when transition takeover commits durable containment", async () => { const timer = await import("./timer"); const { args, markerPath, mutationLockPath, sandboxName, stateDir } = - createFailedRestoreFixture("takeover-containment", timer.parseTimerArgs); + createFailedRestoreFixture("takeover-contain", timer.parseTimerArgs); shieldsIndexMock.prepareAutoRestoreTransitionTakeover.mockImplementationOnce(() => { beginCommittedMcpLifecycleContainmentSync( sandboxName, diff --git a/test/gateway-state-reconcile-2276.test.ts b/test/gateway-state-reconcile-2276.test.ts index 44436b73a74..32e7f99751b 100644 --- a/test/gateway-state-reconcile-2276.test.ts +++ b/test/gateway-state-reconcile-2276.test.ts @@ -124,7 +124,7 @@ function emit(r) { } if (args[0] === "-V" || args[0] === "--version") { - process.stdout.write("openshell 0.0.85\\n"); + process.stdout.write("openshell 0.0.99\\n"); process.exit(0); } @@ -180,7 +180,7 @@ process.exit(0); path.join(homeLocalBin, component), `#!${process.execPath} const requiredFeatures = "request-body-credential-rewrite websocket-credential-rewrite allow_all_known_mcp_methods"; -if (process.argv[2] === "-V" || process.argv[2] === "--version") process.stdout.write("${component} 0.0.85\\n"); +if (process.argv[2] === "-V" || process.argv[2] === "--version") process.stdout.write("${component} 0.0.99\\n"); process.exit(0); `, { mode: 0o755 }, diff --git a/test/helpers/managed-image-buildless-e2e.ts b/test/helpers/managed-image-buildless-e2e.ts index aebe3ea5608..3274ce9842e 100644 --- a/test/helpers/managed-image-buildless-e2e.ts +++ b/test/helpers/managed-image-buildless-e2e.ts @@ -562,7 +562,7 @@ function runManagedOnboard( const home = path.join(fixture, "home"); const script = path.join(fixture, "managed-onboard.cjs"); const dockerLog = path.join(fixture, "docker.log"); - const sandboxName = `managed-${agent.replaceAll(/[^a-z0-9]/gu, "-")}`; + const sandboxName = agent === "langchain-deepagents-code" ? "managed-dcode" : `managed-${agent}`; fs.mkdirSync(fakeBin, { recursive: true }); fs.mkdirSync(home, { recursive: true }); writeRuntimeStubs(fakeBin, dockerLog); diff --git a/test/hermes-mcp-config-transaction.test.ts b/test/hermes-mcp-config-transaction.test.ts index 3e5b0e615e8..24f13415474 100644 --- a/test/hermes-mcp-config-transaction.test.ts +++ b/test/hermes-mcp-config-transaction.test.ts @@ -158,9 +158,9 @@ if len(errors) != 3: expect(result.status, result.stderr).toBe(0); expect(JSON.parse(result.stdout)).toEqual([ - "Authenticated MCP OpenShell host aliases are unavailable with OpenShell v0.0.85", - "Authenticated MCP OpenShell host aliases are unavailable with OpenShell v0.0.85", - "Authenticated MCP OpenShell host aliases are unavailable with OpenShell v0.0.85", + "Authenticated MCP OpenShell host aliases are unavailable with OpenShell v0.0.99", + "Authenticated MCP OpenShell host aliases are unavailable with OpenShell v0.0.99", + "Authenticated MCP OpenShell host aliases are unavailable with OpenShell v0.0.99", ]); }); diff --git a/test/package-contract/openshell-policy-boundary.test.ts b/test/package-contract/openshell-policy-boundary.test.ts index 1da61c34c86..32b88ea33c8 100644 --- a/test/package-contract/openshell-policy-boundary.test.ts +++ b/test/package-contract/openshell-policy-boundary.test.ts @@ -205,7 +205,7 @@ describe("OpenShell policy boundary package contract", () => { "--experimental-strip-types", "--no-warnings", "--eval", - `const contract = require(${JSON.stringify(controlContractPath)}); process.stdout.write(JSON.stringify([contract.isValidName("packaged-hermes-sandbox"), contract.isValidName("../packaged-hermes-sandbox")]));`, + `const contract = require(${JSON.stringify(controlContractPath)}); process.stdout.write(JSON.stringify([contract.isValidName("packaged-hermes"), contract.isValidName("../packaged-hermes")]));`, ], { cwd: repoRoot, encoding: "utf8" }, ), diff --git a/test/process-recovery-supervisor-relaunch.test.ts b/test/process-recovery-supervisor-relaunch.test.ts index a42ba3c5641..7bad729a80a 100644 --- a/test/process-recovery-supervisor-relaunch.test.ts +++ b/test/process-recovery-supervisor-relaunch.test.ts @@ -514,7 +514,7 @@ describe("checkAndRecoverSandboxProcesses supervisor relaunch", () => { }); it("rolls back when post-restore restart does not report an exact ok disposition", () => { - mockOpenClawSandbox("post-restore-failed-box"); + mockOpenClawSandbox("post-restore-fail"); setImmediateRecoveryPolling(); const order: string[] = []; const { finalizeTransaction, relaunchManagedSupervisorSessionImpl } = @@ -530,10 +530,10 @@ describe("checkAndRecoverSandboxProcesses supervisor relaunch", () => { vi.spyOn(openshellRuntime, "captureOpenshell").mockReturnValue({ status: 0, output: - "SANDBOX BIND PORT PID STATUS\npost-restore-failed-box 127.0.0.1 18789 12345 running", + "SANDBOX BIND PORT PID STATUS\npost-restore-fail 127.0.0.1 18789 12345 running", }); - const result = checkAndRecoverSandboxProcesses("post-restore-failed-box", { + const result = checkAndRecoverSandboxProcesses("post-restore-fail", { quiet: true, isSandboxGatewayRunningImpl: () => false, requestGatewaySupervisorAction, @@ -612,7 +612,7 @@ describe("checkAndRecoverSandboxProcesses supervisor relaunch", () => { }); it("prints generic recovery hints when state recovery and rollback both fail", () => { - mockOpenClawSandbox("restore-and-rollback-failed-box"); + mockOpenClawSandbox("restore-rollback"); setImmediateRecoveryPolling(); const finalize = vi.fn(() => ({ backupRemoved: false, @@ -634,7 +634,7 @@ describe("checkAndRecoverSandboxProcesses supervisor relaunch", () => { vi.spyOn(console, "log").mockImplementation(() => undefined); const errorSpy = vi.spyOn(console, "error").mockImplementation(() => undefined); - const result = checkAndRecoverSandboxProcesses("restore-and-rollback-failed-box", { + const result = checkAndRecoverSandboxProcesses("restore-rollback", { quiet: false, isSandboxGatewayRunningImpl: () => false, requestGatewaySupervisorAction, diff --git a/test/rebuild-credential-preflight.test.ts b/test/rebuild-credential-preflight.test.ts index 7ba8c428b63..99c7314401b 100644 --- a/test/rebuild-credential-preflight.test.ts +++ b/test/rebuild-credential-preflight.test.ts @@ -168,7 +168,7 @@ const fs = require("fs"); const a = process.argv.slice(2); const hermesProviderStatePath = ${JSON.stringify(hermesProviderStatePath)}; const requiredFeatures = "request-body-credential-rewrite websocket-credential-rewrite allow_all_known_mcp_methods"; -if (a[0] === "-V" || a[0] === "--version") { process.stdout.write("openshell 0.0.85\\n"); process.exit(0); } +if (a[0] === "-V" || a[0] === "--version") { process.stdout.write("openshell 0.0.99\\n"); process.exit(0); } if (a[0] === "sandbox" && a[1] === "list") { process.stdout.write("${sandboxName} Ready\\n"); process.exit(0); } if (a[0] === "sandbox" && a[1] === "ssh-config") { process.stdout.write("${sshConfig}\\n"); process.exit(0); } if (a[0] === "sandbox" && a[1] === "get") { @@ -240,7 +240,7 @@ process.exit(0); path.join(tmpDir, component), `#!/usr/bin/env node const requiredFeatures = "request-body-credential-rewrite websocket-credential-rewrite allow_all_known_mcp_methods"; -if (process.argv[2] === "-V" || process.argv[2] === "--version") process.stdout.write("${component} 0.0.85\\n"); +if (process.argv[2] === "-V" || process.argv[2] === "--version") process.stdout.write("${component} 0.0.99\\n"); process.exit(0); `, { mode: 0o755 }, @@ -393,7 +393,9 @@ describe("atomic rebuild process contracts (#2273)", () => { expect(registryHasSandbox(fixture)).toBe(true); }); - it("accepts trimmed case-insensitive yes input before continuing into backup", () => { + it("accepts trimmed case-insensitive yes input before continuing into backup", { + timeout: testTimeout(60_000), + }, () => { const fixture = createFixture({ savedCredential: { key: "NVIDIA_INFERENCE_API_KEY", diff --git a/test/rebuild-stale-recovery.test.ts b/test/rebuild-stale-recovery.test.ts index 138bee2db30..ccf8598f343 100644 --- a/test/rebuild-stale-recovery.test.ts +++ b/test/rebuild-stale-recovery.test.ts @@ -137,7 +137,7 @@ function createStaleFixture({ failSandboxCreate = false }: { failSandboxCreate?: `#!/usr/bin/env node const a = process.argv.slice(2); const requiredFeatures = "request-body-credential-rewrite websocket-credential-rewrite allow_all_known_mcp_methods"; -if (a[0]==="-V" || a[0]==="--version") { process.stdout.write("openshell 0.0.85\\n"); process.exit(0); } +if (a[0]==="-V" || a[0]==="--version") { process.stdout.write("openshell 0.0.99\\n"); process.exit(0); } if (a[0]==="sandbox" && a[1]==="list") { process.stdout.write("\\n"); process.exit(0); } if (a[0]==="sandbox" && a[1]==="delete") { process.exit(0); } if (a[0]==="sandbox" && a[1]==="create" && ${JSON.stringify(failSandboxCreate)}) { process.stderr.write("injected sandbox create failure\\n"); process.exit(1); } @@ -157,7 +157,7 @@ process.exit(0); path.join(tmpDir, component), `#!/usr/bin/env node const requiredFeatures = "request-body-credential-rewrite websocket-credential-rewrite allow_all_known_mcp_methods"; -if (process.argv[2] === "-V" || process.argv[2] === "--version") process.stdout.write("${component} 0.0.85\\n"); +if (process.argv[2] === "-V" || process.argv[2] === "--version") process.stdout.write("${component} 0.0.99\\n"); process.exit(0); `, { mode: 0o755 }, diff --git a/test/repro-5978-policy-denial-hint.test.ts b/test/repro-5978-policy-denial-hint.test.ts index c661fa67beb..7b79e15da50 100644 --- a/test/repro-5978-policy-denial-hint.test.ts +++ b/test/repro-5978-policy-denial-hint.test.ts @@ -238,10 +238,10 @@ describe("sandbox policy-denial logs breadcrumb (#5978)", () => { expect(stdout).not.toContain("nemoclaw 9abc logs"); }); - it("falls back to when OPENSHELL_SANDBOX exceeds the 63-char name limit", () => { + it("falls back to when OPENSHELL_SANDBOX exceeds the 19-character name limit", () => { // NAME_MAX_LENGTH matches OpenShell's routable-name limit; an over-length value must not be rendered into // the copyable command (it could never be a real sandbox name). - const tooLong = "a".repeat(64); + const tooLong = "a".repeat(20); const { stdout, status } = gate({ OPENSHELL_SANDBOX: tooLong }); expect(status).toBe(0); expect(stdout).toContain("nemoclaw logs --tail 50"); diff --git a/test/shellquote-sandbox.test.ts b/test/shellquote-sandbox.test.ts index 304842f046a..9a513571c3b 100644 --- a/test/shellquote-sandbox.test.ts +++ b/test/shellquote-sandbox.test.ts @@ -49,7 +49,7 @@ describe("sandboxName command hardening in onboard.js", () => { }; await expect( - createSandbox(null, "test-model", "nvidia-prod", null, "bad; touch /tmp/pwned"), + createSandbox(null, "test-model", "nvidia-prod", null, "bad;touch"), ).rejects.toThrow(/Invalid sandbox name/); }); From 0b2c9879d1c4ec0bdf2bb819a7aa67fdb12ef0d3 Mon Sep 17 00:00:00 2001 From: Apurv Kumaria Date: Fri, 7 Aug 2026 01:07:20 -0700 Subject: [PATCH 09/18] fix(openshell): match supervisor workdir argv Signed-off-by: Apurv Kumaria --- .../openshell-0.0.99-migration-review.md | 1 + .../managed-bootstrap/docker-test-fixture.ts | 2 +- .../managed-workload/onboard-orchestration.ts | 2 +- .../openshell-0.0.99-migration-review.test.ts | 36 +++++++++++++++++++ 4 files changed, 39 insertions(+), 2 deletions(-) diff --git a/docs/security/openshell-0.0.99-migration-review.md b/docs/security/openshell-0.0.99-migration-review.md index 9facf419628..57d73a6b440 100644 --- a/docs/security/openshell-0.0.99-migration-review.md +++ b/docs/security/openshell-0.0.99-migration-review.md @@ -116,6 +116,7 @@ than enabling optional upstream behavior implicitly. | `OS99-13` | Inference status heading changed from `Gateway inference:` to `Inference:` | The parser accepts both headings, with focused regression coverage for the exact v0.0.99 output. | | `OS99-14` | Routable sandbox names are capped at 19 characters | NemoClaw's canonical validation uses the same 19-character limit, and generated activation names fit it. Exact all-agent activation remains a final acceptance gate. | | `OS99-15` | The Docker driver records the immutable image content ID in `Config.Image` | Managed bootstrap accepts either the reviewed `repository@manifestDigest` or its exact runtime content ID, while separately requiring Docker to prove that the manifest resolves to that content ID. | +| `OS99-16` | The Docker driver appends `--workdir /sandbox` to the supervisor command | Managed bootstrap requires that exact v0.0.99 supervisor argv before replacing the held workload. | An unresolved critical or high concern blocks the upgrade. Test selection cannot waive a concern; conditional skips and expected failures do not count as qualification evidence. diff --git a/src/lib/onboard/managed-bootstrap/docker-test-fixture.ts b/src/lib/onboard/managed-bootstrap/docker-test-fixture.ts index 92b6f26c091..bc51809b865 100644 --- a/src/lib/onboard/managed-bootstrap/docker-test-fixture.ts +++ b/src/lib/onboard/managed-bootstrap/docker-test-fixture.ts @@ -44,7 +44,7 @@ const CONFIG_ID = `sha256:${"4".repeat(64)}`; const MANIFEST = `sha256:${"5".repeat(64)}` as const; const REPOSITORY = "registry.example/nemoclaw/hermes"; const IMAGE = `${REPOSITORY}@${MANIFEST}`; -const SUPERVISOR = ["/opt/openshell/bin/openshell-sandbox", "supervise"] as const; +const SUPERVISOR = ["/opt/openshell/bin/openshell-sandbox", "--workdir", "/sandbox"] as const; export const SUPPORTED_AGENTS = ["openclaw", "hermes", "langchain-deepagents-code"] as const; type FixtureCommandResult = { diff --git a/src/lib/onboard/managed-workload/onboard-orchestration.ts b/src/lib/onboard/managed-workload/onboard-orchestration.ts index 6ed533156bf..b4b144c83a9 100644 --- a/src/lib/onboard/managed-workload/onboard-orchestration.ts +++ b/src/lib/onboard/managed-workload/onboard-orchestration.ts @@ -408,7 +408,7 @@ export function resolveOnboardManagedBootstrapLaunch(input: { }, agentIdentity: managedImageRuntimeIdentity(input.workload.source.contract.agent), intendedWorkloadArgv: input.intendedWorkloadArgv, - expectedSupervisorArgv: ["/opt/openshell/bin/openshell-sandbox"], + expectedSupervisorArgv: ["/opt/openshell/bin/openshell-sandbox", "--workdir", "/sandbox"], } as const; } diff --git a/test/openshell-0.0.99-migration-review.test.ts b/test/openshell-0.0.99-migration-review.test.ts index fd507ad7adf..c0296766e9c 100644 --- a/test/openshell-0.0.99-migration-review.test.ts +++ b/test/openshell-0.0.99-migration-review.test.ts @@ -6,6 +6,7 @@ import path from "node:path"; import { describe, expect, it } from "vitest"; import { parseGatewayInference } from "../src/lib/inference/config.js"; +import { resolveOnboardManagedBootstrapLaunch } from "../src/lib/onboard/managed-workload/onboard-orchestration.js"; import { pinnedOpenShellSandboxBuildVersion } from "../src/lib/onboard/openshell-feature-gate.js"; import { validateName } from "../src/lib/runner.js"; @@ -148,6 +149,41 @@ function parseDigestTable(start: string, end: string): DigestMatrix { } describe("OpenShell 0.0.99 migration review", () => { + it("binds managed Docker activation to the v0.0.99 supervisor workdir argv (#8497)", () => { + const authorityStore = {}; + const launch = resolveOnboardManagedBootstrapLaunch({ + runtime: { + runtimeProvider: { + bootstrap: { + supported: true, + createAuthorityStore: () => authorityStore, + }, + }, + } as never, + workload: { + source: { + kind: "managed-image", + contract: { + agent: "openclaw", + image: "registry.example/nemoclaw/openclaw", + digest: `sha256:${"1".repeat(64)}`, + }, + }, + } as never, + stateRoot: "/tmp/nemoclaw-state", + bootstrapIdentity: "bootstrap-identity", + request: {} as never, + intendedWorkloadArgv: ["/usr/local/bin/nemoclaw-start"], + }); + + expect(launch?.expectedSupervisorArgv).toEqual([ + "/opt/openshell/bin/openshell-sandbox", + "--workdir", + "/sandbox", + ]); + expect(launch?.authorityStore).toBe(authorityStore); + }); + it("binds every adjacent range to its declared unique commit ledger (#8497)", () => { const ledger = parseLedger(); const table = parseRangeTable(); From 8576e19152b2240ee6d93f0d39c32d6facf49d3a Mon Sep 17 00:00:00 2001 From: Apurv Kumaria Date: Fri, 7 Aug 2026 01:16:49 -0700 Subject: [PATCH 10/18] fix(e2e): shorten Podman lifecycle names Signed-off-by: Apurv Kumaria --- .github/workflows/podman-cpu-proof.yaml | 10 +++++++--- test/e2e/live/podman-cpu-lifecycle.test.ts | 9 ++++++--- test/e2e/support/podman-cpu-proof-workflow.test.ts | 3 +++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/podman-cpu-proof.yaml b/.github/workflows/podman-cpu-proof.yaml index 312bace2688..86b90f8d86d 100644 --- a/.github/workflows/podman-cpu-proof.yaml +++ b/.github/workflows/podman-cpu-proof.yaml @@ -181,7 +181,11 @@ jobs: image_id="$(podman --url "$endpoint" image inspect --format '{{.Id}}' "$image_ref")" test -n "$image_id" for agent in openclaw hermes langchain-deepagents-code; do - sandbox_name="podman-$agent" + case "$agent" in + openclaw) sandbox_name="podman-openclaw" ;; + hermes) sandbox_name="podman-hermes" ;; + langchain-deepagents-code) sandbox_name="podman-dcode" ;; + esac podman --url "$endpoint" create \ --name "openshell-sandbox-$sandbox_name" \ --label "openshell.managed=true" \ @@ -213,8 +217,8 @@ jobs: run: | set -euo pipefail endpoint="unix://${E2E_PODMAN_SOCKET:-/run/user/$(id -u)/podman/podman.sock}" - for agent in openclaw hermes langchain-deepagents-code; do - podman --url "$endpoint" rm --force "openshell-sandbox-podman-$agent" || true + for sandbox_name in podman-openclaw podman-hermes podman-dcode; do + podman --url "$endpoint" rm --force "openshell-sandbox-$sandbox_name" || true done service_pid="${E2E_PODMAN_SERVICE_PID:-}" if [[ "$service_pid" =~ ^[1-9][0-9]*$ ]]; then diff --git a/test/e2e/live/podman-cpu-lifecycle.test.ts b/test/e2e/live/podman-cpu-lifecycle.test.ts index 8cfbdc874f0..e320170134a 100644 --- a/test/e2e/live/podman-cpu-lifecycle.test.ts +++ b/test/e2e/live/podman-cpu-lifecycle.test.ts @@ -16,7 +16,11 @@ import { createPodmanRuntimeProviderBundle } from "../../../src/lib/onboard/runt import type { SandboxEntry } from "../../../src/lib/state/registry/types"; import { expect, test } from "../fixtures/e2e-test.ts"; -const AGENTS = ["openclaw", "hermes", "langchain-deepagents-code"] as const; +const AGENTS = [ + { agent: "openclaw", sandboxName: "podman-openclaw" }, + { agent: "hermes", sandboxName: "podman-hermes" }, + { agent: "langchain-deepagents-code", sandboxName: "podman-dcode" }, +] as const; const SOCKET_PATH = process.env.E2E_PODMAN_SOCKET ?? ""; const E2E_PHASES = [ "pin the exact rootless Podman endpoint", @@ -77,8 +81,7 @@ test("qualifies rootless Podman and preserves all-agent exact CPU lifecycle iden expect(bundle.capabilities.hostLocalInference).toBe(false); progress.phase("exercise all-agent exact-container start and stop"); - for (const agent of AGENTS) { - const sandboxName = `podman-${agent}`; + for (const { agent, sandboxName } of AGENTS) { const agentEngines = engines(); const agentBundle = createPodmanRuntimeProviderBundle({ engines: agentEngines }); const lifecycle = supportedLifecycle(agentBundle); diff --git a/test/e2e/support/podman-cpu-proof-workflow.test.ts b/test/e2e/support/podman-cpu-proof-workflow.test.ts index 0e2828b01ce..aa87f92954f 100644 --- a/test/e2e/support/podman-cpu-proof-workflow.test.ts +++ b/test/e2e/support/podman-cpu-proof-workflow.test.ts @@ -84,6 +84,8 @@ describe("native Podman CPU proof workflow", () => { const cleanup = namedStep("Clean up rootless Podman fixtures"); expect(fixtures).toContain("for agent in openclaw hermes langchain-deepagents-code"); + expect(fixtures).toContain('langchain-deepagents-code) sandbox_name="podman-dcode"'); + expect(fixtures).not.toContain('sandbox_name="podman-$agent"'); expect(fixtures).toContain("openshell.managed=true"); expect(fixtures).toContain("openshell.sandbox-name=$sandbox_name"); expect(fixtures).toContain("openshell.sandbox-namespace=default"); @@ -91,6 +93,7 @@ describe("native Podman CPU proof workflow", () => { "npx vitest run --project e2e-live test/e2e/live/podman-cpu-lifecycle.test.ts", ); expect(cleanup.if).toBe("always()"); + expect(cleanup.run).toContain("podman-openclaw podman-hermes podman-dcode"); expect(cleanup.run).toContain('podman --url "$endpoint" rm --force'); }); }); From 58786994e8a3ad0b75b49e73684ca74ea45b85ed Mon Sep 17 00:00:00 2001 From: Senthil Ravichandran Date: Fri, 7 Aug 2026 03:37:17 -0700 Subject: [PATCH 11/18] test(openshell): use valid sandbox names Keep integration-test fixture names within OpenShell v0.0.99's 19-character sandbox-name limit. Signed-off-by: Senthil Ravichandran --- test/cli/helpers.ts | 12 ++++++++---- test/cli/sandbox-status-json.test.ts | 4 ++-- test/cli/status-root-json.test.ts | 2 +- test/recover-port-forward.test.ts | 2 +- .../auto-pair-approval.test.ts | 16 ++++++++-------- 5 files changed, 20 insertions(+), 16 deletions(-) diff --git a/test/cli/helpers.ts b/test/cli/helpers.ts index c6380071631..7ae4ac1a531 100644 --- a/test/cli/helpers.ts +++ b/test/cli/helpers.ts @@ -445,12 +445,16 @@ export function createCloudflaredServiceDir(prefix: string): { sandboxName: string; serviceDir: string; } { + const compactPrefix = prefix + .replace(/[^a-z0-9-]/g, "") + .replace(/^-+|-+$/g, "") + .slice(0, 4); const suffix = [ - process.pid.toString(36), - Date.now().toString(36), - Math.random().toString(36).slice(2, 10), + process.pid.toString(36).slice(-3), + Date.now().toString(36).slice(-6), + Math.random().toString(36).slice(2, 5), ].join("-"); - const sandboxName = `${prefix}${suffix}`; + const sandboxName = `${compactPrefix || "test"}-${suffix}`; const serviceDir = path.join("/tmp", `nemoclaw-services-${sandboxName}`); fs.rmSync(serviceDir, { recursive: true, force: true }); fs.mkdirSync(serviceDir, { recursive: true }); diff --git a/test/cli/sandbox-status-json.test.ts b/test/cli/sandbox-status-json.test.ts index 14d5af4e7f8..5a2bd94dbf1 100644 --- a/test/cli/sandbox-status-json.test.ts +++ b/test/cli/sandbox-status-json.test.ts @@ -23,7 +23,7 @@ function createInferenceRouteStatusSetup(options: { }) { const home = fs.mkdtempSync(path.join(os.tmpdir(), "nemoclaw-cli-status-route-")); const localBin = path.join(home, "bin"); - const sandboxName = `route-${process.pid}-${Date.now()}`; + const sandboxName = `r-${process.pid.toString(36).slice(-3)}-${Date.now().toString(36).slice(-8)}`; fs.mkdirSync(localBin, { recursive: true }); writeSandboxRegistry(home, sandboxName, { model: "nvidia/nemotron", @@ -106,7 +106,7 @@ describe("CLI sandbox status JSON output", testTimeoutOptions(20_000), () => { it("sandbox status --json emits structured per-sandbox report", () => { const home = fs.mkdtempSync(path.join(os.tmpdir(), "nemoclaw-cli-sandbox-status-json-")); const localBin = path.join(home, "bin"); - const sandboxName = `alpha-${process.pid}-${Date.now()}`; + const sandboxName = `a-${process.pid.toString(36).slice(-3)}-${Date.now().toString(36).slice(-8)}`; fs.mkdirSync(localBin, { recursive: true }); writeSandboxRegistry(home, sandboxName, { model: "configured-model", diff --git a/test/cli/status-root-json.test.ts b/test/cli/status-root-json.test.ts index be2f429010e..b87992bd444 100644 --- a/test/cli/status-root-json.test.ts +++ b/test/cli/status-root-json.test.ts @@ -14,7 +14,7 @@ describe("CLI root status JSON", () => { const home = fs.mkdtempSync(path.join(os.tmpdir(), "nemoclaw-cli-status-json-")); const localBin = path.join(home, "bin"); const registryDir = path.join(home, ".nemoclaw"); - const sandboxName = `alpha-${process.pid}-${Date.now()}`; + const sandboxName = `a-${process.pid.toString(36).slice(-3)}-${Date.now().toString(36).slice(-8)}`; const serviceDir = path.join("/tmp", `nemoclaw-services-${sandboxName}`); fs.rmSync(serviceDir, { recursive: true, force: true }); fs.mkdirSync(localBin, { recursive: true }); diff --git a/test/recover-port-forward.test.ts b/test/recover-port-forward.test.ts index 9f719df3915..2c4a84fbce0 100644 --- a/test/recover-port-forward.test.ts +++ b/test/recover-port-forward.test.ts @@ -348,7 +348,7 @@ describe("nemoclaw recover", () => { testTimeoutOptions(20_000), () => { const fixture = setupFixture({ - sandboxName: "delayed-owner-sandbox", + sandboxName: "delayed-owner-sb", gatewayProbe: "RUNNING", forwardListStatus: "dead", forwardStartDelayPolls: 3, diff --git a/test/sandbox-connect-inference/auto-pair-approval.test.ts b/test/sandbox-connect-inference/auto-pair-approval.test.ts index 836f2df8619..a9642ee99c3 100644 --- a/test/sandbox-connect-inference/auto-pair-approval.test.ts +++ b/test/sandbox-connect-inference/auto-pair-approval.test.ts @@ -53,7 +53,7 @@ describe("sandbox connect auto-pair approval pass (#4263)", () => { () => { const { tmpDir, stateFile, sandboxName } = setupFixture( { - name: "approval-pass-sandbox", + name: "approval-pass-sb", model: "claude-sonnet-4-20250514", provider: "anthropic-prod", gpuEnabled: false, @@ -98,7 +98,7 @@ describe("sandbox connect auto-pair approval pass (#4263)", () => { () => { const { tmpDir, stateFile, sandboxName } = setupFixture( { - name: "approval-pass-policy", + name: "approval-pass-pol", model: "claude-sonnet-4-20250514", provider: "anthropic-prod", gpuEnabled: false, @@ -161,7 +161,7 @@ describe("sandbox connect auto-pair approval pass (#4263)", () => { it("does not import approval policy from PYTHONPATH", testTimeoutOptions(20_000), () => { const { tmpDir, stateFile, sandboxName } = setupFixture( { - name: "approval-pass-tmp-tamper", + name: "approval-tmp-tamper", model: "claude-sonnet-4-20250514", provider: "anthropic-prod", gpuEnabled: false, @@ -212,7 +212,7 @@ describe("sandbox connect auto-pair approval pass (#4263)", () => { () => { const { tmpDir, stateFile, sandboxName } = setupFixture( { - name: "approval-pass-tolerant", + name: "approval-tolerant", model: "claude-sonnet-4-20250514", provider: "anthropic-prod", gpuEnabled: false, @@ -259,7 +259,7 @@ describe("sandbox connect scope-upgrade approval on recover/probe (#4504)", () = // SSH session. const { tmpDir, stateFile, sandboxName } = setupFixture( { - name: "probe-approval-sandbox", + name: "probe-approval-sb", model: "claude-sonnet-4-20250514", provider: "anthropic-prod", gpuEnabled: false, @@ -307,7 +307,7 @@ describe("sandbox connect scope-upgrade approval on recover/probe (#4504)", () = // probe-only flow must still succeed. const { tmpDir, stateFile, sandboxName } = setupFixture( { - name: "probe-approval-tolerant", + name: "probe-approval-tol", model: "claude-sonnet-4-20250514", provider: "anthropic-prod", gpuEnabled: false, @@ -373,7 +373,7 @@ describe("sandbox connect scope-upgrade approval on recover/probe (#4504)", () = // saw none of the triplet. const { tmpDir, stateFile, sandboxName } = setupFixture( { - name: "probe-env-strip-sandbox", + name: "probe-env-strip-sb", model: "claude-sonnet-4-20250514", provider: "anthropic-prod", gpuEnabled: false, @@ -412,7 +412,7 @@ describe("sandbox connect scope-upgrade approval on recover/probe (#4504)", () = () => { const { tmpDir, stateFile, sandboxName } = setupFixture( { - name: "approve-budget-sandbox", + name: "approve-budget-sb", model: "claude-sonnet-4-20250514", provider: "anthropic-prod", gpuEnabled: false, From bf64639a51e0bdda4897bda6f86420acaef5030a Mon Sep 17 00:00:00 2001 From: Apurv Kumaria Date: Fri, 7 Aug 2026 03:57:01 -0700 Subject: [PATCH 12/18] fix(openshell): reconcile v0.0.99 policy activation Signed-off-by: Apurv Kumaria --- docs/reference/network-policies.mdx | 2 +- docs/security/best-practices.mdx | 6 +- .../openshell-0.0.99-migration-review.md | 15 + nemoclaw-blueprint/policies/presets/brew.yaml | 7 +- .../policies/presets/outlook.yaml | 2 + .../sandbox/policy-channel-add-drift.test.ts | 41 ++ src/lib/actions/sandbox/policy-channel.ts | 64 ++- .../initial-policy-real-policy.test.ts | 72 +++ src/lib/policy/index.ts | 347 ++++++++++++- test/effective-policy-contracts.test.ts | 20 +- test/exit-code-user-error-surfaces.test.ts | 5 +- ...rd-gateway-port-conflict-fast-fail.test.ts | 7 +- .../policy-openclaw-npm-compatibility.test.ts | 457 ++++++++++++++++++ test/rebuild-shields-auto-unlock.test.ts | 4 +- test/repro-2201.test.ts | 4 +- 15 files changed, 1020 insertions(+), 33 deletions(-) create mode 100644 test/policy-openclaw-npm-compatibility.test.ts diff --git a/docs/reference/network-policies.mdx b/docs/reference/network-policies.mdx index 281cf388c01..7c12b12dd95 100644 --- a/docs/reference/network-policies.mdx +++ b/docs/reference/network-policies.mdx @@ -70,7 +70,7 @@ The following endpoint groups are allowed by default: | `clawhub` | `clawhub.ai:443` | `/usr/local/bin/openclaw`, `/usr/local/bin/node` | GET, POST, including scoped package paths | | `openclaw_api` | `openclaw.ai:443` | `/usr/local/bin/openclaw`, `/usr/local/bin/node` | GET, POST | | `openclaw_docs` | `docs.openclaw.ai:443` | `/usr/local/bin/openclaw` | GET only | -| `npm_registry` | `registry.npmjs.org:443` | `/usr/local/bin/openclaw` only (openclaw plugins install) | GET only | +| `npm_registry` | `registry.npmjs.org:443` | `/usr/local/bin/openclaw` only (openclaw plugins install) | GET only; while the broader `npm` preset is active, its reviewed L4 transport metadata temporarily applies to this overlapping route | diff --git a/docs/security/best-practices.mdx b/docs/security/best-practices.mdx index b27d57a7626..a0e46de6b0c 100644 --- a/docs/security/best-practices.mdx +++ b/docs/security/best-practices.mdx @@ -179,7 +179,7 @@ Endpoint rules restrict allowed HTTP methods and URL paths. | Aspect | Detail | |---|---| -| Default | Some endpoints allow GET and POST on `/**` (for example, `clawhub.ai`). Others restrict methods and paths to specific API routes (for example, `integrate.api.nvidia.com` allows POST only to inference and embedding paths and GET to model listings). Read-only endpoints such as `docs.openclaw.ai`, the `npm_registry` baseline entry, and the `pypi` preset allow GET only (PyPI also allows HEAD). The `npm` preset is an intentional exception: npm/Yarn registry traffic uses L4 pass-through for Node 22 undici CONNECT compatibility. | +| Default | Some endpoints allow GET and POST on `/**` (for example, `clawhub.ai`). Others restrict methods and paths to specific API routes (for example, `integrate.api.nvidia.com` allows POST only to inference and embedding paths and GET to model listings). Read-only endpoints such as `docs.openclaw.ai`, the OpenClaw `npm_registry` baseline entry, and the `pypi` preset allow GET only (PyPI also allows HEAD). The broader `npm` preset is an intentional exception: npm/Yarn registry traffic uses L4 pass-through for Node 22 undici CONNECT compatibility. While that preset is active, NemoClaw temporarily aligns the overlapping baseline npm endpoint with the same reviewed L4 metadata because OpenShell 0.0.99 requires a single connection mode. | | What you can change | Add methods (PUT, DELETE, PATCH) or restrict paths to specific prefixes. | | Risk if relaxed | Allowing all methods on an API endpoint gives the agent write and delete access. For example, allowing DELETE on `api.github.com` lets the agent delete repositories. | | Recommendation | Use GET-only rules for endpoints that the agent only reads. Add write methods only for endpoints where the agent must create or modify resources. Restrict paths to specific API routes when possible. | @@ -231,6 +231,10 @@ NemoClaw ships preset policy files in `nemoclaw-blueprint/policies/presets/` for Apply presets only when the agent's task requires the integration. Review the preset's YAML file before applying to understand the endpoints, methods, and binary restrictions it adds. +The OpenClaw baseline npm route remains GET-only until the `npm` preset is active. Adding that +preset temporarily gives the overlapping baseline route the same L4 transport while preserving its +`openclaw`-only binary scope; removing the preset restores the reviewed GET-only baseline entry. +The preset separately grants that registry transport to its listed npm, Yarn, and Node executables. The Personal tier selects `personal-open-internet` and every maintained preset supported by the active agent. diff --git a/docs/security/openshell-0.0.99-migration-review.md b/docs/security/openshell-0.0.99-migration-review.md index 57d73a6b440..cc808a80bcf 100644 --- a/docs/security/openshell-0.0.99-migration-review.md +++ b/docs/security/openshell-0.0.99-migration-review.md @@ -117,6 +117,7 @@ than enabling optional upstream behavior implicitly. | `OS99-14` | Routable sandbox names are capped at 19 characters | NemoClaw's canonical validation uses the same 19-character limit, and generated activation names fit it. Exact all-agent activation remains a final acceptance gate. | | `OS99-15` | The Docker driver records the immutable image content ID in `Config.Image` | Managed bootstrap accepts either the reviewed `repository@manifestDigest` or its exact runtime content ID, while separately requiring Docker to prove that the manifest resolves to that content ID. | | `OS99-16` | The Docker driver appends `--workdir /sandbox` to the supervisor command | Managed bootstrap requires that exact v0.0.99 supervisor argv before replacing the held workload. | +| `OS99-17` | Overlapping endpoint selectors with conflicting connection or request metadata are rejected before policy activation | The OpenClaw baseline npm route remains GET-only in Restricted and temporarily adopts the reviewed npm preset's L4 metadata while that preset is active. Homebrew's overlapping GitHub routes use automatic TLS, and Outlook matches Teams' request-body credential-rewrite setting on shared Microsoft endpoints. Focused composition coverage protects each compatibility decision. | An unresolved critical or high concern blocks the upgrade. Test selection cannot waive a concern; conditional skips and expected failures do not count as qualification evidence. @@ -131,12 +132,26 @@ NemoClaw now normalizes them before hashing. It still refuses any non-empty port the managed clone cannot reproduce that behavior exactly. Unit coverage proves both equivalence and the rejection path; exact `0.0.85 -> 0.0.99` live activation remains required. +OpenShell 0.0.99 also validates the complete effective network policy before activation. Several +previously accepted overlaps used incompatible metadata: the OpenClaw baseline and npm preset +selected different TLS/L7 handling for `registry.npmjs.org`; Homebrew conflicted with agent routes +on `github.com` and `raw.githubusercontent.com`; and Teams and Outlook disagreed on credential-body +rewriting for shared Microsoft endpoints. NemoClaw preserves the GET-only npm baseline in +Restricted, temporarily applies the npm preset's reviewed L4 metadata to that baseline route while +the preset is active, and restores the exact baseline on removal. Homebrew's overlapping GitHub +routes remain plain L4 endpoints with automatic TLS, while Outlook now matches Teams' rewrite +setting. The npm baseline keeps its OpenClaw-only binary scope, but its GET-only method/path +inspection is intentionally unavailable until npm is removed; the other routes retain their +separate binary allowlists and authorization rules. + ## Final acceptance gates - All active CLI, blueprint, installer, Brev, workflow, supervisor, and sandbox selectors agree on `0.0.99` and exact reviewed identities. - The `v0.0.99` credential-boundary manifest is the active manifest and its source commit is exact. - Static checks, focused lifecycle tests, CLI/plugin builds, and documentation checks pass. +- Default OpenClaw policy composition activates without endpoint-metadata ambiguity while retaining + the reviewed binary scopes for npm, Homebrew, and pricing traffic. - Managed Docker and Podman activation, lifecycle, policy, credential, inference, and MCP E2E run against the exact pinned release without conditional skips or expected failures. - A supported host with no prior NemoClaw state demonstrates the `0.0.85 -> 0.0.99` activation transition, including the diff --git a/nemoclaw-blueprint/policies/presets/brew.yaml b/nemoclaw-blueprint/policies/presets/brew.yaml index cf1c9d5a342..d6cda96f539 100644 --- a/nemoclaw-blueprint/policies/presets/brew.yaml +++ b/nemoclaw-blueprint/policies/presets/brew.yaml @@ -19,7 +19,10 @@ network_policies: - host: github.com port: 443 access: full - tls: skip + # Keep GitHub and raw-content routes on automatic TLS handling so this + # preset composes with the agent baselines and narrower inspected + # routes under OpenShell 0.0.99. System git is excluded below; the + # remaining curl/Homebrew clients trust the sandbox CA. - host: ghcr.io port: 443 access: full @@ -35,7 +38,7 @@ network_policies: - host: raw.githubusercontent.com port: 443 access: full - tls: skip + # See the automatic-TLS compatibility rationale on github.com above. # System git is intentionally excluded; git-based Homebrew operations require the github preset. binaries: - { path: /usr/bin/curl } diff --git a/nemoclaw-blueprint/policies/presets/outlook.yaml b/nemoclaw-blueprint/policies/presets/outlook.yaml index ccfb648f257..9d449f5ef4f 100644 --- a/nemoclaw-blueprint/policies/presets/outlook.yaml +++ b/nemoclaw-blueprint/policies/presets/outlook.yaml @@ -13,6 +13,7 @@ network_policies: port: 443 protocol: rest enforcement: enforce + request_body_credential_rewrite: true rules: - allow: { method: GET, path: "/**" } - allow: { method: POST, path: "/**" } @@ -21,6 +22,7 @@ network_policies: port: 443 protocol: rest enforcement: enforce + request_body_credential_rewrite: true rules: - allow: { method: GET, path: "/**" } - allow: { method: POST, path: "/**" } diff --git a/src/lib/actions/sandbox/policy-channel-add-drift.test.ts b/src/lib/actions/sandbox/policy-channel-add-drift.test.ts index 8d386643c87..0cff319aa4b 100644 --- a/src/lib/actions/sandbox/policy-channel-add-drift.test.ts +++ b/src/lib/actions/sandbox/policy-channel-add-drift.test.ts @@ -47,6 +47,7 @@ let errSpy: MockInstance; let promptSpy: MockInstance; let applyPresetMock: MockInstance; let gatewayStateMock: MockInstance; +let npmCompatibilityStateMock: MockInstance; let refreshSpy: MockInstance; async function captureExit(action: () => Promise): Promise { @@ -89,6 +90,9 @@ beforeEach(() => { ); applyPresetMock = vi.spyOn(policies, "applyPreset").mockReturnValue(true); gatewayStateMock = vi.spyOn(policies, "getPresetContentGatewayState").mockReturnValue("drift"); + npmCompatibilityStateMock = vi + .spyOn(policies, "getOpenClawNpmCompatibilityState") + .mockReturnValue("match"); vi.spyOn(policies, "getPresetEndpoints").mockReturnValue(["pypi.example.com"]); vi.spyOn(policies, "getPresetValidationWarning").mockReturnValue(null); @@ -135,6 +139,43 @@ describe("addSandboxPolicy drift-aware named re-add", () => { expect(refreshSpy).not.toHaveBeenCalled(); }); + it("repairs a matching npm preset whose OpenClaw compatibility overlay is absent (#8497)", async () => { + vi.spyOn(registry, "getSandbox").mockReturnValue({ + name: "alpha", + agent: "openclaw", + policies: ["npm"], + }); + vi.spyOn(policies, "listPresets").mockReturnValue([ + { file: "npm.yaml", name: "npm", description: "npm registry access" }, + ]); + vi.spyOn(policies, "getAppliedPresets").mockReturnValue(["npm"]); + vi.spyOn(policies, "loadPresetForSandbox").mockReturnValue( + "network_policies:\n npm_yarn:\n name: npm_yarn\n", + ); + vi.spyOn(registry, "getBaselineExclusions").mockReturnValue([]); + const disclosureSpy = vi + .spyOn(policies, "logOpenClawNpmCompatibilityDisclosure") + .mockImplementation(() => undefined); + gatewayStateMock.mockReturnValue("match"); + npmCompatibilityStateMock.mockReturnValue("repair"); + + await addSandboxPolicy("alpha", { preset: "npm", yes: true }); + + expect(logSpy).toHaveBeenCalledWith( + " Preset 'npm' matches the live policy, but its OpenClaw compatibility overlay requires repair.", + ); + expect(logSpy).toHaveBeenCalledWith( + expect.stringContaining( + "Effective egress scope that would replace the current preset policy", + ), + ); + expect(disclosureSpy).toHaveBeenCalledTimes(1); + expect(applyPresetMock).toHaveBeenCalledWith("alpha", "npm", { + suppressDisclosure: true, + }); + expect(refreshSpy).toHaveBeenCalledTimes(1); + }); + it("re-applies when the preset is recorded but its entries are absent from the live policy", async () => { gatewayStateMock.mockReturnValue("absent"); diff --git a/src/lib/actions/sandbox/policy-channel.ts b/src/lib/actions/sandbox/policy-channel.ts index a040a626f57..38c6856b3d3 100644 --- a/src/lib/actions/sandbox/policy-channel.ts +++ b/src/lib/actions/sandbox/policy-channel.ts @@ -278,7 +278,7 @@ async function addSandboxPolicyUnlocked( const applied = policies.getAppliedPresets(sandboxName); let answer = null; - let reapplyState: "drift" | "absent" | null = null; + let reapplyState: policies.PresetPolicyState | null = null; if (presetArg) { const normalized = presetArg.trim().toLowerCase(); const preset = allPresets.find((item: { name: string }) => item.name === normalized); @@ -314,13 +314,35 @@ async function addSandboxPolicyUnlocked( } const appliedState = policies.getPresetContentGatewayState(sandboxName, appliedContent); if (appliedState === "match") { - // The desired state already holds: exit 0 so converging scripts can - // call `policy add` idempotently, mirroring how applyPreset treats a - // byte-identical re-application as a successful no-op. - console.log( - ` Preset '${preset.name}' is already applied and matches the live policy; nothing to do.`, - ); - return; + const needsOpenClawNpmCheck = + preset.name === "npm" && (sandboxAgent === null || sandboxAgent === "openclaw"); + const npmCompatibilityState = needsOpenClawNpmCheck + ? policies.getOpenClawNpmCompatibilityState(sandboxName) + : "match"; + if (npmCompatibilityState === "repair") { + reapplyState = "drift"; + console.log( + " Preset 'npm' matches the live policy, but its OpenClaw compatibility overlay requires repair.", + ); + } else if (npmCompatibilityState === "drift" || npmCompatibilityState === null) { + console.error( + npmCompatibilityState === null + ? " Could not verify the live OpenClaw npm compatibility overlay." + : " The live OpenClaw npm compatibility overlay has drifted from its reviewed state.", + ); + console.error( + " No policy changes were made; inspect the live npm policy before retrying.", + ); + process.exit(1); + } else { + // The desired state already holds: exit 0 so converging scripts can + // call `policy add` idempotently, mirroring how applyPreset treats a + // byte-identical re-application as a successful no-op. + console.log( + ` Preset '${preset.name}' is already applied and matches the live policy; nothing to do.`, + ); + return; + } } if (appliedState === null) { // Live policy unreadable: drift is unverifiable, so refuse rather @@ -331,14 +353,16 @@ async function addSandboxPolicyUnlocked( ); process.exit(1); } - // State-only notice: the downstream flow reports the dry-run, - // confirmation, and apply outcomes. - reapplyState = appliedState; - console.log( - appliedState === "drift" - ? ` Preset '${preset.name}' no longer matches the live policy.` - : ` Preset '${preset.name}' is recorded as applied but missing from the live policy.`, - ); + if (appliedState !== "match") { + // State-only notice: the downstream flow reports the dry-run, + // confirmation, and apply outcomes. + reapplyState = appliedState; + console.log( + appliedState === "drift" + ? ` Preset '${preset.name}' no longer matches the live policy.` + : ` Preset '${preset.name}' is recorded as applied but missing from the live policy.`, + ); + } } answer = preset.name; } else { @@ -360,6 +384,14 @@ async function addSandboxPolicyUnlocked( } else { policies.logPresetScope(presetContent); } + const needsOpenClawNpmDisclosure = + answer === "npm" && (sandboxAgent === null || sandboxAgent === "openclaw"); + const npmBaselineExcluded = + needsOpenClawNpmDisclosure && + registry.getBaselineExclusions(sandboxName).some((entry) => entry.key === "npm_registry"); + if (needsOpenClawNpmDisclosure && !npmBaselineExcluded) { + policies.logOpenClawNpmCompatibilityDisclosure(); + } const presetWarning = policies.getPresetValidationWarning(answer); if (presetWarning) { diff --git a/src/lib/onboard/initial-policy-real-policy.test.ts b/src/lib/onboard/initial-policy-real-policy.test.ts index 5145fcc6b55..e07f584e2e2 100644 --- a/src/lib/onboard/initial-policy-real-policy.test.ts +++ b/src/lib/onboard/initial-policy-real-policy.test.ts @@ -18,8 +18,12 @@ type PolicyRule = { type PolicyEndpoint = { host?: string; + port?: number; + access?: string; protocol?: string; + enforcement?: string; tls?: string; + allowed_ips?: string[]; request_body_credential_rewrite?: boolean; rules?: PolicyRule[]; }; @@ -327,4 +331,72 @@ describe("initial sandbox policy real preset merge", () => { } } }); + + it("keeps the Restricted OpenClaw npm baseline inspected and GET-only (#8497)", () => { + const baselinePath = repoPath("nemoclaw-blueprint", "policies", "openclaw-sandbox.yaml"); + const reviewed = YAML.parse(fs.readFileSync(baselinePath, "utf-8")) as PolicyDocument; + const effective = readPreparedPolicy( + prepareInitialSandboxCreatePolicy(baselinePath, [], { + agentName: "openclaw", + policyTier: "restricted", + }), + ); + + expect(effective.network_policies?.npm_registry).toEqual( + reviewed.network_policies?.npm_registry, + ); + const endpoint = effective.network_policies?.npm_registry?.endpoints?.[0]; + expect(endpoint).toMatchObject({ protocol: "rest", enforcement: "enforce" }); + expect(endpoint).not.toHaveProperty("access"); + expect(endpoint?.rules?.map((rule) => rule.allow)).toEqual([{ method: "GET", path: "/**" }]); + }); + + it("composes default OpenClaw package and pricing routes without v0.0.99 ambiguity (#8497)", () => { + const effective = readPreparedPolicy( + prepareInitialSandboxCreatePolicy( + repoPath("nemoclaw-blueprint", "policies", "openclaw-sandbox.yaml"), + [], + { + agentName: "openclaw", + policyTier: "balanced", + additionalPresets: ["npm", "brew", "openclaw-pricing"], + }, + ), + ); + const endpoint = (policyName: string, host: string): PolicyEndpoint => { + const match = effective.network_policies?.[policyName]?.endpoints?.find( + (candidate) => candidate.host === host, + ); + expect(match, `${policyName}:${host}`).toBeDefined(); + return match ?? {}; + }; + const connectionMetadata = (candidate: PolicyEndpoint) => ({ + tls: candidate.tls ?? "auto", + allowedIps: [...(candidate.allowed_ips ?? [])].sort(), + }); + const requestMetadata = (candidate: PolicyEndpoint) => ({ + protocol: candidate.protocol ?? "", + enforcement: candidate.enforcement ?? "audit", + }); + + const baselineNpm = endpoint("npm_registry", "registry.npmjs.org"); + const presetNpm = endpoint("npm_yarn", "registry.npmjs.org"); + expect(connectionMetadata(baselineNpm)).toEqual(connectionMetadata(presetNpm)); + expect(requestMetadata(baselineNpm)).toEqual(requestMetadata(presetNpm)); + expect(baselineNpm).toMatchObject({ access: "full", tls: "skip" }); + expect(baselineNpm).not.toHaveProperty("protocol"); + expect(baselineNpm).not.toHaveProperty("rules"); + expect(effective.network_policies?.npm_registry?.binaries).toEqual([ + { path: "/usr/local/bin/openclaw" }, + ]); + + const brewRaw = endpoint("brew", "raw.githubusercontent.com"); + const pricingRaw = endpoint("openclaw-pricing", "raw.githubusercontent.com"); + expect(connectionMetadata(brewRaw)).toEqual(connectionMetadata(pricingRaw)); + expect(brewRaw).not.toHaveProperty("protocol"); + expect(pricingRaw).toMatchObject({ protocol: "rest", enforcement: "enforce" }); + expect(effective.network_policies?.brew?.binaries).not.toEqual( + expect.arrayContaining([{ path: "/usr/local/bin/node" }, { path: "/usr/bin/node" }]), + ); + }); }); diff --git a/src/lib/policy/index.ts b/src/lib/policy/index.ts index c50f26fbfa1..0927560eb1c 100644 --- a/src/lib/policy/index.ts +++ b/src/lib/policy/index.ts @@ -668,6 +668,247 @@ function logPresetScopeForState( for (const line of renderPresetScope(content, { heading })) logger(line); } +const OPENCLAW_NPM_BASELINE_KEY = "npm_registry"; +const OPENCLAW_NPM_PRESET_KEY = "npm_yarn"; + +function npmCompatibilityEntry( + baselineEntry: PolicyObject, + npmPresetEntry: PolicyObject, +): PolicyObject { + const presetEndpoints = Array.isArray(npmPresetEntry.endpoints) + ? npmPresetEntry.endpoints.filter(isPolicyObject) + : []; + const baselineEndpoints = Array.isArray(baselineEntry.endpoints) + ? baselineEntry.endpoints.filter(isPolicyObject) + : []; + if (baselineEndpoints.length === 0) { + throw new Error( + `Cannot compose '${OPENCLAW_NPM_PRESET_KEY}' with '${OPENCLAW_NPM_BASELINE_KEY}': the reviewed baseline has no endpoints.`, + ); + } + const baselineSelectors = new Set(); + const compatibleEndpoints = baselineEndpoints.map((baselineEndpoint) => { + const host = baselineEndpoint.host; + const port = baselineEndpoint.port; + if ( + typeof host !== "string" || + host.length === 0 || + typeof port !== "number" || + !Number.isInteger(port) || + port <= 0 + ) { + throw new Error( + `Cannot compose '${OPENCLAW_NPM_PRESET_KEY}' with '${OPENCLAW_NPM_BASELINE_KEY}': the reviewed baseline selector is invalid.`, + ); + } + const selector = `${host}:${port}`; + if (baselineSelectors.has(selector)) { + throw new Error( + `Cannot compose '${OPENCLAW_NPM_PRESET_KEY}' with '${OPENCLAW_NPM_BASELINE_KEY}': the reviewed baseline repeats selector '${selector}'.`, + ); + } + baselineSelectors.add(selector); + const matches = presetEndpoints.filter( + (candidate) => candidate.host === host && candidate.port === port, + ); + if (matches.length !== 1) { + throw new Error( + `Cannot compose '${OPENCLAW_NPM_PRESET_KEY}' with '${OPENCLAW_NPM_BASELINE_KEY}': selector '${selector}' must have exactly one preset match.`, + ); + } + return structuredClone(matches[0]); + }); + return { ...structuredClone(baselineEntry), endpoints: compatibleEndpoints }; +} + +type OpenClawNpmActivation = { policy: string; widenedBaseline: boolean }; + +function openClawNpmReviewedEntries(baselinePolicyContent: string): { + baseline: PolicyObject; + preset: PolicyObject; +} { + const baseline = getBaselineEntry(baselinePolicyContent, OPENCLAW_NPM_BASELINE_KEY); + const npmPresetContent = loadPresetForAgent("npm", { agent: "openclaw" }); + const preset = parseNetworkPolicies(npmPresetContent)?.[OPENCLAW_NPM_PRESET_KEY]; + if (!baseline || !isPolicyObject(preset)) { + throw new Error("Cannot reconcile OpenClaw npm policy compatibility: reviewed inputs missing."); + } + return { baseline, preset }; +} + +/** + * OpenShell 0.0.99 rejects overlapping endpoint selectors whose TLS or L7 + * metadata differs, even when their binary lists are disjoint. Keep the + * restricted OpenClaw baseline GET-only. While the broader npm preset is + * active, its reviewed full-access L4 endpoint temporarily replaces the + * overlapping baseline endpoint metadata while retaining the baseline's + * OpenClaw-only binary scope. + */ +function activateOpenClawNpmCompatibility( + policyContent: string, + baselinePolicyContent: string, + npmWasActive: boolean, +): OpenClawNpmActivation { + const parsed = YAML.parse(policyContent); + if (!isPolicyDocument(parsed) || !isPresetPolicyMap(parsed.network_policies)) { + throw new Error("Cannot reconcile OpenClaw npm policy compatibility: invalid policy mapping."); + } + const networkPolicies = parsed.network_policies; + const currentBaselineEntry = networkPolicies[OPENCLAW_NPM_BASELINE_KEY]; + if (currentBaselineEntry === undefined) { + return { policy: policyContent, widenedBaseline: false }; + } + if (!isPolicyObject(currentBaselineEntry)) { + throw new Error(`Cannot compose '${OPENCLAW_NPM_PRESET_KEY}': baseline entry is malformed.`); + } + + const reviewed = openClawNpmReviewedEntries(baselinePolicyContent); + const compatibilityEntry = npmCompatibilityEntry(reviewed.baseline, reviewed.preset); + const currentNpmEntry = networkPolicies[OPENCLAW_NPM_PRESET_KEY]; + if (!isPolicyObject(currentNpmEntry) || !isDeepStrictEqual(currentNpmEntry, reviewed.preset)) { + throw new Error( + `Cannot compose '${OPENCLAW_NPM_PRESET_KEY}': the resulting entry differs from the reviewed npm preset.`, + ); + } + if (isDeepStrictEqual(currentBaselineEntry, compatibilityEntry)) { + if (!npmWasActive) { + throw new Error( + `Cannot compose '${OPENCLAW_NPM_PRESET_KEY}': found a compatibility overlay without an active npm preset.`, + ); + } + return { policy: policyContent, widenedBaseline: false }; + } + if (!isDeepStrictEqual(currentBaselineEntry, reviewed.baseline)) { + throw new Error( + `Cannot compose '${OPENCLAW_NPM_PRESET_KEY}': '${OPENCLAW_NPM_BASELINE_KEY}' differs from the reviewed baseline.`, + ); + } + networkPolicies[OPENCLAW_NPM_BASELINE_KEY] = compatibilityEntry; + parsed.network_policies = networkPolicies; + return { policy: YAML.stringify(parsed), widenedBaseline: true }; +} + +function restoreOpenClawNpmCompatibility( + currentPolicy: string, + updatedPolicy: string, + baselinePolicyContent: string, +): string { + const current = YAML.parse(currentPolicy); + const updated = YAML.parse(updatedPolicy); + if ( + !isPolicyDocument(current) || + !isPresetPolicyMap(current.network_policies) || + !isPolicyDocument(updated) || + !isPresetPolicyMap(updated.network_policies) + ) { + throw new Error("Cannot restore OpenClaw npm policy compatibility: invalid policy mapping."); + } + const currentBaselineEntry = current.network_policies[OPENCLAW_NPM_BASELINE_KEY]; + if (currentBaselineEntry === undefined) return updatedPolicy; + if (!isPolicyObject(currentBaselineEntry)) { + throw new Error(`Cannot remove '${OPENCLAW_NPM_PRESET_KEY}': baseline entry is malformed.`); + } + + const reviewed = openClawNpmReviewedEntries(baselinePolicyContent); + if (isDeepStrictEqual(currentBaselineEntry, reviewed.baseline)) return updatedPolicy; + + const currentNpmEntry = current.network_policies[OPENCLAW_NPM_PRESET_KEY]; + if (!isPolicyObject(currentNpmEntry)) { + throw new Error( + `Cannot remove '${OPENCLAW_NPM_PRESET_KEY}': found a compatibility overlay without an active npm preset.`, + ); + } + const compatibilityEntry = npmCompatibilityEntry(reviewed.baseline, currentNpmEntry); + if (!isDeepStrictEqual(currentBaselineEntry, compatibilityEntry)) { + throw new Error( + `Cannot remove '${OPENCLAW_NPM_PRESET_KEY}': '${OPENCLAW_NPM_BASELINE_KEY}' differs from both the reviewed baseline and active compatibility overlay.`, + ); + } + updated.network_policies[OPENCLAW_NPM_BASELINE_KEY] = structuredClone(reviewed.baseline); + return YAML.stringify(updated); +} + +function resolveSandboxOpenClawNpmBaseline(sandboxName: string): string | null { + const sandbox = registry.getSandbox(sandboxName); + // Legacy and unregistered rows historically use OpenClaw preset content. + // Activation still requires an exact reviewed npm_registry entry in the + // live policy, so this fallback cannot inject or broaden a missing key. + const agent = sandbox?.agent || "openclaw"; + if (agent !== "openclaw") return null; + const baseline = resolveAgentBaselinePolicy(agent); + if (!baseline) { + throw new Error( + `Cannot reconcile OpenClaw npm policy compatibility for '${sandboxName}': the reviewed baseline is unavailable.`, + ); + } + return baseline.content; +} + +function openClawNpmExclusionStateError(sandboxName: string, currentPolicy: string): string | null { + const transition = registry.getBaselineExclusionTransition(sandboxName); + if (transition?.exclusion.key === OPENCLAW_NPM_BASELINE_KEY) { + return `baseline repair for '${OPENCLAW_NPM_BASELINE_KEY}' is still pending; finish that transaction before changing npm`; + } + const isExcluded = registry + .getBaselineExclusions(sandboxName) + .some((entry) => entry.key === OPENCLAW_NPM_BASELINE_KEY); + if (!isExcluded) return null; + const live = inspectLiveBaselineEntry(currentPolicy, OPENCLAW_NPM_BASELINE_KEY); + return live.state === "absent" + ? null + : `recorded exclusion for '${OPENCLAW_NPM_BASELINE_KEY}' requires the live entry to remain absent`; +} + +export type OpenClawNpmCompatibilityState = "match" | "repair" | "excluded" | "drift"; + +function getOpenClawNpmCompatibilityState( + sandboxName: string, +): OpenClawNpmCompatibilityState | null { + try { + const baselinePolicyContent = resolveSandboxOpenClawNpmBaseline(sandboxName); + if (!baselinePolicyContent) return "match"; + const currentPolicy = readCurrentSandboxPolicy(sandboxName); + if (!currentPolicy) return null; + const transition = registry.getBaselineExclusionTransition(sandboxName); + if (transition?.exclusion.key === OPENCLAW_NPM_BASELINE_KEY) return "drift"; + const isExcluded = registry + .getBaselineExclusions(sandboxName) + .some((entry) => entry.key === OPENCLAW_NPM_BASELINE_KEY); + const live = inspectLiveBaselineEntry(currentPolicy, OPENCLAW_NPM_BASELINE_KEY); + if (isExcluded) return live.state === "absent" ? "excluded" : "drift"; + if (live.state !== "present") return "drift"; + + const parsed = YAML.parse(currentPolicy); + if (!isPolicyDocument(parsed) || !isPresetPolicyMap(parsed.network_policies)) return null; + const reviewed = openClawNpmReviewedEntries(baselinePolicyContent); + const currentNpmEntry = parsed.network_policies[OPENCLAW_NPM_PRESET_KEY]; + if (!isPolicyObject(currentNpmEntry) || !isDeepStrictEqual(currentNpmEntry, reviewed.preset)) { + return "drift"; + } + if (isDeepStrictEqual(parsed.network_policies[OPENCLAW_NPM_BASELINE_KEY], reviewed.baseline)) { + return "repair"; + } + const compatibilityEntry = npmCompatibilityEntry(reviewed.baseline, currentNpmEntry); + return isDeepStrictEqual(parsed.network_policies[OPENCLAW_NPM_BASELINE_KEY], compatibilityEntry) + ? "match" + : "drift"; + } catch { + return null; + } +} + +function policyHasNetworkPolicy(policyContent: string, policyKey: string): boolean { + return isPolicyObject(parseNetworkPolicies(policyContent)?.[policyKey]); +} + +function logOpenClawNpmCompatibilityDisclosure(logger: (line: string) => void = console.log): void { + logger(" OpenClaw npm compatibility scope while this preset is active:"); + logger( + " registry.npmjs.org:443 for /usr/local/bin/openclaw changes from inspected GET-only REST to full L4 pass-through (HTTP methods and paths are not inspected).", + ); + logger(" Removing the npm preset restores the exact reviewed GET-only baseline route."); +} + function mergePresetNamesIntoPolicy( currentPolicy: string, presetNames: string[], @@ -697,7 +938,24 @@ function mergePresetNamesIntoPolicy( appliedPresets.push(presetName); } - return { policy: merged, appliedPresets, missingPresets }; + let policy = merged; + if ( + (options.agent === undefined || options.agent === null || options.agent === "openclaw") && + appliedPresets.includes("npm") + ) { + const reviewedBaseline = resolveAgentBaselinePolicy("openclaw"); + if (!reviewedBaseline) { + throw new Error( + "Cannot reconcile OpenClaw npm policy compatibility: reviewed baseline missing.", + ); + } + policy = activateOpenClawNpmCompatibility( + merged, + reviewedBaseline.content, + policyHasNetworkPolicy(currentPolicy, OPENCLAW_NPM_PRESET_KEY), + ).policy; + } + return { policy, appliedPresets, missingPresets }; } /** @@ -841,7 +1099,21 @@ function removePreset( return false; } - const updated = removePresetFromPolicy(currentPolicy, presetEntries); + let updated = removePresetFromPolicy(currentPolicy, presetEntries); + if (!isCustom && presetName === "npm") { + try { + const baseline = resolveSandboxOpenClawNpmBaseline(sandboxName); + if (baseline) { + const exclusionError = openClawNpmExclusionStateError(sandboxName, currentPolicy); + if (exclusionError) throw new Error(exclusionError); + updated = restoreOpenClawNpmCompatibility(currentPolicy, updated, baseline); + } + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + console.error(` Refusing to remove npm policy compatibility: ${message}`); + return false; + } + } if (updated === currentPolicy) { console.error(` Preset '${presetName}' could not be removed from the current policy.`); @@ -1637,6 +1909,12 @@ function applyPresetContent( if (options.custom) { const np = parseNetworkPolicies(presetContent); + if (np && Object.prototype.hasOwnProperty.call(np, OPENCLAW_NPM_PRESET_KEY)) { + console.error( + ` Custom presets cannot own reserved network policy key '${OPENCLAW_NPM_PRESET_KEY}'.`, + ); + return false; + } const hasGeneratedPins = np !== null && networkPoliciesHasAllowedIps(np); const trustedPrivatePinsValid = isTrustedPrivatePolicyPinCapability( presetContent, @@ -1724,14 +2002,40 @@ function applyPresetContent( return false; } } - const merged = mergePresetIntoPolicy(currentPolicy, presetEntries); + let merged = mergePresetIntoPolicy(currentPolicy, presetEntries); + let npmBaselineWidened = false; + if (!options.custom && presetName === "npm") { + try { + const baseline = resolveSandboxOpenClawNpmBaseline(sandboxName); + if (baseline) { + const exclusionError = openClawNpmExclusionStateError(sandboxName, currentPolicy); + if (exclusionError) throw new Error(exclusionError); + const activation = activateOpenClawNpmCompatibility( + merged, + baseline, + policyHasNetworkPolicy(currentPolicy, OPENCLAW_NPM_PRESET_KEY), + ); + merged = activation.policy; + npmBaselineWidened = activation.widenedBaseline; + } + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + console.error(` Refusing to apply npm policy compatibility: ${message}`); + return false; + } + } const presetState = classifyPresetEntries(currentPolicy, presetEntries); + const disclosedPresetState = + npmBaselineWidened && presetState === "match" ? "drift" : presetState; const disclosedStateStillCurrent = Object.prototype.hasOwnProperty.call(options, "disclosedPresetState") && - options.disclosedPresetState === presetState; + options.disclosedPresetState === disclosedPresetState; if (!options.suppressDisclosure && !disclosedStateStillCurrent) { - logPresetScopeForState(presetName, presetContent, presetState); + logPresetScopeForState(presetName, presetContent, disclosedPresetState); + } + if (npmBaselineWidened && !options.suppressDisclosure) { + logOpenClawNpmCompatibilityDisclosure(); } // Ownership-aware callers use a successful `policy set --wait` as part of @@ -1903,8 +2207,37 @@ function applyPresets(sandboxName: string, presetNames: string[]): boolean { merged = mergePresetIntoPolicy(merged, presetEntries); } + let npmBaselineWidened = false; + if (uniquePresetNames.includes("npm")) { + try { + const baseline = resolveSandboxOpenClawNpmBaseline(sandboxName); + if (baseline) { + const exclusionError = openClawNpmExclusionStateError(sandboxName, originalPolicy); + if (exclusionError) throw new Error(exclusionError); + const activation = activateOpenClawNpmCompatibility( + merged, + baseline, + policyHasNetworkPolicy(originalPolicy, OPENCLAW_NPM_PRESET_KEY), + ); + merged = activation.policy; + npmBaselineWidened = activation.widenedBaseline; + } + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + console.error(` Refusing to apply npm policy compatibility: ${message}`); + return false; + } + } + for (const preset of presetContents) { - logPresetScopeForState(preset.name, preset.content, preset.state); + const disclosedPresetState = + preset.name === "npm" && npmBaselineWidened && preset.state === "match" + ? "drift" + : preset.state; + logPresetScopeForState(preset.name, preset.content, disclosedPresetState); + if (preset.name === "npm" && npmBaselineWidened) { + logOpenClawNpmCompatibilityDisclosure(); + } } const policyChanged = !policyDocumentsMatch(originalPolicy, merged); @@ -2342,6 +2675,7 @@ export { getBaselineExclusionRuntimeStatus, getGatewayPresets, getLiveSandboxPolicyEntryDigest, + getOpenClawNpmCompatibilityState, getPresetContentGatewayState, getPresetEndpoints, getPresetValidationWarning, @@ -2354,6 +2688,7 @@ export { loadPreset, loadPresetForSandbox, loadPresetFromFile, + logOpenClawNpmCompatibilityDisclosure, logPresetNoNewEgress, logPresetScope, logPresetScopeForState, diff --git a/test/effective-policy-contracts.test.ts b/test/effective-policy-contracts.test.ts index 664170fd48a..019b8f30bac 100644 --- a/test/effective-policy-contracts.test.ts +++ b/test/effective-policy-contracts.test.ts @@ -232,10 +232,11 @@ describe("effective built-in policy contracts", () => { }); it("keeps mutable web APIs on their reviewed hosts, methods, and paths", () => { - const effective = composePresets(["tavily", "outlook", "openclaw-pricing"]); + const effective = composePresets(["tavily", "outlook", "openclaw-pricing", "teams"]); const tavily = requireNetworkPolicy(effective, "tavily"); const outlook = requireNetworkPolicy(effective, "outlook_graph"); const pricing = requireNetworkPolicy(effective, "openclaw-pricing"); + const teams = requireNetworkPolicy(effective, "teams"); expect(tavily.endpoints).toEqual([ { @@ -276,6 +277,12 @@ describe("effective built-in policy contracts", () => { "outlook.office365.com", ]); expect(methods(graph)).toEqual(["GET", "PATCH", "POST"]); + for (const host of ["graph.microsoft.com", "login.microsoftonline.com"]) { + expect(requireEndpoint(outlook, host).request_body_credential_rewrite).toBe(true); + expect(requireEndpoint(outlook, host).request_body_credential_rewrite).toBe( + requireEndpoint(teams, host).request_body_credential_rewrite, + ); + } for (const host of [ "login.microsoftonline.com", "outlook.office365.com", @@ -504,6 +511,17 @@ describe("effective built-in policy contracts", () => { "/usr/local/bin/brew", ].sort(), ); + for (const host of ["github.com", "raw.githubusercontent.com"]) { + const endpoint = requireEndpoint(brew, host); + expect(endpoint).toMatchObject({ port: 443, access: "full" }); + expect(endpoint).not.toHaveProperty("protocol"); + expect(endpoint).not.toHaveProperty("tls"); + } + for (const endpoint of (brew.endpoints ?? []).filter( + (candidate) => !["github.com", "raw.githubusercontent.com"].includes(candidate.host ?? ""), + )) { + expect(endpoint).toMatchObject({ access: "full", tls: "skip" }); + } expect((claude.endpoints ?? []).map((endpoint) => endpoint.host).sort()).toEqual([ "api.anthropic.com", "platform.claude.com", diff --git a/test/exit-code-user-error-surfaces.test.ts b/test/exit-code-user-error-surfaces.test.ts index 07a180ba8dc..b4d43c29d76 100644 --- a/test/exit-code-user-error-surfaces.test.ts +++ b/test/exit-code-user-error-surfaces.test.ts @@ -265,13 +265,16 @@ describe("onboard dashboard-port exhaustion exits non-zero (#5974)", () => { "#!/usr/bin/env bash", "# openshell capabilities: request-body-credential-rewrite websocket-credential-rewrite allow_all_known_mcp_methods", 'case "${1:-}" in', - ' -V|--version) printf "%s 0.0.85\\n" "${0##*/}"; exit 0;;', + ' -V|--version) printf "%s 0.0.99\\n" "${0##*/}"; exit 0;;', "esac", "exit 1", ].join("\n"), { mode: 0o755 }, ); } + fs.writeFileSync(path.join(binDir, "brew"), "#!/usr/bin/env bash\nexit 1\n", { + mode: 0o755, + }); fs.writeFileSync( path.join(binDir, "docker"), [ diff --git a/test/onboard-gateway-port-conflict-fast-fail.test.ts b/test/onboard-gateway-port-conflict-fast-fail.test.ts index 525e3fcb474..ac64c5946b3 100644 --- a/test/onboard-gateway-port-conflict-fast-fail.test.ts +++ b/test/onboard-gateway-port-conflict-fast-fail.test.ts @@ -31,7 +31,7 @@ describe("onboard gateway port conflict fast-fail (#6752)", () => { "# openshell capabilities: request-body-credential-rewrite websocket-credential-rewrite allow_all_known_mcp_methods", `printf '%s\\n' "$*" >> ${JSON.stringify(openshellCallLog)}`, 'case "$*" in', - ' --version|-V) printf "%s 0.0.85\\n" "${0##*/}"; exit 0;;', + ' --version|-V) printf "%s 0.0.99\\n" "${0##*/}"; exit 0;;', ' status|"gateway info"|"gateway info -g nemoclaw"*) sleep 20; exit 0;;', "esac", "exit 1", @@ -40,6 +40,10 @@ describe("onboard gateway port conflict fast-fail (#6752)", () => { ); } + fs.writeFileSync(path.join(binDir, "brew"), "#!/usr/bin/env bash\nexit 1\n", { + mode: 0o755, + }); + fs.writeFileSync( path.join(binDir, "docker"), [ @@ -93,6 +97,7 @@ describe("onboard gateway port conflict fast-fail (#6752)", () => { NEMOCLAW_OPENSHELL_CHANNEL: "stable", NEMOCLAW_OPENSHELL_GATEWAY_BIN: path.join(binDir, "openshell-gateway"), NEMOCLAW_OPENSHELL_SANDBOX_BIN: path.join(binDir, "openshell-sandbox"), + NEMOCLAW_SKIP_HOST_DNS_PREFLIGHT: "1", NEMOCLAW_TEST_NO_SLEEP: "1", }, }, diff --git a/test/policy-openclaw-npm-compatibility.test.ts b/test/policy-openclaw-npm-compatibility.test.ts new file mode 100644 index 00000000000..071ac597d4e --- /dev/null +++ b/test/policy-openclaw-npm-compatibility.test.ts @@ -0,0 +1,457 @@ +// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { spawnSync } from "node:child_process"; +import fs from "node:fs"; +import { createRequire } from "node:module"; +import os from "node:os"; +import path from "node:path"; +import { describe, expect, it, vi } from "vitest"; + +const requireForTest = createRequire(import.meta.url); +const YAML = requireForTest("yaml"); +const REPO_ROOT = path.join(import.meta.dirname, ".."); +const POLICIES_PATH = JSON.stringify(path.join(REPO_ROOT, "src", "lib", "policy", "index.ts")); +const REGISTRY_PATH = JSON.stringify(path.join(REPO_ROOT, "src", "lib", "state", "registry.ts")); +const SOURCE_NODE_ARGS = ["--import", "tsx"]; + +const REVIEWED_BASELINE_ENTRY = { + name: "npm_registry", + endpoints: [ + { + host: "registry.npmjs.org", + port: 443, + protocol: "rest", + enforcement: "enforce", + rules: [{ allow: { method: "GET", path: "/**" } }], + }, + ], + binaries: [{ path: "/usr/local/bin/openclaw" }], +}; + +const REVIEWED_NPM_ENTRY = { + name: "npm_yarn", + endpoints: [ + { host: "registry.npmjs.org", port: 443, access: "full", tls: "skip" }, + { host: "registry.yarnpkg.com", port: 443, access: "full", tls: "skip" }, + ], + binaries: [ + { path: "/usr/local/bin/npm*" }, + { path: "/usr/local/bin/npx*" }, + { path: "/usr/local/bin/node*" }, + { path: "/usr/local/bin/yarn*" }, + { path: "/usr/bin/npm*" }, + { path: "/usr/bin/node*" }, + ], +}; + +const UNRELATED_POLICY_ENTRY = { + name: "unrelated_fixture", + endpoints: [{ host: "fixture.example.com", port: 443, access: "full" }], + binaries: [{ path: "/usr/bin/fixture" }], +}; + +const REVIEWED_NPM_PRESET = YAML.stringify({ + preset: { name: "npm", description: "independent npm compatibility fixture" }, + network_policies: { npm_yarn: REVIEWED_NPM_ENTRY }, +}); + +function policyWith(networkPolicies: Record): string { + return YAML.stringify({ version: 1, network_policies: networkPolicies }); +} + +function reviewedBaselinePolicy(): string { + return policyWith({ npm_registry: structuredClone(REVIEWED_BASELINE_ENTRY) }); +} + +function excludedBaselinePolicy(): string { + return policyWith({ unrelated_fixture: structuredClone(UNRELATED_POLICY_ENTRY) }); +} + +function compatibilityEntry(npmEntry = REVIEWED_NPM_ENTRY) { + const registryEndpoint = npmEntry.endpoints.find( + (endpoint) => endpoint.host === "registry.npmjs.org" && endpoint.port === 443, + ); + expect(registryEndpoint).toBeDefined(); + return { + ...structuredClone(REVIEWED_BASELINE_ENTRY), + endpoints: [structuredClone(registryEndpoint!)], + }; +} + +function activePolicy(npmEntry = REVIEWED_NPM_ENTRY): string { + return policyWith({ + npm_registry: compatibilityEntry(npmEntry), + npm_yarn: structuredClone(npmEntry), + }); +} + +function unoverlaidActivePolicy(): string { + return policyWith({ + npm_registry: structuredClone(REVIEWED_BASELINE_ENTRY), + npm_yarn: structuredClone(REVIEWED_NPM_ENTRY), + }); +} + +function olderNpmEntry() { + const entry = structuredClone(REVIEWED_NPM_ENTRY); + const registryEndpoint = entry.endpoints.find( + (endpoint) => endpoint.host === "registry.npmjs.org", + ); + expect(registryEndpoint).toBeDefined(); + registryEndpoint!.tls = "auto"; + return entry; +} + +function parseResultPayload(stdout: string): any { + const marker = "__RESULT__"; + const markerIndex = stdout.indexOf(marker); + expect(markerIndex).toBeGreaterThanOrEqual(0); + return JSON.parse(stdout.slice(markerIndex + marker.length)); +} + +type LiveScenario = { + initialPolicy: string; + childScript: string; + setMode?: "success" | "fail" | "fail-once"; +}; + +function runLiveScenario({ initialPolicy, childScript, setMode = "success" }: LiveScenario): { + calls: string[]; + payload: any; + stderr: string; + stdout: string; +} { + const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "nemoclaw-npm-compat-")); + const fakeOpenshell = path.join(tmpDir, "openshell"); + const callsPath = path.join(tmpDir, "calls.log"); + const currentPolicyPath = path.join(tmpDir, "current-policy.yaml"); + const firstSetMarker = path.join(tmpDir, "first-set-attempted"); + fs.writeFileSync(currentPolicyPath, initialPolicy); + + fs.writeFileSync( + fakeOpenshell, + `#!/usr/bin/env bash +set -euo pipefail +printf '%s\n' "$*" >> ${JSON.stringify(callsPath)} +if [ "$1 $2" = "policy get" ]; then + printf 'Version: 1\nHash: test\n---\n' + cat ${JSON.stringify(currentPolicyPath)} + exit 0 +fi +if [ "$1 $2" = "policy set" ]; then + npm_test_set_mode=${JSON.stringify(setMode)} + if [ "$npm_test_set_mode" = "fail" ]; then + exit 88 + fi + if [ "$npm_test_set_mode" = "fail-once" ] && [ ! -f ${JSON.stringify(firstSetMarker)} ]; then + touch ${JSON.stringify(firstSetMarker)} + exit 88 + fi + while [ "$#" -gt 0 ]; do + if [ "$1" = "--policy" ]; then + cp "$2" ${JSON.stringify(currentPolicyPath)} + break + fi + shift + done + printf 'Policy version 2 submitted\nPolicy version 2 loaded\n' + exit 0 +fi +exit 1 +`, + { mode: 0o755 }, + ); + + const script = String.raw` +const fs = require("node:fs"); +const YAML = require("yaml"); +const registry = require(${REGISTRY_PATH}); +const policies = require(${POLICIES_PATH}); +${childScript} +`; + + try { + const result = spawnSync(process.execPath, [...SOURCE_NODE_ARGS, "-e", script], { + cwd: REPO_ROOT, + encoding: "utf-8", + env: { + ...process.env, + HOME: tmpDir, + NEMOCLAW_OPENSHELL_BIN: fakeOpenshell, + CURRENT_POLICY: currentPolicyPath, + }, + }); + expect(result.status, result.stderr).toBe(0); + const calls = fs.existsSync(callsPath) + ? fs.readFileSync(callsPath, "utf-8").trim().split("\n").filter(Boolean) + : []; + return { + calls, + payload: parseResultPayload(result.stdout), + stderr: result.stderr, + stdout: result.stdout, + }; + } finally { + fs.rmSync(tmpDir, { recursive: true, force: true }); + } +} + +function exclusionRegistration(sandboxName: string, digestCharacter: string): string { + return ` +registry.addBaselineExclusion(${JSON.stringify(sandboxName)}, { + version: 1, + agent: "openclaw", + key: "npm_registry", + digest: ${JSON.stringify(digestCharacter.repeat(64))}, +});`; +} + +describe("OpenClaw npm compatibility policy lifecycle", () => { + it("repairs an active npm preset and restores the reviewed baseline on removal (#8497)", () => { + const { calls, payload, stdout } = runLiveScenario({ + initialPolicy: unoverlaidActivePolicy(), + childScript: ` +registry.registerSandbox({ name: "npm-lifecycle", agent: "openclaw", policies: ["npm"] }); +const beforeApplyState = policies.getOpenClawNpmCompatibilityState("npm-lifecycle"); +const applied = policies.applyPresets("npm-lifecycle", ["npm"]); +const afterApply = YAML.parse(fs.readFileSync(process.env.CURRENT_POLICY, "utf-8")); +const afterApplyState = policies.getOpenClawNpmCompatibilityState("npm-lifecycle"); +const removed = policies.removePreset("npm-lifecycle", "npm"); +const afterRemove = YAML.parse(fs.readFileSync(process.env.CURRENT_POLICY, "utf-8")); +process.stdout.write("\\n__RESULT__" + JSON.stringify({ + beforeApplyState, + applied, + afterApplyState, + afterApply, + removed, + afterRemove, + registry: registry.getSandbox("npm-lifecycle"), +}));`, + }); + + expect(payload.beforeApplyState).toBe("repair"); + expect(payload.applied).toBe(true); + expect(payload.afterApplyState).toBe("match"); + expect(payload.afterApply.network_policies.npm_registry).toEqual(compatibilityEntry()); + expect(payload.afterApply.network_policies.npm_yarn).toEqual(REVIEWED_NPM_ENTRY); + expect(payload.removed).toBe(true); + expect(payload.afterRemove.network_policies.npm_yarn).toBeUndefined(); + expect(payload.afterRemove.network_policies.npm_registry).toEqual(REVIEWED_BASELINE_ENTRY); + expect(payload.registry.policies).toEqual([]); + expect(stdout).toContain("Effective egress scope that would replace the current preset policy"); + expect(stdout).toContain("OpenClaw npm compatibility"); + expect(stdout).not.toContain("already effective; no new egress would be opened"); + expect(calls.filter((call) => call.startsWith("policy get "))).toHaveLength(4); + expect(calls.filter((call) => call.startsWith("policy set "))).toHaveLength(2); + }); + + it("removes an older compatible overlay only after a successful policy set (#8497)", () => { + const oldNpmEntry = olderNpmEntry(); + const oldActivePolicy = YAML.parse(activePolicy(oldNpmEntry)); + const { calls, payload, stderr } = runLiveScenario({ + initialPolicy: YAML.stringify(oldActivePolicy), + setMode: "fail-once", + childScript: ` +registry.registerSandbox({ name: "npm-old-overlay", agent: "openclaw", policies: ["npm"] }); +const failedRemoval = policies.removePreset("npm-old-overlay", "npm", { nonFatal: true }); +const afterFailedPolicy = YAML.parse(fs.readFileSync(process.env.CURRENT_POLICY, "utf-8")); +const afterFailedRegistry = structuredClone(registry.getSandbox("npm-old-overlay")); +const removed = policies.removePreset("npm-old-overlay", "npm", { nonFatal: true }); +const afterRemove = YAML.parse(fs.readFileSync(process.env.CURRENT_POLICY, "utf-8")); +process.stdout.write("\\n__RESULT__" + JSON.stringify({ + failedRemoval, + afterFailedPolicy, + afterFailedRegistry, + removed, + afterRemove, + registry: registry.getSandbox("npm-old-overlay"), +}));`, + }); + + expect(payload.failedRemoval).toBe(false); + expect(payload.afterFailedPolicy).toEqual(oldActivePolicy); + expect(payload.afterFailedRegistry.policies).toEqual(["npm"]); + expect(payload.removed, stderr).toBe(true); + expect(payload.afterRemove.network_policies.npm_yarn).toBeUndefined(); + expect(payload.afterRemove.network_policies.npm_registry).toEqual(REVIEWED_BASELINE_ENTRY); + expect(payload.registry.policies).toEqual([]); + expect(calls.filter((call) => call.startsWith("policy get "))).toHaveLength(2); + expect(calls.filter((call) => call.startsWith("policy set "))).toHaveLength(2); + }); + + it("refuses removal when the live compatibility overlay has drifted (#8497)", () => { + const drifted = YAML.parse(activePolicy()); + drifted.network_policies.npm_registry.endpoints[0].tls = "auto"; + const { calls, payload, stderr } = runLiveScenario({ + initialPolicy: YAML.stringify(drifted), + childScript: ` +registry.registerSandbox({ name: "npm-drift", agent: "openclaw", policies: ["npm"] }); +const removed = policies.removePreset("npm-drift", "npm", { nonFatal: true }); +process.stdout.write("\\n__RESULT__" + JSON.stringify({ + removed, + policy: YAML.parse(fs.readFileSync(process.env.CURRENT_POLICY, "utf-8")), + registry: registry.getSandbox("npm-drift"), +}));`, + }); + + expect(payload.removed).toBe(false); + expect(payload.policy).toEqual(drifted); + expect(payload.registry.policies).toEqual(["npm"]); + expect(calls.some((call) => call.startsWith("policy set "))).toBe(false); + expect(stderr).toContain("differs from both the reviewed baseline"); + }); + + it("keeps an approved baseline exclusion absent through apply and removal (#8497)", () => { + const { calls, payload, stderr } = runLiveScenario({ + initialPolicy: excludedBaselinePolicy(), + childScript: ` +registry.registerSandbox({ name: "npm-excluded", agent: "openclaw", policies: [] }); +${exclusionRegistration("npm-excluded", "a")} +const applied = policies.applyPresets("npm-excluded", ["npm"]); +const afterApply = YAML.parse(fs.readFileSync(process.env.CURRENT_POLICY, "utf-8")); +const removed = policies.removePreset("npm-excluded", "npm"); +const afterRemove = YAML.parse(fs.readFileSync(process.env.CURRENT_POLICY, "utf-8")); +process.stdout.write("\\n__RESULT__" + JSON.stringify({ + applied, + afterApply, + removed, + afterRemove, + registry: registry.getSandbox("npm-excluded"), +}));`, + }); + + expect(payload.applied).toBe(true); + expect(payload.afterApply.network_policies.npm_yarn).toEqual(REVIEWED_NPM_ENTRY); + expect(payload.afterApply.network_policies.npm_registry).toBeUndefined(); + expect(payload.removed, stderr).toBe(true); + expect(payload.afterRemove.network_policies.npm_yarn).toBeUndefined(); + expect(payload.afterRemove.network_policies.npm_registry).toBeUndefined(); + expect(payload.registry.policies).toEqual([]); + expect(payload.registry.baselineExclusions).toHaveLength(1); + expect(calls.filter((call) => call.startsWith("policy set "))).toHaveLength(2); + }); + + it("refuses batch apply when an excluded baseline drifted back into the live policy (#8497)", () => { + const initialPolicy = reviewedBaselinePolicy(); + const { calls, payload, stderr } = runLiveScenario({ + initialPolicy, + childScript: ` +registry.registerSandbox({ name: "npm-excl-batch", agent: "openclaw", policies: [] }); +${exclusionRegistration("npm-excl-batch", "b")} +const applied = policies.applyPresets("npm-excl-batch", ["npm"]); +process.stdout.write("\\n__RESULT__" + JSON.stringify({ + applied, + policy: fs.readFileSync(process.env.CURRENT_POLICY, "utf-8"), + registry: registry.getSandbox("npm-excl-batch"), +}));`, + }); + + expect(payload.applied).toBe(false); + expect(YAML.parse(payload.policy)).toEqual(YAML.parse(initialPolicy)); + expect(payload.registry.policies).toEqual([]); + expect(calls.some((call) => call.startsWith("policy set "))).toBe(false); + expect(stderr).toContain("requires the live entry to remain absent"); + }); + + it("refuses direct apply when an excluded baseline drifted back into the live policy (#8497)", () => { + const initialPolicy = reviewedBaselinePolicy(); + const { calls, payload, stderr } = runLiveScenario({ + initialPolicy, + childScript: ` +registry.registerSandbox({ name: "npm-excl-direct", agent: "openclaw", policies: [] }); +${exclusionRegistration("npm-excl-direct", "c")} +const applied = policies.applyPreset("npm-excl-direct", "npm"); +process.stdout.write("\\n__RESULT__" + JSON.stringify({ + applied, + policy: fs.readFileSync(process.env.CURRENT_POLICY, "utf-8"), + registry: registry.getSandbox("npm-excl-direct"), +}));`, + }); + + expect(payload.applied).toBe(false); + expect(YAML.parse(payload.policy)).toEqual(YAML.parse(initialPolicy)); + expect(payload.registry.policies).toEqual([]); + expect(calls).toHaveLength(1); + expect(calls[0]).toContain("policy get"); + expect(stderr).toContain("requires the live entry to remain absent"); + }); + + it("rejects custom ownership of the reserved npm compatibility key (#8497)", () => { + const policies = requireForTest( + path.join(REPO_ROOT, "src", "lib", "policy", "index.ts"), + ) as typeof import("../src/lib/policy"); + const errors: string[] = []; + const errorSpy = vi.spyOn(console, "error").mockImplementation((...args: unknown[]) => { + errors.push(args.map(String).join(" ")); + }); + + try { + expect( + policies.applyPresetContent("custom-npm-key", "custom-registry", REVIEWED_NPM_PRESET, { + custom: { sourcePath: "/tmp/custom-registry.yaml" }, + }), + ).toBe(false); + expect(errors.join("\n")).toContain("reserved network policy key 'npm_yarn'"); + } finally { + errorSpy.mockRestore(); + } + }); + + it("does not inject an OpenClaw baseline into other agent policies (#8497)", () => { + const policies = requireForTest( + path.join(REPO_ROOT, "src", "lib", "policy", "index.ts"), + ) as typeof import("../src/lib/policy"); + + for (const agent of ["hermes", "langchain-deepagents-code"] as const) { + const result = policies.mergePresetNamesIntoPolicy(excludedBaselinePolicy(), ["npm"], { + agent, + }); + const effective = YAML.parse(result.policy); + expect(effective.network_policies.npm_yarn, agent).toBeDefined(); + expect(effective.network_policies.npm_registry, agent).toBeUndefined(); + } + }); + + it("keeps an approved baseline exclusion absent during create-time composition (#8497)", () => { + const policies = requireForTest( + path.join(REPO_ROOT, "src", "lib", "policy", "index.ts"), + ) as typeof import("../src/lib/policy"); + const result = policies.mergePresetNamesIntoPolicy(excludedBaselinePolicy(), ["npm"], { + agent: "openclaw", + excludedBaselineKeys: ["npm_registry"], + }); + const effective = YAML.parse(result.policy); + + expect(effective.network_policies.npm_yarn).toBeDefined(); + expect(effective.network_policies.npm_registry).toBeUndefined(); + }); + + it("refuses create-time composition from a drifted OpenClaw npm baseline (#8497)", () => { + const policies = requireForTest( + path.join(REPO_ROOT, "src", "lib", "policy", "index.ts"), + ) as typeof import("../src/lib/policy"); + const driftedBaseline = YAML.parse(reviewedBaselinePolicy()); + driftedBaseline.network_policies.npm_registry.binaries = [{ path: "/**" }]; + + expect(() => + policies.mergePresetNamesIntoPolicy(YAML.stringify(driftedBaseline), ["npm"], { + agent: "openclaw", + }), + ).toThrow(/differs from the reviewed baseline/i); + }); + + it("discloses the temporary OpenClaw baseline widening and exact restoration (#8497)", () => { + const policies = requireForTest( + path.join(REPO_ROOT, "src", "lib", "policy", "index.ts"), + ) as typeof import("../src/lib/policy"); + const lines: string[] = []; + policies.logOpenClawNpmCompatibilityDisclosure((line) => lines.push(line)); + + expect(lines.join("\n")).toContain("/usr/local/bin/openclaw"); + expect(lines.join("\n")).toContain("GET-only REST"); + expect(lines.join("\n")).toContain("full L4 pass-through"); + expect(lines.join("\n")).toContain("HTTP methods and paths are not inspected"); + expect(lines.join("\n")).toContain("restores the exact reviewed GET-only baseline"); + }); +}); diff --git a/test/rebuild-shields-auto-unlock.test.ts b/test/rebuild-shields-auto-unlock.test.ts index c86261c5ebd..30ebd101079 100644 --- a/test/rebuild-shields-auto-unlock.test.ts +++ b/test/rebuild-shields-auto-unlock.test.ts @@ -183,7 +183,7 @@ const fs = require("node:fs"); const a = process.argv.slice(2); const deleteMarkerPath = ${JSON.stringify(deleteMarkerPath)}; const requiredFeatures = "request-body-credential-rewrite websocket-credential-rewrite allow_all_known_mcp_methods"; -if (a[0]==="-V" || a[0]==="--version") { process.stdout.write("openshell 0.0.85\\n"); process.exit(0); } +if (a[0]==="-V" || a[0]==="--version") { process.stdout.write("openshell 0.0.99\\n"); process.exit(0); } if (a[0]==="sandbox" && a[1]==="list") { process.stdout.write("${sandboxName}\\n"); process.exit(0); } if (a[0]==="sandbox" && a[1]==="ssh-config") { process.stdout.write("${sshConfig}\\n"); process.exit(0); } if (a[0]==="sandbox" && a[1]==="delete") { fs.writeFileSync(deleteMarkerPath, "deleted\\n"); process.exit(0); } @@ -211,7 +211,7 @@ process.exit(0); path.join(tmpDir, component), `#!/usr/bin/env node const requiredFeatures = "request-body-credential-rewrite websocket-credential-rewrite allow_all_known_mcp_methods"; -if (process.argv[2] === "-V" || process.argv[2] === "--version") process.stdout.write("${component} 0.0.85\\n"); +if (process.argv[2] === "-V" || process.argv[2] === "--version") process.stdout.write("${component} 0.0.99\\n"); process.exit(0); `, { mode: 0o755 }, diff --git a/test/repro-2201.test.ts b/test/repro-2201.test.ts index 3bbafd10aaa..d374a81fe79 100644 --- a/test/repro-2201.test.ts +++ b/test/repro-2201.test.ts @@ -234,7 +234,7 @@ const fs = require("node:fs"); const a = process.argv.slice(2); const deleteMarker = ${JSON.stringify(deleteMarker)}; const requiredFeatures = "request-body-credential-rewrite websocket-credential-rewrite allow_all_known_mcp_methods"; -if (a[0]==="-V" || a[0]==="--version") { process.stdout.write("openshell 0.0.85\\n"); process.exit(0); } +if (a[0]==="-V" || a[0]==="--version") { process.stdout.write("openshell 0.0.99\\n"); process.exit(0); } if (a[0]==="status") { process.stdout.write("Server Status\\n Gateway: nemoclaw\\n Status: Connected\\n"); process.exit(0); } if (a[0]==="gateway" && a[1]==="info") { const i=a.indexOf("-g"); const name=i>=0?a[i+1]:"nemoclaw"; process.stdout.write("Gateway Info\\n\\nGateway: " + name + "\\n"); process.exit(0); } if (a[0]==="gateway" && a[1]==="select") { process.exit(0); } @@ -256,7 +256,7 @@ process.exit(0); path.join(tmpDir, component), `#!/usr/bin/env node const requiredFeatures = "request-body-credential-rewrite websocket-credential-rewrite allow_all_known_mcp_methods"; -if (process.argv[2] === "-V" || process.argv[2] === "--version") process.stdout.write("${component} 0.0.85\\n"); +if (process.argv[2] === "-V" || process.argv[2] === "--version") process.stdout.write("${component} 0.0.99\\n"); process.exit(0); `, { mode: 0o755 }, From 6daae3477f6fe23f662963a077c65bca58315230 Mon Sep 17 00:00:00 2001 From: Apurv Kumaria Date: Fri, 7 Aug 2026 04:09:15 -0700 Subject: [PATCH 13/18] docs(openshell): clarify npm compatibility safeguards Signed-off-by: Apurv Kumaria --- docs/security/best-practices.mdx | 10 ++-- .../openshell-0.0.99-migration-review.md | 49 ++++++++++--------- 2 files changed, 33 insertions(+), 26 deletions(-) diff --git a/docs/security/best-practices.mdx b/docs/security/best-practices.mdx index a0e46de6b0c..fa8b731d0d6 100644 --- a/docs/security/best-practices.mdx +++ b/docs/security/best-practices.mdx @@ -231,10 +231,14 @@ NemoClaw ships preset policy files in `nemoclaw-blueprint/policies/presets/` for Apply presets only when the agent's task requires the integration. Review the preset's YAML file before applying to understand the endpoints, methods, and binary restrictions it adds. -The OpenClaw baseline npm route remains GET-only until the `npm` preset is active. Adding that -preset temporarily gives the overlapping baseline route the same L4 transport while preserving its -`openclaw`-only binary scope; removing the preset restores the reviewed GET-only baseline entry. + +If the OpenClaw baseline includes `npm_registry`, that route remains GET-only until the `npm` preset is active. +Adding that preset temporarily gives the overlapping baseline route the same L4 transport while preserving its `openclaw`-only binary scope. +Removing the preset restores the exact reviewed GET-only baseline entry. +If you excluded `npm_registry`, adding or removing `npm` preserves that exclusion and does not recreate the baseline route. +When no exclusion exists, NemoClaw refuses the npm change if the live baseline differs from the reviewed GET-only entry or compatibility overlay. The preset separately grants that registry transport to its listed npm, Yarn, and Node executables. + The Personal tier selects `personal-open-internet` and every maintained preset supported by the active agent. diff --git a/docs/security/openshell-0.0.99-migration-review.md b/docs/security/openshell-0.0.99-migration-review.md index cc808a80bcf..fc8966f80b2 100644 --- a/docs/security/openshell-0.0.99-migration-review.md +++ b/docs/security/openshell-0.0.99-migration-review.md @@ -1,9 +1,9 @@ -# OpenShell 0.0.85 to 0.0.99 migration review +# OpenShell 0.0.85 to 0.0.99 Migration Review -## Status and decision +## Status and Decision This review covers the complete public source boundary from the previously supported OpenShell `v0.0.85` commit `3dee5570a46076a57a3b056f35f35ebc0861ac85` through the published @@ -16,7 +16,7 @@ exact pinned artifacts passing NemoClaw's managed activation and live E2E lanes. the previously observed `0.0.85` activation mismatch is part of this upgrade's completion, not a waived unrelated failure. -## Audit method and exact boundary +## Audit Method and Exact Boundary The repository-owned release-ledger collector enumerated every adjacent tag, commit, and changed path from a full clone of the canonical `NVIDIA/OpenShell` repository. All 14 adjacent source ranges @@ -57,7 +57,7 @@ The complete audited commit set, grouped by adjacent range, is: - `97->98`: 704880e5 0a3ec7a1 83284129 - `98->99`: b9818619 0e9a44cf 4d55265f d063751c 53780556 490f66f4 8c7dd148 -## Consumed release artifacts +## Consumed Release Artifacts NemoClaw consumes only the published `v0.0.99` release and pins both archive and extracted-binary identities. Archive SHA-256 values are: @@ -82,7 +82,7 @@ its amd64 and arm64 child digests are respectively `sha256:4adea8392a81ef34b3cc3284e693ac3cc6c13362fad84a492d95b53b3eb403b9` and `sha256:b548fd939331d830cd9197f20fca9a5d95383c5e67f64929d632a37403115f38`. -## Credential and policy boundary +## Credential and Policy Boundary The reviewed credential sources are `google_cloud.rs`, `provider_credentials.rs`, and `secrets.rs`. The only credential-relevant behavioral delta is safer expiry handling: expired @@ -97,7 +97,7 @@ listener negotiation, proxy consolidation, Landlock changes, and system CA mode security boundary. NemoClaw retains its stricter explicit policy and runtime validation rather than enabling optional upstream behavior implicitly. -## Downstream concern ledger +## Downstream Concern Ledger | ID | Concern | Disposition | | --- | --- | --- | @@ -117,42 +117,45 @@ than enabling optional upstream behavior implicitly. | `OS99-14` | Routable sandbox names are capped at 19 characters | NemoClaw's canonical validation uses the same 19-character limit, and generated activation names fit it. Exact all-agent activation remains a final acceptance gate. | | `OS99-15` | The Docker driver records the immutable image content ID in `Config.Image` | Managed bootstrap accepts either the reviewed `repository@manifestDigest` or its exact runtime content ID, while separately requiring Docker to prove that the manifest resolves to that content ID. | | `OS99-16` | The Docker driver appends `--workdir /sandbox` to the supervisor command | Managed bootstrap requires that exact v0.0.99 supervisor argv before replacing the held workload. | -| `OS99-17` | Overlapping endpoint selectors with conflicting connection or request metadata are rejected before policy activation | The OpenClaw baseline npm route remains GET-only in Restricted and temporarily adopts the reviewed npm preset's L4 metadata while that preset is active. Homebrew's overlapping GitHub routes use automatic TLS, and Outlook matches Teams' request-body credential-rewrite setting on shared Microsoft endpoints. Focused composition coverage protects each compatibility decision. | +| `OS99-17` | Overlapping endpoint selectors with conflicting connection or request metadata are rejected before policy activation | The OpenClaw baseline npm route remains GET-only in Restricted and temporarily adopts the reviewed npm preset's L4 metadata while that preset is active. An approved baseline exclusion remains absent, and unexpected live drift stops the npm change. Homebrew's overlapping GitHub routes use automatic TLS, and Outlook matches Microsoft Teams' request-body credential-rewrite setting on shared Microsoft endpoints. Focused composition coverage protects each compatibility decision. | An unresolved critical or high concern blocks the upgrade. Test selection cannot waive a concern; conditional skips and expected failures do not count as qualification evidence. -## The 0.0.85 activation failure +## The 0.0.85 Activation Failure The failing activation compared Docker inspect output produced through different clients. The OpenShell API-created held workload serialized `AttachStdout=false`, `AttachStderr=false`, and `PortBindings=null`; the Docker CLI-created equivalent serialized `true`, `true`, and `{}`. Those values are creation-client markers or equivalent empty defaults, not durable workload identity. NemoClaw now normalizes them before hashing. It still refuses any non-empty port binding because -the managed clone cannot reproduce that behavior exactly. Unit coverage proves both equivalence -and the rejection path; exact `0.0.85 -> 0.0.99` live activation remains required. +the managed clone cannot reproduce that behavior exactly. Unit tests prove both equivalence and +the rejection path; exact `0.0.85 -> 0.0.99` live activation remains required. OpenShell 0.0.99 also validates the complete effective network policy before activation. Several previously accepted overlaps used incompatible metadata: the OpenClaw baseline and npm preset selected different TLS/L7 handling for `registry.npmjs.org`; Homebrew conflicted with agent routes -on `github.com` and `raw.githubusercontent.com`; and Teams and Outlook disagreed on credential-body -rewriting for shared Microsoft endpoints. NemoClaw preserves the GET-only npm baseline in -Restricted, temporarily applies the npm preset's reviewed L4 metadata to that baseline route while -the preset is active, and restores the exact baseline on removal. Homebrew's overlapping GitHub -routes remain plain L4 endpoints with automatic TLS, while Outlook now matches Teams' rewrite -setting. The npm baseline keeps its OpenClaw-only binary scope, but its GET-only method/path -inspection is intentionally unavailable until npm is removed; the other routes retain their -separate binary allowlists and authorization rules. - -## Final acceptance gates +on `github.com` and `raw.githubusercontent.com`; and Microsoft Teams and Outlook disagreed on +request-body credential rewriting for shared Microsoft endpoints. NemoClaw preserves the GET-only +npm baseline in Restricted. While the preset is active, NemoClaw temporarily applies the npm +preset's reviewed L4 metadata to that baseline route and restores the exact baseline on removal. +An approved `npm_registry` baseline exclusion remains absent through both operations. NemoClaw +refuses the change if the live baseline differs from its reviewed GET-only entry, compatibility +overlay, or approved excluded state. Homebrew's overlapping GitHub routes remain plain L4 endpoints +with automatic TLS, while Outlook now matches Microsoft Teams' rewrite setting. The npm baseline +keeps its OpenClaw-only binary scope, but its GET method and path inspection is intentionally +unavailable until npm is removed. The other routes retain their separate binary allowlists and +authorization rules. + +## Final Acceptance Gates - All active CLI, blueprint, installer, Brev, workflow, supervisor, and sandbox selectors agree on `0.0.99` and exact reviewed identities. - The `v0.0.99` credential-boundary manifest is the active manifest and its source commit is exact. -- Static checks, focused lifecycle tests, CLI/plugin builds, and documentation checks pass. +- Static checks, focused lifecycle tests, CLI and plugin builds, and documentation checks pass. - Default OpenClaw policy composition activates without endpoint-metadata ambiguity while retaining the reviewed binary scopes for npm, Homebrew, and pricing traffic. - Managed Docker and Podman activation, lifecycle, policy, credential, inference, and MCP E2E run against the exact pinned release without conditional skips or expected failures. -- A supported host with no prior NemoClaw state demonstrates the `0.0.85 -> 0.0.99` activation transition, including the - previously failing Docker-spec comparison. +- On a supported host that starts with no NemoClaw state, the activation lane creates the `0.0.85` + state and completes its `0.0.99` transition, including the previously failing Docker-spec comparison. From 16be705c37e8701475f0fa021e673a741fb3edae Mon Sep 17 00:00:00 2001 From: Senthil Ravichandran Date: Fri, 7 Aug 2026 06:35:34 -0700 Subject: [PATCH 14/18] docs(policy): document reserved npm policy key Signed-off-by: Senthil Ravichandran --- docs/network-policy/create-custom-policy-presets.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/network-policy/create-custom-policy-presets.mdx b/docs/network-policy/create-custom-policy-presets.mdx index 034d28cb583..ca63e31e222 100644 --- a/docs/network-policy/create-custom-policy-presets.mdx +++ b/docs/network-policy/create-custom-policy-presets.mdx @@ -50,6 +50,8 @@ Authorize only the process that needs the reviewed endpoint. The top-level `preset.name` must be a lowercase RFC 1123 label with letters, digits, and hyphens. It must not collide with a maintained preset name such as `slack` or `pypi`. Rename `preset.name` if NemoClaw reports a collision. +Custom preset `network_policies` entries must not use `npm_yarn`. +NemoClaw reserves that key for the maintained `npm` preset and rejects the file before applying it. Each endpoint must name a specific host or a scoped subdomain wildcard such as `*.example.com`. NemoClaw rejects catch-all destinations, including `*`, `0.0.0.0`, `0.0.0.0/0`, `::`, and `::/0`. From 41a7bd1f2f860b71f6cd02f38ce527cf5cf02ecb Mon Sep 17 00:00:00 2001 From: Apurv Kumaria Date: Fri, 7 Aug 2026 06:35:51 -0700 Subject: [PATCH 15/18] fix(openshell): enforce v0.0.99 sandbox names Signed-off-by: Apurv Kumaria --- .github/workflows/e2e.yaml | 59 +++--- .../workflows/pr-merge-conflict-fixer.yaml | 2 +- .github/workflows/pr-review-advisor.yaml | 4 +- .github/workflows/regression-e2e.yaml | 2 +- docs/manage-sandboxes/update-sandboxes.mdx | 21 ++ docs/reference/architecture.mdx | 2 +- docs/reference/commands.mdx | 17 +- docs/reference/troubleshooting.mdx | 4 +- .../openshell-0.0.99-migration-review.md | 2 +- .../llama-cpp.openclaw.spark-single.v1.yaml | 2 +- .../blueprint/runner-name-validation.test.ts | 2 +- nemoclaw/src/shared/sandbox-name.cts | 20 +- nemoclaw/src/shared/sandbox-name.test.ts | 6 +- schemas/blueprint.schema.json | 6 +- ...a-cpp-dgx-spark-qualification-contract.mts | 7 +- ...anaged-image-protected-runtime-contract.ts | 31 ++- .../checks/run-managed-image-openshell-e2e.ts | 5 +- scripts/install.sh | 88 ++++++++- scripts/nemoclaw-start.sh | 17 +- scripts/smoke-macos-install.sh | 8 +- src/lib/actions/sandbox/destroy.ts | 5 +- .../mcp-bridge-name-diagnostics.test.ts | 15 +- .../actions/sandbox/mcp-bridge-validation.ts | 7 +- .../upgrade-sandboxes-preflight.test.ts | 69 +++++++ .../upgrade-sandboxes-recovery.test.ts | 22 +-- src/lib/actions/upgrade-sandboxes.ts | 28 +++ src/lib/deploy/index.test.ts | 17 +- src/lib/deploy/index.ts | 36 +++- src/lib/name-validation.ts | 2 +- .../onboard/messaging-channel-setup.test.ts | 4 +- src/lib/policy/index.ts | 29 ++- src/lib/runner.ts | 7 +- src/lib/sandbox-name-contract.ts | 12 ++ test/blueprint-name-schema.test.ts | 7 +- test/e2e/fixtures/clients/sandbox.ts | 14 +- test/e2e/live/agent-turn-latency-helpers.ts | 4 +- ...drock-runtime-compatible-anthropic.test.ts | 3 +- test/e2e/live/channels-add-remove.test.ts | 2 +- .../channels-stop-start-googlechat-entry.ts | 2 +- test/e2e/live/channels-stop-start-helpers.ts | 6 +- test/e2e/live/channels-stop-start-safety.ts | 15 +- test/e2e/live/common-egress-agent.test.ts | 8 +- test/e2e/live/dashboard-remote-bind.test.ts | 2 +- test/e2e/live/gpu-double-onboard.test.ts | 2 +- test/e2e/live/hermes-gpu-startup.test.ts | 8 +- .../live/hermes-inference-switch-helpers.ts | 2 +- test/e2e/live/inference-routing-helpers.ts | 2 +- .../inference-routing-provider-smoke.test.ts | 4 +- test/e2e/live/inference-routing.test.ts | 10 +- ...sue-4434-tui-unreachable-inference.test.ts | 2 +- test/e2e/live/launchable-smoke.test.ts | 2 +- ...managed-image-protected-runtime-helpers.ts | 3 +- test/e2e/live/messaging-providers-helpers.ts | 2 +- test/e2e/live/network-policy.test.ts | 13 +- .../e2e/live/openclaw-discord-pairing.test.ts | 2 +- .../live/openclaw-inference-switch.test.ts | 7 +- .../openclaw-plugin-runtime-exdev.test.ts | 2 +- test/e2e/live/openclaw-skill-cli.test.ts | 2 +- test/e2e/live/openclaw-slack-pairing.test.ts | 2 +- .../openclaw-tui-chat-correlation.test.ts | 2 +- ...shell-credential-generation-window.test.ts | 4 +- .../live/openshell-gateway-upgrade.test.ts | 15 +- test/e2e/live/overlayfs-autofix.test.ts | 6 +- test/e2e/live/rebuild-hermes.test.ts | 8 +- test/e2e/live/rebuild-openclaw.test.ts | 8 +- test/e2e/live/registry-targets.test.ts | 6 +- test/e2e/live/sessions-agents-cli.test.ts | 2 +- test/e2e/live/spark-install-helpers.ts | 6 +- test/e2e/live/telegram-injection.test.ts | 2 +- test/e2e/live/token-rotation.test.ts | 2 +- test/e2e/live/tunnel-lifecycle-helpers.ts | 2 +- ...annels-stop-start-googlechat-entry.test.ts | 8 +- .../support/dashboard-remote-bind-env.test.ts | 10 +- test/e2e/support/e2e-clients.test.ts | 18 ++ ...e2e-report-to-pr-workflow-boundary.test.ts | 4 +- test/e2e/support/e2e-workflow.test.ts | 19 +- ...nclaw-plugin-runtime-exdev-fixture.test.ts | 6 +- .../sandbox-name-workflow-boundary.test.ts | 44 +++++ ...security-posture-workflow-boundary.test.ts | 2 +- .../spark-install-workflow-boundary.test.ts | 2 +- .../support/tunnel-lifecycle-helpers.test.ts | 26 +-- test/install-openshell-upgrade-prompt.test.ts | 185 +++++++++++++++++- ...tall-station-sandbox-name-contract.test.ts | 55 ++++++ ...p-dgx-spark-qualification-contract.test.ts | 3 +- ...a-cpp-openclaw-agent-qualification.test.ts | 7 +- ...d-image-protected-runtime-contract.test.ts | 74 ++++++- test/onboard-readiness.test.ts | 42 +++- test/onboard-sandbox-name.test.ts | 6 +- ...pr-e2e-gate-runner-loss-classifier.test.ts | 2 +- ...e-conflict-fixer-workflow-boundary.test.ts | 4 + ...dvisor-openshell-workflow-boundary.test.ts | 4 +- ...o-7795-connect-shell-sandbox-label.test.ts | 1 + test/smoke-macos-install.test.ts | 35 +++- tools/e2e/cli-artifact-workflow-boundary.mts | 2 +- .../hermes-gpu-startup-workflow-boundary.mts | 8 +- .../inference-switch-workflow-boundary.mts | 2 +- ...plugin-runtime-exdev-workflow-boundary.mts | 4 +- tools/e2e/sandbox-name-workflow-boundary.mts | 104 ++++++++++ .../security-posture-workflow-boundary.mts | 4 +- tools/e2e/workflow-boundary.mts | 48 +++-- tools/pr-review-advisor/workflow-boundary.mts | 21 +- 101 files changed, 1199 insertions(+), 300 deletions(-) create mode 100644 src/lib/sandbox-name-contract.ts create mode 100644 test/e2e/support/sandbox-name-workflow-boundary.test.ts create mode 100644 test/install-station-sandbox-name-contract.test.ts create mode 100644 tools/e2e/sandbox-name-workflow-boundary.mts diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index dc948a4967f..48a211ed0d6 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -1715,7 +1715,7 @@ jobs: NEMOCLAW_CLI_BIN: ${{ github.workspace }}/bin/nemoclaw.js NEMOCLAW_RUN_LIVE_E2E: "1" NEMOCLAW_E2E_USE_HOSTED_INFERENCE: "1" - NEMOCLAW_SANDBOX_NAME: "e2e-openclaw-skill-cli" + NEMOCLAW_SANDBOX_NAME: "e2e-oc-skill-cli" OPENSHELL_GATEWAY: "nemoclaw" steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -3003,7 +3003,7 @@ jobs: matrix: include: - mode: anthropic - sandbox_name: e2e-hermes-anthropic-inference-switch + sandbox_name: e2e-hm-inf-switch switch_provider: compatible-anthropic-endpoint switch_model: mock-anthropic-model switch_inference_api: anthropic-messages @@ -3355,7 +3355,7 @@ jobs: NEMOCLAW_RUN_LIVE_E2E: "1" NEMOCLAW_E2E_DASHBOARD_REMOTE_BIND: "1" NEMOCLAW_E2E_USE_HOSTED_INFERENCE: "1" - NEMOCLAW_SANDBOX_NAME: "e2e-dashboard-remote-bind" + NEMOCLAW_SANDBOX_NAME: "e2e-dashboard-bind" OPENSHELL_GATEWAY: "nemoclaw" steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -3404,7 +3404,7 @@ jobs: NEMOCLAW_CLI_BIN: ${{ github.workspace }}/bin/nemoclaw.js NEMOCLAW_RUN_LIVE_E2E: "1" NEMOCLAW_E2E_USE_HOSTED_INFERENCE: "1" - NEMOCLAW_SANDBOX_NAME: "e2e-sessions-agents-cli" + NEMOCLAW_SANDBOX_NAME: "e2e-sessions-cli" OPENSHELL_GATEWAY: "nemoclaw" steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -3611,8 +3611,11 @@ jobs: matrix: include: - scenario: native + sandbox_name: e2e-hgpu-native - scenario: fallback + sandbox_name: e2e-hgpu-fallback - scenario: compatibility-only + sandbox_name: e2e-hgpu-compat env: E2E_JOB: "1" E2E_TARGET_ID: "hermes-gpu-startup" @@ -3626,7 +3629,7 @@ jobs: NEMOCLAW_NON_INTERACTIVE: "1" NEMOCLAW_RECREATE_SANDBOX: "1" NEMOCLAW_SANDBOX_GPU: "1" - NEMOCLAW_SANDBOX_NAME: e2e-hermes-gpu-startup-${{ matrix.scenario }} + NEMOCLAW_SANDBOX_NAME: ${{ matrix.sandbox_name }} NEMOCLAW_ONBOARD_VALIDATION_TIMEOUT_SECONDS: "60" steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -3972,7 +3975,7 @@ jobs: include: - scenario: live-probes selector: "^network-policy:.+probes$" - sandbox: e2e-net-policy-live-probes + sandbox: e2e-net-policy env: E2E_JOB: "1" E2E_TARGET_ID: "network-policy" @@ -4516,7 +4519,7 @@ jobs: NEMOCLAW_MODEL: nvidia/nvidia/nemotron-3-ultra NEMOCLAW_COMPAT_MODEL: nvidia/nvidia/nemotron-3-ultra NEMOCLAW_PREFERRED_API: openai-completions - NEMOCLAW_SANDBOX_NAME: e2e-rebuild-hermes-base + NEMOCLAW_SANDBOX_NAME: e2e-rebuild-base OPENSHELL_GATEWAY: nemoclaw steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -5081,10 +5084,10 @@ jobs: matrix: include: - agent: openclaw - sandbox_name: e2e-openclaw-security-posture + sandbox_name: e2e-oc-security test_file: test/e2e/live/full-e2e.test.ts - agent: hermes - sandbox_name: e2e-hermes-security-posture + sandbox_name: e2e-hm-security test_file: test/e2e/live/hermes-e2e.test.ts env: E2E_JOB: "1" @@ -5309,7 +5312,7 @@ jobs: NEMOCLAW_NON_INTERACTIVE: "1" NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE: "1" NEMOCLAW_MODEL: "qwen3.5:9b" - NEMOCLAW_SANDBOX_NAME: "e2e-gpu-double-onboard" + NEMOCLAW_SANDBOX_NAME: "e2e-gpu-double" NEMOCLAW_PROVIDER: "ollama" NEMOCLAW_OLLAMA_PROXY_PORT: "11435" steps: @@ -5660,7 +5663,7 @@ jobs: NEMOCLAW_RUN_LIVE_E2E: "1" NEMOCLAW_NON_INTERACTIVE: "1" NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE: "1" - NEMOCLAW_GATEWAY_UPGRADE_SURVIVOR_NAME: "e2e-gateway-upgrade-survivor" + NEMOCLAW_GATEWAY_UPGRADE_SURVIVOR_NAME: "e2e-gw-survivor" NEMOCLAW_OLD_NEMOCLAW_REF: ${{ matrix.nemoclaw_ref }} NEMOCLAW_OLD_NEMOCLAW_COMMIT: ${{ matrix.nemoclaw_commit }} NEMOCLAW_OLD_INSTALLER_SHA256: ${{ matrix.installer_sha256 }} @@ -6066,7 +6069,7 @@ jobs: NEMOCLAW_RUN_LIVE_E2E: "1" NEMOCLAW_NON_INTERACTIVE: "1" NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE: "1" - NEMOCLAW_SANDBOX_NAME: "e2e-openclaw-plugin-exdev-release" + NEMOCLAW_SANDBOX_NAME: "e2e-oc-exdev-rel" OPENSHELL_GATEWAY: "nemoclaw" steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -6138,7 +6141,7 @@ jobs: NEMOCLAW_RUN_LIVE_E2E: "1" NEMOCLAW_NON_INTERACTIVE: "1" NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE: "1" - NEMOCLAW_SANDBOX_NAME: "e2e-openclaw-plugin-exdev" + NEMOCLAW_SANDBOX_NAME: "e2e-oc-exdev" OPENSHELL_GATEWAY: "nemoclaw" steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -6373,7 +6376,7 @@ jobs: matrix: include: - mode: anthropic - sandbox_name: e2e-openclaw-anthropic-inference-switch + sandbox_name: e2e-oc-inf-switch switch_provider: compatible-anthropic-endpoint switch_model: mock-anthropic-model switch_inference_api: anthropic-messages @@ -6442,7 +6445,11 @@ jobs: strategy: fail-fast: false matrix: - agent: [openclaw, hermes] + include: + - agent: openclaw + sandbox_name: e2e-oc-bedrock + - agent: hermes + sandbox_name: e2e-hm-bedrock env: E2E_JOB: "1" E2E_TARGET_ID: "bedrock-runtime-compatible-anthropic" @@ -6454,7 +6461,7 @@ jobs: NEMOCLAW_RECREATE_SANDBOX: "1" NEMOCLAW_AGENT: ${{ matrix.agent }} NEMOCLAW_E2E_SHARD: ${{ matrix.agent }} - NEMOCLAW_SANDBOX_NAME: e2e-bedrock-${{ matrix.agent }} + NEMOCLAW_SANDBOX_NAME: ${{ matrix.sandbox_name }} OPENSHELL_GATEWAY: "nemoclaw" steps: - id: trusted_hermes_swap @@ -6592,7 +6599,7 @@ jobs: NEMOCLAW_RUN_LIVE_E2E: "1" NEMOCLAW_NON_INTERACTIVE: "1" NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE: "1" - NEMOCLAW_SANDBOX_NAME: "e2e-channels-add-remove" + NEMOCLAW_SANDBOX_NAME: "e2e-ch-add-remove" OPENSHELL_GATEWAY: "nemoclaw" steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -6669,7 +6676,7 @@ jobs: NEMOCLAW_E2E_USE_HOSTED_INFERENCE: "1" NEMOCLAW_NON_INTERACTIVE: "1" NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE: "1" - NEMOCLAW_SANDBOX_NAME: "e2e-telegram-injection" + NEMOCLAW_SANDBOX_NAME: "e2e-tg-injection" OPENSHELL_GATEWAY: "nemoclaw" steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -6736,7 +6743,11 @@ jobs: strategy: fail-fast: false matrix: - agent: [openclaw, hermes] + include: + - agent: openclaw + sandbox_name: e2e-oc-ch-cycle + - agent: hermes + sandbox_name: e2e-hm-ch-cycle env: E2E_JOB: "1" E2E_TARGET_ID: "channels-stop-start" @@ -6749,7 +6760,7 @@ jobs: NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE: "1" NEMOCLAW_AGENT: ${{ matrix.agent }} NEMOCLAW_CHANNELS_STOP_START_AGENT: ${{ matrix.agent }} - NEMOCLAW_SANDBOX_NAME: e2e-channels-stop-start-${{ matrix.agent }} + NEMOCLAW_SANDBOX_NAME: ${{ matrix.sandbox_name }} OPENSHELL_GATEWAY: "nemoclaw" steps: - id: trusted_hermes_swap @@ -6862,7 +6873,7 @@ jobs: NEMOCLAW_E2E_USE_HOSTED_INFERENCE: "1" NEMOCLAW_NON_INTERACTIVE: "1" NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE: "1" - NEMOCLAW_SANDBOX_NAME: "e2e-openclaw-slack-pairing" + NEMOCLAW_SANDBOX_NAME: "e2e-oc-slack-pair" OPENSHELL_GATEWAY: "nemoclaw" steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -6999,7 +7010,7 @@ jobs: NEMOCLAW_E2E_USE_HOSTED_INFERENCE: "1" NEMOCLAW_NON_INTERACTIVE: "1" NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE: "1" - NEMOCLAW_SANDBOX_NAME: "e2e-openclaw-discord-pairing" + NEMOCLAW_SANDBOX_NAME: "e2e-oc-disc-pair" OPENSHELL_GATEWAY: "nemoclaw" steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -7071,7 +7082,7 @@ jobs: NEMOCLAW_E2E_USE_HOSTED_INFERENCE: "1" NEMOCLAW_NON_INTERACTIVE: "1" NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE: "1" - NEMOCLAW_SANDBOX_NAME: "e2e-tunnel-lifecycle" + NEMOCLAW_SANDBOX_NAME: "e2e-tunnel-life" OPENSHELL_GATEWAY: "nemoclaw" steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -7155,7 +7166,7 @@ jobs: NEMOCLAW_NON_INTERACTIVE: "1" NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE: "1" NEMOCLAW_FRESH: "1" - NEMOCLAW_SANDBOX_NAME: "e2e-spark-install-ci" + NEMOCLAW_SANDBOX_NAME: "e2e-spark-install" NEMOCLAW_PROVIDER: "cloud" OPENSHELL_GATEWAY: "nemoclaw" steps: diff --git a/.github/workflows/pr-merge-conflict-fixer.yaml b/.github/workflows/pr-merge-conflict-fixer.yaml index ac5f236bca9..7125b91255a 100644 --- a/.github/workflows/pr-merge-conflict-fixer.yaml +++ b/.github/workflows/pr-merge-conflict-fixer.yaml @@ -57,7 +57,7 @@ jobs: PI_IMAGE: ghcr.io/nvidia/openshell-community/sandboxes/pi@sha256:00d0c5e9e733f94f6db3eaa2ab70d4fd75bcc4aace6b13a54535cbf2dd20dfcd RESOLUTION_WORKDIR: ${{ github.workspace }}/repo RESOLVER_CONFIG_DIR: ${{ github.workspace }}/pi-config - SANDBOX_NAME: pr-conflict-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.item.pr_number }} + SANDBOX_NAME: pr-conflict TRUSTED_CHECKOUT: ${{ github.workspace }}/trusted steps: - name: Checkout trusted workflow code diff --git a/.github/workflows/pr-review-advisor.yaml b/.github/workflows/pr-review-advisor.yaml index 92ca3aa33c6..289259eeca1 100644 --- a/.github/workflows/pr-review-advisor.yaml +++ b/.github/workflows/pr-review-advisor.yaml @@ -69,12 +69,14 @@ jobs: - id: gpt-5.6-terra label: GPT-5.6 Terra model: azure/openai/gpt-5.6-terra + sandbox_name: pr-advisor-gpt artifact_dir: pr-review-advisor artifact_name: pr-review-advisor publish_comment: true - id: nemotron-ultra label: Nemotron 3 Ultra model: nvidia/nvidia/nemotron-3-ultra + sandbox_name: pr-advisor-nem artifact_dir: pr-review-advisor-nemotron-ultra artifact_name: pr-review-advisor-nemotron-ultra publish_comment: false @@ -106,7 +108,7 @@ jobs: PR_REVIEW_ADVISOR_COMMENT_LABEL: PR review advisor PR_REVIEW_ADVISOR_WORKFLOW_NAME: "PR Review / Advisor" PR_REVIEW_ADVISOR_LOAD_PREVIOUS_REVIEW: "false" - SANDBOX_NAME: pr-advisor-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.advisor.id }} + SANDBOX_NAME: ${{ matrix.advisor.sandbox_name }} # Only executable code from this checkout may run in the analysis job. ADVISOR_DIR: ${{ github.workspace }}/advisor TARGET_REPO: ${{ github.event_name == 'pull_request_target' && github.repository || inputs.target_repo || github.repository }} diff --git a/.github/workflows/regression-e2e.yaml b/.github/workflows/regression-e2e.yaml index b64670dfb66..b7ddcc68922 100644 --- a/.github/workflows/regression-e2e.yaml +++ b/.github/workflows/regression-e2e.yaml @@ -152,7 +152,7 @@ jobs: E2E_ARTIFACT_DIR: ${{ github.workspace }}/e2e-artifacts/live/openclaw-plugin-runtime-exdev-release E2E_TARGET_ID: openclaw-plugin-runtime-exdev-release NEMOCLAW_RUN_LIVE_E2E: "1" - NEMOCLAW_SANDBOX_NAME: e2e-openclaw-plugin-exdev-release + NEMOCLAW_SANDBOX_NAME: e2e-oc-exdev-rel run: | set -euo pipefail npx vitest run --project e2e-live \ diff --git a/docs/manage-sandboxes/update-sandboxes.mdx b/docs/manage-sandboxes/update-sandboxes.mdx index bfb6800b545..7346cba263d 100644 --- a/docs/manage-sandboxes/update-sandboxes.mdx +++ b/docs/manage-sandboxes/update-sandboxes.mdx @@ -38,6 +38,27 @@ The `langchain-deepagents-code` agent manifest declares the expected Deep Agents + +OpenShell 0.0.99 limits a routed sandbox name to 19 characters and rejects consecutive hyphens. +A NemoClaw sandbox name must contain 1 to 19 characters. +It must start with a lowercase letter, use lowercase letters, numbers, and single internal hyphens, and end with a letter or number. +Before the OpenShell upgrade, the installer checks registered sandboxes for the selected gateway. +If the installer finds incompatible names, it lists each name and exits before it can: + +- Prepare the NemoClaw CLI for the upgrade. +- Start a backup of the registered sandboxes. +- Retire the selected OpenShell gateway. +- Install OpenShell 0.0.99. +- Recreate a sandbox. + +NemoClaw does not automatically truncate or change the sandbox name. +Use the installed NemoClaw and OpenShell versions to create a replacement sandbox with a compatible name. +Then use [Transfer State Manually](../state-and-backups/transfer-state-manually) to move the required state into the replacement sandbox. +After you verify the transferred state, destroy the incompatible sandbox with the installed NemoClaw and OpenShell versions. +Then rerun the installer. +If you manually retired the gateway, restore the previously installed OpenShell version and its gateway before you transfer the sandbox state. + + ```bash curl -fsSL https://www.nvidia.com/nemoclaw.sh | bash $$nemoclaw upgrade-sandboxes --check diff --git a/docs/reference/architecture.mdx b/docs/reference/architecture.mdx index 55c5cba4d48..18111c1c495 100644 --- a/docs/reference/architecture.mdx +++ b/docs/reference/architecture.mdx @@ -238,7 +238,7 @@ The blueprint schema and runner enforce these name constraints before the runner | Field | Constraint | |---|---| -| `components.sandbox.name` | Use 1–63 lowercase letters, numbers, or internal hyphens, starting with a letter and ending with a letter or number. | +| `components.sandbox.name` | Use 1–19 lowercase letters, numbers, or single internal hyphens, starting with a letter and ending with a letter or number. Consecutive hyphens (`--`) are not allowed. | | `components.inference.profiles..provider_name` | Use 1–128 letters, numbers, dots, underscores, or hyphens, starting with a letter. | diff --git a/docs/reference/commands.mdx b/docs/reference/commands.mdx index dd41e76e97a..863be2b656c 100644 --- a/docs/reference/commands.mdx +++ b/docs/reference/commands.mdx @@ -678,7 +678,9 @@ API-key mode is inference-only and does not enable managed Nous tool gateways. The wizard prompts for a sandbox name. -Names must be 1 to 19 characters, lowercase, start with a letter, contain only letters, numbers, and internal hyphens, and end with a letter or number. +Names must contain 1 to 19 characters. +They must be lowercase, start with a letter, contain only letters, numbers, and single internal hyphens, and end with a letter or number. +Consecutive hyphens (`--`) are not allowed. The CLI rejects names that do not match these rules. It also prints a `Try: ` recovery line whenever it can derive a valid lowercase, hyphen-separated form from the input, so passing `--name MyAssistant` reports `Try: myassistant`. Names that match global CLI commands (`status`, `list`, `debug`, etc.) are rejected to avoid routing conflicts. @@ -861,7 +863,10 @@ If a `--resume` is attempted with a different `--from` path than the original se #### `--name ` Set the sandbox name without going through the interactive prompt. -The same name format and reserved-name rules that the wizard enforces apply here too. Names must be 1 to 19 characters, lowercase, start with a letter, contain only letters, numbers, and internal hyphens, and end with a letter or number. +The same name format and reserved-name rules that the wizard enforces apply here too. +Names must contain 1 to 19 characters. +They must be lowercase, start with a letter, contain only letters, numbers, and single internal hyphens, and end with a letter or number. +Consecutive hyphens (`--`) are not allowed. Names that match a NemoClaw CLI command (`status`, `list`, `debug`, etc.) are rejected up front. ```bash @@ -3224,6 +3229,14 @@ $$nemoclaw upgrade-sandboxes [--check] [--auto] [--yes|-y] | `--auto` | Rebuild every stale sandbox without prompting. Used by the installer to upgrade in place. | | `--yes`, `-y` | Skip the confirmation prompt for the rebuild plan. | +Before it inspects a gateway or starts a rebuild, the command validates every registered sandbox name against the NemoClaw sandbox name format. +Route-only reservations are not sandboxes and are excluded from this validation. +If the command finds incompatible names, it lists each name before any gateway inspection or rebuild. +With `--check`, the command then returns without changing state. +In a mutating mode, it exits with a nonzero status. +NemoClaw does not truncate or rename a registered sandbox identity. +Follow [Update Sandboxes](../manage-sandboxes/operate-sandboxes/update-sandboxes) to transfer state to a compatible replacement before you rerun the command. + Each rebuild reuses the same workspace backup-and-restore flow as `$$nemoclaw rebuild`, so workspace files survive the upgrade. If the registry is unreachable (offline or firewalled hosts), NemoClaw falls back to the unpinned `:latest` tag and reports that the digest could not be resolved instead of failing. During installer recovery, a registered sandbox that is not Ready can also be rebuilt from its validated latest backup. diff --git a/docs/reference/troubleshooting.mdx b/docs/reference/troubleshooting.mdx index cf719b458ac..c8be2fc4f7b 100644 --- a/docs/reference/troubleshooting.mdx +++ b/docs/reference/troubleshooting.mdx @@ -806,7 +806,9 @@ $$nemoclaw rebuild --yes ### Invalid sandbox name -Sandbox names must use 1 to 19 characters, be lowercase, start with a letter, contain only letters, numbers, and internal hyphens, and end with a letter or number. +Sandbox names must contain 1 to 19 characters. +They must be lowercase, start with a letter, contain only letters, numbers, and single internal hyphens, and end with a letter or number. +Consecutive hyphens (`--`) are not allowed. The CLI rejects names that do not match these rules. It prints a `Try: ` recovery line whenever it can derive a valid lowercase, hyphen-separated form from the input, so passing `--name MyAssistant` reports `Try: myassistant` and you can rerun with the suggested slug. diff --git a/docs/security/openshell-0.0.99-migration-review.md b/docs/security/openshell-0.0.99-migration-review.md index fc8966f80b2..36ef0529058 100644 --- a/docs/security/openshell-0.0.99-migration-review.md +++ b/docs/security/openshell-0.0.99-migration-review.md @@ -114,7 +114,7 @@ than enabling optional upstream behavior implicitly. | `OS99-11` | System CA root mode | Not enabled implicitly; current CA-policy tests remain required. | | `OS99-12` | Podman lifecycle changes | Podman exact-version live coverage remains an acceptance gate. | | `OS99-13` | Inference status heading changed from `Gateway inference:` to `Inference:` | The parser accepts both headings, with focused regression coverage for the exact v0.0.99 output. | -| `OS99-14` | Routable sandbox names are capped at 19 characters | NemoClaw's canonical validation uses the same 19-character limit, and generated activation names fit it. Exact all-agent activation remains a final acceptance gate. | +| `OS99-14` | Routable sandbox names are capped at 19 characters and cannot contain consecutive hyphens | NemoClaw's canonical validation enforces both constraints. Before any CLI preparation, backup, gateway retirement, OpenShell install, or sandbox recreation, the installer lists incompatible registered names for the selected gateway and stops. `upgrade-sandboxes --check` lists incompatible names and returns without gateway inspection or rebuild. `upgrade-sandboxes --auto` lists them and exits with a nonzero status before gateway inspection or rebuild. Generated activation names fit the constraint, and exact all-agent activation remains a final acceptance gate. | | `OS99-15` | The Docker driver records the immutable image content ID in `Config.Image` | Managed bootstrap accepts either the reviewed `repository@manifestDigest` or its exact runtime content ID, while separately requiring Docker to prove that the manifest resolves to that content ID. | | `OS99-16` | The Docker driver appends `--workdir /sandbox` to the supervisor command | Managed bootstrap requires that exact v0.0.99 supervisor argv before replacing the held workload. | | `OS99-17` | Overlapping endpoint selectors with conflicting connection or request metadata are rejected before policy activation | The OpenClaw baseline npm route remains GET-only in Restricted and temporarily adopts the reviewed npm preset's L4 metadata while that preset is active. An approved baseline exclusion remains absent, and unexpected live drift stops the npm change. Homebrew's overlapping GitHub routes use automatic TLS, and Outlook matches Microsoft Teams' request-body credential-rewrite setting on shared Microsoft endpoints. Focused composition coverage protects each compatibility decision. | diff --git a/managed-inference/qualifications/llama-cpp.openclaw.spark-single.v1.yaml b/managed-inference/qualifications/llama-cpp.openclaw.spark-single.v1.yaml index b4de02a7af0..2e1751e4e3f 100644 --- a/managed-inference/qualifications/llama-cpp.openclaw.spark-single.v1.yaml +++ b/managed-inference/qualifications/llama-cpp.openclaw.spark-single.v1.yaml @@ -15,7 +15,7 @@ spec: sourceRevision: eb1d2f5700393892f227ac9fd56f485fc6718bce runtimeProvider: docker sandbox: - name: nemoclaw-llama-cpp-openclaw + name: nmc-lcpp-oc gpuAccess: disabled route: provider: llama-cpp-local diff --git a/nemoclaw/src/blueprint/runner-name-validation.test.ts b/nemoclaw/src/blueprint/runner-name-validation.test.ts index 20b186070d3..82159fb78d4 100644 --- a/nemoclaw/src/blueprint/runner-name-validation.test.ts +++ b/nemoclaw/src/blueprint/runner-name-validation.test.ts @@ -149,7 +149,7 @@ describe("blueprint name validation (fail-closed integration)", () => { ); }); - it("rollback rejects a plan whose sandbox_name is not an RFC 1035 label", async () => { + it("rollback rejects a plan whose sandbox_name is not OpenShell-compatible", async () => { const runDir = `${RUNS_DIR}/nc-run-1`; addDir(runDir); // "--rm" would be consumed as a flag by `openshell sandbox stop/remove`. diff --git a/nemoclaw/src/shared/sandbox-name.cts b/nemoclaw/src/shared/sandbox-name.cts index 291d462458a..142fbefc658 100644 --- a/nemoclaw/src/shared/sandbox-name.cts +++ b/nemoclaw/src/shared/sandbox-name.cts @@ -2,9 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 // sourceOfTruth: These are the canonical blueprint sandbox and provider name -// grammars. Sandbox names are RFC 1035 labels; provider names mirror the -// existing NemoClaw provider contract. This module is compiled to generated -// .cjs/.d.cts files by build:cli before both the plugin and root CLI are built. +// grammars. Sandbox names use NemoClaw's OpenShell-compatible label subset; +// provider names mirror the existing NemoClaw provider contract. This module +// is compiled to generated .cjs/.d.cts files by build:cli before both the +// plugin and root CLI are built. // consumers: The ESM plugin runner (nemoclaw/src/blueprint/runner.ts) and // migration snapshot (nemoclaw/src/blueprint/snapshot.ts) import the generated // .cjs directly; the root CLI re-exports the sandbox constants through @@ -28,14 +29,15 @@ export const NAME_MAX_LENGTH = 19; export const PROVIDER_NAME_MAX_LENGTH = 128; -// RFC 1035 label: starts with a lowercase letter, then lowercase -// letters/digits/internal hyphens, ends with a letter or digit. -export const NAME_VALID_PATTERN = /^[a-z]([a-z0-9-]*[a-z0-9])?$/; +// NemoClaw label: starts with a lowercase letter, then lowercase +// letters/digits/single internal hyphens, and ends with a letter or digit. +// OpenShell v0.0.99 reserves `--` as a routed-name segment delimiter. +export const NAME_VALID_PATTERN = /^(?!.*--)[a-z]([a-z0-9-]*[a-z0-9])?$/; export const PROVIDER_NAME_VALID_PATTERN = /^[A-Za-z][A-Za-z0-9._-]{0,127}$/; export const NAME_ALLOWED_FORMAT = `1-${NAME_MAX_LENGTH} characters, lowercase, starts with a letter, ` + - "letters/numbers/internal hyphens only, ends with letter/number"; + "letters/numbers/single internal hyphens only, ends with letter/number"; export const PROVIDER_NAME_ALLOWED_FORMAT = `1-${PROVIDER_NAME_MAX_LENGTH} characters, starts with a letter, ` + "letters/numbers/dots/underscores/hyphens only"; @@ -68,8 +70,8 @@ export function diagnosticPreview(value: unknown): string { } /** - * True when `value` is a well-formed sandbox name: a non-empty RFC 1035 label - * no longer than NAME_MAX_LENGTH characters. + * True when `value` is a well-formed sandbox name under NemoClaw's + * OpenShell-compatible label contract. */ export function isValidName(value: unknown): value is string { return ( diff --git a/nemoclaw/src/shared/sandbox-name.test.ts b/nemoclaw/src/shared/sandbox-name.test.ts index 53279d16a09..7b482b970c8 100644 --- a/nemoclaw/src/shared/sandbox-name.test.ts +++ b/nemoclaw/src/shared/sandbox-name.test.ts @@ -48,7 +48,7 @@ describe("sandbox and provider name canonical validators", () => { "a1", "my-sandbox-1", "a".repeat(NAME_MAX_LENGTH), - ])("accepts the RFC 1035 label '%s'", (name) => { + ])("accepts the OpenShell-compatible sandbox name '%s'", (name) => { expect(isValidName(name)).toBe(true); }); @@ -57,6 +57,7 @@ describe("sandbox and provider name canonical validators", () => { ["leading dash (flag injection)", "-x"], ["flag-like", "--help"], ["trailing dash", "foo-"], + ["consecutive hyphens", "foo--bar"], ["leading digit", "1box"], ["uppercase", "Foo"], ["underscore", "my_box"], @@ -156,10 +157,11 @@ describe("sandbox and provider name canonical validators", () => { expect(isValidName(candidate)).toBe(false); return; } - // If it returned, the accepted value must be a safe RFC 1035 label. + // If it returned, the accepted value must satisfy the canonical contract. expect(returned).toBe(candidate); expect(NAME_VALID_PATTERN.test(returned)).toBe(true); expect(returned.startsWith("-")).toBe(false); + expect(returned.includes("--")).toBe(false); expect(/[^a-z0-9-]/.test(returned)).toBe(false); }), ); diff --git a/schemas/blueprint.schema.json b/schemas/blueprint.schema.json index 0c69f925597..a69a129436c 100644 --- a/schemas/blueprint.schema.json +++ b/schemas/blueprint.schema.json @@ -57,9 +57,9 @@ }, "name": { "type": "string", - "pattern": "^[a-z]([a-z0-9-]*[a-z0-9])?$", - "maxLength": 63, - "description": "Default sandbox name. RFC 1035 label: lowercase, starts with a letter, letters/numbers/internal hyphens only, ends with a letter or number, max 63 characters. Flows into 'openshell sandbox create --name' and Kubernetes pod names." + "pattern": "^(?!.*--)[a-z]([a-z0-9-]*[a-z0-9])?$", + "maxLength": 19, + "description": "Default sandbox name. Lowercase, starts with a letter, contains letters/numbers/single internal hyphens only, ends with a letter or number, max 19 characters. Flows into 'openshell sandbox create --name' and Kubernetes pod names." }, "forward_ports": { "type": "array", diff --git a/scripts/checks/llama-cpp-dgx-spark-qualification-contract.mts b/scripts/checks/llama-cpp-dgx-spark-qualification-contract.mts index 564a9a74b26..ad690b08a6d 100644 --- a/scripts/checks/llama-cpp-dgx-spark-qualification-contract.mts +++ b/scripts/checks/llama-cpp-dgx-spark-qualification-contract.mts @@ -66,6 +66,7 @@ export const LLAMA_CPP_DGX_SPARK_OPENCLAW_IMAGE = "ghcr.io/nvidia/nemoclaw/openclaw-sandbox@sha256:3648441718cdd6c2bc4c8fe39fa0d04d3931656b2063af34215cc51841cd0d5e" as const; export const LLAMA_CPP_DGX_SPARK_OPENCLAW_SOURCE_REVISION = "eb1d2f5700393892f227ac9fd56f485fc6718bce" as const; +export const LLAMA_CPP_DGX_SPARK_OPENCLAW_SANDBOX = "nmc-lcpp-oc" as const; export const LLAMA_CPP_DGX_SPARK_OPENCLAW_NORMAL_PROMPT = "Reply with exactly one word: PONG" as const; export const LLAMA_CPP_DGX_SPARK_OPENCLAW_TOOL_PROMPT = @@ -315,7 +316,7 @@ export type LlamaCppDgxSparkAgentQualificationPlan = { readonly runtimeProvider: "docker"; readonly sandbox: { readonly gpuAccess: "disabled"; - readonly name: "nemoclaw-llama-cpp-openclaw"; + readonly name: typeof LLAMA_CPP_DGX_SPARK_OPENCLAW_SANDBOX; }; readonly sessions: { readonly normal: "llama-cpp-openclaw-normal"; @@ -704,7 +705,7 @@ function parseAgentQualification(value: unknown): LlamaCppDgxSparkAgentQualifica route.api !== "openai-completions" || route.routedBaseUrl !== "https://inference.local/v1" || route.upstreamBaseUrl !== "http://host.openshell.internal:8081/v1" || - sandbox.name !== "nemoclaw-llama-cpp-openclaw" || + sandbox.name !== LLAMA_CPP_DGX_SPARK_OPENCLAW_SANDBOX || sandbox.gpuAccess !== "disabled" || sessions.normal !== "llama-cpp-openclaw-normal" || sessions.tool !== "llama-cpp-openclaw-tool" || @@ -760,7 +761,7 @@ function parseAgentQualification(value: unknown): LlamaCppDgxSparkAgentQualifica upstreamBaseUrl: "http://host.openshell.internal:8081/v1", }, runtimeProvider: "docker", - sandbox: { gpuAccess: "disabled", name: "nemoclaw-llama-cpp-openclaw" }, + sandbox: { gpuAccess: "disabled", name: LLAMA_CPP_DGX_SPARK_OPENCLAW_SANDBOX }, sessions: { normal: "llama-cpp-openclaw-normal", tool: "llama-cpp-openclaw-tool", diff --git a/scripts/checks/managed-image-protected-runtime-contract.ts b/scripts/checks/managed-image-protected-runtime-contract.ts index dadd311c117..ff9efb24e43 100644 --- a/scripts/checks/managed-image-protected-runtime-contract.ts +++ b/scripts/checks/managed-image-protected-runtime-contract.ts @@ -16,6 +16,31 @@ export const MANAGED_IMAGE_LOCAL_INFERENCE_KINDS = ["llama-cpp", "ollama", "nim" export type ManagedImageLocalInferenceKind = (typeof MANAGED_IMAGE_LOCAL_INFERENCE_KINDS)[number]; +export type ManagedImageProtectedRouteKind = ManagedImageLocalInferenceKind | "rollback"; + +// OpenShell 0.0.99 caps routable sandbox names at 19 characters. Keep the +// protected-runtime ownership prefix and every agent/route discriminator +// explicit so the qualification matrix remains deterministic and collision +// free without relying on truncation. +export const MANAGED_IMAGE_PROTECTED_SANDBOX_PREFIX = "nmc-mi-"; + +const PROTECTED_SANDBOX_AGENT_TOKENS: Readonly> = Object.freeze( + { + openclaw: "oc", + hermes: "he", + "langchain-deepagents-code": "dc", + }, +); + +const PROTECTED_SANDBOX_ROUTE_TOKENS: Readonly> = + Object.freeze({ + "llama-cpp": "lc", + ollama: "ol", + nim: "ni", + vllm: "vl", + rollback: "rb", + }); + export type ManagedImageLocalInferenceRoute = { readonly kind: ManagedImageLocalInferenceKind; readonly providerName: "llama-cpp-local" | "ollama-local" | "vllm-local"; @@ -95,9 +120,7 @@ export function withManagedImageLocalInferenceProfile( export function managedImageProtectedSandboxName( agent: ManagedStartupAgent, - routeKind: ManagedImageLocalInferenceKind | "rollback", + routeKind: ManagedImageProtectedRouteKind, ): string { - const agentToken = - agent === "langchain-deepagents-code" ? "dcode" : agent.replace(/[^a-z0-9-]+/gu, "-"); - return `nemoclaw-managed-${agentToken}-${routeKind}`; + return `${MANAGED_IMAGE_PROTECTED_SANDBOX_PREFIX}${PROTECTED_SANDBOX_AGENT_TOKENS[agent]}-${PROTECTED_SANDBOX_ROUTE_TOKENS[routeKind]}`; } diff --git a/scripts/checks/run-managed-image-openshell-e2e.ts b/scripts/checks/run-managed-image-openshell-e2e.ts index 727c2145c74..bb6c6826938 100644 --- a/scripts/checks/run-managed-image-openshell-e2e.ts +++ b/scripts/checks/run-managed-image-openshell-e2e.ts @@ -8,6 +8,7 @@ import os from "node:os"; import path from "node:path"; import { fileURLToPath, pathToFileURL } from "node:url"; import { resolveAgent } from "../../src/lib/agent/onboard.ts"; +import { isValidName, NAME_ALLOWED_FORMAT } from "../../src/lib/name-validation.ts"; import { type InitialSandboxPolicy, prepareInitialSandboxCreatePolicy, @@ -165,8 +166,8 @@ export function parseManagedImageOpenShellE2eInputs(argv: readonly string[]): In throw new Error("--image must be an immutable repository@sha256 manifest reference"); } const sandbox = requiredValue(argv, "--sandbox"); - if (!/^[a-z0-9](?:[a-z0-9.-]{0,61}[a-z0-9])?$/u.test(sandbox)) { - throw new Error("--sandbox must be a valid RFC 1123 label"); + if (!isValidName(sandbox)) { + throw new Error(`--sandbox must use ${NAME_ALLOWED_FORMAT}`); } const gpu = argv.includes("--gpu"); const localProviderValue = argv.includes("--local-provider") diff --git a/scripts/install.sh b/scripts/install.sh index eaa7ae35495..98cba197162 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1139,6 +1139,11 @@ _PREEXISTING_SANDBOX_RECOVERY_RAN=false # preserved). The final summary must not claim those sandboxes were recovered. _PREEXISTING_SANDBOX_ORPHANED=false _LEGACY_MANAGED_RECOVERY_NAMES_JSON="[]" +# OpenShell v0.0.99 routes sandbox and workspace identities through labels +# capped at 19 characters. Keep this installer-only raw-registry preflight in +# sync with NAME_MAX_LENGTH in nemoclaw/src/shared/sandbox-name.cts. The +# current CLI cannot be prepared safely until legacy names are checked. +_OPENSHELL_SANDBOX_NAME_MAX_LENGTH=19 # #5735: set when automatic recovery/upgrade of pre-existing sandboxes # reported a failure. A failed/destructive rebuild must not be reported as a # clean install, so print_done downgrades the final banner when this is true. @@ -2290,7 +2295,7 @@ verify_nemoclaw() { inspect_sandbox_registry_for_upgrade() { local reg_file="$1" field="$2" scope="${3:-legacy}" gateway_port gateway_port="$(resolve_nemoclaw_gateway_port)" - node - "$reg_file" "$field" "$gateway_port" "$scope" <<'NODE' + node - "$reg_file" "$field" "$gateway_port" "$scope" "$_OPENSHELL_SANDBOX_NAME_MAX_LENGTH" <<'NODE' const fs = require("node:fs"); function isObjectRecord(value) { @@ -2342,6 +2347,8 @@ try { process.exit(1); } if (process.argv[5] === "selected" && entries.length !== allEntries.length) process.exit(1); +const maxNameLength = Number(process.argv[6]); +if (!Number.isInteger(maxNameLength) || maxNameLength < 1) process.exit(1); // Keep this raw-registry predicate in sync with isRouteOnlySandboxReservation() // in src/lib/state/registry.ts. const sandboxes = entries.filter( @@ -2352,6 +2359,18 @@ if (process.argv[3] === "count") { process.stdout.write(String(sandboxes.length)); process.exit(0); } +if (process.argv[3] === "incompatible-names") { + const compatiblePattern = /^[a-z]([a-z0-9-]*[a-z0-9])?$/; + const incompatible = sandboxes + .map(([name]) => name) + .filter( + (name) => + name.length > maxNameLength || !compatiblePattern.test(name) || name.includes("--"), + ) + .sort(); + process.stdout.write(JSON.stringify(incompatible)); + process.exit(0); +} if (process.argv[3] !== "ambiguous-names") process.exit(1); const ambiguous = sandboxes @@ -2497,6 +2516,69 @@ legacy_ambiguous_sandbox_names_json() { inspect_sandbox_registry_for_upgrade "$reg_file" ambiguous-names "$scope" } +openshell_incompatible_sandbox_names_json() { + local reg_file="$1" + local scope="legacy" + if [ "$(resolve_nemoclaw_gateway_port)" -ne 8080 ] \ + && [ "$reg_file" = "$(nemoclaw_state_dir)/sandboxes.json" ]; then + scope="selected" + fi + inspect_sandbox_registry_for_upgrade "$reg_file" incompatible-names "$scope" +} + +require_openshell_compatible_sandbox_names() { + local reg_file="$1" incompatible_json="" incompatible_count="0" + if ! incompatible_json="$(openshell_incompatible_sandbox_names_json "$reg_file")"; then + error "Could not validate existing sandbox names for the OpenShell upgrade. Existing gateway and sandboxes were left unchanged." + fi + incompatible_count="$(node -e 'process.stdout.write(String(JSON.parse(process.argv[1]).length))' "$incompatible_json")" + if [ "$incompatible_count" -eq 0 ] 2>/dev/null; then + return 0 + fi + + cat < { + const raw = String(value); + const prefix = raw.slice(0, 80); + let escaped = "\""; + for (let index = 0; index < prefix.length; index += 1) { + const codeUnit = prefix.charCodeAt(index); + if (codeUnit === 0x22) escaped += "\\\""; + else if (codeUnit === 0x5c) escaped += "\\\\"; + else if (codeUnit >= 0x20 && codeUnit <= 0x7e) escaped += prefix[index]; + else escaped += "\\u" + codeUnit.toString(16).padStart(4, "0"); + } + return escaped + (raw.length > 80 ? "...\"" : "\""); + }; + for (const name of JSON.parse(process.argv[1])) console.log(preview(name)); + ' "$incompatible_json") + cat </dev/null || return 0 + require_openshell_compatible_sandbox_names "$reg_file" if ! command_exists openshell; then # NemoClaw v0.0.55's OpenShell 0.0.44 layout could install this binary # without persisting ~/.local/bin on PATH. Retain this fallback while direct @@ -3788,7 +3871,8 @@ validate_station_express_resume_agent() { validate_station_express_resume_sandbox() { local sandbox="${1:-}" - [[ ${#sandbox} -le 63 ]] \ + [[ ${#sandbox} -le $_OPENSHELL_SANDBOX_NAME_MAX_LENGTH ]] \ + && [[ "$sandbox" != *--* ]] \ && { [[ "$sandbox" =~ ^[a-z]$ ]] || [[ "$sandbox" =~ ^[a-z][a-z0-9-]*[a-z0-9]$ ]]; } } diff --git a/scripts/nemoclaw-start.sh b/scripts/nemoclaw-start.sh index cfbfc44c8ae..3f0207515b8 100755 --- a/scripts/nemoclaw-start.sh +++ b/scripts/nemoclaw-start.sh @@ -3454,7 +3454,7 @@ GATEWAYURLENVEOF # src/lib/onboard/sandbox-create-launch.ts) and is the only in-container # source of the name; capture it here for the renderer below. # - # Apply the same RFC-1123 allowlist the renderer uses (mirrors + # Apply the same canonical sandbox-name allowlist the renderer uses (mirrors # NAME_VALID_PATTERN in src/lib/name-validation.ts). Missing or invalid # values cannot reach a copyable command. An accepted value is limited to # [a-z0-9-] and needs no further escaping. @@ -3467,7 +3467,7 @@ GATEWAYURLENVEOF _sandbox_label="" case "$_sandbox_label_src" in "" | 0 | 1 | true | TRUE | false | FALSE) ;; - [!a-z]* | *- | *[!a-z0-9-]*) ;; + [!a-z]* | *- | *--* | *[!a-z0-9-]*) ;; *) if [ "${#_sandbox_label_src}" -le 19 ]; then _sandbox_label="$_sandbox_label_src" @@ -3942,11 +3942,12 @@ _nemoclaw_valid_sandbox_label() { # The candidates are untrusted input interpolated into a copyable `nemoclaw …` # command, so allowlist rather than merely strip: only render a value that is # a valid sandbox name. This mirrors NAME_VALID_PATTERN in - # src/lib/name-validation.ts (/^[a-z]([a-z0-9-]*[a-z0-9])?$/, max 19): starts - # with a lowercase letter, then lowercase alphanumerics/hyphens, no trailing - # hyphen. Anything else (digit-leading labels, control characters, ANSI - # escapes, shell metacharacters, whitespace) is rejected, and the caller falls - # back to a placeholder the user resolves with `nemoclaw list`. Shell `case` + # src/lib/name-validation.ts (lowercase, max 19, no consecutive hyphens): + # starts with a lowercase letter, then lowercase alphanumerics/single internal + # hyphens, with no trailing hyphen. Anything else (digit-leading labels, + # control characters, ANSI escapes, shell metacharacters, whitespace) is + # rejected, and the caller falls back to a placeholder the user resolves with + # `nemoclaw list`. Shell `case` # globs match newlines as ordinary characters, so an embedded newline is # rejected by the metacharacter class. The boolean forms are OpenShell's older # "this is a sandbox" marker rather than a name. @@ -3959,7 +3960,7 @@ _nemoclaw_valid_sandbox_label() { LC_ALL=C case "${1:-}" in "" | 0 | 1 | true | TRUE | false | FALSE) ;; - [!a-z]* | *- | *[!a-z0-9-]*) ;; + [!a-z]* | *- | *--* | *[!a-z0-9-]*) ;; *) if [ "${#1}" -le 19 ]; then printf '%s' "$1" diff --git a/scripts/smoke-macos-install.sh b/scripts/smoke-macos-install.sh index 28cea4a6714..a85217269f5 100755 --- a/scripts/smoke-macos-install.sh +++ b/scripts/smoke-macos-install.sh @@ -24,7 +24,7 @@ REPO_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" # shellcheck source=./lib/runtime.sh . "$SCRIPT_DIR/lib/runtime.sh" -SANDBOX_NAME="smoke-$(date +%Y%m%d%H%M%S)" +SANDBOX_NAME="smoke-$(date +%m%d%H%M%S)" LOG_DIR="${TMPDIR:-/tmp}/nemoclaw-smoke" RUNTIME="" ALLOW_EXISTING_STATE=false @@ -115,8 +115,10 @@ done [ -x "$REPO_DIR/uninstall.sh" ] || fail "uninstall.sh not found at repo root." validate_sandbox_name() { - if ! [[ "$SANDBOX_NAME" =~ ^[a-z0-9]([a-z0-9-]*[a-z0-9])?$ ]]; then - fail "Invalid sandbox name '$SANDBOX_NAME'. Use lowercase letters, numbers, and hyphens." + if [ "${#SANDBOX_NAME}" -gt 19 ] \ + || [[ "$SANDBOX_NAME" == *--* ]] \ + || ! [[ "$SANDBOX_NAME" =~ ^[a-z]([a-z0-9-]*[a-z0-9])?$ ]]; then + fail "Invalid sandbox name '$SANDBOX_NAME'. Use 1-19 lowercase letters, numbers, and single internal hyphens; start with a letter and end with a letter or number." fi } diff --git a/src/lib/actions/sandbox/destroy.ts b/src/lib/actions/sandbox/destroy.ts index 6712b7e362d..894dd8a77b1 100644 --- a/src/lib/actions/sandbox/destroy.ts +++ b/src/lib/actions/sandbox/destroy.ts @@ -145,8 +145,9 @@ export function cleanupSandboxServices( // Source boundary: this exported helper can be called independently of CLI // dispatch, including from forced local recovery. Validate once before every // host and provider cleanup side effect, then derive the PID path from that - // same RFC 1123 name. Remove only when the helper accepts a validated-name - // type that cannot be constructed from unchecked input. + // same canonical OpenShell-compatible name. Remove only when the helper + // accepts a validated-name type that cannot be constructed from unchecked + // input. const validatedSandboxName = validateName(sandboxName, "sandbox name"); const servicesPidDir = path.resolve("/tmp", `nemoclaw-services-${validatedSandboxName}`); const getSandbox = deps.getSandbox ?? registry.getSandbox; diff --git a/src/lib/actions/sandbox/mcp-bridge-name-diagnostics.test.ts b/src/lib/actions/sandbox/mcp-bridge-name-diagnostics.test.ts index b737154fb28..fde3aa29bc0 100644 --- a/src/lib/actions/sandbox/mcp-bridge-name-diagnostics.test.ts +++ b/src/lib/actions/sandbox/mcp-bridge-name-diagnostics.test.ts @@ -21,6 +21,17 @@ function messageFrom(reject: () => void): string { } describe("MCP bridge name diagnostics", () => { + it("uses the canonical OpenShell 0.0.99 sandbox-name boundary (#8497)", () => { + expect(() => validateSandboxName("a".repeat(19))).not.toThrow(); + + for (const name of ["a".repeat(20), "legacy--box"]) { + const message = messageFrom(() => validateSandboxName(name)); + + expect(message).toContain(`Invalid sandbox name "${name}"`); + expect(message).toContain("Allowed format: 1-19 characters"); + } + }); + it("escapes control characters in a rejected sandbox name (#7796)", () => { const message = messageFrom(() => validateSandboxName(`bad${ESC}[31mX`)); @@ -44,8 +55,10 @@ describe("MCP bridge name diagnostics", () => { it("bounds an over-length rejected name to a truncated preview (#7796)", () => { const message = messageFrom(() => validateSandboxName(`Bad${"x".repeat(200)}`)); + const muchLongerMessage = messageFrom(() => validateSandboxName(`Bad${"x".repeat(2_000)}`)); expect(message).toContain(`"Bad${"x".repeat(77)}..."`); - expect(message.length).toBeLessThan(200); + expect(muchLongerMessage.length).toBe(message.length); + expect(message.length).toBeLessThan(260); }); }); diff --git a/src/lib/actions/sandbox/mcp-bridge-validation.ts b/src/lib/actions/sandbox/mcp-bridge-validation.ts index 3e0531071b3..cd9477713ad 100644 --- a/src/lib/actions/sandbox/mcp-bridge-validation.ts +++ b/src/lib/actions/sandbox/mcp-bridge-validation.ts @@ -5,7 +5,7 @@ import { type SpawnSyncReturns, spawnSync } from "node:child_process"; import crypto from "node:crypto"; import { resolveOpenshell } from "../../adapters/openshell/resolve"; -import { diagnosticPreview } from "../../name-validation"; +import { diagnosticPreview, isValidName, NAME_ALLOWED_FORMAT } from "../../sandbox-name-contract"; import { normalizeTrustedPrivateHost, parseTrustedPrivateHosts, @@ -34,7 +34,6 @@ export { const VALID_SERVER_RE = /^[A-Za-z][A-Za-z0-9_-]{0,63}$/; const VALID_ENV_RE = /^[A-Za-z_][A-Za-z0-9_]{0,127}$/; const OPENSHELL_REVISIONED_CREDENTIAL_NAME_RE = /^v[0-9]+_[A-Za-z0-9_]+$/; -const VALID_SANDBOX_RE = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/; const OPENSHELL_VERSION_OUTPUT_RE = /^openshell\s+([0-9]+\.[0-9]+\.[0-9]+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?)$/; const OPENSHELL_VERSION_PROBE_TIMEOUT_MS = 5_000; @@ -165,9 +164,9 @@ const SANDBOX_RUNTIME_CONTROL_ENV_KEYS = new Set(childVisibleCredentialManifest. const SANDBOX_RUNTIME_CONTROL_ENV_PREFIXES = childVisibleCredentialManifest.runtimeControlPrefixes; const MCP_PROVIDER_HASH_BYTES = 8; export function validateSandboxName(name: string): void { - if (!name || name.length > 63 || !VALID_SANDBOX_RE.test(name)) { + if (!isValidName(name)) { throw new McpBridgeError( - `Invalid sandbox name ${diagnosticPreview(name)}. Names must be 1-63 lowercase alphanumeric characters with optional internal hyphens.`, + `Invalid sandbox name ${diagnosticPreview(name)}. Allowed format: ${NAME_ALLOWED_FORMAT}.`, 2, ); } diff --git a/src/lib/actions/upgrade-sandboxes-preflight.test.ts b/src/lib/actions/upgrade-sandboxes-preflight.test.ts index 416c728bc47..c21856160a9 100644 --- a/src/lib/actions/upgrade-sandboxes-preflight.test.ts +++ b/src/lib/actions/upgrade-sandboxes-preflight.test.ts @@ -3,6 +3,8 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; +import { diagnosticPreview, NAME_MAX_LENGTH } from "../name-validation"; + const mocks = vi.hoisted(() => ({ captureNamedGatewaySandboxListReadOnly: vi.fn(), captureSandboxListWithGatewayPreflightOrExit: vi.fn(), @@ -90,6 +92,73 @@ describe("upgrade-sandboxes gateway preflight adapter (#6237)", () => { expect(logSpy.mock.calls.flat().join("\n")).toContain("No sandboxes found"); }); + it("reports every incompatible registered name without querying a gateway in check mode (#8497)", async () => { + const overlengthName = `a${"b".repeat(NAME_MAX_LENGTH)}`; + const invalidFormatName = "Legacy_Name"; + const unsafeDiagnosticName = "bad\u202e::error::forged"; + const routeOnlyInvalidName = "Route_Only_Invalid"; + mocks.listSandboxes.mockReturnValue({ + sandboxes: [ + { name: "alpha", provider: "nvidia-prod", model: "nemotron" }, + { name: overlengthName, provider: "nvidia-prod", model: "nemotron" }, + { name: invalidFormatName, provider: "nvidia-prod", model: "nemotron" }, + { name: unsafeDiagnosticName, provider: "nvidia-prod", model: "nemotron" }, + { + name: routeOnlyInvalidName, + provider: "nvidia-prod", + model: "nemotron", + pendingRouteReservation: true, + }, + ], + }); + const errorSpy = vi.spyOn(console, "error").mockImplementation(() => undefined); + const exitSpy = vi.spyOn(process, "exit").mockImplementation((() => undefined) as never); + + await expect(upgradeSandboxes({ check: true })).resolves.toBeUndefined(); + + const output = errorSpy.mock.calls.flat().join("\n"); + expect(output).toContain(JSON.stringify(overlengthName)); + expect(output).toContain(JSON.stringify(invalidFormatName)); + expect(output).toContain(diagnosticPreview(unsafeDiagnosticName)); + expect(output).not.toContain(unsafeDiagnosticName); + expect(output).not.toContain(JSON.stringify(routeOnlyInvalidName)); + expect(output).toContain(`1-${NAME_MAX_LENGTH} characters`); + expect(output).toContain("create a replacement with a valid name and transfer its state"); + expect(exitSpy).not.toHaveBeenCalled(); + expect(mocks.captureNamedGatewaySandboxListReadOnly).not.toHaveBeenCalled(); + expect(mocks.captureSandboxListWithGatewayPreflightOrExit).not.toHaveBeenCalled(); + expect(mocks.classifyUpgradeableSandboxes).not.toHaveBeenCalled(); + expect(upgradeSandboxesDependencies.rebuildSandbox).not.toHaveBeenCalled(); + }); + + it("exits before gateway preflight or rebuild when automatic mode finds an incompatible name (#8497)", async () => { + const incompatibleNames = [`a${"b".repeat(NAME_MAX_LENGTH)}`, "Legacy_Name", "legacy--box"]; + mocks.listSandboxes.mockReturnValue({ + sandboxes: incompatibleNames.map((name) => ({ + name, + provider: "nvidia-prod", + model: "nemotron", + })), + }); + const errorSpy = vi.spyOn(console, "error").mockImplementation(() => undefined); + const exitSpy = vi.spyOn(process, "exit").mockImplementation(((code?: number) => { + throw new Error(`process.exit(${String(code)})`); + }) as never); + + await expect(upgradeSandboxes({ auto: true })).rejects.toThrow("process.exit(1)"); + + const output = errorSpy.mock.calls.flat().join("\n"); + for (const name of incompatibleNames) { + expect(output).toContain(JSON.stringify(name)); + } + expect(exitSpy).toHaveBeenCalledWith(1); + expect(mocks.captureNamedGatewaySandboxListReadOnly).not.toHaveBeenCalled(); + expect(mocks.captureSandboxListWithGatewayPreflightOrExit).not.toHaveBeenCalled(); + expect(mocks.classifyUpgradeableSandboxes).not.toHaveBeenCalled(); + expect(mocks.getLatestBackup).not.toHaveBeenCalled(); + expect(upgradeSandboxesDependencies.rebuildSandbox).not.toHaveBeenCalled(); + }); + it("queries the sandbox's recorded gateway read-only, never the recovering preflight (#7279)", async () => { const logSpy = vi.spyOn(console, "log").mockImplementation(() => undefined); diff --git a/src/lib/actions/upgrade-sandboxes-recovery.test.ts b/src/lib/actions/upgrade-sandboxes-recovery.test.ts index 715538f53f9..92ebd4e7ba6 100644 --- a/src/lib/actions/upgrade-sandboxes-recovery.test.ts +++ b/src/lib/actions/upgrade-sandboxes-recovery.test.ts @@ -482,11 +482,11 @@ describe("upgrade-sandboxes prepared backup recovery (#6114)", () => { }); it("warns and does not recover a stale registered sandbox absent from the selected gateway", async () => { - const harness = createRecoveryHarness(["registered-elsewhere"], { - gatewayNames: { "registered-elsewhere": "gateway-b" }, + const harness = createRecoveryHarness(["registered-away"], { + gatewayNames: { "registered-away": "gateway-b" }, liveOutput: "selected-gateway-box Ready", latestBackup: null, - staleNames: ["registered-elsewhere"], + staleNames: ["registered-away"], }); const exitSpy = vi.spyOn(process, "exit").mockImplementation(((code?: number) => { throw new Error(`process.exit(${code})`); @@ -621,8 +621,8 @@ describe("upgrade-sandboxes prepared backup recovery (#6114)", () => { }); it("does not flag a sandbox bound to another live gateway as orphaned (#6520)", async () => { - const harness = createRecoveryHarness(["registered-elsewhere"], { - gatewayNames: { "registered-elsewhere": "gateway-b" }, + const harness = createRecoveryHarness(["registered-away"], { + gatewayNames: { "registered-away": "gateway-b" }, liveOutput: "selected-box Ready", }); vi.stubEnv("NEMOCLAW_RESTORE_LATEST_BACKUP_ON_RECREATE", "0"); @@ -678,10 +678,10 @@ describe("upgrade-sandboxes prepared backup recovery (#6114)", () => { }); it("does not recover an absent sandbox bound to a different gateway even when a validated backup exists", async () => { - const harness = createRecoveryHarness(["registered-elsewhere"], { - gatewayNames: { "registered-elsewhere": "gateway-b" }, + const harness = createRecoveryHarness(["registered-away"], { + gatewayNames: { "registered-away": "gateway-b" }, liveOutput: "selected-box Ready", - staleNames: ["registered-elsewhere"], + staleNames: ["registered-away"], }); const exitSpy = vi.spyOn(process, "exit").mockImplementation(((code?: number) => { throw new Error(`process.exit(${code})`); @@ -776,9 +776,9 @@ describe("upgrade-sandboxes prepared backup recovery (#6114)", () => { }); it("does not recover a non-Ready sandbox bound to another valid gateway (#6114)", async () => { - const harness = createRecoveryHarness(["registered-elsewhere"], { - gatewayNames: { "registered-elsewhere": "nemoclaw-12345" }, - liveOutput: "registered-elsewhere Provisioning", + const harness = createRecoveryHarness(["registered-away"], { + gatewayNames: { "registered-away": "nemoclaw-12345" }, + liveOutput: "registered-away Provisioning", }); await expect(harness.upgradeSandboxes({ auto: true })).resolves.toBeUndefined(); diff --git a/src/lib/actions/upgrade-sandboxes.ts b/src/lib/actions/upgrade-sandboxes.ts index 10348f282da..acffb7b641a 100644 --- a/src/lib/actions/upgrade-sandboxes.ts +++ b/src/lib/actions/upgrade-sandboxes.ts @@ -28,6 +28,7 @@ import { } from "../openshell-sandbox-list"; import { parseLiveSandboxEntries, parseReadySandboxNames } from "../runtime-recovery"; import * as sandboxVersion from "../sandbox/version"; +import { diagnosticPreview, isValidName, NAME_ALLOWED_FORMAT } from "../sandbox-name-contract"; import * as registry from "../state/registry"; import * as sandboxState from "../state/sandbox"; @@ -237,6 +238,19 @@ function resolveCheckGatewayName( return recorded.size === 1 ? [...recorded][0] : fallbackGatewayName; } +function printIncompatibleRegisteredSandboxNames(names: readonly string[]): void { + console.error( + `\n ${YW}Registered sandbox names cannot be recreated by this NemoClaw version:${R}`, + ); + for (const name of names) { + console.error(` ${diagnosticPreview(name)}`); + } + console.error(`\n Registered sandbox names must use: ${NAME_ALLOWED_FORMAT}.`); + console.error( + ` For each listed sandbox, create a replacement with a valid name and transfer its state before rerunning \`${CLI_NAME} upgrade-sandboxes\`.`, + ); +} + export async function upgradeSandboxes( options: string[] | UpgradeSandboxesOptions = {}, ): Promise { @@ -252,6 +266,20 @@ export async function upgradeSandboxes( return; } + // OpenShell can no longer recreate legacy registry identities that fall + // outside the canonical sandbox-name contract. Detect every such identity + // before resolving or querying a gateway so check mode remains read-only and + // the mutating path cannot cross the rebuild boundary with an invalid name. + const incompatibleSandboxNames = sandboxes + .map((sandbox) => sandbox.name) + .filter((name) => !isValidName(name)) + .sort(); + if (incompatibleSandboxNames.length > 0) { + printIncompatibleRegisteredSandboxNames(incompatibleSandboxNames); + if (checkOnly) return; + process.exit(1); + } + // Resolve the configured gateway once and pin every observation to it. The // initial list, the confirmation list, and persisted-binding eligibility must // share this source; OpenShell's mutable current selection may be a sibling diff --git a/src/lib/deploy/index.test.ts b/src/lib/deploy/index.test.ts index 794a2e014f6..f6616687fc9 100644 --- a/src/lib/deploy/index.test.ts +++ b/src/lib/deploy/index.test.ts @@ -10,8 +10,23 @@ import { inferDeployProvider, isBrevInstanceFailed, isBrevInstanceReady, + validateDeployInstanceName, } from "./index"; +describe("validateDeployInstanceName", () => { + it("preserves the Brev instance-name contract independently of sandbox limits (#8497)", () => { + const sixtyThreeCharacters = `a${"b".repeat(61)}z`; + + expect(validateDeployInstanceName("brev--instance-name-that-exceeds-nineteen")).toBe( + "brev--instance-name-that-exceeds-nineteen", + ); + expect(validateDeployInstanceName(sixtyThreeCharacters)).toBe(sixtyThreeCharacters); + expect(() => validateDeployInstanceName(`a${"b".repeat(63)}`)).toThrow( + /instance name too long \(max 63 chars\)/, + ); + }); +}); + describe("inferDeployProvider", () => { it("prefers an explicit provider override", () => { const provider = inferDeployProvider("openai", { @@ -275,7 +290,7 @@ describe("executeDeploy", () => { expect(errorText).toContain('Invalid sandbox name: "bad name"'); expect(errorText).toContain("Sandbox names cannot contain spaces."); expect(errorText).toContain( - "Allowed format: 1-19 characters, lowercase, starts with a letter, letters/numbers/internal hyphens only, ends with letter/number.", + "Allowed format: 1-19 characters, lowercase, starts with a letter, letters/numbers/single internal hyphens only, ends with letter/number.", ); expect(errorText).toContain( "Brev deploy is non-interactive and cannot prompt for a corrected sandbox name.", diff --git a/src/lib/deploy/index.ts b/src/lib/deploy/index.ts index 65733f1a657..e8ee88307f7 100644 --- a/src/lib/deploy/index.ts +++ b/src/lib/deploy/index.ts @@ -4,9 +4,39 @@ import fs from "node:fs"; import os from "node:os"; import path from "node:path"; - -import { NAME_ALLOWED_FORMAT, getNameValidationGuidance } from "../name-validation"; import { sleepSeconds } from "../core/wait"; +import { + diagnosticPreview, + getNameValidationGuidance, + NAME_ALLOWED_FORMAT, +} from "../name-validation"; + +const DEPLOY_INSTANCE_NAME_MAX_LENGTH = 63; +const DEPLOY_INSTANCE_NAME_PATTERN = /^[a-z]([a-z0-9-]*[a-z0-9])?$/; +const DEPLOY_INSTANCE_NAME_ALLOWED_FORMAT = + "1-63 characters, lowercase, starts with a letter, letters/numbers/internal hyphens only, ends with letter/number"; + +// Brev instance names are not OpenShell sandbox identities. Preserve their +// established RFC-compatible 63-character boundary while sandbox names use +// the stricter OpenShell 0.0.99 contract through the injected validator. +export function validateDeployInstanceName(name: string): string { + if (!name || typeof name !== "string") { + throw new Error( + `instance name is required. Allowed format: ${DEPLOY_INSTANCE_NAME_ALLOWED_FORMAT}.`, + ); + } + if (name.length > DEPLOY_INSTANCE_NAME_MAX_LENGTH) { + throw new Error( + `instance name too long (max ${DEPLOY_INSTANCE_NAME_MAX_LENGTH} chars): ${diagnosticPreview(name)}. Allowed format: ${DEPLOY_INSTANCE_NAME_ALLOWED_FORMAT}.`, + ); + } + if (!DEPLOY_INSTANCE_NAME_PATTERN.test(name)) { + throw new Error( + `Invalid instance name: ${diagnosticPreview(name)}. Allowed format: ${DEPLOY_INSTANCE_NAME_ALLOWED_FORMAT}.`, + ); + } + return name; +} type ExecLikeValue = | string @@ -291,7 +321,7 @@ export async function executeDeploy(opts: DeployExecutionOptions): Promise ); } - const name = validateName(instanceName, "instance name"); + const name = validateDeployInstanceName(instanceName); const gpu = env.NEMOCLAW_GPU || "a2-highgpu-1g:nvidia-tesla-a100:1"; const brevProvider = String(env.NEMOCLAW_BREV_PROVIDER || "gcp") .trim() diff --git a/src/lib/name-validation.ts b/src/lib/name-validation.ts index d56d5d7090e..899229f2b98 100644 --- a/src/lib/name-validation.ts +++ b/src/lib/name-validation.ts @@ -36,7 +36,7 @@ function validationSubject(label: string): string { return "Names"; } -// Derive a copy-paste-ready RFC 1123 label from arbitrary user input. Returns +// Derive a copy-paste-ready OpenShell-compatible label from arbitrary user input. Returns // null when no recoverable slug exists (empty, all-symbol input) or when the // input is already a valid name (no canonicalisation is performed against // inputs the validator would accept). The transform mirrors what a user would diff --git a/src/lib/onboard/messaging-channel-setup.test.ts b/src/lib/onboard/messaging-channel-setup.test.ts index 003f88452cb..19e1254195b 100644 --- a/src/lib/onboard/messaging-channel-setup.test.ts +++ b/src/lib/onboard/messaging-channel-setup.test.ts @@ -9,10 +9,10 @@ import { MessagingSetupApplier, type SandboxMessagingPlan, } from "../messaging"; -import { resolveMessagingPlanAuthority } from "../messaging/plan-authority"; import { MESSAGING_SETUP_APPLIER_ENV_KEY } from "../messaging/applier/types"; import { validateSlackCredentials } from "../messaging/channels/slack/hooks/credential-validation"; import { runWechatHostQrLogin } from "../messaging/channels/wechat/login"; +import { resolveMessagingPlanAuthority } from "../messaging/plan-authority"; import * as registry from "../state/registry"; import { detectMessagingChannelsFromEnv, @@ -671,7 +671,7 @@ describe("setupMessagingChannels", () => { manifests("googlechat"), { interactive: false, - sandboxName: "e2e-channels-stop-start-openclaw", + sandboxName: "e2e-oc-ch-cycle", }, ); diff --git a/src/lib/policy/index.ts b/src/lib/policy/index.ts index 0927560eb1c..8f238b1d389 100644 --- a/src/lib/policy/index.ts +++ b/src/lib/policy/index.ts @@ -28,6 +28,7 @@ import { resolveSandboxGatewayName } from "../onboard/gateway-binding"; import { assertNoOpenShellGatewayEndpointOverride } from "../openshell-gateway-endpoint-guard"; import { OPENSHELL_SANDBOX_HOST_BRIDGE } from "../private-networks"; import { ROOT, run, runCapture } from "../runner"; +import { diagnosticPreview, isValidName, NAME_ALLOWED_FORMAT } from "../sandbox-name-contract"; import * as registry from "../state/registry"; import type { BaselineExclusionRuntimeStatus } from "./baseline-exclusion"; import { @@ -1051,11 +1052,10 @@ function removePreset( ): boolean { // Guard against truncated sandbox names — WSL can truncate hyphenated // names during argument parsing, e.g. "my-assistant" → "m" - const isRfc1123Label = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(sandboxName); - if (!sandboxName || sandboxName.length > 63 || !isRfc1123Label) { + if (!isValidName(sandboxName)) { throw new Error( - `Invalid or truncated sandbox name: '${sandboxName}'. ` + - `Names must be 1-63 chars, lowercase alphanumeric, with optional internal hyphens.`, + `Invalid or truncated sandbox name: ${diagnosticPreview(sandboxName)}. ` + + `Allowed format: ${NAME_ALLOWED_FORMAT}.`, ); } @@ -1899,11 +1899,10 @@ function applyPresetContent( ): boolean { // Guard against truncated sandbox names — WSL can truncate hyphenated // names during argument parsing, e.g. "my-assistant" → "m" - const isRfc1123Label = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(sandboxName); - if (!sandboxName || sandboxName.length > 63 || !isRfc1123Label) { + if (!isValidName(sandboxName)) { throw new Error( - `Invalid or truncated sandbox name: '${sandboxName}'. ` + - `Names must be 1-63 chars, lowercase alphanumeric, with optional internal hyphens.`, + `Invalid or truncated sandbox name: ${diagnosticPreview(sandboxName)}. ` + + `Allowed format: ${NAME_ALLOWED_FORMAT}.`, ); } @@ -2147,11 +2146,10 @@ function applyPreset( * preset during onboarding. */ function applyPresets(sandboxName: string, presetNames: string[]): boolean { - const isRfc1123Label = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(sandboxName); - if (!sandboxName || sandboxName.length > 63 || !isRfc1123Label) { + if (!isValidName(sandboxName)) { throw new Error( - `Invalid or truncated sandbox name: '${sandboxName}'. ` + - `Names must be 1-63 chars, lowercase alphanumeric, with optional internal hyphens.`, + `Invalid or truncated sandbox name: ${diagnosticPreview(sandboxName)}. ` + + `Allowed format: ${NAME_ALLOWED_FORMAT}.`, ); } @@ -2637,11 +2635,10 @@ function resolvePermissivePolicyPath(sandboxName: string): string { } function applyPermissivePolicy(sandboxName: string): void { - const isRfc1123Label = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(sandboxName); - if (!sandboxName || sandboxName.length > 63 || !isRfc1123Label) { + if (!isValidName(sandboxName)) { throw new Error( - `Invalid or truncated sandbox name: '${sandboxName}'. ` + - `Names must be 1-63 chars, lowercase alphanumeric, with optional internal hyphens.`, + `Invalid or truncated sandbox name: ${diagnosticPreview(sandboxName)}. ` + + `Allowed format: ${NAME_ALLOWED_FORMAT}.`, ); } diff --git a/src/lib/runner.ts b/src/lib/runner.ts index 777a987affc..e3f08c6291e 100644 --- a/src/lib/runner.ts +++ b/src/lib/runner.ts @@ -11,13 +11,13 @@ import path from "node:path"; import { redirectInheritedChildStdoutToStderr } from "./cli/stdout-guard"; import { shellQuote } from "./core/shell-quote"; +import { detectDockerHost } from "./platform"; import { diagnosticPreview, NAME_ALLOWED_FORMAT, NAME_MAX_LENGTH, NAME_VALID_PATTERN, -} from "./name-validation"; -import { detectDockerHost } from "./platform"; +} from "./sandbox-name-contract"; import { redact, redactError, writeRedactedResult } from "./security/redact"; import { buildSubprocessEnv } from "./subprocess-env"; @@ -376,7 +376,8 @@ function runCaptureEx( } /** - * Validate a name (sandbox, instance, container) against RFC 1123 label rules. + * Validate a name (sandbox, instance, container) against the canonical + * OpenShell-compatible label rules. * Rejects shell metacharacters, path traversal, and empty/overlength names. */ function validateName(name: string, label = "name"): string { diff --git a/src/lib/sandbox-name-contract.ts b/src/lib/sandbox-name-contract.ts new file mode 100644 index 00000000000..51afc48a2b0 --- /dev/null +++ b/src/lib/sandbox-name-contract.ts @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +// Keep sandbox-only consumers behind one boundary so the canonical validation +// implementation does not become a high-fan-in dependency. +export { + diagnosticPreview, + isValidName, + NAME_ALLOWED_FORMAT, + NAME_MAX_LENGTH, + NAME_VALID_PATTERN, +} from "./name-validation"; diff --git a/test/blueprint-name-schema.test.ts b/test/blueprint-name-schema.test.ts index c05f81e0e7a..ca3fd2ed612 100644 --- a/test/blueprint-name-schema.test.ts +++ b/test/blueprint-name-schema.test.ts @@ -46,7 +46,8 @@ describe("blueprint name schema", () => { ["a command-substitution sandbox name", "$(id)"], ["an uppercase sandbox name", "TestSandbox"], ["a trailing-hyphen sandbox name", "sandbox-"], - ["an over-length sandbox name", "a".repeat(64)], + ["a 20-character sandbox name", "a".repeat(20)], + ["a double-hyphen sandbox name", "legacy--sandbox"], ])("rejects blueprint with %s", (_label, name) => { const blueprint = createBlueprint(); blueprint.components.sandbox.name = name; @@ -67,9 +68,9 @@ describe("blueprint name schema", () => { expect(validate(blueprint)).toBe(expected); }); - it("accepts blueprint with a renamed RFC 1035 sandbox name", () => { + it("accepts blueprint with an exact 19-character sandbox name (#8497)", () => { const blueprint = createBlueprint(); - blueprint.components.sandbox.name = "my-sandbox-1"; + blueprint.components.sandbox.name = `a${"b".repeat(18)}`; expect(validate(blueprint), JSON.stringify(validate.errors)).toBe(true); }); }); diff --git a/test/e2e/fixtures/clients/sandbox.ts b/test/e2e/fixtures/clients/sandbox.ts index bd0ec670dfc..d41b433de34 100644 --- a/test/e2e/fixtures/clients/sandbox.ts +++ b/test/e2e/fixtures/clients/sandbox.ts @@ -1,6 +1,7 @@ // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 +import * as importedSandboxNameContract from "../../../../nemoclaw/src/shared/sandbox-name.cts"; import { buildAvailabilityProbeEnv } from "../availability-env.ts"; import type { ShellProbeResult, ShellProbeRunOptions } from "../shell-probe.ts"; import { trustedShellCommand } from "../shell-probe.ts"; @@ -12,6 +13,13 @@ import { resultText, } from "./command.ts"; +const sandboxNameContract = ( + "default" in importedSandboxNameContract && importedSandboxNameContract.default + ? importedSandboxNameContract.default + : importedSandboxNameContract +) as typeof import("../../../../nemoclaw/src/shared/sandbox-name.cts"); +const { diagnosticPreview, isValidName, NAME_ALLOWED_FORMAT } = sandboxNameContract; + const SANDBOX_ALREADY_ABSENT = /\bNotFound\b|\bNot Found\b|sandbox[^\n]*(?:not found|not present|does not exist)|no such sandbox/i; @@ -222,8 +230,10 @@ export class SandboxClient { } export function validateSandboxName(name: string): void { - if (!/^[A-Za-z0-9][A-Za-z0-9_.-]*$/.test(name)) { - throw new Error(`sandbox name is invalid for fixture client: ${name}`); + if (!isValidName(name)) { + throw new Error( + `sandbox name is invalid for fixture client: ${diagnosticPreview(name)}. Allowed format: ${NAME_ALLOWED_FORMAT}.`, + ); } } diff --git a/test/e2e/live/agent-turn-latency-helpers.ts b/test/e2e/live/agent-turn-latency-helpers.ts index 9ac983851ef..91503a70b5f 100644 --- a/test/e2e/live/agent-turn-latency-helpers.ts +++ b/test/e2e/live/agent-turn-latency-helpers.ts @@ -21,9 +21,9 @@ export { REPO_ROOT }; export const CLI = CLI_ENTRYPOINT; export const OPENCLAW_SANDBOX = - process.env.NEMOCLAW_OPENCLAW_TURN_LATENCY_SANDBOX_NAME ?? "e2e-openclaw-turn-latency"; + process.env.NEMOCLAW_OPENCLAW_TURN_LATENCY_SANDBOX_NAME ?? "e2e-oc-turn-lat"; export const HERMES_SANDBOX = - process.env.NEMOCLAW_HERMES_TURN_LATENCY_SANDBOX_NAME ?? "e2e-hermes-turn-latency"; + process.env.NEMOCLAW_HERMES_TURN_LATENCY_SANDBOX_NAME ?? "e2e-hm-turn-lat"; validateSandboxName(OPENCLAW_SANDBOX); validateSandboxName(HERMES_SANDBOX); const DEFAULT_NVIDIA_MODEL = "nvidia/nemotron-3-super-120b-a12b"; diff --git a/test/e2e/live/bedrock-runtime-compatible-anthropic.test.ts b/test/e2e/live/bedrock-runtime-compatible-anthropic.test.ts index a4101623014..ed3ba583e04 100644 --- a/test/e2e/live/bedrock-runtime-compatible-anthropic.test.ts +++ b/test/e2e/live/bedrock-runtime-compatible-anthropic.test.ts @@ -69,7 +69,8 @@ const BEDROCK_MODEL = const COMPATIBLE_KEY = process.env.NEMOCLAW_BEDROCK_RUNTIME_FAKE_KEY ?? "fake-pasted-bedrock-runtime-key-e2e"; const AGENT = process.env.NEMOCLAW_AGENT ?? "openclaw"; -const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? `e2e-bedrock-${AGENT}`; +const SANDBOX_NAME = + process.env.NEMOCLAW_SANDBOX_NAME ?? (AGENT === "hermes" ? "e2e-hm-bedrock" : "e2e-oc-bedrock"); const ONBOARD_TIMEOUT_MS = 30 * 60_000; const TEST_TIMEOUT_MS = 60 * 60_000; const SANDBOX_TIMEOUT_MS = 180_000; diff --git a/test/e2e/live/channels-add-remove.test.ts b/test/e2e/live/channels-add-remove.test.ts index 6d61eb48949..8ad46ce07eb 100644 --- a/test/e2e/live/channels-add-remove.test.ts +++ b/test/e2e/live/channels-add-remove.test.ts @@ -22,7 +22,7 @@ import type { ShellProbeResult } from "../fixtures/shell-probe.ts"; // registry/gateway/policy/in-sandbox state, then remove Telegram and rebuild // back to a clean state. -const TEST_SANDBOX_PREFIX = "e2e-channels-add-remove"; +const TEST_SANDBOX_PREFIX = "e2e-ch-add-remove"; const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? TEST_SANDBOX_PREFIX; validateSandboxName(SANDBOX_NAME); diff --git a/test/e2e/live/channels-stop-start-googlechat-entry.ts b/test/e2e/live/channels-stop-start-googlechat-entry.ts index 1c7b4e58c61..5d24975db84 100644 --- a/test/e2e/live/channels-stop-start-googlechat-entry.ts +++ b/test/e2e/live/channels-stop-start-googlechat-entry.ts @@ -40,7 +40,7 @@ export async function addGooglechatForChannelsStopStartLiveE2e( input: GooglechatLiveE2eComposition, dependencies: GooglechatLiveE2eDependencies = DEFAULT_DEPENDENCIES, ): Promise { - assertChannelsStopStartSandboxName(input.sandboxName); + assertChannelsStopStartSandboxName(input.sandboxName, "openclaw"); const audience = input.audience.trim(); if (!audience) { throw new Error("GOOGLECHAT_AUDIENCE is required for the channels-stop-start live target"); diff --git a/test/e2e/live/channels-stop-start-helpers.ts b/test/e2e/live/channels-stop-start-helpers.ts index f28d0e5fa3f..cc916f91f05 100644 --- a/test/e2e/live/channels-stop-start-helpers.ts +++ b/test/e2e/live/channels-stop-start-helpers.ts @@ -32,8 +32,10 @@ const AGENT = (process.env.NEMOCLAW_CHANNELS_STOP_START_AGENT ?? if (AGENT !== "openclaw" && AGENT !== "hermes") { throw new Error(`NEMOCLAW_CHANNELS_STOP_START_AGENT must be openclaw or hermes, got ${AGENT}`); } -const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? `e2e-channels-stop-start-${AGENT}`; -assertChannelsStopStartSandboxName(SANDBOX_NAME); +const SANDBOX_NAME = + process.env.NEMOCLAW_SANDBOX_NAME ?? + (AGENT === "openclaw" ? "e2e-oc-ch-cycle" : "e2e-hm-ch-cycle"); +assertChannelsStopStartSandboxName(SANDBOX_NAME, AGENT); const REGISTRY_FILE = path.join(process.env.HOME ?? os.homedir(), ".nemoclaw", "sandboxes.json"); // Google Chat is OpenClaw-only; Teams remains supported on both agent arms. const BASE_CHANNELS = ["telegram", "discord", "wechat", "slack", "whatsapp", "teams"] as const; diff --git a/test/e2e/live/channels-stop-start-safety.ts b/test/e2e/live/channels-stop-start-safety.ts index 2e65c146528..7a1b63bea24 100644 --- a/test/e2e/live/channels-stop-start-safety.ts +++ b/test/e2e/live/channels-stop-start-safety.ts @@ -1,12 +1,19 @@ // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 -export const CHANNELS_STOP_START_SANDBOX_PREFIX = "e2e-channels-stop-start-"; +export const CHANNELS_STOP_START_SANDBOX_PREFIXES = Object.freeze({ + openclaw: "e2e-oc-ch-", + hermes: "e2e-hm-ch-", +}); -export function assertChannelsStopStartSandboxName(sandboxName: string): void { - if (!sandboxName.startsWith(CHANNELS_STOP_START_SANDBOX_PREFIX)) { +export function assertChannelsStopStartSandboxName( + sandboxName: string, + agent: keyof typeof CHANNELS_STOP_START_SANDBOX_PREFIXES, +): void { + const prefix = CHANNELS_STOP_START_SANDBOX_PREFIXES[agent]; + if (!sandboxName.startsWith(prefix)) { throw new Error( - `channels-stop-start live test is destructive and only accepts sandbox names with prefix ${CHANNELS_STOP_START_SANDBOX_PREFIX}; got ${sandboxName}`, + `channels-stop-start live test is destructive and only accepts ${agent} sandbox names with prefix ${prefix}; got ${sandboxName}`, ); } } diff --git a/test/e2e/live/common-egress-agent.test.ts b/test/e2e/live/common-egress-agent.test.ts index ef4ed62a2b0..7d83e2124b0 100644 --- a/test/e2e/live/common-egress-agent.test.ts +++ b/test/e2e/live/common-egress-agent.test.ts @@ -41,12 +41,10 @@ import { stripAnsi } from "./json-envelope.ts"; // one bash script, not a new shared e2e framework. const OPENCLAW_BALANCED_SANDBOX = - process.env.NEMOCLAW_COMMON_EGRESS_OPENCLAW_BALANCED_SANDBOX ?? - "e2e-common-egress-openclaw-balanced"; + process.env.NEMOCLAW_COMMON_EGRESS_OPENCLAW_BALANCED_SANDBOX ?? "e2e-oc-bal"; const OPENCLAW_OPEN_SANDBOX = - process.env.NEMOCLAW_COMMON_EGRESS_OPENCLAW_OPEN_SANDBOX ?? "e2e-common-egress-openclaw-open"; -const HERMES_SANDBOX = - process.env.NEMOCLAW_COMMON_EGRESS_HERMES_SANDBOX ?? "e2e-common-egress-hermes-open"; + process.env.NEMOCLAW_COMMON_EGRESS_OPENCLAW_OPEN_SANDBOX ?? "e2e-oc-open"; +const HERMES_SANDBOX = process.env.NEMOCLAW_COMMON_EGRESS_HERMES_SANDBOX ?? "e2e-hm-open"; const CHAT_MODEL = process.env.NEMOCLAW_MODEL ?? "nvidia/nemotron-3-super-120b-a12b"; const ONBOARD_TIMEOUT_MS = 25 * 60_000; const TEST_TIMEOUT_MS = 40 * 60_000; diff --git a/test/e2e/live/dashboard-remote-bind.test.ts b/test/e2e/live/dashboard-remote-bind.test.ts index 733ff10afcd..ac4c55c5627 100644 --- a/test/e2e/live/dashboard-remote-bind.test.ts +++ b/test/e2e/live/dashboard-remote-bind.test.ts @@ -17,7 +17,7 @@ import { parseJsonFromText } from "./json-envelope.ts"; const runDashboardRemoteBindTest = process.env.NEMOCLAW_E2E_DASHBOARD_REMOTE_BIND === "1" ? test : test.skip; -const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME || "e2e-dashboard-remote-bind"; +const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME || "e2e-dashboard-bind"; const TEST_TIMEOUT_MS = 50 * 60_000; function testEnv(extra: NodeJS.ProcessEnv = {}): NodeJS.ProcessEnv { diff --git a/test/e2e/live/gpu-double-onboard.test.ts b/test/e2e/live/gpu-double-onboard.test.ts index 5a57983a02e..cad6012c016 100644 --- a/test/e2e/live/gpu-double-onboard.test.ts +++ b/test/e2e/live/gpu-double-onboard.test.ts @@ -17,7 +17,7 @@ import { expect, test } from "../fixtures/e2e-test.ts"; import { CLI_ENTRYPOINT, REPO_ROOT } from "../fixtures/paths.ts"; import type { ShellProbeResult } from "../fixtures/shell-probe.ts"; -const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? "e2e-gpu-double-onboard"; +const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? "e2e-gpu-double"; const PROXY_PORT = process.env.NEMOCLAW_OLLAMA_PROXY_PORT ?? "11435"; const GPU_E2E_MODEL = process.env.NEMOCLAW_MODEL ?? "qwen3.5:9b"; const TOKEN_FILE = path.join(os.homedir(), ".nemoclaw", "ollama-proxy-token"); diff --git a/test/e2e/live/hermes-gpu-startup.test.ts b/test/e2e/live/hermes-gpu-startup.test.ts index 2bcf9d0dd71..dd989d6dcdc 100644 --- a/test/e2e/live/hermes-gpu-startup.test.ts +++ b/test/e2e/live/hermes-gpu-startup.test.ts @@ -40,7 +40,6 @@ exec node -e 'const { cleanupGatewayAfterLastSandbox } = require(process.argv[1] `; const GATEWAY_ALREADY_ABSENT = /gateway[^\n]*(?:does not exist|not found)|No (?:active )?gateway|No gateway metadata found/i; -const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? "e2e-hermes-gpu-startup"; const FAKE_API_KEY = "e2e-hermes-gpu-startup-key"; const FAKE_MODEL = "test-model"; const EXTRA_PLACEHOLDER_TOKEN_A = "e2e-hermes-gpu-extra-telegram-token"; @@ -50,6 +49,13 @@ const { route: GPU_ROUTE, scenario: GPU_STARTUP_SCENARIO } = resolveHermesGpuSta process.env.E2E_HERMES_GPU_STARTUP_SCENARIO, process.env.NEMOCLAW_DOCKER_GPU_PATCH === "1", ); +const SANDBOX_NAME = + process.env.NEMOCLAW_SANDBOX_NAME ?? + (GPU_STARTUP_SCENARIO === "fallback" + ? "e2e-hgpu-fallback" + : GPU_STARTUP_SCENARIO === "compatibility-only" + ? "e2e-hgpu-compat" + : "e2e-hgpu-native"); const GPU_ROUTE_CONTROL = GPU_ROUTE === "compatibility-only" ? "1" diff --git a/test/e2e/live/hermes-inference-switch-helpers.ts b/test/e2e/live/hermes-inference-switch-helpers.ts index 95bd9219ecb..b069f03a29d 100644 --- a/test/e2e/live/hermes-inference-switch-helpers.ts +++ b/test/e2e/live/hermes-inference-switch-helpers.ts @@ -50,7 +50,7 @@ import { export { REPO_ROOT }; export const CLI = CLI_ENTRYPOINT; -export const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? "e2e-hermes-inference-switch"; +export const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? "e2e-hm-inf-switch"; validateSandboxName(SANDBOX_NAME); const USE_COMPATIBLE_HOSTED = process.env.NEMOCLAW_E2E_USE_HOSTED_INFERENCE === "1"; export const SWITCH_PROVIDER = diff --git a/test/e2e/live/inference-routing-helpers.ts b/test/e2e/live/inference-routing-helpers.ts index ff4f6cf46f8..a576101b35f 100644 --- a/test/e2e/live/inference-routing-helpers.ts +++ b/test/e2e/live/inference-routing-helpers.ts @@ -68,7 +68,7 @@ function hasRawNodeStackTrace(text: string): boolean { } function inferenceSandboxName(prefix: string): string { - const name = `${prefix}-${process.pid}`; + const name = `${prefix}-${process.pid.toString(36)}`; validateSandboxName(name); return name; } diff --git a/test/e2e/live/inference-routing-provider-smoke.test.ts b/test/e2e/live/inference-routing-provider-smoke.test.ts index 2c748e44d6d..4f0239ea61e 100644 --- a/test/e2e/live/inference-routing-provider-smoke.test.ts +++ b/test/e2e/live/inference-routing-provider-smoke.test.ts @@ -45,7 +45,7 @@ test("TC-INF-05 real NVIDIA key is isolated from sandbox env, process list, and secrets.optional("NVIDIA_INFERENCE_API_KEY") ?? skipLive(skip, "NVIDIA_INFERENCE_API_KEY not set — cannot test credential isolation"); await requireLivePrerequisites(host, skip); - const sandboxName = inferenceSandboxName("e2e-inf-cred"); + const sandboxName = inferenceSandboxName("e2e-cred"); cleanup.add(`best-effort inference-routing credential-isolation cleanup for ${sandboxName}`, () => cleanupSandbox(host, sandbox, sandboxName), ); @@ -274,7 +274,7 @@ test("TC-INF-03 Anthropic provider responds through inference.local", { const apiKey = secrets.optional("ANTHROPIC_API_KEY") ?? skipLive(skip, "ANTHROPIC_API_KEY not set"); await requireLivePrerequisites(host, skip); - const sandboxName = inferenceSandboxName("e2e-anthropic"); + const sandboxName = inferenceSandboxName("e2e-anth"); const model = process.env.NEMOCLAW_ANTHROPIC_MODEL || "claude-sonnet-4-6"; cleanup.add(`best-effort inference-routing Anthropic cleanup for ${sandboxName}`, () => cleanupSandbox(host, sandbox, sandboxName), diff --git a/test/e2e/live/inference-routing.test.ts b/test/e2e/live/inference-routing.test.ts index ee958ed60f5..ff2b250b468 100644 --- a/test/e2e/live/inference-routing.test.ts +++ b/test/e2e/live/inference-routing.test.ts @@ -55,7 +55,7 @@ test("TC-INF-06 invalid API key fails with credential classification and cleanup }, }, async ({ artifacts, cleanup, host, progress, sandbox, skip }) => { await requireLivePrerequisites(host, skip); - const sandboxName = inferenceSandboxName("e2e-invalid-key"); + const sandboxName = inferenceSandboxName("e2e-badkey"); cleanup.add(`remove inference-routing invalid-key residue for ${sandboxName}`, () => cleanupSandbox(host, sandbox, sandboxName), ); @@ -106,7 +106,7 @@ test("TC-INF-07 unreachable endpoint fails with transport classification and cle }, }, async ({ artifacts, cleanup, host, progress, sandbox, skip }) => { await requireLivePrerequisites(host, skip); - const sandboxName = inferenceSandboxName("e2e-unreachable"); + const sandboxName = inferenceSandboxName("e2e-unreach"); cleanup.add(`remove inference-routing unreachable residue for ${sandboxName}`, () => cleanupSandbox(host, sandbox, sandboxName), ); @@ -344,7 +344,7 @@ async function runRuntimeIdentityE2EScenario( const model = "nemoclaw-e2e-runtime-identity"; const inferenceKey = "sk-runtime-identity-TEST-NOT-A-REAL-VALUE"; - const sandboxName = inferenceSandboxName(`e2e-${scenario.testId.toLowerCase()}`); + const sandboxName = inferenceSandboxName(`e2e-i${scenario.testId.slice(-2)}`); const providerType = scenario.providerType; const providerName = `e2e-${scenario.providerType}-${String(process.pid)}`; const credentialKey = scenario.credentialKey; @@ -1005,7 +1005,7 @@ test("TC-INF-09 Deep Agents Code uses a local compatible endpoint through infere const model = "nemoclaw-e2e-compatible"; const apiKey = "sk-compatible-TEST-NOT-A-REAL-VALUE"; await requireLivePrerequisites(host, skip); - const sandboxName = inferenceSandboxName("e2e-compat-ep"); + const sandboxName = inferenceSandboxName("e2e-compat"); cleanup.add(`best-effort inference-routing compatible-endpoint cleanup for ${sandboxName}`, () => cleanupSandbox(host, sandbox, sandboxName), ); @@ -1149,7 +1149,7 @@ test("TC-INF-11 DNS-backed HTTPS custom endpoint routes through the local pinnin await requireLivePrerequisites(host, skip); const model = "nemoclaw-e2e-https-pin"; const apiKey = "sk-https-pin-TEST-NOT-A-REAL-VALUE"; - const sandboxName = inferenceSandboxName("e2e-https-pin"); + const sandboxName = inferenceSandboxName("e2e-https"); cleanup.add(`best-effort inference-routing https-pin cleanup for ${sandboxName}`, () => cleanupSandbox(host, sandbox, sandboxName), ); diff --git a/test/e2e/live/issue-4434-tui-unreachable-inference.test.ts b/test/e2e/live/issue-4434-tui-unreachable-inference.test.ts index caf3c92cf62..eea578adce2 100644 --- a/test/e2e/live/issue-4434-tui-unreachable-inference.test.ts +++ b/test/e2e/live/issue-4434-tui-unreachable-inference.test.ts @@ -31,7 +31,7 @@ import { const DOCKERFILE_BASE = path.join(REPO_ROOT, "Dockerfile.base"); const ENVIRONMENT = ubuntuRepoDocker("cloud-openclaw"); -const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? "e2e-issue-4434-tui-unreachable"; +const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? "e2e-issue-4434"; validateSandboxName(SANDBOX_NAME); const INFERENCE_MODELS_URL = "https://inference-api.nvidia.com/v1/models"; diff --git a/test/e2e/live/launchable-smoke.test.ts b/test/e2e/live/launchable-smoke.test.ts index 4a3513b442c..e0816bbacf3 100644 --- a/test/e2e/live/launchable-smoke.test.ts +++ b/test/e2e/live/launchable-smoke.test.ts @@ -32,7 +32,7 @@ const BOOTSTRAP_SENTINEL = "/var/run/nemoclaw-launchable-ready"; const MODEL = process.env.NEMOCLAW_MODEL ?? process.env.NEMOCLAW_COMPAT_MODEL ?? DEFAULT_HOSTED_INFERENCE_MODEL; const EXPECTED_ROUTE_PROVIDER = HOSTED_INFERENCE_PROVIDER_NAME; -const DEFAULT_SANDBOX_NAME = `e2e-bootstrap-${randomUUID().slice(0, 8)}`; +const DEFAULT_SANDBOX_NAME = `e2e-boot-${randomUUID().slice(0, 8)}`; const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? DEFAULT_SANDBOX_NAME; const TEST_TIMEOUT_MS = 30 * 60_000; const INSTALL_TIMEOUT_MS = 30 * 60_000; diff --git a/test/e2e/live/managed-image-protected-runtime-helpers.ts b/test/e2e/live/managed-image-protected-runtime-helpers.ts index 4ef2bd7d13b..e2d46405113 100644 --- a/test/e2e/live/managed-image-protected-runtime-helpers.ts +++ b/test/e2e/live/managed-image-protected-runtime-helpers.ts @@ -6,6 +6,7 @@ import fs from "node:fs"; import path from "node:path"; import { + MANAGED_IMAGE_PROTECTED_SANDBOX_PREFIX, type ManagedImageLocalInferenceKind, managedImageProtectedSandboxName, PROTECTED_MANAGED_IMAGE_AGENTS, @@ -321,7 +322,7 @@ async function proveOwnedRuntimeInventoryClean(host: HostCliClient): Promise): string { return [result.stdout, result.stderr].filter(Boolean).join("\n"); diff --git a/test/e2e/live/openclaw-discord-pairing.test.ts b/test/e2e/live/openclaw-discord-pairing.test.ts index 9b0b7cb8a3b..26cdba73be5 100644 --- a/test/e2e/live/openclaw-discord-pairing.test.ts +++ b/test/e2e/live/openclaw-discord-pairing.test.ts @@ -29,7 +29,7 @@ import { trackSandboxCleanup, } from "./phase6-messaging-helpers.ts"; -const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? "e2e-openclaw-discord-pairing"; +const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? "e2e-oc-disc-pair"; const DISCORD_TOKEN = process.env.DISCORD_BOT_TOKEN ?? "test-fake-discord-pairing-e2e"; const LIVE_TIMEOUT_MS = 55 * 60_000; diff --git a/test/e2e/live/openclaw-inference-switch.test.ts b/test/e2e/live/openclaw-inference-switch.test.ts index 01510128cf1..805c7cac972 100644 --- a/test/e2e/live/openclaw-inference-switch.test.ts +++ b/test/e2e/live/openclaw-inference-switch.test.ts @@ -56,8 +56,7 @@ import { requirePublicNvidiaSwitchKey, } from "./public-nvidia-switch-provider.ts"; -const SANDBOX_NAME = - process.env.NEMOCLAW_SANDBOX_NAME ?? uniqueSandboxName("e2e-openclaw-inference-switch"); +const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? "e2e-oc-inf-switch"; const SWITCH_PROVIDER = process.env.NEMOCLAW_SWITCH_PROVIDER ?? PUBLIC_NVIDIA_SWITCH_PROVIDER; const SWITCH_MODEL = process.env.NEMOCLAW_SWITCH_MODEL ?? PUBLIC_NVIDIA_SWITCH_MODEL; const SWITCH_INFERENCE_API = process.env.NEMOCLAW_SWITCH_INFERENCE_API ?? "openai-completions"; @@ -206,10 +205,6 @@ function sleep(ms: number): Promise { return new Promise((resolve) => setTimeout(resolve, ms)); } -function uniqueSandboxName(prefix: string): string { - return `${prefix}-${process.pid}-${Date.now()}`; -} - function parsePortEnv(name: string, fallback: number): number { const raw = process.env[name]; if (!raw) return fallback; diff --git a/test/e2e/live/openclaw-plugin-runtime-exdev.test.ts b/test/e2e/live/openclaw-plugin-runtime-exdev.test.ts index 0524c42ac7a..669a98f023e 100644 --- a/test/e2e/live/openclaw-plugin-runtime-exdev.test.ts +++ b/test/e2e/live/openclaw-plugin-runtime-exdev.test.ts @@ -89,7 +89,7 @@ const RELEASE_BUILDER_IMAGE_REF = const CURRENT_BUILDER_IMAGE_REF = "node:22-trixie-slim@sha256:e6d9a389d34ff9678438af985c9913fbd1eb6ed36e80fea56644f4b4f6dd70ba"; const TOOL_DISCLOSURE_ENV_REFERENCE = "${NEMOCLAW_TOOL_DISCLOSURE}"; -const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? "e2e-openclaw-plugin-exdev"; +const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? "e2e-oc-exdev"; const ONBOARD_TIMEOUT_MS = 25 * 60_000; const PROBE_TIMEOUT_MS = 60_000; const EXDEV_TMPFS_MOUNT = "/tmp/nemoclaw-exdev-tmpfs"; diff --git a/test/e2e/live/openclaw-skill-cli.test.ts b/test/e2e/live/openclaw-skill-cli.test.ts index 0014c6d6457..e9d5ebb34ca 100644 --- a/test/e2e/live/openclaw-skill-cli.test.ts +++ b/test/e2e/live/openclaw-skill-cli.test.ts @@ -24,7 +24,7 @@ import type { ShellProbeResult } from "../fixtures/shell-probe.ts"; // onboard a Docker/OpenShell sandbox, execute OpenClaw's skills CLI inside the // sandbox, and verify install/list/info/check agree on the workspace skill path. -const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? "e2e-openclaw-skill-cli"; +const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? "e2e-oc-skill-cli"; const SKILL_ID = "openclaw-skill-cli-fixture"; const SKILL_DESCRIPTION = "E2E fixture proving openclaw skills install + list roundtrip"; const REMOTE_SKILL_DIR = `/tmp/${SKILL_ID}`; diff --git a/test/e2e/live/openclaw-slack-pairing.test.ts b/test/e2e/live/openclaw-slack-pairing.test.ts index 782b80468af..549beaf6d10 100644 --- a/test/e2e/live/openclaw-slack-pairing.test.ts +++ b/test/e2e/live/openclaw-slack-pairing.test.ts @@ -27,7 +27,7 @@ import { trackSandboxCleanup, } from "./phase6-messaging-helpers.ts"; -const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? "e2e-openclaw-slack-pairing"; +const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? "e2e-oc-slack-pair"; const SLACK_BOT_TOKEN = process.env.SLACK_BOT_TOKEN ?? "xoxb-fake-slack-pairing-e2e"; const SLACK_APP_TOKEN = process.env.SLACK_APP_TOKEN ?? "xapp-fake-slack-pairing-e2e"; const LIVE_TIMEOUT_MS = 55 * 60_000; diff --git a/test/e2e/live/openclaw-tui-chat-correlation.test.ts b/test/e2e/live/openclaw-tui-chat-correlation.test.ts index 6b61a602330..f35a373ffa7 100644 --- a/test/e2e/live/openclaw-tui-chat-correlation.test.ts +++ b/test/e2e/live/openclaw-tui-chat-correlation.test.ts @@ -57,7 +57,7 @@ import { // `from(env) → from(state, instance)` model. const ENVIRONMENT = ubuntuRepoDocker("cloud-openclaw"); -const SANDBOX_NAME = "e2e-openclaw-tui-corr"; +const SANDBOX_NAME = "e2e-oc-tui-corr"; // OpenClaw 2026.7.1 is the post-fix regression-guard version for #2603 + #3145. // Historical buggy builds were older; this live guard asserts the fixed // protocol/history contract stays stable on the pinned OpenClaw version. diff --git a/test/e2e/live/openshell-credential-generation-window.test.ts b/test/e2e/live/openshell-credential-generation-window.test.ts index aadb9848168..70a48590592 100644 --- a/test/e2e/live/openshell-credential-generation-window.test.ts +++ b/test/e2e/live/openshell-credential-generation-window.test.ts @@ -36,7 +36,7 @@ import { OPENSHELL_RETAINED_CREDENTIAL_GENERATIONS, } from "./openshell-credential-generation-window.ts"; -const SANDBOX_NAME = "e2e-mcp-credential-window"; +const SANDBOX_NAME = "e2e-cred-window"; const SERVER_NAME = "fake"; const COMPATIBLE_KEY = MCP_BRIDGE_TEST_CREDENTIALS.compatibleEndpoint; const COMPATIBLE_MODEL = "mock/mcp-credential-window"; @@ -434,7 +434,7 @@ test("openshell-credential-generation-window", { }); expectExitZero(status, "inspect credential-window MCP bridge"); const providerName = (JSON.parse(status.stdout) as { provider: { name: string } }).provider.name; - expect(providerName).toMatch(/^e2e-mcp-credential-window-mcp-fake-[a-f0-9]{16}$/u); + expect(providerName).toMatch(/^e2e-cred-window-mcp-fake-[a-f0-9]{16}$/u); const originalRevision = await observeFreshRevision( sandbox, diff --git a/test/e2e/live/openshell-gateway-upgrade.test.ts b/test/e2e/live/openshell-gateway-upgrade.test.ts index 60cb61ef529..8e4e21adbcf 100644 --- a/test/e2e/live/openshell-gateway-upgrade.test.ts +++ b/test/e2e/live/openshell-gateway-upgrade.test.ts @@ -89,15 +89,7 @@ const { sandboxBaseDigest: OLD_SANDBOX_BASE_DIGEST } = validateLegacyGatewayUpgr sandboxBaseImageRef: OLD_SANDBOX_BASE_IMAGE_REF, }); const SURVIVOR_SANDBOX = - process.env.NEMOCLAW_GATEWAY_UPGRADE_SURVIVOR_NAME ?? - [ - "e2e-gateway-upgrade-survivor", - process.env.GITHUB_RUN_ID, - process.env.GITHUB_RUN_ATTEMPT, - process.pid, - ] - .filter(Boolean) - .join("-"); + process.env.NEMOCLAW_GATEWAY_UPGRADE_SURVIVOR_NAME ?? `e2e-gw-${process.pid}`; const SURVIVOR_MARKER = `gateway-upgrade-survivor-${Date.now()}`; const SURVIVOR_MARKER_PATH = "/sandbox/.openclaw/workspace/nemoclaw-gateway-upgrade-marker"; const INSTALLED_AGENT_DB_MARKER = `openclaw-2026-6-agent-db-${Date.now()}`; @@ -113,9 +105,10 @@ const OPENSHELL_TIMEOUT_MS = 2 * 60_000; validateSandboxName(SURVIVOR_SANDBOX); expect( - SURVIVOR_SANDBOX.startsWith("e2e-gateway-upgrade-survivor"), - `openshell-gateway-upgrade live test only accepts survivor sandbox names with prefix e2e-gateway-upgrade-survivor; got ${SURVIVOR_SANDBOX}`, + SURVIVOR_SANDBOX.startsWith("e2e-gw-"), + `openshell-gateway-upgrade live test only accepts survivor sandbox names with prefix e2e-gw-; got ${SURVIVOR_SANDBOX}`, ).toBe(true); +expect(SURVIVOR_SANDBOX.length).toBeLessThanOrEqual(19); const stateUpgradeFixtureExpectations: ReadonlyArray = OPENCLAW_STATE_UPGRADE_PROOF ? [ diff --git a/test/e2e/live/overlayfs-autofix.test.ts b/test/e2e/live/overlayfs-autofix.test.ts index 88555ebe172..d6b636a3f9e 100644 --- a/test/e2e/live/overlayfs-autofix.test.ts +++ b/test/e2e/live/overlayfs-autofix.test.ts @@ -22,11 +22,7 @@ import { negativeOverlayOutcome } from "./overlayfs-autofix-outcome.ts"; // not reproduce that kernel-specific failure). const TEST_SANDBOX_PREFIX = "e2e-overlayfs"; -const SANDBOX_NAME = - process.env.NEMOCLAW_SANDBOX_NAME ?? - [TEST_SANDBOX_PREFIX, process.env.GITHUB_RUN_ID, process.env.GITHUB_RUN_ATTEMPT, process.pid] - .filter(Boolean) - .join("-"); +const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? TEST_SANDBOX_PREFIX; const TEST_TIMEOUT_MS = Number(process.env.NEMOCLAW_E2E_TIMEOUT_SECONDS ?? 1_500) * 1_000; const NEGATIVE_TIMEOUT_SECONDS = Number(process.env.NEMOCLAW_OVERLAYFS_E2E_NEGATIVE_TIMEOUT ?? 300); const GATEWAY_CONTAINER = "openshell-cluster-nemoclaw"; diff --git a/test/e2e/live/rebuild-hermes.test.ts b/test/e2e/live/rebuild-hermes.test.ts index 26f49736367..a1d1ca61b9b 100644 --- a/test/e2e/live/rebuild-hermes.test.ts +++ b/test/e2e/live/rebuild-hermes.test.ts @@ -82,12 +82,8 @@ const HERMES_MANIFEST = path.join(REPO_ROOT, "agents", "hermes", "manifest.yaml" const OLD_HERMES_VERSION = `v${REBUILD_HERMES_OLD_BASE_FIXTURE.hermesCalver}`; const OLD_HERMES_REGISTRY_VERSION = OLD_HERMES_VERSION.slice(1); const STALE_BASE_REBUILD = process.env.NEMOCLAW_HERMES_STALE_BASE_REBUILD_E2E === "1"; -const TEST_SANDBOX_PREFIX = STALE_BASE_REBUILD ? "e2e-rebuild-hermes-base" : "e2e-rebuild-hermes"; -const SANDBOX_NAME = - process.env.NEMOCLAW_SANDBOX_NAME ?? - [TEST_SANDBOX_PREFIX, process.env.GITHUB_RUN_ID, process.env.GITHUB_RUN_ATTEMPT, process.pid] - .filter(Boolean) - .join("-"); +const TEST_SANDBOX_PREFIX = STALE_BASE_REBUILD ? "e2e-rebuild-base" : "e2e-rebuild-hermes"; +const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? TEST_SANDBOX_PREFIX; validateSandboxName(SANDBOX_NAME); SANDBOX_NAME.startsWith(TEST_SANDBOX_PREFIX) || fail( diff --git a/test/e2e/live/rebuild-openclaw.test.ts b/test/e2e/live/rebuild-openclaw.test.ts index 56064bb98bc..44381c8fdb2 100644 --- a/test/e2e/live/rebuild-openclaw.test.ts +++ b/test/e2e/live/rebuild-openclaw.test.ts @@ -40,12 +40,8 @@ const DEFAULT_MODEL = process.env.NEMOCLAW_MODEL ?? process.env.NEMOCLAW_COMPAT_MODEL ?? "nvidia/nvidia/nemotron-3-ultra"; -const TEST_SANDBOX_PREFIX = "e2e-rebuild-openclaw"; -const SANDBOX_NAME = - process.env.NEMOCLAW_SANDBOX_NAME ?? - [TEST_SANDBOX_PREFIX, process.env.GITHUB_RUN_ID, process.env.GITHUB_RUN_ATTEMPT, process.pid] - .filter(Boolean) - .join("-"); +const TEST_SANDBOX_PREFIX = "e2e-rebuild-oc"; +const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? TEST_SANDBOX_PREFIX; validateSandboxName(SANDBOX_NAME); if (!SANDBOX_NAME.startsWith(TEST_SANDBOX_PREFIX)) { throw new Error( diff --git a/test/e2e/live/registry-targets.test.ts b/test/e2e/live/registry-targets.test.ts index 713e34bd28c..f71583dec9b 100644 --- a/test/e2e/live/registry-targets.test.ts +++ b/test/e2e/live/registry-targets.test.ts @@ -49,7 +49,7 @@ const REGISTRY_TARGET_PHASES = [ "record target completion evidence", ] as const; -for (const target of listTargets()) { +for (const [targetIndex, target] of listTargets().entries()) { const support = liveTargetSupport(target); if (!support.supported) { if (SELECTED_TARGET_ID === target.id) { @@ -118,7 +118,9 @@ for (const target of listTargets()) { ? lifecycle.preparePostReboot() : Promise.resolve()); progress.phase("onboard the registry-selected sandbox"); - const instance = await onboard.from(ready, { sandboxName: `e2e-${target.id}` }); + const instance = await onboard.from(ready, { + sandboxName: `e2e-reg-${targetIndex.toString(36)}`, + }); // Lifecycle phase runs between onboard and state-validation. // Targets opt in by setting `environment.lifecycle` to a diff --git a/test/e2e/live/sessions-agents-cli.test.ts b/test/e2e/live/sessions-agents-cli.test.ts index 7da54f07304..bab8916ab49 100644 --- a/test/e2e/live/sessions-agents-cli.test.ts +++ b/test/e2e/live/sessions-agents-cli.test.ts @@ -24,7 +24,7 @@ import { CLI_DIST_ENTRYPOINT, CLI_ENTRYPOINT, REPO_ROOT } from "../fixtures/path import type { ShellProbeResult } from "../fixtures/shell-probe.ts"; import { parseJsonFromText } from "./json-envelope.ts"; -const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? "e2e-sessions-agents-cli"; +const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? "e2e-sessions-cli"; const TEST_AGENT_ID = process.env.NEMOCLAW_E2E_AGENT_ID ?? "work"; const ONBOARD_TIMEOUT_MS = 40 * 60_000; const AGENT_TURN_TIMEOUT_MS = 5 * 60_000; diff --git a/test/e2e/live/spark-install-helpers.ts b/test/e2e/live/spark-install-helpers.ts index fe926ee75bd..b9385b12961 100644 --- a/test/e2e/live/spark-install-helpers.ts +++ b/test/e2e/live/spark-install-helpers.ts @@ -8,7 +8,7 @@ import { validateSandboxName } from "../fixtures/clients/sandbox.ts"; import { redactString } from "../fixtures/redaction.ts"; import type { ShellProbeResult } from "../fixtures/shell-probe.ts"; -export const DEFAULT_SPARK_INSTALL_SANDBOX_NAME = "e2e-spark-install-live"; +export const DEFAULT_SPARK_INSTALL_SANDBOX_NAME = "e2e-spark-install"; export const DEFAULT_INSTALL_URL = "https://www.nvidia.com/nemoclaw.sh"; export type InstallerInvocation = { @@ -33,8 +33,8 @@ function requireSparkInstallContract(condition: boolean, message: string): void export function assertSparkInstallSandboxName(name: string): string { validateSandboxName(name); requireSparkInstallContract( - name.startsWith("e2e-spark-install-"), - `spark install sandbox must use the e2e-spark-install- prefix: ${name}`, + name.startsWith("e2e-spark-"), + `spark install sandbox must use the e2e-spark- prefix: ${name}`, ); return name; } diff --git a/test/e2e/live/telegram-injection.test.ts b/test/e2e/live/telegram-injection.test.ts index c60c8350d72..e1e73bd5cfa 100644 --- a/test/e2e/live/telegram-injection.test.ts +++ b/test/e2e/live/telegram-injection.test.ts @@ -23,7 +23,7 @@ import { trackSandboxCleanup, } from "./phase6-messaging-helpers.ts"; -const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? "e2e-telegram-injection"; +const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? "e2e-tg-injection"; const LIVE_TIMEOUT_MS = 35 * 60_000; function openshellStdinCommand(payload: string, remoteShell: string): string { diff --git a/test/e2e/live/token-rotation.test.ts b/test/e2e/live/token-rotation.test.ts index d2b56685ad3..04627c0465c 100644 --- a/test/e2e/live/token-rotation.test.ts +++ b/test/e2e/live/token-rotation.test.ts @@ -22,7 +22,7 @@ import { CLI_ENTRYPOINT, REPO_ROOT } from "../fixtures/paths.ts"; // upsert, registry credential-hash, sandbox rebuild, and reuse assertions. const REGISTRY_FILE = path.join(process.env.HOME ?? "/tmp", ".nemoclaw", "sandboxes.json"); -const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? `e2e-token-rotation-${process.pid}`; +const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? `e2e-tok-${process.pid}`; validateSandboxName(SANDBOX_NAME); const ONBOARD_TIMEOUT_MS = 25 * 60_000; diff --git a/test/e2e/live/tunnel-lifecycle-helpers.ts b/test/e2e/live/tunnel-lifecycle-helpers.ts index 5ef8dc52d49..d377fe51ea5 100644 --- a/test/e2e/live/tunnel-lifecycle-helpers.ts +++ b/test/e2e/live/tunnel-lifecycle-helpers.ts @@ -21,7 +21,7 @@ import { requireHostedInferenceConfig } from "../fixtures/hosted-inference.ts"; import { REPO_ROOT } from "../fixtures/paths.ts"; import type { ShellProbeResult } from "../fixtures/shell-probe.ts"; -const TEST_SANDBOX_PREFIX = "e2e-tunnel-lifecycle"; +const TEST_SANDBOX_PREFIX = "e2e-tunnel-life"; const SANDBOX_NAME = process.env.NEMOCLAW_SANDBOX_NAME ?? TEST_SANDBOX_PREFIX; const LOCAL_DASHBOARD_PORT = process.env.NEMOCLAW_DASHBOARD_PORT ?? "18789"; const TEST_TIMEOUT_MS = Number(process.env.NEMOCLAW_E2E_TIMEOUT_SECONDS ?? 3_600) * 1_000; diff --git a/test/e2e/support/channels-stop-start-googlechat-entry.test.ts b/test/e2e/support/channels-stop-start-googlechat-entry.test.ts index d62ab68c75a..50e97eebdd4 100644 --- a/test/e2e/support/channels-stop-start-googlechat-entry.test.ts +++ b/test/e2e/support/channels-stop-start-googlechat-entry.test.ts @@ -40,14 +40,14 @@ describe("channels stop/start Google Chat live composition", () => { await addGooglechatForChannelsStopStartLiveE2e( { - sandboxName: "e2e-channels-stop-start-openclaw", + sandboxName: "e2e-oc-ch-cycle", audience: " https://e2e-fake.trycloudflare.com/googlechat ", }, { addSandboxChannel }, ); expect(addSandboxChannel).toHaveBeenCalledWith( - "e2e-channels-stop-start-openclaw", + "e2e-oc-ch-cycle", { channel: "googlechat" }, { googlechatNonInteractiveAudienceCapability: { @@ -68,7 +68,7 @@ describe("channels stop/start Google Chat live composition", () => { }, { addSandboxChannel }, ), - ).rejects.toThrow(/only accepts sandbox names with prefix/); + ).rejects.toThrow(/only accepts openclaw sandbox names with prefix e2e-oc-ch-/); expect(addSandboxChannel).not.toHaveBeenCalled(); }); @@ -78,7 +78,7 @@ describe("channels stop/start Google Chat live composition", () => { await expect( addGooglechatForChannelsStopStartLiveE2e( { - sandboxName: "e2e-channels-stop-start-openclaw", + sandboxName: "e2e-oc-ch-cycle", audience: " ", }, { addSandboxChannel }, diff --git a/test/e2e/support/dashboard-remote-bind-env.test.ts b/test/e2e/support/dashboard-remote-bind-env.test.ts index 5875f12f1f9..8d7a89b2279 100644 --- a/test/e2e/support/dashboard-remote-bind-env.test.ts +++ b/test/e2e/support/dashboard-remote-bind-env.test.ts @@ -11,21 +11,21 @@ import { describe("dashboard remote-bind E2E environment", () => { it("prepares remote dashboard exposure during install and onboarding", () => { - const env = buildDashboardRemoteBindEnv("e2e-dashboard-remote-bind", { + const env = buildDashboardRemoteBindEnv("e2e-dashboard-bind", { NVIDIA_INFERENCE_API_KEY: "test-key", }); expect(env).toMatchObject({ NEMOCLAW_DASHBOARD_BIND: "0.0.0.0", NEMOCLAW_RECREATE_SANDBOX: "1", - NEMOCLAW_SANDBOX_NAME: "e2e-dashboard-remote-bind", + NEMOCLAW_SANDBOX_NAME: "e2e-dashboard-bind", NVIDIA_INFERENCE_API_KEY: "test-key", }); expect(env.PATH).toContain(buildAvailabilityProbeEnv().PATH); }); it("does not allow command overlays to disable remote exposure preparation", () => { - const env = buildDashboardRemoteBindEnv("e2e-dashboard-remote-bind", { + const env = buildDashboardRemoteBindEnv("e2e-dashboard-bind", { NEMOCLAW_DASHBOARD_BIND: "127.0.0.1", }); @@ -40,7 +40,7 @@ describe("dashboard remote-bind E2E environment", () => { stdout: "\u001B[32m✓\u001B[0m Dashboard port forward re-established.\n", stderr: "client_loop: send disconnect: Broken pipe\n", }, - "e2e-dashboard-remote-bind", + "e2e-dashboard-bind", "18789", ), ).toBe(true); @@ -54,7 +54,7 @@ describe("dashboard remote-bind E2E environment", () => { stdout: "Connecting to sandbox...\n", stderr: "", }, - "e2e-dashboard-remote-bind", + "e2e-dashboard-bind", "18789", ), ).toBe(false); diff --git a/test/e2e/support/e2e-clients.test.ts b/test/e2e/support/e2e-clients.test.ts index 629e143e31f..fe8bc150bd3 100644 --- a/test/e2e/support/e2e-clients.test.ts +++ b/test/e2e/support/e2e-clients.test.ts @@ -18,6 +18,7 @@ import { type TrustedSandboxShellScript, trustedProviderEndpoint, trustedSandboxShellScript, + validateSandboxName, } from "../fixtures/clients/index.ts"; import type { ShellProbeResult, @@ -75,6 +76,23 @@ class FakeRunner implements CommandRunner { } describe("E2E fixture clients", () => { + it("enforces the OpenShell 0.0.99 sandbox identity boundary (#8497)", () => { + expect(() => validateSandboxName("a234567890123456789")).not.toThrow(); + + for (const invalidName of [ + "a2345678901234567890", + "e2e--sandbox", + "1e2e-sandbox", + "E2e-sandbox", + "e2e.sandbox", + "e2e_sandbox", + ]) { + expect(() => validateSandboxName(invalidName), invalidName).toThrow( + /sandbox name is invalid for fixture client/, + ); + } + }); + it("host client runs the configured NemoClaw CLI", async () => { const runner = new FakeRunner(); runner.stdout = "nemoclaw 0.1.0\n"; diff --git a/test/e2e/support/e2e-report-to-pr-workflow-boundary.test.ts b/test/e2e/support/e2e-report-to-pr-workflow-boundary.test.ts index a9e7d81308b..eca81f0af45 100644 --- a/test/e2e/support/e2e-report-to-pr-workflow-boundary.test.ts +++ b/test/e2e/support/e2e-report-to-pr-workflow-boundary.test.ts @@ -8,7 +8,6 @@ import path from "node:path"; import { expect, it, vi } from "vitest"; import YAML from "yaml"; -import { testTimeout } from "../../helpers/timeouts"; import { type CredentialFreeTestMatrixRow, discoverCredentialFreeTests, @@ -24,6 +23,7 @@ import { } from "../../../tools/e2e/report-e2e-results.mts"; import { validateE2eWorkflowBoundary } from "../../../tools/e2e/workflow-boundary.mts"; import { buildE2eWorkflowPlan } from "../../../tools/e2e/workflow-plan.mts"; +import { testTimeout } from "../../helpers/timeouts"; import { requireFixture } from "./require-fixture"; function readWorkflow(): Record { @@ -764,7 +764,7 @@ it("reports one total wall clock span when matrix job names start with their job { completed_at: "2026-07-15T04:56:38Z", conclusion: "success", - name: "hermes-inference-switch (anthropic, e2e-hermes-anthropic-inference-switch, compatible-anthropic-e...", + name: "hermes-inference-switch (anthropic, e2e-hm-inf-switch, compatible-anthropic-e...", started_at: "2026-07-15T04:49:26Z", status: "completed", }, diff --git a/test/e2e/support/e2e-workflow.test.ts b/test/e2e/support/e2e-workflow.test.ts index 3e0bb2327b6..a8866977c17 100644 --- a/test/e2e/support/e2e-workflow.test.ts +++ b/test/e2e/support/e2e-workflow.test.ts @@ -24,15 +24,14 @@ import { requireFixture } from "./require-fixture"; describe("e2e workflow boundary", () => { it("guards channels-stop-start destructive cleanup to test-owned sandboxes", () => { - expect(() => assertChannelsStopStartSandboxName("personal-dev")).toThrow( - /only accepts sandbox names with prefix e2e-channels-stop-start-/, + expect(() => assertChannelsStopStartSandboxName("personal-dev", "openclaw")).toThrow( + /only accepts openclaw sandbox names with prefix e2e-oc-ch-/, + ); + expect(() => assertChannelsStopStartSandboxName("e2e-oc-ch-cycle", "openclaw")).not.toThrow(); + expect(() => assertChannelsStopStartSandboxName("e2e-hm-ch-cycle", "hermes")).not.toThrow(); + expect(() => assertChannelsStopStartSandboxName("e2e-hm-ch-cycle", "openclaw")).toThrow( + /only accepts openclaw sandbox names with prefix e2e-oc-ch-/, ); - expect(() => - assertChannelsStopStartSandboxName("e2e-channels-stop-start-openclaw"), - ).not.toThrow(); - expect(() => - assertChannelsStopStartSandboxName("e2e-channels-stop-start-hermes"), - ).not.toThrow(); }); it("keeps the E2E workflow push-driven, dispatchable, pinned, and artifact-safe", () => { @@ -1377,8 +1376,8 @@ jobs: expect.arrayContaining([ "channels-stop-start job must keep the 90 minute timeout", "channels-stop-start strategy.fail-fast must be false", - "channels-stop-start matrix.agent must be openclaw,hermes", - "channels-stop-start job must derive NEMOCLAW_SANDBOX_NAME from matrix.agent with the e2e-channels-stop-start- prefix", + "channels-stop-start matrix must bind canonical per-agent sandbox names", + "channels-stop-start job must derive NEMOCLAW_SANDBOX_NAME from matrix.sandbox_name", "channels-stop-start job env must not include DOCKER_CONFIG", "channels-stop-start job env must not include NVIDIA_INFERENCE_API_KEY", "channels-stop-start checkout step must set persist-credentials=false", diff --git a/test/e2e/support/openclaw-plugin-runtime-exdev-fixture.test.ts b/test/e2e/support/openclaw-plugin-runtime-exdev-fixture.test.ts index f4427a63fdd..f9e062d7256 100644 --- a/test/e2e/support/openclaw-plugin-runtime-exdev-fixture.test.ts +++ b/test/e2e/support/openclaw-plugin-runtime-exdev-fixture.test.ts @@ -42,7 +42,7 @@ describe("OpenClaw plugin runtime EXDEV current lifecycle", () => { currentLifecycleCommands({ cliEntrypoint: "/repo/bin/nemoclaw.js", dockerfilePath: "/fixture/Dockerfile", - sandboxName: "e2e-openclaw-plugin-exdev", + sandboxName: "e2e-oc-exdev", }), ).toEqual({ onboard: { @@ -70,7 +70,7 @@ describe("OpenClaw plugin runtime EXDEV current lifecycle", () => { "--yes", "--yes-i-accept-third-party-software", "--name", - "e2e-openclaw-plugin-exdev", + "e2e-oc-exdev", "--agent", "openclaw", "--from", @@ -79,7 +79,7 @@ describe("OpenClaw plugin runtime EXDEV current lifecycle", () => { }, restart: { command: "node", - args: ["/repo/bin/nemoclaw.js", "e2e-openclaw-plugin-exdev", "gateway", "restart"], + args: ["/repo/bin/nemoclaw.js", "e2e-oc-exdev", "gateway", "restart"], }, }); expect(CURRENT_LIFECYCLE_PHASES).toEqual([ diff --git a/test/e2e/support/sandbox-name-workflow-boundary.test.ts b/test/e2e/support/sandbox-name-workflow-boundary.test.ts new file mode 100644 index 00000000000..d1a85ceb9a9 --- /dev/null +++ b/test/e2e/support/sandbox-name-workflow-boundary.test.ts @@ -0,0 +1,44 @@ +// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { describe, expect, it } from "vitest"; + +import { + resolveWorkflowSandboxIdentities, + validateWorkflowSandboxNames, +} from "../../../tools/e2e/sandbox-name-workflow-boundary.mts"; +import { readYaml, type Workflow } from "../../helpers/e2e-workflow-contract"; + +const WORKFLOW_PATHS = [ + ".github/workflows/e2e.yaml", + ".github/workflows/regression-e2e.yaml", +] as const; + +describe("live workflow sandbox name boundary", () => { + it.each( + WORKFLOW_PATHS, + )("keeps every literal and matrix-generated sandbox identity canonical in %s (#8497)", (workflowPath) => { + const workflow = readYaml(workflowPath); + const identities = resolveWorkflowSandboxIdentities(workflow); + + expect(identities.length).toBeGreaterThan(0); + expect(validateWorkflowSandboxNames(workflow)).toEqual([]); + }); + + it("rejects overlong and unresolved optional-lane sandbox identities (#8497)", () => { + const workflow = readYaml(".github/workflows/e2e.yaml"); + workflow.jobs["bedrock-runtime-compatible-anthropic"]!.strategy!.matrix = { + include: [ + { agent: "openclaw", sandbox_name: "e2e-overlong-optional-lane" }, + { agent: "hermes" }, + ], + }; + + expect(validateWorkflowSandboxNames(workflow)).toEqual( + expect.arrayContaining([ + expect.stringContaining('invalid sandbox name "e2e-overlong-optional-lane"'), + expect.stringContaining('resolves to invalid sandbox name ""'), + ]), + ); + }); +}); diff --git a/test/e2e/support/security-posture-workflow-boundary.test.ts b/test/e2e/support/security-posture-workflow-boundary.test.ts index 2f2a2434c0d..8ef6ca87ef0 100644 --- a/test/e2e/support/security-posture-workflow-boundary.test.ts +++ b/test/e2e/support/security-posture-workflow-boundary.test.ts @@ -50,7 +50,7 @@ describe("security posture workflow boundary", () => { it("rejects missing agent coverage, mode drift, and broadly scoped credentials", () => { const hermesMatrixEntry = [ " - agent: hermes", - " sandbox_name: e2e-hermes-security-posture", + " sandbox_name: e2e-hm-security", " test_file: test/e2e/live/hermes-e2e.test.ts", "", ].join("\n"); diff --git a/test/e2e/support/spark-install-workflow-boundary.test.ts b/test/e2e/support/spark-install-workflow-boundary.test.ts index 8ffe6df3e02..a6ef06aadec 100644 --- a/test/e2e/support/spark-install-workflow-boundary.test.ts +++ b/test/e2e/support/spark-install-workflow-boundary.test.ts @@ -83,7 +83,7 @@ describe("spark install workflow boundary", () => { "spark-install job must set NEMOCLAW_NON_INTERACTIVE=1", "spark-install job must accept third-party software non-interactively", "spark-install job must set NEMOCLAW_FRESH=1", - "spark-install job must use the stable e2e-spark-install-ci sandbox name", + "spark-install job must use the stable e2e-spark-install sandbox name", "spark-install job must use the cloud provider", "spark-install job must force OPENSHELL_GATEWAY=nemoclaw", "spark-install job env must not include NVIDIA_INFERENCE_API_KEY", diff --git a/test/e2e/support/tunnel-lifecycle-helpers.test.ts b/test/e2e/support/tunnel-lifecycle-helpers.test.ts index 9953ce613b7..ee6613dd1ba 100644 --- a/test/e2e/support/tunnel-lifecycle-helpers.test.ts +++ b/test/e2e/support/tunnel-lifecycle-helpers.test.ts @@ -89,7 +89,7 @@ describe("tunnel lifecycle cleanup registration", () => { expect(result.failures).toEqual([ { - name: "destroy sandbox e2e-tunnel-lifecycle", + name: "destroy sandbox e2e-tunnel-life", message: "docker daemon denied sandbox destroy", }, ]); @@ -139,10 +139,8 @@ describe("tunnel lifecycle cloudflared log attribution", () => { ); try { - expect(getCloudflaredLogPath(logRoot, "e2e-tunnel-lifecycle-current")).toBeUndefined(); - expect(classifyCloudflaredLog(logRoot, "e2e-tunnel-lifecycle-current")).toBe( - "nemoclaw_no_spawn", - ); + expect(getCloudflaredLogPath(logRoot, "e2e-tunnel-life")).toBeUndefined(); + expect(classifyCloudflaredLog(logRoot, "e2e-tunnel-life")).toBe("nemoclaw_no_spawn"); } finally { fs.rmSync(logRoot, { recursive: true, force: true }); } @@ -150,16 +148,14 @@ describe("tunnel lifecycle cloudflared log attribution", () => { it("classifies only the sandbox-specific cloudflared log", () => { const logRoot = fs.mkdtempSync(path.join(os.tmpdir(), "tunnel-lifecycle-logs-")); - const sandboxDir = path.join(logRoot, "nemoclaw-services-e2e-tunnel-lifecycle-current"); + const sandboxDir = path.join(logRoot, "nemoclaw-services-e2e-tunnel-life"); fs.mkdirSync(sandboxDir, { recursive: true }); const sandboxLog = path.join(sandboxDir, "cloudflared.log"); fs.writeFileSync(sandboxLog, "https://current.trycloudflare.com\n"); try { - expect(getCloudflaredLogPath(logRoot, "e2e-tunnel-lifecycle-current")).toBe(sandboxLog); - expect(classifyCloudflaredLog(logRoot, "e2e-tunnel-lifecycle-current")).toBe( - "nemoclaw_capture_bug", - ); + expect(getCloudflaredLogPath(logRoot, "e2e-tunnel-life")).toBe(sandboxLog); + expect(classifyCloudflaredLog(logRoot, "e2e-tunnel-life")).toBe("nemoclaw_capture_bug"); } finally { fs.rmSync(logRoot, { recursive: true, force: true }); } @@ -167,7 +163,7 @@ describe("tunnel lifecycle cloudflared log attribution", () => { it("classifies localhost/origin-refused logs as a NemoClaw local-origin fault", () => { const logRoot = fs.mkdtempSync(path.join(os.tmpdir(), "tunnel-lifecycle-logs-")); - const sandboxDir = path.join(logRoot, "nemoclaw-services-e2e-tunnel-lifecycle-current"); + const sandboxDir = path.join(logRoot, "nemoclaw-services-e2e-tunnel-life"); fs.mkdirSync(sandboxDir, { recursive: true }); fs.writeFileSync( path.join(sandboxDir, "cloudflared.log"), @@ -175,9 +171,7 @@ describe("tunnel lifecycle cloudflared log attribution", () => { ); try { - expect(classifyCloudflaredLog(logRoot, "e2e-tunnel-lifecycle-current")).toBe( - "nemoclaw_local", - ); + expect(classifyCloudflaredLog(logRoot, "e2e-tunnel-life")).toBe("nemoclaw_local"); } finally { fs.rmSync(logRoot, { recursive: true, force: true }); } @@ -185,7 +179,7 @@ describe("tunnel lifecycle cloudflared log attribution", () => { it("classifies representative quick-tunnel registration failures as Cloudflare faults", () => { const logRoot = fs.mkdtempSync(path.join(os.tmpdir(), "tunnel-lifecycle-logs-")); - const sandboxDir = path.join(logRoot, "nemoclaw-services-e2e-tunnel-lifecycle-current"); + const sandboxDir = path.join(logRoot, "nemoclaw-services-e2e-tunnel-life"); fs.mkdirSync(sandboxDir, { recursive: true }); fs.writeFileSync( path.join(sandboxDir, "cloudflared.log"), @@ -193,7 +187,7 @@ describe("tunnel lifecycle cloudflared log attribution", () => { ); try { - expect(classifyCloudflaredLog(logRoot, "e2e-tunnel-lifecycle-current")).toBe("cloudflare"); + expect(classifyCloudflaredLog(logRoot, "e2e-tunnel-life")).toBe("cloudflare"); } finally { fs.rmSync(logRoot, { recursive: true, force: true }); } diff --git a/test/install-openshell-upgrade-prompt.test.ts b/test/install-openshell-upgrade-prompt.test.ts index af0e30e3c62..c4224ff22e8 100644 --- a/test/install-openshell-upgrade-prompt.test.ts +++ b/test/install-openshell-upgrade-prompt.test.ts @@ -104,6 +104,7 @@ function runPreinstallUpgradeGuard( options: { currentBackupSucceeds?: boolean; currentCliAvailable?: boolean; + currentMaxOpenshellVersion?: string; currentMinOpenshellVersion?: string; gatewayDestroySucceeds?: boolean; gatewayProcessStopSucceeds?: boolean; @@ -132,7 +133,7 @@ function runPreinstallUpgradeGuard( fs.mkdirSync(bin, { recursive: true }); fs.writeFileSync( path.join(currentSource, "nemoclaw-blueprint", "blueprint.yaml"), - `min_openshell_version: "${options.currentMinOpenshellVersion ?? "0.0.85"}"\nmax_openshell_version: "0.0.85"\n`, + `min_openshell_version: "${options.currentMinOpenshellVersion ?? "0.0.85"}"\nmax_openshell_version: "${options.currentMaxOpenshellVersion ?? "0.0.85"}"\n`, ); fs.writeFileSync(registry, options.registryJson ?? '{"sandboxes":{"alpha":{"name":"alpha"}}}'); const currentCliAvailable = options.currentCliAvailable === false ? "0" : "1"; @@ -860,6 +861,188 @@ require_reportable_openshell_version`, expect(openshellLog).toBe(""); }); + it("stops before upgrade mutations when a legacy sandbox name exceeds the OpenShell 0.0.99 limit (#8497)", () => { + const incompatibleName = "abcdefghijklmnopqrst"; + const registryJson = JSON.stringify({ + sandboxes: { + [incompatibleName]: { + name: incompatibleName, + nemoclawVersion: "0.0.89", + fromDockerfile: false, + }, + }, + }); + const { result, cliLog, openshellLog, registry } = runPreinstallUpgradeGuard( + { NON_INTERACTIVE: "1" }, + { + currentMaxOpenshellVersion: "0.0.99", + currentMinOpenshellVersion: "0.0.99", + hasOldCli: false, + openshellVersion: "0.0.85", + registryJson, + }, + ); + + const output = result.stdout + result.stderr; + expect(result.status).not.toBe(0); + expect(output).toContain(JSON.stringify(incompatibleName)); + expect(output).toContain("1-19"); + expect(output).toContain("stopped before preparing the current CLI"); + expect(output).toContain("replacement sandbox with a compatible name"); + expect(cliLog).toBe(""); + expect(openshellLog).toBe(""); + expect(registry).toBe(registryJson); + }); + + it("continues the OpenShell 0.0.99 upgrade when an existing sandbox name is exactly 19 characters (#8497)", () => { + const compatibleName = "abcdefghij123456789"; + const { result, cliLog, openshellLog } = runPreinstallUpgradeGuard( + { NON_INTERACTIVE: "1" }, + { + currentMaxOpenshellVersion: "0.0.99", + currentMinOpenshellVersion: "0.0.99", + hasOldCli: false, + openshellVersion: "0.0.85", + registryJson: JSON.stringify({ + sandboxes: { + [compatibleName]: { + name: compatibleName, + nemoclawVersion: "0.0.89", + fromDockerfile: false, + }, + }, + }), + }, + ); + + expect(result.status).toBe(0); + expect(cliLog.split(/\r?\n/)).toContain("current:backup-all"); + expect(openshellLog).toContain("gateway remove nemoclaw"); + }); + + it("escapes an incompatible legacy sandbox name before printing the OpenShell upgrade diagnostic (#8497)", () => { + const incompatibleName = "bad\u202e::error::forged"; + const { result, cliLog, openshellLog } = runPreinstallUpgradeGuard( + { NON_INTERACTIVE: "1" }, + { + currentMaxOpenshellVersion: "0.0.99", + currentMinOpenshellVersion: "0.0.99", + hasOldCli: false, + openshellVersion: "0.0.85", + registryJson: JSON.stringify({ + sandboxes: { + [incompatibleName]: { + name: incompatibleName, + nemoclawVersion: "0.0.89", + fromDockerfile: false, + }, + }, + }), + }, + ); + + const output = result.stdout + result.stderr; + expect(result.status).not.toBe(0); + expect(output).toContain('"bad\\u202e::error::forged"'); + expect(output).not.toContain(incompatibleName); + expect(cliLog).toBe(""); + expect(openshellLog).toBe(""); + }); + + it("stops before upgrade mutations when a legacy sandbox name contains OpenShell's reserved double hyphen (#8497)", () => { + const incompatibleName = "legacy--box"; + const registryJson = JSON.stringify({ + sandboxes: { + [incompatibleName]: { + name: incompatibleName, + nemoclawVersion: "0.0.89", + fromDockerfile: false, + }, + }, + }); + const { result, cliLog, openshellLog, registry } = runPreinstallUpgradeGuard( + { NON_INTERACTIVE: "1" }, + { + currentMaxOpenshellVersion: "0.0.99", + currentMinOpenshellVersion: "0.0.99", + hasOldCli: false, + openshellVersion: "0.0.85", + registryJson, + }, + ); + + const output = result.stdout + result.stderr; + expect(result.status).not.toBe(0); + expect(output).toContain(JSON.stringify(incompatibleName)); + expect(output).toContain("rejects consecutive"); + expect(cliLog).toBe(""); + expect(openshellLog).toBe(""); + expect(registry).toBe(registryJson); + }); + + it("ignores an incompatible route-only reservation during the OpenShell name preflight (#8497)", () => { + const routeOnlyName = "route-only-reservation-name"; + const { result, cliLog, openshellLog } = runPreinstallUpgradeGuard( + { NON_INTERACTIVE: "1" }, + { + currentMaxOpenshellVersion: "0.0.99", + currentMinOpenshellVersion: "0.0.99", + openshellVersion: "0.0.85", + registryJson: JSON.stringify({ + sandboxes: { + [routeOnlyName]: { + name: routeOnlyName, + pendingRouteReservation: true, + }, + }, + }), + }, + ); + + expect(result.status).toBe(0); + expect(result.stdout).toContain("RESTORE="); + expect(cliLog).toBe(""); + expect(openshellLog).toBe(""); + }); + + it("ignores an incompatible legacy name owned by a different gateway during the OpenShell preflight (#8497)", () => { + const { result, cliLog, openshellLog } = runPreinstallUpgradeGuard( + { + NEMOCLAW_GATEWAY_PORT: "9123", + NON_INTERACTIVE: "1", + }, + { + currentMaxOpenshellVersion: "0.0.99", + currentMinOpenshellVersion: "0.0.99", + hasOldCli: false, + openshellVersion: "0.0.85", + registryJson: JSON.stringify({ + sandboxes: { + selected: { + name: "selected", + gatewayPort: 9123, + gatewayName: "nemoclaw-9123", + nemoclawVersion: "0.0.89", + fromDockerfile: false, + }, + "incompatible-sibling-name": { + name: "incompatible-sibling-name", + gatewayPort: 9124, + gatewayName: "nemoclaw-9124", + nemoclawVersion: "0.0.89", + fromDockerfile: false, + }, + }, + }), + }, + ); + + expect(result.status).toBe(0); + expect(result.stdout + result.stderr).not.toContain("incompatible-sibling-name"); + expect(cliLog.split(/\r?\n/)).toContain("current:backup-all"); + expect(openshellLog).toContain("gateway remove nemoclaw-9123"); + }); + it("ignores a route-only reservation during pre-upgrade backup (#6500)", () => { const { result, cliLog, openshellLog } = runPreinstallUpgradeGuard( { diff --git a/test/install-station-sandbox-name-contract.test.ts b/test/install-station-sandbox-name-contract.test.ts new file mode 100644 index 00000000000..2b87f2edd41 --- /dev/null +++ b/test/install-station-sandbox-name-contract.test.ts @@ -0,0 +1,55 @@ +// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { spawnSync } from "node:child_process"; +import fs from "node:fs"; +import os from "node:os"; +import path from "node:path"; +import { describe, expect, it } from "vitest"; + +import { INSTALLER_PAYLOAD, TEST_SYSTEM_PATH } from "./helpers/installer-sourced-env"; + +const REPO_ROOT = path.resolve(import.meta.dirname, ".."); + +describe("Station resume sandbox name contract", () => { + it("keeps names within the OpenShell 0.0.99 routed-name contract (#8497)", () => { + const home = fs.mkdtempSync(path.join(os.tmpdir(), "nemoclaw-station-name-")); + const result = spawnSync( + "bash", + [ + "--noprofile", + "--norc", + "-c", + ` +source "$INSTALLER_UNDER_TEST" >/dev/null +for sandbox in abcdefghijklmnopqrs abcdefghijklmnopqrst legacy--box; do + if validate_station_express_resume_sandbox "$sandbox"; then + printf '%s=valid\n' "$sandbox" + else + printf '%s=invalid\n' "$sandbox" + fi +done +`, + ], + { + cwd: REPO_ROOT, + encoding: "utf-8", + env: { + HOME: home, + PATH: TEST_SYSTEM_PATH, + INSTALLER_UNDER_TEST: INSTALLER_PAYLOAD, + }, + timeout: 15_000, + killSignal: "SIGKILL", + }, + ); + + const output = `${result.stdout}${result.stderr}`; + expect(result.status, output).toBe(0); + expect(result.stdout.trim().split("\n")).toEqual([ + "abcdefghijklmnopqrs=valid", + "abcdefghijklmnopqrst=invalid", + "legacy--box=invalid", + ]); + }); +}); diff --git a/test/llama-cpp-dgx-spark-qualification-contract.test.ts b/test/llama-cpp-dgx-spark-qualification-contract.test.ts index 52d3c73a977..2ab33414107 100644 --- a/test/llama-cpp-dgx-spark-qualification-contract.test.ts +++ b/test/llama-cpp-dgx-spark-qualification-contract.test.ts @@ -16,6 +16,7 @@ import { LLAMA_CPP_DGX_SPARK_MODEL_ID, LLAMA_CPP_DGX_SPARK_MODEL_PATH_PATTERN, LLAMA_CPP_DGX_SPARK_OPENCLAW_IMAGE, + LLAMA_CPP_DGX_SPARK_OPENCLAW_SANDBOX, LLAMA_CPP_DGX_SPARK_OPENCLAW_SOURCE_REVISION, LLAMA_CPP_DGX_SPARK_OWNED_IMAGE_REPOSITORY, LLAMA_CPP_DGX_SPARK_PROTOCOL_PROBES, @@ -105,7 +106,7 @@ function agentQualification() { upstreamBaseUrl: "http://host.openshell.internal:8081/v1", }, runtimeProvider: "docker", - sandbox: { gpuAccess: "disabled", name: "nemoclaw-llama-cpp-openclaw" }, + sandbox: { gpuAccess: "disabled", name: LLAMA_CPP_DGX_SPARK_OPENCLAW_SANDBOX }, sessions: { normal: "llama-cpp-openclaw-normal", tool: "llama-cpp-openclaw-tool", diff --git a/test/llama-cpp-openclaw-agent-qualification.test.ts b/test/llama-cpp-openclaw-agent-qualification.test.ts index e2df46510a6..dfe9a1890e7 100644 --- a/test/llama-cpp-openclaw-agent-qualification.test.ts +++ b/test/llama-cpp-openclaw-agent-qualification.test.ts @@ -4,7 +4,10 @@ import { describe, expect, it } from "vitest"; import { loadLlamaCppImageConfig } from "../scripts/checks/export-llama-cpp-image-config.mts"; -import { parseLlamaCppDgxSparkExecutionPlan } from "../scripts/checks/llama-cpp-dgx-spark-qualification-contract.mts"; +import { + LLAMA_CPP_DGX_SPARK_OPENCLAW_SANDBOX, + parseLlamaCppDgxSparkExecutionPlan, +} from "../scripts/checks/llama-cpp-dgx-spark-qualification-contract.mts"; import { runLlamaCppOpenClawAgentQualification } from "../scripts/checks/llama-cpp-openclaw-agent-qualification.mts"; import type { ManagedImageOpenShellE2eProbeContext } from "../scripts/checks/run-managed-image-openshell-e2e.ts"; @@ -31,7 +34,7 @@ function context( image: enabledConfig().image.reference, localProvider, model: "nvidia-nemotron-3-nano-30b-a3b", - sandbox: "nemoclaw-llama-cpp-openclaw", + sandbox: LLAMA_CPP_DGX_SPARK_OPENCLAW_SANDBOX, }, runSandbox(argv) { invocations.push([...argv]); diff --git a/test/managed-image-protected-runtime-contract.test.ts b/test/managed-image-protected-runtime-contract.test.ts index c03b970d2a1..c5a8b2701ff 100644 --- a/test/managed-image-protected-runtime-contract.test.ts +++ b/test/managed-image-protected-runtime-contract.test.ts @@ -8,7 +8,9 @@ import { describe, expect, it } from "vitest"; import { managedStartupE2eProfile } from "../scripts/checks/generate-managed-startup-profile-fixture.mts"; import { MANAGED_IMAGE_LOCAL_INFERENCE_KINDS, + MANAGED_IMAGE_PROTECTED_SANDBOX_PREFIX, managedImageProtectedSandboxName, + PROTECTED_MANAGED_IMAGE_AGENTS, resolveManagedImageLocalInferenceRoute, withManagedImageLocalInferenceProfile, } from "../scripts/checks/managed-image-protected-runtime-contract.ts"; @@ -21,8 +23,64 @@ import { } from "../scripts/checks/run-managed-image-openshell-e2e.ts"; const IMAGE = `localhost:5000/nemoclaw-managed-protected/openclaw@sha256:${"a".repeat(64)}`; +const VALID_SANDBOX = "managed-openclaw"; describe("protected managed-image runtime contract", () => { + it("assigns every protected agent and route a unique OpenShell-compatible sandbox name (#8497)", () => { + const routeKinds = [...MANAGED_IMAGE_LOCAL_INFERENCE_KINDS, "rollback"] as const; + const qualifications = PROTECTED_MANAGED_IMAGE_AGENTS.flatMap((agent) => + routeKinds.map((routeKind) => ({ + agent, + sandbox: managedImageProtectedSandboxName(agent, routeKind), + })), + ); + const names = qualifications.map(({ sandbox }) => sandbox); + + expect(names).toEqual([ + "nmc-mi-oc-lc", + "nmc-mi-oc-ol", + "nmc-mi-oc-ni", + "nmc-mi-oc-vl", + "nmc-mi-oc-rb", + "nmc-mi-he-lc", + "nmc-mi-he-ol", + "nmc-mi-he-ni", + "nmc-mi-he-vl", + "nmc-mi-he-rb", + "nmc-mi-dc-lc", + "nmc-mi-dc-ol", + "nmc-mi-dc-ni", + "nmc-mi-dc-vl", + "nmc-mi-dc-rb", + ]); + expect(new Set(names).size).toBe(names.length); + for (const { agent, sandbox: name } of qualifications) { + expect(name.startsWith(MANAGED_IMAGE_PROTECTED_SANDBOX_PREFIX)).toBe(true); + expect(name.length).toBeLessThanOrEqual(19); + expect(name).not.toContain("--"); + expect( + parseManagedImageOpenShellE2eInputs(["--agent", agent, "--image", IMAGE, "--sandbox", name]) + .sandbox, + ).toBe(name); + } + }); + + it("enforces the canonical OpenShell sandbox-name length and delimiter contract (#8497)", () => { + const parseSandbox = (sandbox: string) => + parseManagedImageOpenShellE2eInputs([ + "--agent", + "openclaw", + "--image", + IMAGE, + "--sandbox", + sandbox, + ]); + + expect(parseSandbox(`a${"b".repeat(18)}`).sandbox).toHaveLength(19); + expect(() => parseSandbox(`a${"b".repeat(19)}`)).toThrow(/1-19 characters/u); + expect(() => parseSandbox("managed--openclaw")).toThrow(/single internal hyphens/u); + }); + it.each([ ["llama-cpp", "llama-cpp-local", "NEMOCLAW_LLAMACPP_LOCAL_TOKEN", 8081], ["ollama", "ollama-local", "NEMOCLAW_OLLAMA_PROXY_TOKEN", 11435], @@ -129,7 +187,7 @@ describe("protected managed-image runtime contract", () => { "--image", "localhost:5000/openclaw:latest", "--sandbox", - "managed-openclaw", + VALID_SANDBOX, ]), ).toThrow(/immutable repository@sha256/u); expect(() => @@ -139,7 +197,7 @@ describe("protected managed-image runtime contract", () => { "--image", IMAGE, "--sandbox", - "managed-openclaw", + VALID_SANDBOX, "--gpu", ]), ).toThrow(/--gpu requires/u); @@ -153,7 +211,7 @@ describe("protected managed-image runtime contract", () => { "--image", IMAGE, "--sandbox", - "managed-openclaw-llama-cpp", + "managed-oc-llama", "--local-provider", "llama-cpp", "--model", @@ -171,7 +229,7 @@ describe("protected managed-image runtime contract", () => { "--image", IMAGE, "--sandbox", - "managed-openclaw-vllm", + "managed-oc-vllm", "--local-provider", "vllm", "--model", @@ -185,7 +243,7 @@ describe("protected managed-image runtime contract", () => { "--image", IMAGE, "--sandbox", - "managed-openclaw-llama-cpp", + "managed-oc-llama", "--local-provider", "llama-cpp", "--model", @@ -200,7 +258,7 @@ describe("protected managed-image runtime contract", () => { "--image", IMAGE, "--sandbox", - "managed-openclaw-llama-cpp", + "managed-oc-llama", "--local-provider", "llama-cpp", ]), @@ -212,7 +270,7 @@ describe("protected managed-image runtime contract", () => { "--image", IMAGE, "--sandbox", - "managed-openclaw-llama-cpp", + "managed-oc-llama", "--local-provider", "llama-cpp", "--model", @@ -233,7 +291,7 @@ describe("protected managed-image runtime contract", () => { "--image", IMAGE, "--sandbox", - "managed-openclaw-rollback", + "managed-oc-rollback", "--inject-bootstrap-completion-failure", ]), ).toMatchObject({ failureInjection: "bootstrap-completion" }); diff --git a/test/onboard-readiness.test.ts b/test/onboard-readiness.test.ts index c57b37b6f03..b2f18339d68 100644 --- a/test/onboard-readiness.test.ts +++ b/test/onboard-readiness.test.ts @@ -1,12 +1,28 @@ // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 -import { describe, expect, it } from "vitest"; +import { beforeEach, describe, expect, it, vi } from "vitest"; + +const policySideEffects = vi.hoisted(() => ({ + run: vi.fn(), + runCapture: vi.fn(), +})); + +vi.mock("../src/lib/runner", async (importOriginal) => ({ + ...(await importOriginal()), + run: policySideEffects.run, + runCapture: policySideEffects.runCapture, +})); + import { + applyPermissivePolicy, applyPreset, + applyPresetContent, + applyPresets, buildPolicyGetCommand, buildPolicyGetFullCommand, buildPolicySetCommand, + removePreset, } from "../src/lib/policy"; type OnboardReadinessInternals = { @@ -34,6 +50,11 @@ if (!isOnboardReadinessInternals(onboardReadinessInternals)) { } const { hasStaleGateway, isSandboxReady, parseSandboxStatus } = onboardReadinessInternals; +beforeEach(() => { + policySideEffects.run.mockReset(); + policySideEffects.runCapture.mockReset(); +}); + describe("sandbox readiness parsing", () => { it("detects Ready sandbox", () => { expect(isSandboxReady("my-assistant Ready 2m ago", "my-assistant")).toBeTruthy(); @@ -160,6 +181,25 @@ describe("WSL sandbox name handling", () => { expect(() => applyPreset("-broken", "npm")).toThrow(/Invalid or truncated sandbox name/); }); + it("accepts an exact 19-character sandbox name before a no-op policy batch (#8497)", () => { + expect(applyPresets("a".repeat(19), [])).toBe(true); + expect(policySideEffects.runCapture).not.toHaveBeenCalled(); + expect(policySideEffects.run).not.toHaveBeenCalled(); + }); + + it.each([ + ["removePreset", (name: string) => removePreset(name, "npm")], + ["applyPresetContent", (name: string) => applyPresetContent(name, "npm", "")], + ["applyPresets", (name: string) => applyPresets(name, ["npm"])], + ["applyPermissivePolicy", (name: string) => applyPermissivePolicy(name)], + ])("%s rejects 20-character and consecutive-hyphen names before policy side effects (#8497)", (_entrypoint, invoke) => { + for (const name of ["a".repeat(20), "legacy--box"]) { + expect(() => invoke(name)).toThrow(/Allowed format: 1-19 characters/); + } + expect(policySideEffects.runCapture).not.toHaveBeenCalled(); + expect(policySideEffects.run).not.toHaveBeenCalled(); + }); + it("readiness check uses exact match preventing truncated name false-positive", () => { // If "my-assistant" was truncated to "m", the readiness check should // NOT match a sandbox named "my-assistant" when searching for "m" diff --git a/test/onboard-sandbox-name.test.ts b/test/onboard-sandbox-name.test.ts index c2844fa1217..68cd4acdf89 100644 --- a/test/onboard-sandbox-name.test.ts +++ b/test/onboard-sandbox-name.test.ts @@ -97,7 +97,7 @@ describe("onboard sandbox naming helpers", () => { it("exposes the full allowed sandbox name format", () => { expect(NAME_ALLOWED_FORMAT).toBe( - "1-19 characters, lowercase, starts with a letter, letters/numbers/internal hyphens only, ends with letter/number", + "1-19 characters, lowercase, starts with a letter, letters/numbers/single internal hyphens only, ends with letter/number", ); }); @@ -128,8 +128,8 @@ describe("onboard sandbox naming helpers", () => { expect(suggestNameSlug("foo bar")).toBe("foo-bar"); }); - it("returns null for inputs that are already valid even with internal hyphen runs", () => { - expect(suggestNameSlug("a---b")).toBeNull(); + it("collapses consecutive hyphens that OpenShell reserves for routed names (#8497)", () => { + expect(suggestNameSlug("a---b")).toBe("a-b"); }); it("prefixes 's-' when the slug would otherwise start with a digit", () => { diff --git a/test/pr-e2e-gate-runner-loss-classifier.test.ts b/test/pr-e2e-gate-runner-loss-classifier.test.ts index 10b22f21cec..08173b89bd0 100644 --- a/test/pr-e2e-gate-runner-loss-classifier.test.ts +++ b/test/pr-e2e-gate-runner-loss-classifier.test.ts @@ -167,7 +167,7 @@ function exit143HostedRunnerLossJob(overrides: Record = {}) { const tail = exit143ShutdownLogTail(); return hostedRunnerLossJob({ id: 89_271_065_810, - name: "security-posture (hermes, e2e-hermes-security-posture)", + name: "security-posture (hermes, e2e-hm-security)", runnerId: 1_021_384_642, runnerName: "GitHub Actions 1021384642", startedAt: "2026-07-23T16:41:05Z", diff --git a/test/pr-merge-conflict-fixer-workflow-boundary.test.ts b/test/pr-merge-conflict-fixer-workflow-boundary.test.ts index e4a9c902d68..a959552335c 100644 --- a/test/pr-merge-conflict-fixer-workflow-boundary.test.ts +++ b/test/pr-merge-conflict-fixer-workflow-boundary.test.ts @@ -117,6 +117,10 @@ describe("PR merge conflict fixer workflow boundary", () => { expect(record(resolve.env).PI_IMAGE).toBe( "ghcr.io/nvidia/openshell-community/sandboxes/pi@sha256:00d0c5e9e733f94f6db3eaa2ab70d4fd75bcc4aace6b13a54535cbf2dd20dfcd", ); + const sandboxName = String(record(resolve.env).SANDBOX_NAME ?? ""); + expect(sandboxName).toBe("pr-conflict"); + expect(sandboxName.length).toBeLessThanOrEqual(19); + expect(sandboxName).toMatch(/^(?!.*--)[a-z]([a-z0-9-]*[a-z0-9])?$/u); expect(workflowSource.match(/\$\{\{\s*secrets\.[A-Z0-9_]+\s*\}\}/gu)).toEqual([ "${{ secrets.PR_REVIEW_ADVISOR_API_KEY }}", ]); diff --git a/test/pr-review-advisor-openshell-workflow-boundary.test.ts b/test/pr-review-advisor-openshell-workflow-boundary.test.ts index 5ab6ef13a30..3e2010747ca 100644 --- a/test/pr-review-advisor-openshell-workflow-boundary.test.ts +++ b/test/pr-review-advisor-openshell-workflow-boundary.test.ts @@ -306,6 +306,7 @@ describe("PR review advisor OpenShell workflow boundary", () => { workflow.jobs.review.env.PI_IMAGE = "ghcr.io/nvidia/openshell-community/sandboxes/pi:latest"; workflow.jobs.review.env.SANDBOX_NAME = "pr-advisor"; + workflow.jobs.review.strategy.matrix.advisor[0].sandbox_name = "pr-advisor--bad"; workflow.jobs.review.strategy.matrix.advisor[0].artifact_dir = "../../advisor"; const prepare = workflow.jobs.review.steps.find( (step: { name?: string }) => step.name === "Prepare isolated analysis workspace", @@ -318,7 +319,8 @@ describe("PR review advisor OpenShell workflow boundary", () => { expect.arrayContaining([ "review job env.OPENSHELL_GATEWAY_ENDPOINT must be http://127.0.0.1:8080", "review job env.PI_IMAGE must be ghcr.io/nvidia/openshell-community/sandboxes/pi@sha256:00d0c5e9e733f94f6db3eaa2ab70d4fd75bcc4aace6b13a54535cbf2dd20dfcd", - "review job env.SANDBOX_NAME must be pr-advisor-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.advisor.id }}", + "review job env.SANDBOX_NAME must be ${{ matrix.advisor.sandbox_name }}", + "advisor matrix entry 1 sandbox_name must satisfy the OpenShell 0.0.99 sandbox-name contract", "advisor matrix entry 1 artifact_dir must be a simple directory name", "Prepare isolated analysis workspace must use the fixed pr-workdir upload directory", ]), diff --git a/test/repro-7795-connect-shell-sandbox-label.test.ts b/test/repro-7795-connect-shell-sandbox-label.test.ts index 8ac1243abd0..60fcf927a08 100644 --- a/test/repro-7795-connect-shell-sandbox-label.test.ts +++ b/test/repro-7795-connect-shell-sandbox-label.test.ts @@ -211,6 +211,7 @@ describe("connect-shell sandbox label for host-side hints (#7795)", () => { ["digit leading", "9abc"], ["underscore", "qa_7795"], ["trailing hyphen", "qa-7795-"], + ["consecutive hyphens", "qa--7795"], ])("rejects an invalid injected sandbox name (%s) instead of interpolating it", (_label, value) => { withTmpDir((tmpDir) => { const envFile = generateConnectEnv(tmpDir, value); diff --git a/test/smoke-macos-install.test.ts b/test/smoke-macos-install.test.ts index 0a38a9ff295..19ebeccb1b2 100644 --- a/test/smoke-macos-install.test.ts +++ b/test/smoke-macos-install.test.ts @@ -1,12 +1,43 @@ // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 -import { describe, it, expect } from "vitest"; -import path from "node:path"; import { spawnSync } from "node:child_process"; +import path from "node:path"; +import { describe, expect, it } from "vitest"; const SMOKE_SCRIPT = path.join(import.meta.dirname, "..", "scripts", "smoke-macos-install.sh"); +describe("macOS smoke install sandbox-name guard", () => { + it.each([ + ["an exact 19-character name", "abcdefghijklmnopqrs", true], + ["a 20-character name", "abcdefghijklmnopqrst", false], + ["consecutive hyphens", "legacy--box", false], + ["a leading digit", "1legacy-box", false], + ])("validates %s against the OpenShell 0.0.99 contract (#8497)", (_label, name, valid) => { + const result = spawnSync( + "bash", + [ + "--noprofile", + "--norc", + "-c", + 'set --; source "$SMOKE_SCRIPT_PATH"; SANDBOX_NAME="$SMOKE_SANDBOX_NAME"; validate_sandbox_name', + ], + { + cwd: path.join(import.meta.dirname, ".."), + encoding: "utf-8", + env: { + ...process.env, + NVIDIA_INFERENCE_API_KEY: "nvapi-test", + SMOKE_SANDBOX_NAME: name, + SMOKE_SCRIPT_PATH: SMOKE_SCRIPT, + }, + }, + ); + + expect(result.status === 0, `${result.stdout}${result.stderr}`).toBe(valid); + }); +}); + describe.skip("macOS smoke install script guardrails", () => { it("prints help", () => { const result = spawnSync("bash", [SMOKE_SCRIPT, "--help"], { diff --git a/tools/e2e/cli-artifact-workflow-boundary.mts b/tools/e2e/cli-artifact-workflow-boundary.mts index 4296cbf9895..cd5eb8d93bd 100644 --- a/tools/e2e/cli-artifact-workflow-boundary.mts +++ b/tools/e2e/cli-artifact-workflow-boundary.mts @@ -40,7 +40,7 @@ const CLI_ARTIFACT_PROVENANCE_STEP = "Record CLI artifact provenance"; const CANDIDATE_CHECKOUT_STEP_CONTENT_SHA256 = "3578a053cede863f7aa4814d8399b4ca21ea0b77cee712e6d549c684818f11dd"; const CLI_ARTIFACT_WORKFLOW_CONTRACT_SHA256 = - "008ab9ac0866ad564653316aaf6b758743e79c41dd015dc616bd1b99d83a263d"; + "69d825fd9b6d0b38fa72eff18e71ed42ed802c6236a8f41a78c31e50fb3ddb29"; const CLI_ARTIFACT_CONSUMER_JOB_NAMES = [ "agent-turn-latency", "bedrock-runtime-compatible-anthropic", diff --git a/tools/e2e/hermes-gpu-startup-workflow-boundary.mts b/tools/e2e/hermes-gpu-startup-workflow-boundary.mts index f73f51b4c3a..6e731201e35 100644 --- a/tools/e2e/hermes-gpu-startup-workflow-boundary.mts +++ b/tools/e2e/hermes-gpu-startup-workflow-boundary.mts @@ -122,9 +122,9 @@ export function validateHermesGpuStartupWorkflow( strategy["max-parallel"] !== 1 || JSON.stringify(matrix.include) !== JSON.stringify([ - { scenario: "native" }, - { scenario: "fallback" }, - { scenario: "compatibility-only" }, + { scenario: "native", sandbox_name: "e2e-hgpu-native" }, + { scenario: "fallback", sandbox_name: "e2e-hgpu-fallback" }, + { scenario: "compatibility-only", sandbox_name: "e2e-hgpu-compat" }, ]) ) { errors.push(`${JOB_NAME} must serialize GPU scenarios`); @@ -141,7 +141,7 @@ export function validateHermesGpuStartupWorkflow( NEMOCLAW_E2E_SHARD: "${{ matrix.scenario }}", NEMOCLAW_RUN_LIVE_E2E: "1", NEMOCLAW_SANDBOX_GPU: "1", - NEMOCLAW_SANDBOX_NAME: "e2e-hermes-gpu-startup-${{ matrix.scenario }}", + NEMOCLAW_SANDBOX_NAME: "${{ matrix.sandbox_name }}", } as const; for (const [name, expected] of Object.entries(requiredEnv)) { if (jobEnv[name] !== expected) { diff --git a/tools/e2e/inference-switch-workflow-boundary.mts b/tools/e2e/inference-switch-workflow-boundary.mts index 364b049bad5..78c886a7c49 100644 --- a/tools/e2e/inference-switch-workflow-boundary.mts +++ b/tools/e2e/inference-switch-workflow-boundary.mts @@ -59,7 +59,7 @@ function expectedModes(agent: JobSpec["agent"]): Array> return [ { mode: "anthropic", - sandbox_name: `e2e-${agent}-anthropic-inference-switch`, + sandbox_name: agent === "hermes" ? "e2e-hm-inf-switch" : "e2e-oc-inf-switch", switch_provider: "compatible-anthropic-endpoint", switch_model: "mock-anthropic-model", switch_inference_api: "anthropic-messages", diff --git a/tools/e2e/openclaw-plugin-runtime-exdev-workflow-boundary.mts b/tools/e2e/openclaw-plugin-runtime-exdev-workflow-boundary.mts index 4dd9f0a105e..27bacd29b21 100644 --- a/tools/e2e/openclaw-plugin-runtime-exdev-workflow-boundary.mts +++ b/tools/e2e/openclaw-plugin-runtime-exdev-workflow-boundary.mts @@ -20,7 +20,7 @@ const JOB_CONTRACTS = [ jobName: "openclaw-plugin-runtime-exdev-release", timeoutMinutes: 55, artifactId: "openclaw-plugin-runtime-exdev-release", - sandboxName: "e2e-openclaw-plugin-exdev-release", + sandboxName: "e2e-oc-exdev-rel", selector: "release-baseline", runName: "Run OpenClaw custom-plugin release baseline live test", uploadName: "Upload OpenClaw plugin release baseline artifacts", @@ -31,7 +31,7 @@ const JOB_CONTRACTS = [ jobName: "openclaw-plugin-runtime-exdev", timeoutMinutes: 105, artifactId: "openclaw-plugin-runtime-exdev", - sandboxName: "e2e-openclaw-plugin-exdev", + sandboxName: "e2e-oc-exdev", selector: "current-lifecycle", runName: "Run OpenClaw custom-plugin lifecycle and runtime-deps EXDEV live test", uploadName: "Upload OpenClaw plugin runtime-deps EXDEV artifacts", diff --git a/tools/e2e/sandbox-name-workflow-boundary.mts b/tools/e2e/sandbox-name-workflow-boundary.mts new file mode 100644 index 00000000000..45160af24dc --- /dev/null +++ b/tools/e2e/sandbox-name-workflow-boundary.mts @@ -0,0 +1,104 @@ +// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +import * as sandboxNameContractModule from "../../nemoclaw/dist/shared/sandbox-name.cjs"; + +const sandboxNameContract = ( + "default" in sandboxNameContractModule && sandboxNameContractModule.default + ? sandboxNameContractModule.default + : sandboxNameContractModule +) as typeof import("../../nemoclaw/dist/shared/sandbox-name.cjs"); +const { NAME_ALLOWED_FORMAT, isValidName } = sandboxNameContract; + +type WorkflowRecord = Record; + +const SANDBOX_IDENTITY_ENV_NAMES = new Set([ + "NEMOCLAW_GATEWAY_UPGRADE_SURVIVOR_NAME", + "NEMOCLAW_SANDBOX_NAME", +]); +const MATRIX_EXPRESSION = /\$\{\{\s*matrix\.([A-Za-z_][A-Za-z0-9_]*)\s*\}\}/gu; + +function record(value: unknown): WorkflowRecord { + return value && typeof value === "object" && !Array.isArray(value) + ? (value as WorkflowRecord) + : {}; +} + +function matrixRows(job: WorkflowRecord): WorkflowRecord[] { + const matrix = record(record(job.strategy).matrix); + const include = Array.isArray(matrix.include) ? matrix.include.map(record) : []; + if (include.length > 0) return include; + + const axes = Object.entries(matrix).filter( + ([name, values]) => name !== "exclude" && Array.isArray(values), + ) as Array<[string, unknown[]]>; + return axes.reduce( + (rows, [name, values]) => + rows.flatMap((row) => values.map((value) => ({ ...row, [name]: value }))), + [{}], + ); +} + +function sandboxEnvBindings(job: WorkflowRecord): Array<[string, unknown]> { + const bindings: Array<[string, unknown]> = []; + const collect = (scope: string, envValue: unknown) => { + for (const [name, value] of Object.entries(record(envValue))) { + if (SANDBOX_IDENTITY_ENV_NAMES.has(name)) bindings.push([`${scope}.${name}`, value]); + } + }; + + collect("env", job.env); + const steps = Array.isArray(job.steps) ? job.steps.map(record) : []; + steps.forEach((step, index) => collect(`steps[${index}].env`, step.env)); + return bindings; +} + +function resolveMatrixTemplate(template: string, row: WorkflowRecord): string { + return template.replace(MATRIX_EXPRESSION, (_expression, name: string) => { + const value = row[name]; + return typeof value === "string" || typeof value === "number" ? String(value) : ""; + }); +} + +export type WorkflowSandboxIdentity = { + job: string; + location: string; + name: string; +}; + +export function resolveWorkflowSandboxIdentities( + workflowValue: unknown, +): WorkflowSandboxIdentity[] { + const workflow = record(workflowValue); + const identities: WorkflowSandboxIdentity[] = []; + for (const [jobName, jobValue] of Object.entries(record(workflow.jobs))) { + const job = record(jobValue); + for (const [location, rawTemplate] of sandboxEnvBindings(job)) { + const template = typeof rawTemplate === "string" ? rawTemplate : ""; + const rows = matrixRows(job); + rows.forEach((row, rowIndex) => { + identities.push({ + job: jobName, + location: rows.length > 1 ? `${location}.matrix[${rowIndex}]` : location, + name: resolveMatrixTemplate(template, row), + }); + }); + } + } + return identities; +} + +export function validateWorkflowSandboxNames(workflowValue: unknown): string[] { + const identities = resolveWorkflowSandboxIdentities(workflowValue); + const errors: string[] = []; + + for (const identity of identities) { + const owner = `${identity.job}.${identity.location}`; + if (!isValidName(identity.name)) { + errors.push( + `${owner} resolves to invalid sandbox name ${JSON.stringify(identity.name)}; expected ${NAME_ALLOWED_FORMAT}`, + ); + } + } + return errors; +} diff --git a/tools/e2e/security-posture-workflow-boundary.mts b/tools/e2e/security-posture-workflow-boundary.mts index 24d99c8377e..91f5d93dfe2 100644 --- a/tools/e2e/security-posture-workflow-boundary.mts +++ b/tools/e2e/security-posture-workflow-boundary.mts @@ -73,12 +73,12 @@ export function validateSecurityPostureWorkflow(workflow: WorkflowRecord): strin const expectedMatrix = [ { agent: "openclaw", - sandbox_name: "e2e-openclaw-security-posture", + sandbox_name: "e2e-oc-security", test_file: "test/e2e/live/full-e2e.test.ts", }, { agent: "hermes", - sandbox_name: "e2e-hermes-security-posture", + sandbox_name: "e2e-hm-security", test_file: "test/e2e/live/hermes-e2e.test.ts", }, ]; diff --git a/tools/e2e/workflow-boundary.mts b/tools/e2e/workflow-boundary.mts index 1f7bc9b56cb..5a48a5b3422 100644 --- a/tools/e2e/workflow-boundary.mts +++ b/tools/e2e/workflow-boundary.mts @@ -261,7 +261,7 @@ const NETWORK_POLICY_SCENARIO_MATRIX = { { scenario: "live-probes", selector: "^network-policy:.+probes$", - sandbox: "e2e-net-policy-live-probes", + sandbox: "e2e-net-policy", }, ], } as const; @@ -2020,8 +2020,8 @@ function validateRebuildHermesJob( if (jobEnv.NEMOCLAW_HERMES_STALE_BASE_REBUILD_E2E !== "1") { errors.push(`${jobName} job must enable NEMOCLAW_HERMES_STALE_BASE_REBUILD_E2E=1`); } - if (jobEnv.NEMOCLAW_SANDBOX_NAME !== "e2e-rebuild-hermes-base") { - errors.push(`${jobName} job must set NEMOCLAW_SANDBOX_NAME=e2e-rebuild-hermes-base`); + if (jobEnv.NEMOCLAW_SANDBOX_NAME !== "e2e-rebuild-base") { + errors.push(`${jobName} job must set NEMOCLAW_SANDBOX_NAME=e2e-rebuild-base`); } } else if (jobEnv.NEMOCLAW_SANDBOX_NAME !== "e2e-rebuild-hermes") { errors.push(`${jobName} job must set NEMOCLAW_SANDBOX_NAME=e2e-rebuild-hermes`); @@ -2836,8 +2836,8 @@ function validateSparkInstallJob(errors: string[], jobs: WorkflowRecord): void { if (jobEnv.NEMOCLAW_FRESH !== "1") { errors.push("spark-install job must set NEMOCLAW_FRESH=1"); } - if (jobEnv.NEMOCLAW_SANDBOX_NAME !== "e2e-spark-install-ci") { - errors.push("spark-install job must use the stable e2e-spark-install-ci sandbox name"); + if (jobEnv.NEMOCLAW_SANDBOX_NAME !== "e2e-spark-install") { + errors.push("spark-install job must use the stable e2e-spark-install sandbox name"); } if (jobEnv.NEMOCLAW_PROVIDER !== "cloud") { errors.push("spark-install job must use the cloud provider"); @@ -3324,8 +3324,8 @@ function validateChannelsAddRemoveJob(errors: string[], jobs: WorkflowRecord): v if (jobEnv.NEMOCLAW_CLI_BIN !== "${{ github.workspace }}/bin/nemoclaw.js") { errors.push("channels-add-remove job must point NEMOCLAW_CLI_BIN at the repo CLI"); } - if (jobEnv.NEMOCLAW_SANDBOX_NAME !== "e2e-channels-add-remove") { - errors.push("channels-add-remove job must set NEMOCLAW_SANDBOX_NAME=e2e-channels-add-remove"); + if (jobEnv.NEMOCLAW_SANDBOX_NAME !== "e2e-ch-add-remove") { + errors.push("channels-add-remove job must set NEMOCLAW_SANDBOX_NAME=e2e-ch-add-remove"); } if (jobEnv.NEMOCLAW_NON_INTERACTIVE !== "1") { errors.push("channels-add-remove job must set NEMOCLAW_NON_INTERACTIVE=1"); @@ -3568,8 +3568,15 @@ function validateChannelsStopStartJob(errors: string[], jobs: WorkflowRecord): v errors.push("channels-stop-start strategy.fail-fast must be false"); } const matrix = asRecord(strategy.matrix); - if (!Array.isArray(matrix.agent) || matrix.agent.join(",") !== "openclaw,hermes") { - errors.push("channels-stop-start matrix.agent must be openclaw,hermes"); + if ( + !isDeepStrictEqual(matrix, { + include: [ + { agent: "openclaw", sandbox_name: "e2e-oc-ch-cycle" }, + { agent: "hermes", sandbox_name: "e2e-hm-ch-cycle" }, + ], + }) + ) { + errors.push("channels-stop-start matrix must bind canonical per-agent sandbox names"); } const jobEnv = asRecord(job.env); @@ -3587,9 +3594,9 @@ function validateChannelsStopStartJob(errors: string[], jobs: WorkflowRecord): v if (jobEnv.NEMOCLAW_CLI_BIN !== "${{ github.workspace }}/bin/nemoclaw.js") { errors.push("channels-stop-start job must point NEMOCLAW_CLI_BIN at the repo CLI"); } - if (jobEnv.NEMOCLAW_SANDBOX_NAME !== "e2e-channels-stop-start-${{ matrix.agent }}") { + if (jobEnv.NEMOCLAW_SANDBOX_NAME !== "${{ matrix.sandbox_name }}") { errors.push( - "channels-stop-start job must derive NEMOCLAW_SANDBOX_NAME from matrix.agent with the e2e-channels-stop-start- prefix", + "channels-stop-start job must derive NEMOCLAW_SANDBOX_NAME from matrix.sandbox_name", ); } if (jobEnv.NEMOCLAW_AGENT !== "${{ matrix.agent }}") { @@ -3757,7 +3764,7 @@ function validateDashboardRemoteBindJob(errors: string[], jobs: WorkflowRecord): E2E_ARTIFACT_DIR: "${{ github.workspace }}/e2e-artifacts/live/dashboard-remote-bind", NEMOCLAW_RUN_LIVE_E2E: "1", NEMOCLAW_E2E_DASHBOARD_REMOTE_BIND: "1", - NEMOCLAW_SANDBOX_NAME: "e2e-dashboard-remote-bind", + NEMOCLAW_SANDBOX_NAME: "e2e-dashboard-bind", }; for (const [key, value] of Object.entries(expectedEnv)) { if (jobEnv[key] !== value) { @@ -3818,8 +3825,17 @@ function validateBedrockRuntimeCompatibleAnthropicJob( errors.push("bedrock-runtime-compatible-anthropic strategy.fail-fast must be false"); } const matrix = asRecord(strategy.matrix); - if (!Array.isArray(matrix.agent) || matrix.agent.join(",") !== "openclaw,hermes") { - errors.push("bedrock-runtime-compatible-anthropic matrix.agent must be openclaw,hermes"); + if ( + !isDeepStrictEqual(matrix, { + include: [ + { agent: "openclaw", sandbox_name: "e2e-oc-bedrock" }, + { agent: "hermes", sandbox_name: "e2e-hm-bedrock" }, + ], + }) + ) { + errors.push( + "bedrock-runtime-compatible-anthropic matrix must bind canonical per-agent sandbox names", + ); } const jobEnv = asRecord(job.env); @@ -3863,9 +3879,9 @@ function validateBedrockRuntimeCompatibleAnthropicJob( "bedrock-runtime-compatible-anthropic job must pass matrix.agent through NEMOCLAW_E2E_SHARD", ); } - if (jobEnv.NEMOCLAW_SANDBOX_NAME !== "e2e-bedrock-${{ matrix.agent }}") { + if (jobEnv.NEMOCLAW_SANDBOX_NAME !== "${{ matrix.sandbox_name }}") { errors.push( - "bedrock-runtime-compatible-anthropic job must derive NEMOCLAW_SANDBOX_NAME from matrix.agent", + "bedrock-runtime-compatible-anthropic job must derive NEMOCLAW_SANDBOX_NAME from matrix.sandbox_name", ); } if (jobEnv.OPENSHELL_GATEWAY !== "nemoclaw") { diff --git a/tools/pr-review-advisor/workflow-boundary.mts b/tools/pr-review-advisor/workflow-boundary.mts index 2a384a91571..b03f8f5ed0e 100644 --- a/tools/pr-review-advisor/workflow-boundary.mts +++ b/tools/pr-review-advisor/workflow-boundary.mts @@ -8,6 +8,8 @@ import YAML from "yaml"; const REPO_ROOT = join(dirname(fileURLToPath(import.meta.url)), "..", ".."); const DEFAULT_WORKFLOW_PATH = join(REPO_ROOT, ".github", "workflows", "pr-review-advisor.yaml"); +const OPENSHELL_SANDBOX_NAME_MAX_LENGTH = 19; +const OPENSHELL_SANDBOX_NAME_PATTERN = /^(?!.*--)[a-z]([a-z0-9-]*[a-z0-9])?$/u; const DEFAULT_PACKAGE_LOCK_PATH = join(REPO_ROOT, "package-lock.json"); const DEFAULT_OPENSHELL_POLICY_PATH = join( REPO_ROOT, @@ -451,13 +453,22 @@ function checkAnalysisJob(errors: string[], reviewJob: WorkflowRecord): void { if (entries.filter((entry) => booleanValue(entry.publish_comment) === true).length !== 1) { errors.push("advisor matrix must identify one primary artifact lane"); } - for (const field of ["model", "artifact_dir", "artifact_name"]) { + for (const field of ["model", "artifact_dir", "artifact_name", "sandbox_name"]) { requireUniqueMatrixField(errors, entries, field); } for (const [index, entry] of entries.entries()) { if (!/^[a-z0-9][a-z0-9-]*$/u.test(stringValue(entry.artifact_dir))) { errors.push(`advisor matrix entry ${index + 1} artifact_dir must be a simple directory name`); } + const sandboxName = stringValue(entry.sandbox_name); + if ( + sandboxName.length > OPENSHELL_SANDBOX_NAME_MAX_LENGTH || + !OPENSHELL_SANDBOX_NAME_PATTERN.test(sandboxName) + ) { + errors.push( + `advisor matrix entry ${index + 1} sandbox_name must satisfy the OpenShell 0.0.99 sandbox-name contract`, + ); + } } requireEnv( @@ -518,13 +529,7 @@ function checkAnalysisJob(errors: string[], reviewJob: WorkflowRecord): void { ); requireEnv(errors, "review job", reviewJob, "PI_IMAGE", PINNED_PI_IMAGE); requireEnv(errors, "review job", reviewJob, "PR_REVIEW_ADVISOR_SANDBOX_TIMEOUT_SECONDS", "2100"); - requireEnv( - errors, - "review job", - reviewJob, - "SANDBOX_NAME", - "pr-advisor-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.advisor.id }}", - ); + requireEnv(errors, "review job", reviewJob, "SANDBOX_NAME", "${{ matrix.advisor.sandbox_name }}"); const steps = asSteps(reviewJob.steps); if (steps.length === 0) errors.push("review job must declare steps"); From 32ef2daea92b0b785f43b9d9640b2aee775d5c7f Mon Sep 17 00:00:00 2001 From: Apurv Kumaria Date: Fri, 7 Aug 2026 06:58:11 -0700 Subject: [PATCH 16/18] test(openshell): align sandbox fixture names Signed-off-by: Apurv Kumaria --- .../actions/sandbox/mcp-bridge-policy.test.ts | 4 +- test/e2e/support/e2e-phase-lifecycle.test.ts | 40 ++++++++--------- test/e2e/support/e2e-phase-onboarding.test.ts | 42 +++++++++++------- test/e2e/support/e2e-phase-runtime.test.ts | 12 ++--- .../e2e-phase-state-validation.test.ts | 44 +++++++++---------- .../e2e/support/spark-install-helpers.test.ts | 8 ++-- 6 files changed, 77 insertions(+), 73 deletions(-) diff --git a/src/lib/actions/sandbox/mcp-bridge-policy.test.ts b/src/lib/actions/sandbox/mcp-bridge-policy.test.ts index a02e45ea005..bd55883d8ed 100644 --- a/src/lib/actions/sandbox/mcp-bridge-policy.test.ts +++ b/src/lib/actions/sandbox/mcp-bridge-policy.test.ts @@ -377,11 +377,11 @@ describe("MCP OpenShell policy", () => { expect(underscoreNormalized).toMatch(/^alpha-mcp-github-server-[a-f0-9]{16}$/); expect(new Set([caseNormalized, underscoreNormalized, "alpha-mcp-github-server"]).size).toBe(3); const long = buildMcpBridgeProviderName( - "sandbox-name-with-a-long-prefix", + "sandbox-name-prefix", "ServerNameThatWouldOtherwiseExceedTheProviderNameLimit", ); expect(long.length).toBeLessThanOrEqual(63); - expect(long).toMatch(/^sandbox-name-with-a-long-prefix-mcp-servername-[a-f0-9]{16}$/); + expect(long).toMatch(/^sandbox-name-prefix-mcp-servernamethatwouldoth-[a-f0-9]{16}$/); expect(buildMcpBridgeProviderName("alpha", "github-server", "0123456789abcdef")).toBe( "alpha-mcp-github-server-0123456789abcdef", ); diff --git a/test/e2e/support/e2e-phase-lifecycle.test.ts b/test/e2e/support/e2e-phase-lifecycle.test.ts index 6389ddc3786..817e0fc0e7a 100644 --- a/test/e2e/support/e2e-phase-lifecycle.test.ts +++ b/test/e2e/support/e2e-phase-lifecycle.test.ts @@ -93,7 +93,7 @@ class FakeCleanup implements LifecycleCleanup { function instance(overrides: Partial = {}): NemoClawInstance { return { onboarding: "cloud-openclaw", - sandboxName: "e2e-ubuntu-repo-cloud-openclaw", + sandboxName: "e2e-cloud-oc", agent: "openclaw", provider: "nvidia", providerEnv: "cloud", @@ -160,7 +160,7 @@ describe("LifecyclePhaseFixture.simulate post-reboot-recovery (stop-original)", const runner = new FakeRunner(); const cleanup = new FakeCleanup(); const prepared = await preparedPostRebootFixture(runner, cleanup, "staged"); - runner.enqueue(shellResult(0, "openshell-cluster-e2e-ubuntu-repo-cloud-openclaw\n")); // discover + runner.enqueue(shellResult(0, "openshell-cluster-e2e-cloud-oc\n")); // discover runner.enqueue(shellResult(0)); // docker stop runner.enqueue(shellResult(0)); // forward stop runner.enqueue(shellResult(0)); // gateway stop @@ -169,38 +169,38 @@ describe("LifecyclePhaseFixture.simulate post-reboot-recovery (stop-original)", runner.enqueue(shellResult(0)); // user service restart runner.enqueue(shellResult(0, "Connected to nemoclaw\n")); // openshell status runner.enqueue(shellResult(0)); // boot-owned docker start - runner.enqueue(shellResult(0, "NAME PHASE\ne2e-ubuntu-repo-cloud-openclaw Ready\n")); + runner.enqueue(shellResult(0, "NAME PHASE\ne2e-cloud-oc Ready\n")); runner.enqueue(shellResult(0)); // status proves recovered delivery readiness const result = await prepared.simulate("post-reboot-recovery", instance()); expect(result.profile).toBe("post-reboot-recovery"); expect(result.steps.map((step) => step.id)).toEqual([ - "docker-stop:openshell-cluster-e2e-ubuntu-repo-cloud-openclaw", + "docker-stop:openshell-cluster-e2e-cloud-oc", "gateway-restart:user-service", "gateway-connected:nemoclaw", - "docker-boot-start:openshell-cluster-e2e-ubuntu-repo-cloud-openclaw", - "sandbox-ready-after-boot:e2e-ubuntu-repo-cloud-openclaw", - "nemoclaw-status:e2e-ubuntu-repo-cloud-openclaw", + "docker-boot-start:openshell-cluster-e2e-cloud-oc", + "sandbox-ready-after-boot:e2e-cloud-oc", + "nemoclaw-status:e2e-cloud-oc", ]); expect(runner.calls.map((call) => `${call.command} ${call.args.join(" ")}`)).toEqual([ expect.stringContaining('bash -lc command -v "$1"'), expect.stringContaining("bash -lc set -eu"), - "docker ps -a --filter label=openshell.ai/sandbox-name=e2e-ubuntu-repo-cloud-openclaw --format {{.Names}}", - "docker stop openshell-cluster-e2e-ubuntu-repo-cloud-openclaw", + "docker ps -a --filter label=openshell.ai/sandbox-name=e2e-cloud-oc --format {{.Names}}", + "docker stop openshell-cluster-e2e-cloud-oc", "sh -lc command -v openshell >/dev/null 2>&1 && openshell forward stop 18789 || true", "sh -lc command -v openshell >/dev/null 2>&1 && openshell gateway stop -g nemoclaw || true", expect.stringContaining("sh -lc pid_file="), expect.stringContaining("sh -lc cid="), expect.stringContaining('systemctl --user cat "$service"'), "openshell status", - "docker start openshell-cluster-e2e-ubuntu-repo-cloud-openclaw", + "docker start openshell-cluster-e2e-cloud-oc", "openshell sandbox list", - "nemoclaw e2e-ubuntu-repo-cloud-openclaw status", + "nemoclaw e2e-cloud-oc status", ]); expect(cleanup.calls.map((call) => call.name)).toEqual([ "lifecycle.remove-staged-gateway-user-service", - "lifecycle.docker-start:openshell-cluster-e2e-ubuntu-repo-cloud-openclaw", + "lifecycle.docker-start:openshell-cluster-e2e-cloud-oc", ]); }); @@ -217,11 +217,11 @@ describe("LifecyclePhaseFixture.simulate post-reboot-recovery (stop-original)", runner.enqueue(shellResult(0)); // user service restart runner.enqueue(shellResult(0, "Connected to nemoclaw\n")); // openshell status runner.enqueue(shellResult(0)); // boot-owned docker start - runner.enqueue(shellResult(0, "NAME PHASE\ne2e-ubuntu-repo-cloud-openclaw Ready\n")); + runner.enqueue(shellResult(0, "NAME PHASE\ne2e-cloud-oc Ready\n")); runner.enqueue(shellResult(1, "Removed stale local registry entry.\n")); // status non-zero await expect(prepared.simulate("post-reboot-recovery", instance())).rejects.toThrow( - /nemoclaw e2e-ubuntu-repo-cloud-openclaw status failed: Removed stale local registry entry/, + /nemoclaw e2e-cloud-oc status failed: Removed stale local registry entry/, ); }); @@ -238,7 +238,7 @@ describe("LifecyclePhaseFixture.simulate post-reboot-recovery (stop-original)", runner.enqueue(shellResult(0)); // user service restart runner.enqueue(shellResult(0, "Connected to nemoclaw\n")); // openshell status runner.enqueue(shellResult(0)); // boot-owned docker start - runner.enqueue(shellResult(0, "NAME PHASE\ne2e-ubuntu-repo-cloud-openclaw Ready\n")); + runner.enqueue(shellResult(0, "NAME PHASE\ne2e-cloud-oc Ready\n")); runner.enqueue(shellResult(0)); // status restores the delivery chain const result = await prepared.simulate("post-reboot-recovery", instance()); @@ -250,17 +250,17 @@ describe("LifecyclePhaseFixture.simulate post-reboot-recovery (stop-original)", (call) => call === "docker start container-1" || call === "openshell sandbox list" || - call === "nemoclaw e2e-ubuntu-repo-cloud-openclaw status", + call === "nemoclaw e2e-cloud-oc status", ), ).toEqual([ "docker start container-1", "openshell sandbox list", - "nemoclaw e2e-ubuntu-repo-cloud-openclaw status", + "nemoclaw e2e-cloud-oc status", ]); expect(result.steps.slice(-3).map((step) => step.id)).toEqual([ "docker-boot-start:container-1", - "sandbox-ready-after-boot:e2e-ubuntu-repo-cloud-openclaw", - "nemoclaw-status:e2e-ubuntu-repo-cloud-openclaw", + "sandbox-ready-after-boot:e2e-cloud-oc", + "nemoclaw-status:e2e-cloud-oc", ]); expect(result.steps.at(-1)?.results[0]?.exitCode).toBe(0); }); @@ -560,7 +560,7 @@ describe("LifecyclePhaseFixture profile dispatch", () => { }); describe("LifecyclePhaseFixture DCode invalid-credential rebuild", () => { - const sandboxName = "e2e-ubuntu-repo-cloud-langchain-deepagents-code"; + const sandboxName = "e2e-dcode-cloud"; const validCredential = "valid-fixture-credential"; const options = dcodeInvalidCredentialRebuildOptionsFromRegistryEntry( { diff --git a/test/e2e/support/e2e-phase-onboarding.test.ts b/test/e2e/support/e2e-phase-onboarding.test.ts index 8c245a6406b..25c5428f0b3 100644 --- a/test/e2e/support/e2e-phase-onboarding.test.ts +++ b/test/e2e/support/e2e-phase-onboarding.test.ts @@ -123,11 +123,11 @@ describe("onboarding phase fixture", () => { const secrets = new FakeSecrets({ NVIDIA_INFERENCE_API_KEY: "secret-token" }); const onboard = new OnboardingPhaseFixture(new HostCliClient(runner), secrets); - const instance = await onboard.from(ready(), { sandboxName: "e2e-ubuntu-repo-cloud-openclaw" }); + const instance = await onboard.from(ready(), { sandboxName: "e2e-cloud-oc" }); expect(instance).toMatchObject({ onboarding: "cloud-openclaw", - sandboxName: "e2e-ubuntu-repo-cloud-openclaw", + sandboxName: "e2e-cloud-oc", agent: "openclaw", provider: "nvidia", providerEnv: "cloud", @@ -143,7 +143,7 @@ describe("onboarding phase fixture", () => { env: expect.objectContaining({ NEMOCLAW_AGENT: "openclaw", NEMOCLAW_PROVIDER: "cloud", - NEMOCLAW_SANDBOX_NAME: "e2e-ubuntu-repo-cloud-openclaw", + NEMOCLAW_SANDBOX_NAME: "e2e-cloud-oc", NVIDIA_INFERENCE_API_KEY: "secret-token", PATH: expect.any(String), }), @@ -161,12 +161,12 @@ describe("onboarding phase fixture", () => { const onboard = new OnboardingPhaseFixture(new HostCliClient(runner), secrets); const instance = await onboard.from(ready({ onboarding: "cloud-langchain-deepagents-code" }), { - sandboxName: "e2e-ubuntu-repo-cloud-langchain-deepagents-code", + sandboxName: "e2e-dcode-cloud", }); expect(instance).toMatchObject({ agent: "langchain-deepagents-code", - sandboxName: "e2e-ubuntu-repo-cloud-langchain-deepagents-code", + sandboxName: "e2e-dcode-cloud", }); expect(runner.calls[0]).toMatchObject({ command: "nemoclaw", @@ -355,12 +355,12 @@ describe("onboarding phase fixture", () => { const instance = await onboard.from( ready({ onboarding: "cloud-openclaw-policy-custom-missing-presets" }), - { sandboxName: "e2e-policy-custom-missing" }, + { sandboxName: "e2e-policy-missing" }, ); expect(instance).toMatchObject({ onboarding: "cloud-openclaw-policy-custom-missing-presets", - sandboxName: "e2e-policy-custom-missing", + sandboxName: "e2e-policy-missing", expectedFailure: { phase: "onboarding", errorClass: "policy-presets-required", @@ -374,7 +374,7 @@ describe("onboarding phase fixture", () => { env: expect.objectContaining({ NEMOCLAW_POLICY_MODE: "custom", NEMOCLAW_POLICY_PRESETS: "", - NEMOCLAW_SANDBOX_NAME: "e2e-policy-custom-missing", + NEMOCLAW_SANDBOX_NAME: "e2e-policy-missing", NVIDIA_INFERENCE_API_KEY: "secret-token", }), redactionValues: ["secret-token"], @@ -382,7 +382,7 @@ describe("onboarding phase fixture", () => { }, }); expect(cleanup.calls).toHaveLength(1); - expect(cleanup.calls[0]?.name).toBe("destroy NemoClaw sandbox e2e-policy-custom-missing"); + expect(cleanup.calls[0]?.name).toBe("destroy NemoClaw sandbox e2e-policy-missing"); }); it("rejects unrelated failures for the missing custom policy presets negative path", async () => { @@ -394,7 +394,9 @@ describe("onboarding phase fixture", () => { ); await expect( - onboard.from(ready({ onboarding: "cloud-openclaw-policy-custom-missing-presets" })), + onboard.from(ready({ onboarding: "cloud-openclaw-policy-custom-missing-presets" }), { + sandboxName: "e2e-policy-missing", + }), ).rejects.toThrow(/failed without the policy preset signature/); }); @@ -412,7 +414,9 @@ describe("onboarding phase fixture", () => { ); await expect( - onboard.from(ready({ onboarding: "cloud-openclaw-policy-custom-missing-presets" })), + onboard.from(ready({ onboarding: "cloud-openclaw-policy-custom-missing-presets" }), { + sandboxName: "e2e-policy-missing", + }), ).rejects.toThrow(/failed with a JavaScript stack trace/); }); @@ -434,6 +438,7 @@ describe("onboarding phase fixture", () => { onboarding: "cloud-openclaw-no-docker", docker: { id: "docker-missing", expectation: "missing", available: true }, }), + { sandboxName: "e2e-no-docker" }, ); const logBody = fs.readFileSync(path.join(tmp, "negative-preflight.log"), "utf8"); @@ -464,6 +469,7 @@ describe("onboarding phase fixture", () => { onboarding: "cloud-openclaw-no-docker", docker: { id: "docker-missing", expectation: "missing", available: false }, }), + { sandboxName: "e2e-no-docker" }, ); expect(instance.expectedFailure).toEqual({ @@ -504,6 +510,7 @@ describe("onboarding phase fixture", () => { onboarding: "cloud-openclaw-no-docker", docker: { id: "docker-missing", expectation: "missing", available: false }, }), + { sandboxName: "e2e-no-docker" }, ); const pathValue = runner.calls[0]?.options?.env?.PATH; @@ -540,19 +547,19 @@ describe("onboarding phase fixture", () => { onboarding: "cloud-openclaw-no-docker", docker: { id: "docker-missing", expectation: "missing", available: false }, }), - { sandboxName: "e2e-no-docker-success" }, + { sandboxName: "e2e-no-docker-ok" }, ), ).rejects.toThrow(/unexpectedly succeeded/); expect(cleanup.calls).toHaveLength(1); - expect(cleanup.calls[0]?.name).toBe("destroy NemoClaw sandbox e2e-no-docker-success"); + expect(cleanup.calls[0]?.name).toBe("destroy NemoClaw sandbox e2e-no-docker-ok"); runner.enqueue(shellResult(0, "destroyed\n")); await cleanup.calls[0]?.run(); expect(runner.calls[1]).toMatchObject({ command: "nemoclaw", - args: ["e2e-no-docker-success", "destroy", "--yes"], + args: ["e2e-no-docker-ok", "destroy", "--yes"], options: { - artifactName: "cleanup-destroy-e2e-no-docker-success", + artifactName: "cleanup-destroy-e2e-no-docker-ok", timeoutMs: 900_000, }, }); @@ -573,6 +580,7 @@ describe("onboarding phase fixture", () => { onboarding: "cloud-openclaw-no-docker", docker: { id: "docker-missing", expectation: "missing", available: false }, }), + { sandboxName: "e2e-no-docker" }, ), ).rejects.toThrow(/without Docker-missing preflight signature/); }); @@ -600,13 +608,13 @@ describe("onboarding phase fixture", () => { new ArtifactSink(tmp), ); - await onboard.from(ready(), { sandboxName: "e2e-artifact-success" }); + await onboard.from(ready(), { sandboxName: "e2e-artifact-ok" }); expect(readJson(path.join(tmp, "onboarding.result.json"))).toMatchObject({ phase: "onboarding", status: "passed", onboarding: "cloud-openclaw", - sandboxName: "e2e-artifact-success", + sandboxName: "e2e-artifact-ok", agent: "openclaw", provider: "nvidia", providerEnv: "cloud", diff --git a/test/e2e/support/e2e-phase-runtime.test.ts b/test/e2e/support/e2e-phase-runtime.test.ts index 6f8a1f931f3..f64d0780e99 100644 --- a/test/e2e/support/e2e-phase-runtime.test.ts +++ b/test/e2e/support/e2e-phase-runtime.test.ts @@ -4,16 +4,16 @@ import { describe, expect, expectTypeOf, it } from "vitest"; import { + type CommandRunner, ProviderClient, SandboxClient, trustedProviderEndpoint, - type CommandRunner, } from "../fixtures/clients/index.ts"; import type { E2ETargetFixtures } from "../fixtures/e2e-test.ts"; import { inferenceRouteUrl, - RuntimePhaseFixture, type NemoClawInstance, + RuntimePhaseFixture, } from "../fixtures/phases/index.ts"; import type { ShellProbeResult, @@ -73,7 +73,7 @@ class FakeRunner implements CommandRunner { function instance(overrides: Partial = {}): NemoClawInstance { return { onboarding: "cloud-openclaw", - sandboxName: "e2e-ubuntu-repo-cloud-openclaw", + sandboxName: "e2e-cloud-oc", agent: "openclaw", provider: "nvidia", providerEnv: "cloud", @@ -116,7 +116,7 @@ describe("runtime phase fixture", () => { "sandbox", "exec", "-n", - "e2e-ubuntu-repo-cloud-openclaw", + "e2e-cloud-oc", "--", "curl", "-fsS", @@ -176,7 +176,7 @@ describe("runtime phase fixture", () => { "sandbox", "exec", "-n", - "e2e-ubuntu-repo-cloud-openclaw", + "e2e-cloud-oc", "--", "curl", "-fsS", @@ -241,7 +241,7 @@ describe("runtime phase fixture", () => { "sandbox", "exec", "-n", - "e2e-ubuntu-repo-cloud-openclaw", + "e2e-cloud-oc", "--", "curl", "-sS", diff --git a/test/e2e/support/e2e-phase-state-validation.test.ts b/test/e2e/support/e2e-phase-state-validation.test.ts index 5775ba1ce69..dd4da206e82 100644 --- a/test/e2e/support/e2e-phase-state-validation.test.ts +++ b/test/e2e/support/e2e-phase-state-validation.test.ts @@ -120,7 +120,7 @@ class FakeRunner implements CommandRunner { function instance(overrides: Partial = {}): NemoClawInstance { return { onboarding: "cloud-openclaw", - sandboxName: "e2e-ubuntu-repo-cloud-openclaw", + sandboxName: "e2e-cloud-oc", agent: "openclaw", provider: "nvidia", providerEnv: "cloud", @@ -151,7 +151,7 @@ describe("state-validation phase fixture", () => { const runner = new FakeRunner(); runner.enqueue(shellResult(0, "nemoclaw v0.0.0\n")); runner.enqueue(shellResult(0, "200")); - runner.enqueue(shellResult(0, "NAME\ne2e-ubuntu-repo-cloud-openclaw\n")); + runner.enqueue(shellResult(0, "NAME\ne2e-cloud-oc\n")); const result = await fixture(runner).from("cloud-openclaw-ready", instance()); @@ -201,7 +201,7 @@ describe("state-validation phase fixture", () => { runner.enqueue(shellResult(0, "nemoclaw v0.0.0\n")); runner.enqueue(shellResult(7, "connection refused")); runner.enqueue(shellResult(0, "204")); - runner.enqueue(shellResult(0, "NAME\ne2e-ubuntu-repo-cloud-openclaw\n")); + runner.enqueue(shellResult(0, "NAME\ne2e-cloud-oc\n")); const result = await fixture(runner).from("cloud-openclaw-ready", instance()); @@ -220,7 +220,7 @@ describe("state-validation phase fixture", () => { runner.enqueue(shellResult(7, "connection refused")); runner.enqueue(shellResult(7, "connection refused")); runner.enqueue(shellResult(0, "401")); - runner.enqueue(shellResult(0, "NAME\ne2e-ubuntu-repo-cloud-openclaw\n")); + runner.enqueue(shellResult(0, "NAME\ne2e-cloud-oc\n")); const result = await fixture(runner).from( "local-ollama-openclaw-ready", @@ -237,7 +237,7 @@ describe("state-validation phase fixture", () => { "sandbox", "exec", "-n", - "e2e-ubuntu-repo-cloud-openclaw", + "e2e-cloud-oc", "--", "curl", "-sS", @@ -360,7 +360,7 @@ describe("state-validation phase fixture", () => { runner.enqueue(shellResult(0, "nemoclaw v0.0.0\n")); runner.enqueue(shellResult(1, "gateway stopped")); runner.enqueue(shellResult(7, "connection refused")); - runner.enqueue(shellResult(0, "NAME\ne2e-ubuntu-repo-cloud-openclaw\n")); + runner.enqueue(shellResult(0, "NAME\ne2e-cloud-oc\n")); await expect(fixture(runner).from("preflight-failure-no-sandbox", instance())).rejects.toThrow( /nemoclaw listed it/, @@ -373,7 +373,7 @@ describe("state-validation phase fixture", () => { runner.enqueue(shellResult(1, "gateway stopped")); runner.enqueue(shellResult(7, "connection refused")); runner.enqueue(shellResult(0, "NAME\nother-sandbox\n")); - runner.enqueue(shellResult(0, "NAME\ne2e-ubuntu-repo-cloud-openclaw\n")); + runner.enqueue(shellResult(0, "NAME\ne2e-cloud-oc\n")); await expect(fixture(runner).from("preflight-failure-no-sandbox", instance())).rejects.toThrow( /OpenShell listed it/, @@ -419,8 +419,8 @@ describe("state-validation phase fixture", () => { runner.enqueue(shellResult(0, "nemoclaw v0.0.0\n")); runner.enqueue(shellResult(1, "gateway stopped")); runner.enqueue(shellResult(7, "connection refused")); - runner.enqueue(shellResult(0, "NAME\ne2e-ubuntu-repo-cloud-openclaw-old\n")); - runner.enqueue(shellResult(0, "NAME\nold-e2e-ubuntu-repo-cloud-openclaw\n")); + runner.enqueue(shellResult(0, "NAME\ne2e-cloud-oc-old\n")); + runner.enqueue(shellResult(0, "NAME\nold-e2e-cloud-oc\n")); const result = await fixture(runner).from("preflight-failure-no-sandbox", instance()); @@ -488,11 +488,11 @@ describe("state-validation phase fixture", () => { const runner = new FakeRunner(); const fx = fixture(runner, { readRegistry: () => ({ - entries: { "e2e-ubuntu-repo-cloud-openclaw": {} }, + entries: { "e2e-cloud-oc": {} }, }), }); - expect(() => fx.expectLocalRegistryContains("e2e-ubuntu-repo-cloud-openclaw")).not.toThrow(); + expect(() => fx.expectLocalRegistryContains("e2e-cloud-oc")).not.toThrow(); runner.enqueue(shellResult(0)); runner.enqueue(shellResult(0, "survived\n")); runner.enqueue(shellResult(0, "/sandbox/.openclaw/config.json\n")); @@ -506,9 +506,9 @@ describe("state-validation phase fixture", () => { await fx.expectSandboxDirectoryPopulated(instance(), "/sandbox/.openclaw"); expect(runner.calls.map((call) => call.args.slice(0, 7))).toEqual([ - ["sandbox", "exec", "-n", "e2e-ubuntu-repo-cloud-openclaw", "--", "sh", "-lc"], - ["sandbox", "exec", "-n", "e2e-ubuntu-repo-cloud-openclaw", "--", "sh", "-lc"], - ["sandbox", "exec", "-n", "e2e-ubuntu-repo-cloud-openclaw", "--", "sh", "-lc"], + ["sandbox", "exec", "-n", "e2e-cloud-oc", "--", "sh", "-lc"], + ["sandbox", "exec", "-n", "e2e-cloud-oc", "--", "sh", "-lc"], + ["sandbox", "exec", "-n", "e2e-cloud-oc", "--", "sh", "-lc"], ]); }); @@ -573,8 +573,8 @@ describe("state-validation host-side probes", () => { const fx = fixture(runner, { readRegistry: () => ({ entries: { - "e2e-ubuntu-repo-cloud-openclaw": { - name: "e2e-ubuntu-repo-cloud-openclaw", + "e2e-cloud-oc": { + name: "e2e-cloud-oc", }, }, }), @@ -591,7 +591,7 @@ describe("state-validation host-side probes", () => { const fx = fixture(runner, { readRegistry: () => null }); await expect(fx.from(localRegistryState, instance())).rejects.toThrow( - /expected local registry entry for 'e2e-ubuntu-repo-cloud-openclaw'.*does not exist/, + /expected local registry entry for 'e2e-cloud-oc'.*does not exist/, ); }); @@ -608,7 +608,7 @@ describe("state-validation host-side probes", () => { it("docker-sandbox-container-present passes when docker ps -a returns labeled names", async () => { const runner = new FakeRunner(); - runner.enqueue(shellResult(0, "e2e-ubuntu-repo-cloud-openclaw\n")); + runner.enqueue(shellResult(0, "e2e-cloud-oc\n")); const fx = fixture(runner); const result = await fx.from(dockerContainerState, instance()); @@ -621,12 +621,12 @@ describe("state-validation host-side probes", () => { "ps", "-a", "--filter", - "label=openshell.ai/sandbox-name=e2e-ubuntu-repo-cloud-openclaw", + "label=openshell.ai/sandbox-name=e2e-cloud-oc", "--format", "{{.Names}}", ], options: { - artifactName: "docker-sandbox-container-present-e2e-ubuntu-repo-cloud-openclaw", + artifactName: "docker-sandbox-container-present-e2e-cloud-oc", env: expect.objectContaining({ PATH: expect.any(String) }), timeoutMs: 15_000, }, @@ -636,9 +636,7 @@ describe("state-validation host-side probes", () => { it("docker-sandbox-container-present matches *-nemoclaw-gpu-backup-* sibling containers", async () => { const runner = new FakeRunner(); - runner.enqueue( - shellResult(0, "e2e-ubuntu-repo-cloud-openclaw-nemoclaw-gpu-backup-1717280000000\n"), - ); + runner.enqueue(shellResult(0, "e2e-cloud-oc-nemoclaw-gpu-backup-1717280000000\n")); const fx = fixture(runner); const result = await fx.from(dockerContainerState, instance()); diff --git a/test/e2e/support/spark-install-helpers.test.ts b/test/e2e/support/spark-install-helpers.test.ts index 655fd6c5eba..e6d0b4a4a7e 100644 --- a/test/e2e/support/spark-install-helpers.test.ts +++ b/test/e2e/support/spark-install-helpers.test.ts @@ -94,11 +94,9 @@ describe("spark install live test helpers", () => { }); it("rejects non-test-owned sandbox names before destructive cleanup can use them", () => { - expect(assertSparkInstallSandboxName("e2e-spark-install-live")).toBe("e2e-spark-install-live"); - expect(assertSparkInstallSandboxName("e2e-spark-install-local-1")).toBe( - "e2e-spark-install-local-1", - ); - expect(() => assertSparkInstallSandboxName("personal-dev")).toThrow(/e2e-spark-install-/); + expect(assertSparkInstallSandboxName("e2e-spark-live")).toBe("e2e-spark-live"); + expect(assertSparkInstallSandboxName("e2e-spark-local")).toBe("e2e-spark-local"); + expect(() => assertSparkInstallSandboxName("personal-dev")).toThrow(/e2e-spark-/); expect(() => assertSparkInstallSandboxName("bad name")).toThrow(/sandbox name is invalid/); }); From c917c05d1f9c907c6ce6fd15e1e4d23227ac4b7c Mon Sep 17 00:00:00 2001 From: Apurv Kumaria Date: Fri, 7 Aug 2026 06:59:13 -0700 Subject: [PATCH 17/18] docs(openshell): correct current glibc floor Signed-off-by: Apurv Kumaria --- docs/security/openshell-0.0.72-compatibility-review.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/security/openshell-0.0.72-compatibility-review.mdx b/docs/security/openshell-0.0.72-compatibility-review.mdx index a62832871fb..5bceb2acd48 100644 --- a/docs/security/openshell-0.0.72-compatibility-review.mdx +++ b/docs/security/openshell-0.0.72-compatibility-review.mdx @@ -35,7 +35,7 @@ The inherited contract also continues to reject `NEMOCLAW_GATEWAY_BIND_ADDRESS=0 User principals remain blocked from sandbox-only methods. The compatibility container remains an explicit trusted-host fallback behind `NEMOCLAW_OPENSHELL_GATEWAY_CONTAINER_PATCH=1`. -It uses host networking and read-only Docker socket access, so directly supported glibc 2.28 or newer hosts remain preferred. +It uses host networking and read-only Docker socket access, so hosts with glibc 2.39 or newer remain preferred for the current OpenShell 0.0.99 pin. Wildcard gateway binds remain rejected while gateway JWT authentication is active. Review this fallback at every stable OpenShell bump and remove it in the same NemoClaw release that raises every supported Linux host to OpenShell's native glibc floor and passes the gateway-authentication and gateway-upgrade matrix for the release candidate commit without the flag. @@ -45,7 +45,7 @@ Review this fallback at every stable OpenShell bump and remove it in the same Ne - `sourceBoundary`: OpenShell owns its native glibc floor; NemoClaw owns the explicit `NEMOCLAW_OPENSHELL_GATEWAY_CONTAINER_PATCH=1` opt-in, host-networking configuration, read-only socket mount, and gateway authentication controls. - `whyNotSourceFix`: NemoClaw cannot make an upstream binary support an older host libc, so supported legacy hosts require an explicit, audited container boundary until the host floor is raised. - `regressionTest`: `test/install-openshell-version-check.test.ts` proves the flag gates the fallback, while `src/lib/onboard/docker-driver-gateway-compat-container.test.ts` covers container launch, the trust boundary, and the glibc decision. -- `removalCondition`: Remove the fallback when every supported Linux host meets OpenShell's native glibc 2.28-or-newer floor and the gateway-authentication and gateway-upgrade matrix passes for the release candidate commit without the flag. +- `removalCondition`: Remove the fallback when every supported Linux host meets OpenShell's native glibc 2.39-or-newer floor and the gateway-authentication and gateway-upgrade matrix passes for the release candidate commit without the flag. The release source boundary is the immutable upstream tag, its GitHub release asset digests, and the GHCR manifest digest produced by the linked release workflow. A mutable tag, a digest copied from another release, or a checksum file that disagrees with NemoClaw's table is an invalid state. From e91128b05e742baa18f3f756ace2119417c017f6 Mon Sep 17 00:00:00 2001 From: Apurv Kumaria Date: Fri, 7 Aug 2026 07:36:32 -0700 Subject: [PATCH 18/18] test(e2e): align release evidence matrix identities Signed-off-by: Apurv Kumaria --- test/release-e2e-evidence.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/release-e2e-evidence.test.ts b/test/release-e2e-evidence.test.ts index 8a12482c1d8..e0142af31bd 100644 --- a/test/release-e2e-evidence.test.ts +++ b/test/release-e2e-evidence.test.ts @@ -185,7 +185,7 @@ describe("release E2E evidence", () => { it("reports a failed matrix row without collapsing its successful siblings", () => { const plan = preflight(); - const failedId = 'hermes-gpu-startup[scenario="fallback"]'; + const failedId = 'hermes-gpu-startup[scenario="fallback",sandbox_name="e2e-hgpu-fallback"]'; const ledger = buildReleaseE2eLedger(plan, [ runEvidence(plan, "default", { conclusion: (execution) => (execution.id === failedId ? "failure" : "success"), @@ -199,7 +199,9 @@ describe("release E2E evidence", () => { }); expect( ledger.entries.find( - (entry) => entry.id === 'hermes-gpu-startup[scenario="compatibility-only"]', + (entry) => + entry.id === + 'hermes-gpu-startup[scenario="compatibility-only",sandbox_name="e2e-hgpu-compat"]', ), ).toMatchObject({ status: "successful" }); });