From 32129c711ea3c7986a4a32bb06b5d78c3baf7d69 Mon Sep 17 00:00:00 2001 From: Carlos Villela Date: Mon, 10 Aug 2026 04:28:30 -0700 Subject: [PATCH 01/13] test(onboard): expose portable gateway route failure --- .../gateway-sandbox-reachability.test.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/lib/onboard/gateway-sandbox-reachability.test.ts b/src/lib/onboard/gateway-sandbox-reachability.test.ts index f2b08c09f45..73c2b3b7637 100644 --- a/src/lib/onboard/gateway-sandbox-reachability.test.ts +++ b/src/lib/onboard/gateway-sandbox-reachability.test.ts @@ -89,6 +89,23 @@ describe("isSandboxBridgeGatewayReachable", () => { expect(seen.args.join(" ")).toContain("nc -zw7 host.openshell.internal 9090"); }); + it("routes portable profile probes through the OpenShell Podman host gateway", async () => { + vi.stubEnv("NEMOCLAW_EXPERIMENTAL_PROFILE", "portable"); + const seen: { args: readonly string[] } = { args: [] }; + + await isSandboxBridgeGatewayReachable({ + inspectNetworkImpl: () => ({ subnet: "10.89.0.0/24", gatewayIp: "10.89.0.1" }), + usesHostGatewayRouteImpl: () => false, + runImpl: (args) => { + seen.args = args; + return { status: 0 }; + }, + }); + + expect(seen.args).toContain("host.openshell.internal:169.254.1.2"); + expect(seen.args).not.toContain("host.openshell.internal:10.89.0.1"); + }); + it("does not call a missing Docker network a firewall failure", async () => { const result = await isSandboxBridgeGatewayReachable({ inspectNetworkImpl: () => undefined, From 25c7e39e16284b048e341ca5abe96ac7bd56c112 Mon Sep 17 00:00:00 2001 From: Carlos Villela Date: Mon, 10 Aug 2026 04:36:02 -0700 Subject: [PATCH 02/13] fix(onboard): route portable gateway reachability probe --- src/lib/onboard/docker-driver-platform.ts | 27 +++++++------------ .../onboard/experimental/portable-profile.ts | 21 +++++++++++++++ .../onboard/gateway-sandbox-reachability.ts | 21 ++++++++++++++- 3 files changed, 50 insertions(+), 19 deletions(-) create mode 100644 src/lib/onboard/experimental/portable-profile.ts diff --git a/src/lib/onboard/docker-driver-platform.ts b/src/lib/onboard/docker-driver-platform.ts index 3e25bf60c5f..e568aed848b 100644 --- a/src/lib/onboard/docker-driver-platform.ts +++ b/src/lib/onboard/docker-driver-platform.ts @@ -5,24 +5,15 @@ import { resolveCurrentOpenShellComputePlan, usesManagedDockerGateway } from "./ export { resolveCurrentOpenShellComputePlan } from "./compute/plan"; -export const EXPERIMENTAL_PROFILE_ENV = "NEMOCLAW_EXPERIMENTAL_PROFILE"; -export const PORTABLE_EXPERIMENTAL_PROFILE = "portable"; -export const PORTABLE_HOST_GATEWAY_IP = "169.254.1.2"; -export const PORTABLE_LOCAL_REGISTRY = "localhost:5000"; - -export type ExperimentalOnboardProfile = typeof PORTABLE_EXPERIMENTAL_PROFILE; - -export function resolveExperimentalOnboardProfile( - env: NodeJS.ProcessEnv = process.env, -): ExperimentalOnboardProfile | null { - return env[EXPERIMENTAL_PROFILE_ENV] === PORTABLE_EXPERIMENTAL_PROFILE - ? PORTABLE_EXPERIMENTAL_PROFILE - : null; -} - -export function isPortableExperimentalProfile(env: NodeJS.ProcessEnv = process.env): boolean { - return resolveExperimentalOnboardProfile(env) === PORTABLE_EXPERIMENTAL_PROFILE; -} +export { + type ExperimentalOnboardProfile, + EXPERIMENTAL_PROFILE_ENV, + isPortableExperimentalProfile, + PORTABLE_EXPERIMENTAL_PROFILE, + PORTABLE_HOST_GATEWAY_IP, + PORTABLE_LOCAL_REGISTRY, + resolveExperimentalOnboardProfile, +} from "./experimental/portable-profile"; export function isLinuxDockerDriverGatewayEnabled( platform: NodeJS.Platform = process.platform, diff --git a/src/lib/onboard/experimental/portable-profile.ts b/src/lib/onboard/experimental/portable-profile.ts new file mode 100644 index 00000000000..04aa07e45f1 --- /dev/null +++ b/src/lib/onboard/experimental/portable-profile.ts @@ -0,0 +1,21 @@ +// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +export const EXPERIMENTAL_PROFILE_ENV = "NEMOCLAW_EXPERIMENTAL_PROFILE"; +export const PORTABLE_EXPERIMENTAL_PROFILE = "portable"; +export const PORTABLE_HOST_GATEWAY_IP = "169.254.1.2"; +export const PORTABLE_LOCAL_REGISTRY = "localhost:5000"; + +export type ExperimentalOnboardProfile = typeof PORTABLE_EXPERIMENTAL_PROFILE; + +export function resolveExperimentalOnboardProfile( + env: NodeJS.ProcessEnv = process.env, +): ExperimentalOnboardProfile | null { + return env[EXPERIMENTAL_PROFILE_ENV] === PORTABLE_EXPERIMENTAL_PROFILE + ? PORTABLE_EXPERIMENTAL_PROFILE + : null; +} + +export function isPortableExperimentalProfile(env: NodeJS.ProcessEnv = process.env): boolean { + return resolveExperimentalOnboardProfile(env) === PORTABLE_EXPERIMENTAL_PROFILE; +} diff --git a/src/lib/onboard/gateway-sandbox-reachability.ts b/src/lib/onboard/gateway-sandbox-reachability.ts index 81689206f2f..187442ef66e 100644 --- a/src/lib/onboard/gateway-sandbox-reachability.ts +++ b/src/lib/onboard/gateway-sandbox-reachability.ts @@ -16,6 +16,10 @@ import { dockerCapture, dockerRun } from "../adapters/docker/run"; import { failLine, warnLine } from "../cli/terminal-style"; import { GATEWAY_PORT } from "../core/ports"; import { cliDisplayName, cliName } from "./branding"; +import { + isPortableExperimentalProfile, + PORTABLE_HOST_GATEWAY_IP, +} from "./experimental/portable-profile"; import { DOCKER_DESKTOP_WSL_INTEGRATION_HINT, ensureProbeImageCached, @@ -165,8 +169,18 @@ function buildOpenShellDockerRoute( networkName: string, network: DockerBridgeNetworkInfo | undefined, usesHostGatewayRoute: boolean, + portableHostGatewayIp?: string, ): OpenShellDockerRoute | undefined { if (!network) return undefined; + if (portableHostGatewayIp) { + return { + networkName, + subnet: network.subnet, + gatewayIp: portableHostGatewayIp, + routeKind: "host_gateway", + addHosts: [`${HOST_INTERNAL_NAME}:${portableHostGatewayIp}`], + }; + } if (usesHostGatewayRoute) { return { networkName, @@ -270,7 +284,12 @@ export async function isSandboxBridgeGatewayReachable( const runImpl = opts.runImpl ?? defaultRunImpl; const network = inspectNetwork(networkName); - const route = buildOpenShellDockerRoute(networkName, network, usesHostGatewayRoute()); + const route = buildOpenShellDockerRoute( + networkName, + network, + usesHostGatewayRoute(), + isPortableExperimentalProfile() ? PORTABLE_HOST_GATEWAY_IP : undefined, + ); if (!route) { return { ok: false, From af86bfcc7e61ffc6dd300f94d9274c09a86eff9e Mon Sep 17 00:00:00 2001 From: Carlos Villela Date: Mon, 10 Aug 2026 04:53:30 -0700 Subject: [PATCH 03/13] test(onboard): assert portable gateway route metadata --- src/lib/onboard/gateway-sandbox-reachability.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/onboard/gateway-sandbox-reachability.test.ts b/src/lib/onboard/gateway-sandbox-reachability.test.ts index 73c2b3b7637..f503f80a6c2 100644 --- a/src/lib/onboard/gateway-sandbox-reachability.test.ts +++ b/src/lib/onboard/gateway-sandbox-reachability.test.ts @@ -93,7 +93,7 @@ describe("isSandboxBridgeGatewayReachable", () => { vi.stubEnv("NEMOCLAW_EXPERIMENTAL_PROFILE", "portable"); const seen: { args: readonly string[] } = { args: [] }; - await isSandboxBridgeGatewayReachable({ + const result = await isSandboxBridgeGatewayReachable({ inspectNetworkImpl: () => ({ subnet: "10.89.0.0/24", gatewayIp: "10.89.0.1" }), usesHostGatewayRouteImpl: () => false, runImpl: (args) => { @@ -102,6 +102,8 @@ describe("isSandboxBridgeGatewayReachable", () => { }, }); + expect(result).toMatchObject({ ok: true, gatewayIp: "169.254.1.2", routeKind: "host_gateway" }); + expect(seen.args).toContain("host.openshell.internal:169.254.1.2"); expect(seen.args).not.toContain("host.openshell.internal:10.89.0.1"); }); From 20bd53ca777b448aaaa4083931f403739a50e31b Mon Sep 17 00:00:00 2001 From: Carlos Villela Date: Mon, 10 Aug 2026 04:57:57 -0700 Subject: [PATCH 04/13] fix(onboard): report Podman gateway recovery --- .../gateway-sandbox-reachability.test.ts | 23 +++++++++++++++++-- .../onboard/gateway-sandbox-reachability.ts | 17 +++++++++++--- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/src/lib/onboard/gateway-sandbox-reachability.test.ts b/src/lib/onboard/gateway-sandbox-reachability.test.ts index f503f80a6c2..0f709edf9a3 100644 --- a/src/lib/onboard/gateway-sandbox-reachability.test.ts +++ b/src/lib/onboard/gateway-sandbox-reachability.test.ts @@ -89,7 +89,7 @@ describe("isSandboxBridgeGatewayReachable", () => { expect(seen.args.join(" ")).toContain("nc -zw7 host.openshell.internal 9090"); }); - it("routes portable profile probes through the OpenShell Podman host gateway", async () => { + it("routes probes for the portable experimental profile through the OpenShell Podman host gateway", async () => { vi.stubEnv("NEMOCLAW_EXPERIMENTAL_PROFILE", "portable"); const seen: { args: readonly string[] } = { args: [] }; @@ -102,7 +102,11 @@ describe("isSandboxBridgeGatewayReachable", () => { }, }); - expect(result).toMatchObject({ ok: true, gatewayIp: "169.254.1.2", routeKind: "host_gateway" }); + expect(result).toMatchObject({ + ok: true, + gatewayIp: "169.254.1.2", + routeKind: "portable_host_gateway", + }); expect(seen.args).toContain("host.openshell.internal:169.254.1.2"); expect(seen.args).not.toContain("host.openshell.internal:10.89.0.1"); @@ -486,6 +490,21 @@ describe("formatSandboxBridgeUnreachableMessage", () => { expect(msg).toContain("host-gateway"); expect(msg).not.toContain("ufw allow"); }); + + it("reports Podman recovery for portable host-gateway failures", () => { + const msg = formatSandboxBridgeUnreachableMessage({ + ok: false, + reason: "tcp_failed", + routeKind: "portable_host_gateway", + networkName: "openshell-docker", + subnet: "10.89.0.0/24", + gatewayIp: "169.254.1.2", + }); + expect(msg).toContain("OpenShell Podman host gateway"); + expect(msg).toContain("Restart Podman"); + expect(msg).not.toContain("Restart Docker"); + expect(msg).not.toContain("ufw allow"); + }); }); describe("tryAutoApplyUfwRule (#4265)", () => { diff --git a/src/lib/onboard/gateway-sandbox-reachability.ts b/src/lib/onboard/gateway-sandbox-reachability.ts index 187442ef66e..221b317b929 100644 --- a/src/lib/onboard/gateway-sandbox-reachability.ts +++ b/src/lib/onboard/gateway-sandbox-reachability.ts @@ -48,7 +48,7 @@ export type SandboxBridgeReachabilityReason = | "probe_timeout" | "veth_unsupported" | "docker_daemon_unreachable"; -export type SandboxBridgeRouteKind = "bridge_gateway" | "host_gateway"; +export type SandboxBridgeRouteKind = "bridge_gateway" | "host_gateway" | "portable_host_gateway"; export interface DockerBridgeNetworkInfo { subnet?: string; @@ -177,7 +177,7 @@ function buildOpenShellDockerRoute( networkName, subnet: network.subnet, gatewayIp: portableHostGatewayIp, - routeKind: "host_gateway", + routeKind: "portable_host_gateway", addHosts: [`${HOST_INTERNAL_NAME}:${portableHostGatewayIp}`], }; } @@ -467,6 +467,14 @@ export function formatSandboxBridgeUnreachableMessage( .join("\n"); } + if (result.routeKind === "portable_host_gateway") { + return [ + failLine(`Sandbox containers cannot reach the gateway at ${HOST_INTERNAL_NAME}:${port}.`), + ` The probe mapped ${HOST_INTERNAL_NAME} to the OpenShell Podman host gateway.`, + ` Restart Podman and the OpenShell gateway, then re-run \`${cliName()} onboard\`.`, + ].join("\n"); + } + if (result.routeKind === "host_gateway") { return [ failLine(`Sandbox containers cannot reach the gateway at ${HOST_INTERNAL_NAME}:${port}.`), @@ -518,7 +526,10 @@ const SILENT_UFW_AUTO_APPLY_REASONS = new Set([ ]); function isRetriableHostGatewayFailure(reach: SandboxBridgeReachabilityResult): boolean { - return reach.routeKind === "host_gateway" && reach.reason === "tcp_failed"; + return ( + (reach.routeKind === "host_gateway" || reach.routeKind === "portable_host_gateway") && + reach.reason === "tcp_failed" + ); } function sleepMs(ms: number): Promise { From bd85793bc49edbeb41dd44d1f35da02aa6c34d48 Mon Sep 17 00:00:00 2001 From: Carlos Villela Date: Mon, 10 Aug 2026 05:05:04 -0700 Subject: [PATCH 05/13] fix(onboard): preserve portable recovery profile --- docs/reference/commands.mdx | 4 ++ docs/reference/troubleshooting.mdx | 42 +++++++++++++++++++ .../gateway-sandbox-reachability.test.ts | 4 +- .../onboard/gateway-sandbox-reachability.ts | 5 ++- 4 files changed, 53 insertions(+), 2 deletions(-) diff --git a/docs/reference/commands.mdx b/docs/reference/commands.mdx index f1956c936ff..491005dc97a 100644 --- a/docs/reference/commands.mdx +++ b/docs/reference/commands.mdx @@ -771,6 +771,10 @@ For Linux Docker-driver gateways, onboarding also checks that a helper container If a host firewall blocks that sandbox path, onboarding exits with a `sudo ufw allow from to port proto tcp` command before it reports the gateway healthy. Set `NEMOCLAW_AUTO_FIX_FIREWALL=1` to opt in to automatic UFW remediation for this specific failure: NemoClaw uses `sudo -n` only, validates the Docker bridge subnet/gateway/port, applies the narrow UFW rule only after a proven TCP reachability failure, and re-probes before continuing. If passwordless sudo, UFW, or active UFW is unavailable, NemoClaw falls back to the manual guidance path without prompting for a password. + +For the portable experimental profile, the helper maps `host.openshell.internal` to the OpenShell Podman host gateway instead of the inspected network gateway. +This path does not use Docker bridge UFW remediation. +If the probe fails, onboarding prints user-scoped Podman restart commands and a rerun command that preserves `--experimental-profile portable`. Tune the wait via `NEMOCLAW_REUSE_HEALTH_POLL_COUNT` (default `6`) and `NEMOCLAW_REUSE_HEALTH_POLL_INTERVAL` (default `5` seconds). The poll count is clamped to a minimum of `1` so the probe always runs at least once, and the interval is clamped to a minimum of `0` (no sleep between attempts). diff --git a/docs/reference/troubleshooting.mdx b/docs/reference/troubleshooting.mdx index 02e2656e25e..9914e21e66b 100644 --- a/docs/reference/troubleshooting.mdx +++ b/docs/reference/troubleshooting.mdx @@ -3054,6 +3054,48 @@ Then rerun portable onboarding: $$nemoclaw onboard --experimental-profile portable ``` +### Portable Host Gateway Is Unreachable + +The portable experimental profile maps `host.openshell.internal` to the OpenShell Podman host gateway. +Do not apply the Docker bridge UFW command when portable onboarding reports this route as unreachable. + +Portable onboarding reports output like this: + +```text +✗ Sandbox containers cannot reach the gateway at host.openshell.internal:8080. + The probe mapped host.openshell.internal to the OpenShell Podman host gateway. +``` + +Restart the user-scoped Podman service and enable its socket: + +```bash +systemctl --user try-restart podman.service +systemctl --user enable --now podman.socket +``` + +These commands restart the current user's Podman service and keep its API socket active. +They do not change system services or credentials. + +Verify that the socket is active: + +```bash +systemctl --user is-active podman.socket +``` + +Expected output: + +```text +active +``` + +Then rerun portable onboarding: + +```bash +$$nemoclaw onboard --experimental-profile portable +``` + +Continue only when onboarding no longer reports that the OpenShell Podman host gateway is unreachable. + ## Hermes diff --git a/src/lib/onboard/gateway-sandbox-reachability.test.ts b/src/lib/onboard/gateway-sandbox-reachability.test.ts index 0f709edf9a3..eeef20ea854 100644 --- a/src/lib/onboard/gateway-sandbox-reachability.test.ts +++ b/src/lib/onboard/gateway-sandbox-reachability.test.ts @@ -501,7 +501,9 @@ describe("formatSandboxBridgeUnreachableMessage", () => { gatewayIp: "169.254.1.2", }); expect(msg).toContain("OpenShell Podman host gateway"); - expect(msg).toContain("Restart Podman"); + expect(msg).toContain("systemctl --user try-restart podman.service"); + expect(msg).toContain("systemctl --user enable --now podman.socket"); + expect(msg).toContain("nemoclaw onboard --experimental-profile portable"); expect(msg).not.toContain("Restart Docker"); expect(msg).not.toContain("ufw allow"); }); diff --git a/src/lib/onboard/gateway-sandbox-reachability.ts b/src/lib/onboard/gateway-sandbox-reachability.ts index 221b317b929..6fa03210608 100644 --- a/src/lib/onboard/gateway-sandbox-reachability.ts +++ b/src/lib/onboard/gateway-sandbox-reachability.ts @@ -471,7 +471,10 @@ export function formatSandboxBridgeUnreachableMessage( return [ failLine(`Sandbox containers cannot reach the gateway at ${HOST_INTERNAL_NAME}:${port}.`), ` The probe mapped ${HOST_INTERNAL_NAME} to the OpenShell Podman host gateway.`, - ` Restart Podman and the OpenShell gateway, then re-run \`${cliName()} onboard\`.`, + " Restart the user-scoped Podman service and socket:", + " systemctl --user try-restart podman.service", + " systemctl --user enable --now podman.socket", + ` Then rerun \`${cliName()} onboard --experimental-profile portable\` to restart the OpenShell gateway.`, ].join("\n"); } From 8f0e57b56ff64b710ac5a289e891249c1c970e6f Mon Sep 17 00:00:00 2001 From: Carlos Villela Date: Mon, 10 Aug 2026 05:09:16 -0700 Subject: [PATCH 06/13] docs(onboard): clarify portable gateway recovery --- docs/reference/commands.mdx | 4 ++-- docs/reference/troubleshooting.mdx | 8 +++++--- src/lib/onboard/gateway-sandbox-reachability.ts | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/reference/commands.mdx b/docs/reference/commands.mdx index 491005dc97a..05469f38928 100644 --- a/docs/reference/commands.mdx +++ b/docs/reference/commands.mdx @@ -775,8 +775,8 @@ If passwordless sudo, UFW, or active UFW is unavailable, NemoClaw falls back to For the portable experimental profile, the helper maps `host.openshell.internal` to the OpenShell Podman host gateway instead of the inspected network gateway. This path does not use Docker bridge UFW remediation. If the probe fails, onboarding prints user-scoped Podman restart commands and a rerun command that preserves `--experimental-profile portable`. -Tune the wait via `NEMOCLAW_REUSE_HEALTH_POLL_COUNT` (default `6`) and `NEMOCLAW_REUSE_HEALTH_POLL_INTERVAL` (default `5` seconds). -The poll count is clamped to a minimum of `1` so the probe always runs at least once, and the interval is clamped to a minimum of `0` (no sleep between attempts). +To tune the existing-gateway HTTP health poll, use `NEMOCLAW_REUSE_HEALTH_POLL_COUNT` (default `6`) and `NEMOCLAW_REUSE_HEALTH_POLL_INTERVAL` (default `5` seconds). +The poll count is clamped to a minimum of `1` so the health probe always runs at least once, and the interval is clamped to a minimum of `0` (no sleep between attempts). #### `--from ` diff --git a/docs/reference/troubleshooting.mdx b/docs/reference/troubleshooting.mdx index 9914e21e66b..3bb5581d20b 100644 --- a/docs/reference/troubleshooting.mdx +++ b/docs/reference/troubleshooting.mdx @@ -3066,15 +3066,17 @@ Portable onboarding reports output like this: The probe mapped host.openshell.internal to the OpenShell Podman host gateway. ``` -Restart the user-scoped Podman service and enable its socket: +If `podman.service` is active, restart it. +Then enable and start the user-scoped Podman socket: ```bash systemctl --user try-restart podman.service systemctl --user enable --now podman.socket ``` -These commands restart the current user's Podman service and keep its API socket active. -They do not change system services or credentials. +The first command does not start an inactive service. +The second command enables and starts the current user's Podman API socket. +These commands do not change system services or credentials. Verify that the socket is active: diff --git a/src/lib/onboard/gateway-sandbox-reachability.ts b/src/lib/onboard/gateway-sandbox-reachability.ts index 6fa03210608..67919347999 100644 --- a/src/lib/onboard/gateway-sandbox-reachability.ts +++ b/src/lib/onboard/gateway-sandbox-reachability.ts @@ -471,7 +471,7 @@ export function formatSandboxBridgeUnreachableMessage( return [ failLine(`Sandbox containers cannot reach the gateway at ${HOST_INTERNAL_NAME}:${port}.`), ` The probe mapped ${HOST_INTERNAL_NAME} to the OpenShell Podman host gateway.`, - " Restart the user-scoped Podman service and socket:", + " If active, restart the user-scoped Podman service, then enable and start its socket:", " systemctl --user try-restart podman.service", " systemctl --user enable --now podman.socket", ` Then rerun \`${cliName()} onboard --experimental-profile portable\` to restart the OpenShell gateway.`, From 2e97ea995a4d09c7154368519e37c780444d3960 Mon Sep 17 00:00:00 2001 From: Carlos Villela Date: Mon, 10 Aug 2026 05:13:29 -0700 Subject: [PATCH 07/13] docs(onboard): correct portable rerun scope --- docs/reference/commands.mdx | 2 +- src/lib/onboard/gateway-sandbox-reachability.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/reference/commands.mdx b/docs/reference/commands.mdx index 05469f38928..01e2ee69afb 100644 --- a/docs/reference/commands.mdx +++ b/docs/reference/commands.mdx @@ -774,7 +774,7 @@ If passwordless sudo, UFW, or active UFW is unavailable, NemoClaw falls back to For the portable experimental profile, the helper maps `host.openshell.internal` to the OpenShell Podman host gateway instead of the inspected network gateway. This path does not use Docker bridge UFW remediation. -If the probe fails, onboarding prints user-scoped Podman restart commands and a rerun command that preserves `--experimental-profile portable`. +If the portable TCP probe cannot connect, onboarding prints user-scoped Podman restart commands and a rerun command that preserves `--experimental-profile portable`. To tune the existing-gateway HTTP health poll, use `NEMOCLAW_REUSE_HEALTH_POLL_COUNT` (default `6`) and `NEMOCLAW_REUSE_HEALTH_POLL_INTERVAL` (default `5` seconds). The poll count is clamped to a minimum of `1` so the health probe always runs at least once, and the interval is clamped to a minimum of `0` (no sleep between attempts). diff --git a/src/lib/onboard/gateway-sandbox-reachability.ts b/src/lib/onboard/gateway-sandbox-reachability.ts index 67919347999..de063c7a9d3 100644 --- a/src/lib/onboard/gateway-sandbox-reachability.ts +++ b/src/lib/onboard/gateway-sandbox-reachability.ts @@ -474,7 +474,7 @@ export function formatSandboxBridgeUnreachableMessage( " If active, restart the user-scoped Podman service, then enable and start its socket:", " systemctl --user try-restart podman.service", " systemctl --user enable --now podman.socket", - ` Then rerun \`${cliName()} onboard --experimental-profile portable\` to restart the OpenShell gateway.`, + ` Then rerun \`${cliName()} onboard --experimental-profile portable\`.`, ].join("\n"); } From 2116574e8933ce7485fa47d090e5d23c70609859 Mon Sep 17 00:00:00 2001 From: Carlos Villela Date: Mon, 10 Aug 2026 05:19:20 -0700 Subject: [PATCH 08/13] fix(onboard): use route-neutral gateway diagnostics --- docs/reference/commands.mdx | 3 ++- docs/reference/troubleshooting.mdx | 3 ++- src/lib/onboard/gateway-sandbox-reachability.test.ts | 10 +++++----- src/lib/onboard/gateway-sandbox-reachability.ts | 8 +++----- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/reference/commands.mdx b/docs/reference/commands.mdx index 01e2ee69afb..ca66da161c8 100644 --- a/docs/reference/commands.mdx +++ b/docs/reference/commands.mdx @@ -774,7 +774,8 @@ If passwordless sudo, UFW, or active UFW is unavailable, NemoClaw falls back to For the portable experimental profile, the helper maps `host.openshell.internal` to the OpenShell Podman host gateway instead of the inspected network gateway. This path does not use Docker bridge UFW remediation. -If the portable TCP probe cannot connect, onboarding prints user-scoped Podman restart commands and a rerun command that preserves `--experimental-profile portable`. +On a failed portable TCP probe, onboarding prints commands for the user-scoped Podman service and socket. +The rerun command preserves `--experimental-profile portable`. To tune the existing-gateway HTTP health poll, use `NEMOCLAW_REUSE_HEALTH_POLL_COUNT` (default `6`) and `NEMOCLAW_REUSE_HEALTH_POLL_INTERVAL` (default `5` seconds). The poll count is clamped to a minimum of `1` so the health probe always runs at least once, and the interval is clamped to a minimum of `0` (no sleep between attempts). diff --git a/docs/reference/troubleshooting.mdx b/docs/reference/troubleshooting.mdx index 3bb5581d20b..09236ccd361 100644 --- a/docs/reference/troubleshooting.mdx +++ b/docs/reference/troubleshooting.mdx @@ -3076,7 +3076,8 @@ systemctl --user enable --now podman.socket The first command does not start an inactive service. The second command enables and starts the current user's Podman API socket. -These commands do not change system services or credentials. +These commands affect only the current user's Podman units. +They do not read or write credentials. Verify that the socket is active: diff --git a/src/lib/onboard/gateway-sandbox-reachability.test.ts b/src/lib/onboard/gateway-sandbox-reachability.test.ts index eeef20ea854..9540c5d50cd 100644 --- a/src/lib/onboard/gateway-sandbox-reachability.test.ts +++ b/src/lib/onboard/gateway-sandbox-reachability.test.ts @@ -698,7 +698,7 @@ describe("verifySandboxBridgeGatewayReachableOrExit host-gateway retry", () => { retryDelayMs: 25, sleepMsImpl, }), - ).rejects.toThrow("sandbox-bridge unreachable"); + ).rejects.toThrow("cannot reach the OpenShell gateway"); expect(reachabilityImpl).toHaveBeenCalledTimes(3); expect(sleepMsImpl).toHaveBeenCalledTimes(2); expect(sleepMsImpl).toHaveBeenNthCalledWith(1, 25); @@ -729,7 +729,7 @@ describe("verifySandboxBridgeGatewayReachableOrExit host-gateway retry", () => { reachabilityImpl, sleepMsImpl, }), - ).rejects.toThrow("sandbox-bridge unreachable"); + ).rejects.toThrow("cannot reach the OpenShell gateway"); expect(reachabilityImpl).toHaveBeenCalledTimes(10); expect(sleepMsImpl).toHaveBeenCalledTimes(9); expect(sleepMsImpl).toHaveBeenCalledWith(1000); @@ -761,7 +761,7 @@ describe("verifySandboxBridgeGatewayReachableOrExit host-gateway retry", () => { retryDelayMs: 25, sleepMsImpl, }), - ).rejects.toThrow("sandbox-bridge unreachable"); + ).rejects.toThrow("cannot reach the OpenShell gateway"); expect(reachabilityImpl).toHaveBeenCalledTimes(1); expect(sleepMsImpl).not.toHaveBeenCalled(); expect(error).toHaveBeenCalledWith(expect.stringContaining("ufw allow")); @@ -827,7 +827,7 @@ describe("verifySandboxBridgeGatewayReachableOrExit UFW auto-apply (#4265)", () autoApplyOptedInImpl: () => true, reachabilityImpl, }), - ).rejects.toThrow("sandbox-bridge unreachable"); + ).rejects.toThrow("cannot reach the OpenShell gateway"); expect(reachabilityImpl).toHaveBeenCalledTimes(2); expect(error).toHaveBeenCalledWith(expect.stringContaining("ufw allow")); log.mockRestore(); @@ -843,7 +843,7 @@ describe("verifySandboxBridgeGatewayReachableOrExit UFW auto-apply (#4265)", () autoApplyOptedInImpl: () => true, reachabilityImpl: () => tcpFailure, }), - ).rejects.toThrow("sandbox-bridge unreachable"); + ).rejects.toThrow("cannot reach the OpenShell gateway"); expect(warn).not.toHaveBeenCalled(); expect(error).toHaveBeenCalledWith(expect.stringContaining("ufw allow")); warn.mockRestore(); diff --git a/src/lib/onboard/gateway-sandbox-reachability.ts b/src/lib/onboard/gateway-sandbox-reachability.ts index de063c7a9d3..de856dc6277 100644 --- a/src/lib/onboard/gateway-sandbox-reachability.ts +++ b/src/lib/onboard/gateway-sandbox-reachability.ts @@ -568,14 +568,12 @@ export async function verifySandboxBridgeGatewayReachableOrExit( attempt += 1 ) { console.log( - ` Docker-driver sandbox bridge probe attempt ${attempt - 1}/${retryAttempts} failed (${reach.reason}); retrying in ${retryDelayMs} ms...`, + ` OpenShell gateway reachability probe attempt ${attempt - 1}/${retryAttempts} failed (${reach.reason}); retrying in ${retryDelayMs} ms...`, ); await sleep(retryDelayMs); reach = await reachability({ port }); if (reach.ok) { - console.log( - ` ✓ Docker-driver sandbox bridge reachable on attempt ${attempt}/${retryAttempts}`, - ); + console.log(` ✓ OpenShell gateway reachable on attempt ${attempt}/${retryAttempts}`); return; } } @@ -613,7 +611,7 @@ export async function verifySandboxBridgeGatewayReachableOrExit( if (exitOnFailure) { process.exit(1); } - throw new Error(`Docker-driver sandbox-bridge unreachable (${reach.reason})`); + throw new Error(`Sandbox containers cannot reach the OpenShell gateway (${reach.reason})`); } export const __test = { From 5c33dae0c168029b697d50e275a8bc39d6aa9d6d Mon Sep 17 00:00:00 2001 From: Carlos Villela Date: Mon, 10 Aug 2026 05:22:48 -0700 Subject: [PATCH 09/13] docs(onboard): split portable recovery steps --- docs/reference/commands.mdx | 2 +- src/lib/onboard/gateway-sandbox-reachability.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/reference/commands.mdx b/docs/reference/commands.mdx index ca66da161c8..2226602222d 100644 --- a/docs/reference/commands.mdx +++ b/docs/reference/commands.mdx @@ -774,7 +774,7 @@ If passwordless sudo, UFW, or active UFW is unavailable, NemoClaw falls back to For the portable experimental profile, the helper maps `host.openshell.internal` to the OpenShell Podman host gateway instead of the inspected network gateway. This path does not use Docker bridge UFW remediation. -On a failed portable TCP probe, onboarding prints commands for the user-scoped Podman service and socket. +After all portable TCP probe attempts fail, onboarding prints commands for the user-scoped Podman service and socket. The rerun command preserves `--experimental-profile portable`. To tune the existing-gateway HTTP health poll, use `NEMOCLAW_REUSE_HEALTH_POLL_COUNT` (default `6`) and `NEMOCLAW_REUSE_HEALTH_POLL_INTERVAL` (default `5` seconds). The poll count is clamped to a minimum of `1` so the health probe always runs at least once, and the interval is clamped to a minimum of `0` (no sleep between attempts). diff --git a/src/lib/onboard/gateway-sandbox-reachability.ts b/src/lib/onboard/gateway-sandbox-reachability.ts index de856dc6277..a7e506f650f 100644 --- a/src/lib/onboard/gateway-sandbox-reachability.ts +++ b/src/lib/onboard/gateway-sandbox-reachability.ts @@ -471,8 +471,9 @@ export function formatSandboxBridgeUnreachableMessage( return [ failLine(`Sandbox containers cannot reach the gateway at ${HOST_INTERNAL_NAME}:${port}.`), ` The probe mapped ${HOST_INTERNAL_NAME} to the OpenShell Podman host gateway.`, - " If active, restart the user-scoped Podman service, then enable and start its socket:", + " If the user-scoped Podman service is active, restart it:", " systemctl --user try-restart podman.service", + " Enable and start the user-scoped Podman socket:", " systemctl --user enable --now podman.socket", ` Then rerun \`${cliName()} onboard --experimental-profile portable\`.`, ].join("\n"); From 88d55471e54136bd4ca18b6776c64388949843fb Mon Sep 17 00:00:00 2001 From: Carlos Villela Date: Mon, 10 Aug 2026 05:32:51 -0700 Subject: [PATCH 10/13] docs(onboard): preserve CLI parity for portable recovery --- docs/reference/commands.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/commands.mdx b/docs/reference/commands.mdx index 2226602222d..35bec89f919 100644 --- a/docs/reference/commands.mdx +++ b/docs/reference/commands.mdx @@ -775,7 +775,7 @@ If passwordless sudo, UFW, or active UFW is unavailable, NemoClaw falls back to For the portable experimental profile, the helper maps `host.openshell.internal` to the OpenShell Podman host gateway instead of the inspected network gateway. This path does not use Docker bridge UFW remediation. After all portable TCP probe attempts fail, onboarding prints commands for the user-scoped Podman service and socket. -The rerun command preserves `--experimental-profile portable`. +The printed rerun command keeps the portable experimental profile selected. To tune the existing-gateway HTTP health poll, use `NEMOCLAW_REUSE_HEALTH_POLL_COUNT` (default `6`) and `NEMOCLAW_REUSE_HEALTH_POLL_INTERVAL` (default `5` seconds). The poll count is clamped to a minimum of `1` so the health probe always runs at least once, and the interval is clamped to a minimum of `0` (no sleep between attempts). From 82664319d1c0e51377e5d62a3c8ced5b2f9786c4 Mon Sep 17 00:00:00 2001 From: Carlos Villela Date: Mon, 10 Aug 2026 05:38:00 -0700 Subject: [PATCH 11/13] fix(onboard): route portable daemon recovery --- docs/reference/commands.mdx | 2 + docs/reference/troubleshooting.mdx | 2 + .../gateway-sandbox-reachability.test.ts | 39 +++++++++++++++++++ .../onboard/gateway-sandbox-reachability.ts | 14 +++++++ 4 files changed, 57 insertions(+) diff --git a/docs/reference/commands.mdx b/docs/reference/commands.mdx index 35bec89f919..65339e88558 100644 --- a/docs/reference/commands.mdx +++ b/docs/reference/commands.mdx @@ -775,6 +775,8 @@ If passwordless sudo, UFW, or active UFW is unavailable, NemoClaw falls back to For the portable experimental profile, the helper maps `host.openshell.internal` to the OpenShell Podman host gateway instead of the inspected network gateway. This path does not use Docker bridge UFW remediation. After all portable TCP probe attempts fail, onboarding prints commands for the user-scoped Podman service and socket. + +Onboarding prints the same commands when the portable probe cannot reach the user-scoped Podman service. The printed rerun command keeps the portable experimental profile selected. To tune the existing-gateway HTTP health poll, use `NEMOCLAW_REUSE_HEALTH_POLL_COUNT` (default `6`) and `NEMOCLAW_REUSE_HEALTH_POLL_INTERVAL` (default `5` seconds). The poll count is clamped to a minimum of `1` so the health probe always runs at least once, and the interval is clamped to a minimum of `0` (no sleep between attempts). diff --git a/docs/reference/troubleshooting.mdx b/docs/reference/troubleshooting.mdx index 09236ccd361..52b48ac2e43 100644 --- a/docs/reference/troubleshooting.mdx +++ b/docs/reference/troubleshooting.mdx @@ -3059,6 +3059,8 @@ $$nemoclaw onboard --experimental-profile portable The portable experimental profile maps `host.openshell.internal` to the OpenShell Podman host gateway. Do not apply the Docker bridge UFW command when portable onboarding reports this route as unreachable. +Use the same procedure when onboarding reports that the Podman service is unreachable for the portable gateway probe. + Portable onboarding reports output like this: ```text diff --git a/src/lib/onboard/gateway-sandbox-reachability.test.ts b/src/lib/onboard/gateway-sandbox-reachability.test.ts index 9540c5d50cd..99225bf2e2b 100644 --- a/src/lib/onboard/gateway-sandbox-reachability.test.ts +++ b/src/lib/onboard/gateway-sandbox-reachability.test.ts @@ -507,6 +507,20 @@ describe("formatSandboxBridgeUnreachableMessage", () => { expect(msg).not.toContain("Restart Docker"); expect(msg).not.toContain("ufw allow"); }); + + it("reports Podman recovery when the portable profile cannot reach its daemon", () => { + vi.stubEnv("NEMOCLAW_EXPERIMENTAL_PROFILE", "portable"); + const msg = formatSandboxBridgeUnreachableMessage({ + ok: false, + reason: "docker_daemon_unreachable", + detail: "Cannot connect to the container runtime", + }); + expect(msg).toContain("Podman service is not reachable"); + expect(msg).toContain("systemctl --user try-restart podman.service"); + expect(msg).toContain("systemctl --user enable --now podman.socket"); + expect(msg).toContain("nemoclaw onboard --experimental-profile portable"); + expect(msg).not.toContain("Restart the Docker daemon"); + }); }); describe("tryAutoApplyUfwRule (#4265)", () => { @@ -685,6 +699,31 @@ describe("verifySandboxBridgeGatewayReachableOrExit host-gateway retry", () => { } }); + it("retries a transient portable host-gateway TCP failure", async () => { + const portableFailure = { + ...hostGatewayTcpFailure, + routeKind: "portable_host_gateway" as const, + gatewayIp: "169.254.1.2", + }; + const reachabilityImpl = vi + .fn() + .mockResolvedValueOnce(portableFailure) + .mockResolvedValueOnce({ ...portableFailure, ok: true as const, reason: "ok" as const }); + const sleepMsImpl = vi.fn().mockResolvedValue(undefined); + vi.spyOn(console, "log").mockImplementation(() => undefined); + + await verifySandboxBridgeGatewayReachableOrExit(true, { + reachabilityImpl, + retryAttempts: 3, + retryDelayMs: 25, + sleepMsImpl, + }); + + expect(reachabilityImpl).toHaveBeenCalledTimes(2); + expect(sleepMsImpl).toHaveBeenCalledOnce(); + expect(sleepMsImpl).toHaveBeenCalledWith(25); + }); + it("fails after exhausting persistent host-gateway tcp failures", async () => { const reachabilityImpl = vi.fn().mockResolvedValue(hostGatewayTcpFailure); const sleepMsImpl = vi.fn().mockResolvedValue(undefined); diff --git a/src/lib/onboard/gateway-sandbox-reachability.ts b/src/lib/onboard/gateway-sandbox-reachability.ts index a7e506f650f..58a65ce8e3f 100644 --- a/src/lib/onboard/gateway-sandbox-reachability.ts +++ b/src/lib/onboard/gateway-sandbox-reachability.ts @@ -455,6 +455,20 @@ export function formatSandboxBridgeUnreachableMessage( .join("\n"); } + if (result.reason === "docker_daemon_unreachable" && isPortableExperimentalProfile()) { + return [ + failLine("Podman service is not reachable for the portable gateway probe."), + result.detail ? ` ${result.detail}` : undefined, + " If the user-scoped Podman service is active, restart it:", + " systemctl --user try-restart podman.service", + " Enable and start the user-scoped Podman socket:", + " systemctl --user enable --now podman.socket", + ` Then rerun \`${cliName()} onboard --experimental-profile portable\`.`, + ] + .filter((line): line is string => Boolean(line)) + .join("\n"); + } + if (result.reason === "docker_daemon_unreachable") { return [ failLine("Docker daemon is not reachable for the sandbox bridge probe."), From 8e7ec3a31c00620ff18395908c440025b02fff57 Mon Sep 17 00:00:00 2001 From: Carlos Villela Date: Mon, 10 Aug 2026 05:45:46 -0700 Subject: [PATCH 12/13] fix(onboard): classify portable daemon inspection failures --- docs/reference/troubleshooting.mdx | 2 +- .../gateway-sandbox-reachability.test.ts | 22 +++++++++++++++++ .../onboard/gateway-sandbox-reachability.ts | 24 ++++++++++++++++++- 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/docs/reference/troubleshooting.mdx b/docs/reference/troubleshooting.mdx index 52b48ac2e43..7354c091001 100644 --- a/docs/reference/troubleshooting.mdx +++ b/docs/reference/troubleshooting.mdx @@ -3099,7 +3099,7 @@ Then rerun portable onboarding: $$nemoclaw onboard --experimental-profile portable ``` -Continue only when onboarding no longer reports that the OpenShell Podman host gateway is unreachable. +Continue only when onboarding no longer reports that the Podman service or OpenShell Podman host gateway is unreachable. diff --git a/src/lib/onboard/gateway-sandbox-reachability.test.ts b/src/lib/onboard/gateway-sandbox-reachability.test.ts index 99225bf2e2b..67a04bf73f2 100644 --- a/src/lib/onboard/gateway-sandbox-reachability.test.ts +++ b/src/lib/onboard/gateway-sandbox-reachability.test.ts @@ -123,6 +123,28 @@ describe("isSandboxBridgeGatewayReachable", () => { expect(result.detail).toContain("not found"); }); + it("classifies an unavailable portable daemon before route inspection completes", async () => { + vi.stubEnv("NEMOCLAW_EXPERIMENTAL_PROFILE", "portable"); + const runtimeProbeImpl = vi.fn(() => ({ + status: 1, + stderr: "Cannot connect to Podman. Verify the user service and socket.", + })); + + const result = await isSandboxBridgeGatewayReachable({ + inspectNetworkImpl: () => undefined, + runtimeProbeImpl, + usesHostGatewayRouteImpl: () => false, + }); + + expect(result).toMatchObject({ + ok: false, + reason: "docker_daemon_unreachable", + networkName: "openshell-docker", + }); + expect(result.detail).toContain("Cannot connect to Podman"); + expect(runtimeProbeImpl).toHaveBeenCalledOnce(); + }); + it("does not call helper DNS failures firewall failures", async () => { const result = await isSandboxBridgeGatewayReachable({ inspectNetworkImpl: () => ({ subnet: "172.19.0.0/16", gatewayIp: "172.19.0.1" }), diff --git a/src/lib/onboard/gateway-sandbox-reachability.ts b/src/lib/onboard/gateway-sandbox-reachability.ts index 58a65ce8e3f..dbb93fb2032 100644 --- a/src/lib/onboard/gateway-sandbox-reachability.ts +++ b/src/lib/onboard/gateway-sandbox-reachability.ts @@ -93,6 +93,8 @@ export interface SandboxBridgeReachabilityOptions { runImpl?: (args: readonly string[], timeoutMs: number) => SandboxBridgeProbeRunResult; inspectNetworkImpl?: (networkName: string) => DockerBridgeNetworkInfo | undefined; usesHostGatewayRouteImpl?: () => boolean; + + runtimeProbeImpl?: () => SandboxBridgeProbeRunResult; /** Inject a precomputed image-cache result; bypasses real pre-pull. */ ensureImageCachedOverride?: import("./preflight").EnsureProbeImageCachedResult; } @@ -283,14 +285,34 @@ export async function isSandboxBridgeGatewayReachable( const usesHostGatewayRoute = opts.usesHostGatewayRouteImpl ?? defaultUsesHostGatewayRoute; const runImpl = opts.runImpl ?? defaultRunImpl; + const portableProfile = isPortableExperimentalProfile(); + const runtimeProbe = + opts.runtimeProbeImpl ?? + (() => + defaultRunImpl( + ["info", "--format", "{{.ServerVersion}}"], + timeoutSec * 1000 + PROBE_RUN_OVERHEAD_MS, + )); + const network = inspectNetwork(networkName); const route = buildOpenShellDockerRoute( networkName, network, usesHostGatewayRoute(), - isPortableExperimentalProfile() ? PORTABLE_HOST_GATEWAY_IP : undefined, + portableProfile ? PORTABLE_HOST_GATEWAY_IP : undefined, ); if (!route) { + if (portableProfile) { + const runtimeResult = runtimeProbe(); + if (runtimeResult.status !== 0) { + return { + ok: false, + reason: "docker_daemon_unreachable", + networkName, + detail: summarizeProbeResult(runtimeResult), + }; + } + } return { ok: false, reason: "probe_unavailable", From 036f2c0c913e77e8504f7526d5a57199c49e93c4 Mon Sep 17 00:00:00 2001 From: Carlos Villela Date: Mon, 10 Aug 2026 06:01:27 -0700 Subject: [PATCH 13/13] test(onboard): update route-neutral severity assertion --- src/lib/onboard/gateway-sandbox-reachability-severity.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/onboard/gateway-sandbox-reachability-severity.test.ts b/src/lib/onboard/gateway-sandbox-reachability-severity.test.ts index 9c12dd4178a..9f2a5be4baf 100644 --- a/src/lib/onboard/gateway-sandbox-reachability-severity.test.ts +++ b/src/lib/onboard/gateway-sandbox-reachability-severity.test.ts @@ -74,7 +74,7 @@ describe("sandbox bridge reachability severity (#6004)", () => { gatewayIp: "172.18.0.1", }), }), - ).rejects.toThrow("sandbox-bridge unreachable"); + ).rejects.toThrow("cannot reach the OpenShell gateway"); expect(warn.mock.calls[0]?.[0]).toMatch( /^ \x1b\[33m⚠ NEMOCLAW_AUTO_FIX_FIREWALL=1 set but could not auto-apply UFW rule/, );