Skip to content
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
0b297d1
feat(cli): add read-only host mounts
ericksoa Aug 5, 2026
2307c24
docs(cli): document read-only host mounts
ericksoa Aug 5, 2026
aad2498
docs(cli): align host mount reference wording
ericksoa Aug 5, 2026
6a8b0fd
test(cli): keep host mount fixtures compatible
ericksoa Aug 5, 2026
e01efa7
refactor(onboard): keep host mount flow modular
ericksoa Aug 5, 2026
1668693
fix(cli): harden host mount lifecycle
ericksoa Aug 5, 2026
5ca4cc3
fix(onboard): always restore host mount scope
ericksoa Aug 5, 2026
dfadc4e
fix(cli): canonicalize host mounts deterministically
ericksoa Aug 5, 2026
19c269a
fix(cli): revalidate host mounts at create boundary
ericksoa Aug 5, 2026
6cbe6e7
test(cli): expect rebuilt mount identity
ericksoa Aug 5, 2026
0930ee5
merge: resolve conflicts with main
github-actions[bot] Aug 5, 2026
de8bee4
merge: resolve conflicts with main
github-actions[bot] Aug 5, 2026
7d0e659
fix(cli): use shared gateway health wait config
ericksoa Aug 5, 2026
974066d
Merge remote-tracking branch 'origin/feat/read-only-host-mounts-8274'…
ericksoa Aug 5, 2026
3e33e40
feat(onboard): declare runtime host mount support
ericksoa Aug 5, 2026
23d5c6e
test(onboard): keep capability assertions linear
ericksoa Aug 5, 2026
90784b8
merge: resolve conflicts with main
github-actions[bot] Aug 5, 2026
f57f843
merge: resolve conflicts with main
github-actions[bot] Aug 6, 2026
a016737
merge: resolve conflicts with main
github-actions[bot] Aug 6, 2026
837389e
Merge branch 'main' into feat/read-only-host-mounts-8274
ericksoa Aug 6, 2026
905b4e6
merge: resolve runtime host-mount capability conflicts
prekshivyas Aug 6, 2026
f832717
merge: resolve conflicts with main
github-actions[bot] Aug 12, 2026
e3e3a35
merge: resolve conflicts with main
github-actions[bot] Aug 13, 2026
3541c65
merge: resolve conflicts with main
github-actions[bot] Aug 13, 2026
d12df2d
merge: resolve conflicts with main
github-actions[bot] Aug 13, 2026
8415b24
merge: resolve conflicts with main
github-actions[bot] Aug 14, 2026
7cc7546
merge: resolve conflicts with main
github-actions[bot] Aug 14, 2026
29d0ab3
merge: resolve conflicts with main
github-actions[bot] Aug 14, 2026
793aa8a
merge: rebuild runtime host mount support on main
cv Aug 15, 2026
1cd2810
fix(onboard): reject host mounts before runtime preparation
cv Aug 15, 2026
ff20cc5
test(onboard): narrow runtime authority fixture
cv Aug 15, 2026
fa0020a
merge(main): incorporate current required checks
cv Aug 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions docs/manage-sandboxes/workspace-files.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,34 @@ You can also expose selected host directories for live, read-only access when co

## Mount a Host Directory for Read-Only Access

On Linux and Windows Subsystem for Linux 2 (WSL2), onboarding can expose an existing host directory inside a sandbox.
This operation is supported only with a NemoClaw-managed Docker-driver gateway.
Onboarding can expose an existing host directory inside a sandbox when the selected runtime provider and host platform support read-only host mounts.
The same command works with OpenClaw, Hermes, and LangChain Deep Agents Code sandboxes.

### Runtime Support

The runtime provider and host platform determine whether NemoClaw can create the mount:

| Runtime Provider | Host Platform | Status |
|---|---|---|
| Docker | Linux or Windows Subsystem for Linux 2 (WSL2) | Supported with a NemoClaw-managed Docker-driver gateway. |
| Docker | macOS or native Windows | Unsupported. |
| Kubernetes | Any host | Unsupported because host directories are node-local and require separately qualified scheduling, policy, and security rules. |
| Podman | Any host | Unsupported because read-only host mounts have not been qualified for the Podman runtime provider. |
| OpenShell MXC | Any host | Unsupported because OpenShell MXC does not expose a qualified native host-sharing contract. |

When you request `--host-mount`, NemoClaw checks the selected runtime provider and host platform before it records onboarding state or changes runtime resources.
An unsupported provider reports its declared reason.
A supported provider on an unqualified host reports that the host platform is not qualified.
NemoClaw does not fall back to Docker bind-mount configuration.

A runtime-provider implementation must meet these requirements before it can declare support:

- Declare qualified host platforms when supported, or declare an explicit reason when unsupported.
- Preserve the source, target, symbolic-link, duplication, and read-only validation described on this page.
- Revalidate the source path identity immediately before sandbox creation.
- Implement provider-specific create configuration and host-side activation without a Docker fallback.
- Test requested and persisted mounts across onboarding, resume, rebuild, and failure paths.

<Warning>
The mount crosses the sandbox boundary and gives every sandbox process read access to the complete host directory tree.
Read-only access prevents sandbox writes, but it does not protect confidential host files from being read.
Expand Down
116 changes: 6 additions & 110 deletions src/lib/actions/sandbox/status-flow.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// 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 { afterEach, beforeEach, describe, expect, it, type MockInstance, vi } from "vitest";

import {
Expand Down Expand Up @@ -163,41 +160,17 @@ describe("showSandboxStatus flow", () => {
});

it("reports durable read-only host directory exposure", async () => {
const source = fs.mkdtempSync(path.join(process.cwd(), ".status-text-host-mount-test-"));
try {
const harness = createStatusFlowHarness({
sandboxEntry: {
hostMounts: [{ source, target: "/sandbox/project", readOnly: true }],
},
});

await expect(harness.showSandboxStatus("alpha")).resolves.toBeUndefined();

const output = harness.logSpy.mock.calls.flat().join("\n");
expect(output).toContain("Host mounts:");
expect(output).toContain(`${source} -> /sandbox/project (read-only)`);
} finally {
fs.rmSync(source, { recursive: true, force: true });
}
});

it("rejects control-character host mounts before terminal rendering", async () => {
const harness = createStatusFlowHarness({
sandboxEntry: {
hostMounts: [
{
source: "/srv/project\u001b[31m",
target: "/sandbox/project",
readOnly: true,
},
],
hostMounts: [{ source: "/srv/project", target: "/sandbox/project", readOnly: true }],
},
});

await expect(harness.showSandboxStatus("alpha")).rejects.toThrow(
"unsafe terminal control characters",
);
expect(harness.logSpy.mock.calls.flat().join("\n")).not.toContain("\u001b[31m");
await expect(harness.showSandboxStatus("alpha")).resolves.toBeUndefined();

const output = harness.logSpy.mock.calls.flat().join("\n");
expect(output).toContain("Host mounts:");
expect(output).toContain("/srv/project -> /sandbox/project (read-only)");
});

it("omits SSH sessions when the active-session probe is unavailable (#7805)", async () => {
Expand Down Expand Up @@ -716,83 +689,6 @@ describe("showSandboxStatus flow", () => {
expect(output).not.toContain("Recovered NemoClaw gateway runtime");
});

it("points SSH operators to dashboard-url for remote-access instructions when the gateway is running (#8465)", async () => {
vi.stubEnv("SSH_CONNECTION", "203.0.113.9 51000 198.51.100.2 22");
const harness = createStatusFlowHarness({ gatewayRunning: true });

await expect(harness.showSandboxStatus("alpha")).resolves.toBeUndefined();

const output = harness.logSpy.mock.calls.map((call) => String(call[0])).join("\n");
expect(output).toContain("OpenClaw: ");
expect(output).toContain("running");
expect(output).toContain(
"Remote access: run `nemoclaw 'alpha' dashboard-url` for SSH port forward instructions.",
);
});

it("shell-quotes the sandbox name in SSH dashboard guidance (#8465)", async () => {
vi.stubEnv("SSH_CONNECTION", "203.0.113.9 51000 198.51.100.2 22");
const sandboxName = "alpha's box";
const harness = createStatusFlowHarness({
gatewayRunning: true,
sandboxEntry: { name: sandboxName },
});

await expect(harness.showSandboxStatus(sandboxName)).resolves.toBeUndefined();

const output = harness.logSpy.mock.calls.map((call) => String(call[0])).join("\n");
expect(output).toContain(
"Remote access: run `nemoclaw 'alpha'\\''s box' dashboard-url` for SSH port forward instructions.",
);
});

it.each([
{
caseLabel: "a routable dashboard URL",
chatUiUrl: "https://dashboard.example.test",
sandboxEntry: {},
},
{
caseLabel: "a prepared remote bind",
chatUiUrl: "",
sandboxEntry: { dashboardRemoteBindPrepared: true },
},
])("omits port forward guidance for $caseLabel (#8465)", async ({ chatUiUrl, sandboxEntry }) => {
vi.stubEnv("SSH_CONNECTION", "203.0.113.9 51000 198.51.100.2 22");
vi.stubEnv("CHAT_UI_URL", chatUiUrl);
const harness = createStatusFlowHarness({ gatewayRunning: true, sandboxEntry });

await expect(harness.showSandboxStatus("alpha")).resolves.toBeUndefined();

const output = harness.logSpy.mock.calls.map((call) => String(call[0])).join("\n");
expect(output).toContain("running");
expect(output).not.toContain("Remote access: run");
});

it("omits dashboard guidance over SSH when the gateway is stopped (#8465)", async () => {
vi.stubEnv("SSH_CONNECTION", "203.0.113.9 51000 198.51.100.2 22");
const harness = createStatusFlowHarness({ gatewayRunning: false });

await expect(harness.showSandboxStatus("alpha")).resolves.toBeUndefined();

const output = harness.logSpy.mock.calls.map((call) => String(call[0])).join("\n");
expect(output).toContain("not running");
expect(output).not.toContain("Remote access: run");
});

it("omits the remote-access pointer when the session is not over SSH (#8465)", async () => {
vi.stubEnv("SSH_CONNECTION", "");
vi.stubEnv("SSH_CLIENT", "");
vi.stubEnv("SSH_TTY", "");
const harness = createStatusFlowHarness({ gatewayRunning: true });

await expect(harness.showSandboxStatus("alpha")).resolves.toBeUndefined();

const output = harness.logSpy.mock.calls.map((call) => String(call[0])).join("\n");
expect(output).toContain("running");
expect(output).not.toContain("Remote access: run");
});

it("renders gateway-level handshake failures without removing registry state", async () => {
const harness = createStatusFlowHarness({
inferenceHealth: null,
Expand Down
36 changes: 6 additions & 30 deletions src/lib/actions/sandbox/status-snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { setTimeout as sleep } from "node:timers/promises";

import {
detectOpenShellStateRpcResultIssue,
type OpenShellStateRpcIssue,
Expand Down Expand Up @@ -38,6 +39,7 @@ import type { BaselineExclusionRuntimeStatus } from "../../policy/baseline-exclu
import { redact } from "../../security/redact";
import { parseSandboxPhase } from "../../state/gateway";
import * as registry from "../../state/registry";
import { normalizePersistedSandboxHostMounts } from "../../state/registry/host-mount";
import {
buildGatewayInferenceGetArgs,
canSandboxGatewayRouteRealign,
Expand All @@ -62,6 +64,10 @@ import {
type TerminalRuntimeOomProbeResult,
} from "./terminal-runtime-health";

function normalizeSandboxStatusHostMounts(hostMounts: unknown) {
return normalizePersistedSandboxHostMounts(hostMounts).map((mount) => ({ ...mount }));
}

type ProbeProviderHealth = (
provider: string,
options?: ProviderHealthProbeOptions,
Expand Down Expand Up @@ -119,36 +125,6 @@ export function isInferenceHealthFailing(inferenceHealth: ProviderHealthStatus |
return Boolean(inferenceHealth && (!inferenceHealth.probed || !inferenceHealth.ok));
}

/** Validate user-editable mount state before it reaches JSON or terminal output. */
export function normalizeSandboxStatusHostMounts(value: unknown): registry.SandboxHostMount[] {
if (value === undefined) return [];
if (!Array.isArray(value)) {
throw new Error("Persisted host mount state must be an array; repair the local state first.");
}
return value.map((candidate) => {
if (
typeof candidate !== "object" ||
candidate === null ||
typeof (candidate as Record<string, unknown>).source !== "string" ||
typeof (candidate as Record<string, unknown>).target !== "string" ||
(candidate as Record<string, unknown>).readOnly !== true
) {
throw new Error(
"Persisted state contains an invalid read-only host mount; repair the local state first.",
);
}
const { source, target } = candidate as { source: string; target: string };
if (
registry.hasUnsafeHostMountTerminalText(source) ||
registry.hasUnsafeHostMountTerminalText(target)
) {
throw new Error(
"Persisted state contains a host mount with unsafe terminal control characters; repair the local state first.",
);
}
return { source, target, readOnly: true };
});
}

export interface SandboxStatusReport {
schemaVersion: 1;
Expand Down
22 changes: 2 additions & 20 deletions src/lib/actions/sandbox/status-text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { formatInferenceRouteDriftForDisplay } from "../../inference/config";
import type { ProviderHealthStatus } from "../../inference/health";
import * as nim from "../../inference/nim";
import { getEffectiveReasoningEffort } from "../../inference/selection";
import { buildSshForwardHintLines } from "../../onboard/ssh-forward-hint";
import { getBaselineExclusionRuntimeStatus } from "../../policy";
import {
BASELINE_EXCLUSION_SUPPORT_IMPACT,
Expand All @@ -19,6 +18,7 @@ import {
import * as sandboxVersion from "../../sandbox/version";
import * as shields from "../../shields";
import type { SandboxEntry, SandboxGpuProofResult } from "../../state/registry";
import { normalizePersistedSandboxHostMounts } from "../../state/registry/host-mount";
import {
createSystemDeps as createSessionDeps,
getActiveSandboxSessions,
Expand All @@ -28,7 +28,6 @@ import type { SandboxGatewayState } from "./gateway-state";
import { isSandboxGatewayRunningForStatus } from "./status/process-recovery";
import {
isInferenceHealthFailing,
normalizeSandboxStatusHostMounts,
resolveSandboxStatusDcodeAutoApprovalMode,
type SandboxStatusAgentInfo,
type SandboxStatusRouteDrift,
Expand Down Expand Up @@ -206,7 +205,7 @@ function printSandboxGpuStatus(sandbox: SandboxEntry): void {
}

function printSandboxHostMounts(sandbox: SandboxEntry): void {
const hostMounts = normalizeSandboxStatusHostMounts(sandbox.hostMounts);
const hostMounts = normalizePersistedSandboxHostMounts(sandbox.hostMounts);
if (hostMounts.length === 0) return;
console.log(" Host mounts:");
for (const mount of hostMounts) {
Expand Down Expand Up @@ -390,30 +389,13 @@ export function printSandboxDetails(context: SandboxStatusTextContext): SandboxS
return { exitCode: inferenceExitCode ?? agentExitCode };
}

// `status` does not print the dashboard URL, so direct SSH operators to
// `dashboard-url` only when the shared SSH port forward check says the
// dashboard still needs a loopback forward (#5925, #8465).
function printDashboardRemoteAccessHint(context: SandboxStatusTextContext): void {
const { sandboxName, sb } = context;
const dashboardPort = sb?.dashboardPort;
if (!dashboardPort) return;
const accessUrl = sb?.dashboardRemoteBindPrepared
? `http://0.0.0.0:${dashboardPort}`
: process.env.CHAT_UI_URL;
if (!buildSshForwardHintLines({ port: dashboardPort, accessUrl })) return;
console.log(
` Remote access: run \`${CLI_NAME} ${shellQuote(sandboxName)} dashboard-url\` for SSH port forward instructions.`,
);
}

async function printGatewayProcessStatus(context: SandboxStatusTextContext): Promise<void> {
const { sandboxName, statusAgent } = context;
const running = await isSandboxGatewayRunningForStatus(sandboxName);
if (running === null) return;
const agentName = statusAgent.agentDisplayName;
if (running) {
console.log(` ${agentName}: ${G}running${R}`);
printDashboardRemoteAccessHint(context);
return;
}
console.log(` ${agentName}: ${RD}not running${R}`);
Expand Down
45 changes: 9 additions & 36 deletions src/lib/actions/sandbox/status.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// 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";
import type { ProviderHealthProbeOptions } from "../../inference/health";
import {
Expand Down Expand Up @@ -96,40 +93,16 @@ describe("sandbox status DCode auto-approval (#6478)", () => {

describe("sandbox status host mounts", () => {
it("projects durable read-only host mounts into JSON status", async () => {
const source = fs.mkdtempSync(path.join(process.cwd(), ".status-host-mount-test-"));
const hostMounts = [{ source, target: "/sandbox/project", readOnly: true as const }];
try {
const report = await getSandboxStatusReport("alpha", {
getSandbox: () => ({ name: "alpha", hostMounts }) as never,
reconcile: async () => ({ state: "missing" as const, output: "not found" }),
});

expect(report.hostMounts).toEqual(hostMounts);
expect(report.hostMounts).not.toBe(hostMounts);
} finally {
fs.rmSync(source, { recursive: true, force: true });
}
});

it("rejects malformed and terminal-control host mounts before JSON rendering", async () => {
const reportFor = (hostMounts: unknown) =>
getSandboxStatusReport("alpha", {
getSandbox: () => ({ name: "alpha", hostMounts }) as never,
reconcile: async () => ({ state: "missing" as const, output: "not found" }),
});
const hostMounts = [
{ source: "/srv/project", target: "/sandbox/project", readOnly: true as const },
];
const report = await getSandboxStatusReport("alpha", {
getSandbox: () => ({ name: "alpha", hostMounts }) as never,
reconcile: async () => ({ state: "missing" as const, output: "not found" }),
});

await expect(reportFor("not-an-array")).rejects.toThrow(
"Persisted host mount state must be an array",
);
await expect(
reportFor([
{
source: "/srv/project\u202e",
target: "/sandbox/project",
readOnly: true,
},
]),
).rejects.toThrow("unsafe terminal control characters");
expect(report.hostMounts).toEqual(hostMounts);
expect(report.hostMounts).not.toBe(hostMounts);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
});
});

Expand Down
1 change: 1 addition & 0 deletions src/lib/onboard/checkpoint-resume-guard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ function makeDeps(overrides: Partial<OnboardSessionBootstrapDeps>): OnboardSessi
exitProcess: (code) => {
throw new ExitError(code);
},
requireHostMountRuntimeSupport: () => {},
resolveResumeCheckpoint: (): CheckpointLoadResult => ({ status: "none" }),
...overrides,
};
Expand Down
Loading
Loading