From 42d6325f791f72daf75f31176daa27db862264c8 Mon Sep 17 00:00:00 2001 From: latenighthackathon Date: Mon, 30 Mar 2026 21:38:15 -0500 Subject: [PATCH 1/4] fix(cli): resolve sandbox name for stop and status commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `nemoclaw stop` and `nemoclaw status` call start-services.sh without passing SANDBOX_NAME, so the script defaults to "default". If the user named their sandbox anything else during onboarding (e.g. "research"), the PID directory lookup fails — stop cannot find the running processes and status always reports services as stopped. `nemoclaw start` already resolves the sandbox name from the registry. Apply the same resolution to stop() and showStatus() so all three commands use consistent PID directories. Closes #1077 Signed-off-by: latenighthackathon --- bin/nemoclaw.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/nemoclaw.js b/bin/nemoclaw.js index d19317c16..ef68e9848 100755 --- a/bin/nemoclaw.js +++ b/bin/nemoclaw.js @@ -775,7 +775,10 @@ async function start() { } function stop() { - run(`bash "${SCRIPTS}/start-services.sh" --stop`); + const { defaultSandbox } = registry.listSandboxes(); + const safeName = defaultSandbox && /^[a-zA-Z0-9._-]+$/.test(defaultSandbox) ? defaultSandbox : null; + const sandboxEnv = safeName ? `SANDBOX_NAME=${shellQuote(safeName)}` : ""; + run(`${sandboxEnv} bash "${SCRIPTS}/start-services.sh" --stop`); } function debug(args) { @@ -849,8 +852,10 @@ function showStatus() { console.log(""); } - // Show service status - run(`bash "${SCRIPTS}/start-services.sh" --status`); + // Show service status — pass sandbox name so PID lookup uses the correct directory + const safeName = defaultSandbox && /^[a-zA-Z0-9._-]+$/.test(defaultSandbox) ? defaultSandbox : null; + const sandboxEnv = safeName ? `SANDBOX_NAME=${shellQuote(safeName)}` : ""; + run(`${sandboxEnv} bash "${SCRIPTS}/start-services.sh" --status`); } async function listSandboxes() { From 93f4bb5df4dd638b1a4469cee25a3f33f1800600 Mon Sep 17 00:00:00 2001 From: latenighthackathon Date: Mon, 30 Mar 2026 21:50:50 -0500 Subject: [PATCH 2/4] fix(cli): use --sandbox arg instead of env var for service commands Address review feedback: SANDBOX_NAME env var is overridden by NEMOCLAW_SANDBOX in start-services.sh (line 22), so a stale NEMOCLAW_SANDBOX in the user's shell could cause stop/status to look in the wrong PID directory. The --sandbox flag (lines 27-29) overwrites the initial resolution, making the registry value authoritative. Extract registrySandboxArg() helper so start, stop, and status all pass the registry-resolved sandbox consistently via --sandbox. Signed-off-by: latenighthackathon --- bin/nemoclaw.js | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/bin/nemoclaw.js b/bin/nemoclaw.js index ef68e9848..8228a0594 100755 --- a/bin/nemoclaw.js +++ b/bin/nemoclaw.js @@ -766,19 +766,19 @@ async function deploy(instanceName) { ); } -async function start() { +function registrySandboxArg() { const { defaultSandbox } = registry.listSandboxes(); - const safeName = - defaultSandbox && /^[a-zA-Z0-9._-]+$/.test(defaultSandbox) ? defaultSandbox : null; - const sandboxEnv = safeName ? `SANDBOX_NAME=${shellQuote(safeName)}` : ""; - run(`${sandboxEnv} bash "${SCRIPTS}/start-services.sh"`); + const safe = defaultSandbox && /^[a-zA-Z0-9._-]+$/.test(defaultSandbox) ? defaultSandbox : null; + return safe ? ` --sandbox ${shellQuote(safe)}` : ""; +} + +async function start() { + await ensureApiKey(); + run(`bash "${SCRIPTS}/start-services.sh"${registrySandboxArg()}`); } function stop() { - const { defaultSandbox } = registry.listSandboxes(); - const safeName = defaultSandbox && /^[a-zA-Z0-9._-]+$/.test(defaultSandbox) ? defaultSandbox : null; - const sandboxEnv = safeName ? `SANDBOX_NAME=${shellQuote(safeName)}` : ""; - run(`${sandboxEnv} bash "${SCRIPTS}/start-services.sh" --stop`); + run(`bash "${SCRIPTS}/start-services.sh" --stop${registrySandboxArg()}`); } function debug(args) { @@ -852,10 +852,8 @@ function showStatus() { console.log(""); } - // Show service status — pass sandbox name so PID lookup uses the correct directory - const safeName = defaultSandbox && /^[a-zA-Z0-9._-]+$/.test(defaultSandbox) ? defaultSandbox : null; - const sandboxEnv = safeName ? `SANDBOX_NAME=${shellQuote(safeName)}` : ""; - run(`${sandboxEnv} bash "${SCRIPTS}/start-services.sh" --status`); + // Show service status — pass --sandbox so PID lookup uses the correct directory + run(`bash "${SCRIPTS}/start-services.sh" --status${registrySandboxArg()}`); } async function listSandboxes() { From 3d4fe31d0c5da227b5254a5592b4daa513329f7d Mon Sep 17 00:00:00 2001 From: latenighthackathon Date: Tue, 31 Mar 2026 22:17:25 -0500 Subject: [PATCH 3/4] refactor(cli): pass resolved sandbox to registrySandboxArg Accept an optional defaultSandbox parameter so callers that already read the registry (e.g. showStatus) reuse the same snapshot instead of re-reading it, keeping display and service-status consistent. --- bin/nemoclaw.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/nemoclaw.js b/bin/nemoclaw.js index 8228a0594..3343e24f1 100755 --- a/bin/nemoclaw.js +++ b/bin/nemoclaw.js @@ -766,8 +766,7 @@ async function deploy(instanceName) { ); } -function registrySandboxArg() { - const { defaultSandbox } = registry.listSandboxes(); +function registrySandboxArg(defaultSandbox = registry.listSandboxes().defaultSandbox) { const safe = defaultSandbox && /^[a-zA-Z0-9._-]+$/.test(defaultSandbox) ? defaultSandbox : null; return safe ? ` --sandbox ${shellQuote(safe)}` : ""; } @@ -853,7 +852,7 @@ function showStatus() { } // Show service status — pass --sandbox so PID lookup uses the correct directory - run(`bash "${SCRIPTS}/start-services.sh" --status${registrySandboxArg()}`); + run(`bash "${SCRIPTS}/start-services.sh" --status${registrySandboxArg(defaultSandbox)}`); } async function listSandboxes() { From aa5553f2990ea0d2aa2f5fcef98ff2e36e1ccf7a Mon Sep 17 00:00:00 2001 From: latenighthackathon Date: Tue, 31 Mar 2026 22:55:03 -0500 Subject: [PATCH 4/4] fix(cli): remove ensureApiKey from start() to match upstream behavior The start command should launch services without prompting for an API key. The ensureApiKey call was incorrectly introduced during conflict resolution. --- bin/nemoclaw.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/nemoclaw.js b/bin/nemoclaw.js index 3343e24f1..aea540f23 100755 --- a/bin/nemoclaw.js +++ b/bin/nemoclaw.js @@ -771,8 +771,7 @@ function registrySandboxArg(defaultSandbox = registry.listSandboxes().defaultSan return safe ? ` --sandbox ${shellQuote(safe)}` : ""; } -async function start() { - await ensureApiKey(); +function start() { run(`bash "${SCRIPTS}/start-services.sh"${registrySandboxArg()}`); }