From c898b8248352b16fdfd175cf1a989ccd03bf2e08 Mon Sep 17 00:00:00 2001 From: futhgar Date: Wed, 18 Mar 2026 22:01:32 -0400 Subject: [PATCH] fix: start OpenClaw gateway and port forwarding in nemoclaw start `nemoclaw start` previously only started the Telegram bridge and cloudflared tunnel. After a system reboot, the OpenClaw gateway inside the sandbox and the dashboard port forwarding were lost, requiring manual intervention. Add `openclaw-gateway` and `gateway-forward` as managed services in start-services.sh so `nemoclaw start` / `nemoclaw stop` / `nemoclaw status` manage the full service lifecycle. - resolve_sandbox() auto-detects the active sandbox when not explicit - validate_name() rejects identifiers with shell metacharacters - Gateway started via `openshell sandbox exec` (foreground, PID tracked) - Port forwarding started via `openshell forward start` (PID tracked) - Status and banner updated to show all four services Fixes #311 Signed-off-by: Josue Gomez --- src/nemoclaw.ts | 15 +++++++++++++-- test/cli.test.ts | 6 ++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/nemoclaw.ts b/src/nemoclaw.ts index dbf93b62782..657556c5ba5 100644 --- a/src/nemoclaw.ts +++ b/src/nemoclaw.ts @@ -843,8 +843,19 @@ async function deploy(instanceName) { async function start() { const { startAll } = require("./lib/services"); + + // Recover gateway and port forwarding for the default sandbox before + // starting host-side services (cloudflared). After a system reboot the + // OpenClaw gateway inside the sandbox and the dashboard port forward are + // lost — checkAndRecoverSandboxProcesses re-establishes both. + const sandboxes = registry.listSandboxes(); + const defaultSandbox = sandboxes.defaultSandbox; + if (defaultSandbox) { + checkAndRecoverSandboxProcesses(defaultSandbox); + } + await runStartCommand({ - listSandboxes: () => registry.listSandboxes(), + listSandboxes: () => sandboxes, startAll, }); } @@ -1486,7 +1497,7 @@ function help() { nemoclaw deploy Deprecated Brev-specific bootstrap path ${G}Services:${R} - nemoclaw start Start auxiliary services ${D}(Telegram, tunnel)${R} + nemoclaw start Start services ${D}(gateway, port fwd, tunnel)${R} nemoclaw stop Stop all services nemoclaw status Show sandbox list and service status diff --git a/test/cli.test.ts b/test/cli.test.ts index 6e28cc4dca9..4c0a4a30c0c 100644 --- a/test/cli.test.ts +++ b/test/cli.test.ts @@ -43,6 +43,12 @@ describe("CLI dispatch", () => { expect(r.out.includes("Compatibility Commands")).toBeTruthy(); }); + it("help mentions gateway in start description", () => { + const r = run("help"); + expect(r.code).toBe(0); + expect(r.out.includes("gateway")).toBeTruthy(); + }); + it("--help exits 0", () => { expect(run("--help").code).toBe(0); });