Skip to content
3 changes: 2 additions & 1 deletion docs/reference/cli-selection-guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ openshell sandbox exec -n my-assistant -- cat /tmp/gateway.log
### Check Health or Logs

Use `$$nemoclaw <name> status` and `$$nemoclaw <name> logs` first.
They combine NemoClaw registry data, OpenShell state, OpenClaw process health, inference health, policy details, and messaging-channel warnings.
They combine NemoClaw registry data, OpenShell state, OpenClaw process health, inference health, policy details, and messaging-channel warnings for that sandbox.
Use `$$nemoclaw status` only for the global all-sandbox and host-service overview.

Use `openshell sandbox list`, `openshell sandbox get`, `openshell logs <name> -n 20`, or `openshell doctor check` when debugging lower-level OpenShell behavior.
When using `openshell logs` directly, `-n <lines>` controls the line count; use `--tail` only when you want live OpenShell log streaming.
Expand Down
8 changes: 6 additions & 2 deletions docs/reference/commands-nemohermes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,9 @@ nemohermes my-assistant recover

### `nemohermes <name> status`

Show sandbox status, health, and inference configuration.
Show sandbox-scoped status, health, and inference configuration for one registered sandbox.
Use this form when you care about a specific sandbox's live OpenShell state, agent runtime, inference health, GPU proof, permissions, and recovery hints.
Do not pass a sandbox name to `nemohermes status`; that command is the global all-sandbox/service overview.

Pass `--json` to emit a structured per-sandbox report instead of the text renderer.
The JSON output includes at least `schemaVersion`, `name`, `found`, `model`, `provider`, `phase`, `gatewayState`, `inferenceHealth`, `rpcIssue`, `hostGpuDetected`, `sandboxGpuEnabled`, `sandboxGpuMode`, `sandboxGpuDevice`, `openshellDriver`, `openshellVersion`, `policies`, `failureLayer`, and `dockerPaused`.
Expand Down Expand Up @@ -1434,7 +1436,9 @@ This command remains as a compatibility alias to `nemohermes tunnel stop`.

### `nemohermes status`

Show the sandbox list and the status of host auxiliary services (for example cloudflared).
Show the global sandbox list and the status of host auxiliary services (for example cloudflared).
This command is host-wide. It summarizes registered sandboxes, the default sandbox's live inference route, messaging overlap warnings, gateway health, and host services.
Use `nemohermes <name> status` when you need one sandbox's live health and recovery guidance.
Pass `--json` for machine-readable output with registered sandboxes, service state, inference routes, and messaging health.
For each listed sandbox, the text output includes the configured inference provider and model plus whether an active SSH session is connected.
Host-service PID lookup honors `NEMOCLAW_SANDBOX_NAME`, then `NEMOCLAW_SANDBOX`, then `SANDBOX_NAME`, then the registry default.
Expand Down
8 changes: 6 additions & 2 deletions docs/reference/commands.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,9 @@ $$nemoclaw my-assistant recover

### `$$nemoclaw <name> status`

Show sandbox status, health, and inference configuration.
Show sandbox-scoped status, health, and inference configuration for one registered sandbox.
Use this form when you care about a specific sandbox's live OpenShell state, agent runtime, inference health, GPU proof, permissions, and recovery hints.
Do not pass a sandbox name to `$$nemoclaw status`; that command is the global all-sandbox/service overview.

Pass `--json` to emit a structured per-sandbox report instead of the text renderer.
The JSON output includes at least `schemaVersion`, `name`, `found`, `model`, `provider`, `phase`, `gatewayState`, `inferenceHealth`, `rpcIssue`, `hostGpuDetected`, `sandboxGpuEnabled`, `sandboxGpuMode`, `sandboxGpuDevice`, `openshellDriver`, `openshellVersion`, `policies`, `failureLayer`, and `dockerPaused`.
Expand Down Expand Up @@ -1737,7 +1739,9 @@ This command remains as a compatibility alias to `$$nemoclaw tunnel stop`.

### `$$nemoclaw status`

Show the sandbox list and the status of host auxiliary services (for example cloudflared).
Show the global sandbox list and the status of host auxiliary services (for example cloudflared).
This command is host-wide. It summarizes registered sandboxes, the default sandbox's live inference route, messaging overlap warnings, gateway health, and host services.
Use `$$nemoclaw <name> status` when you need one sandbox's live health and recovery guidance.
Pass `--json` for machine-readable output with registered sandboxes, service state, inference routes, and messaging health.
For each listed sandbox, the text output includes the configured inference provider and model plus whether an active SSH session is connected.
Host-service PID lookup honors `NEMOCLAW_SANDBOX_NAME`, then `NEMOCLAW_SANDBOX`, then `SANDBOX_NAME`, then the registry default.
Expand Down
6 changes: 4 additions & 2 deletions src/commands/sandbox/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ export default class SandboxStatusCommand extends NemoClawCommand {
static id = "sandbox:status";
static strict = true;
static enableJsonFlag = true;
static summary = "Sandbox health and NIM status";
static description = "Show sandbox health, OpenShell gateway state, and local NIM status.";
static summary = "Show one sandbox's health and runtime status";
static description =
"Show one sandbox's health, OpenShell gateway state, inference status, and local NIM status. Use global `status` for the all-sandbox/service overview.";
static usage = ["<name> [--json]"];
static examples = [
"<%= config.bin %> alpha status",
"<%= config.bin %> sandbox status alpha",
"<%= config.bin %> sandbox status alpha --json",
];
Expand Down
5 changes: 3 additions & 2 deletions src/commands/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ export default class StatusCommand extends NemoClawCommand {
static id = "status";
static strict = true;
static enableJsonFlag = true;
static summary = "Show sandbox list and service status";
static description = "Show registered sandboxes, live inference, services, and messaging health.";
static summary = "Show global sandbox and host service status";
static description =
"Show the global overview across registered sandboxes, live inference, host services, and messaging health. Use `<name> status` for one sandbox.";
static usage = ["status [--json]"];
static examples = ["<%= config.bin %> status", "<%= config.bin %> status --json"];
static flags = {};
Expand Down
6 changes: 6 additions & 0 deletions src/lib/actions/root-help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ export function help(): void {
lines.push("");
lines.push(` ${B}${G}${CLI_DISPLAY_NAME}${R} ${D}v${getVersion()}${R}`);
lines.push(` ${D}Deploy more secure, always-on AI assistants with a single command.${R}`);
lines.push(
` ${D}Global commands inspect host-wide state; sandbox commands start with a sandbox name.${R}`,
);
lines.push(
` ${D}Use \`${CLI_NAME} status\` for the global overview, and \`${CLI_NAME} <name> status\` for one sandbox.${R}`,
);

for (const [group, cmds] of grouped) {
lines.push("");
Expand Down
1 change: 1 addition & 0 deletions src/lib/actions/sandbox/status-flow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ describe("showSandboxStatus flow", () => {
await expect(harness.showSandboxStatus("alpha")).resolves.toBeUndefined();

const output = harness.logSpy.mock.calls.map((call) => String(call[0])).join("\n");
expect(output).toContain("Sandbox-scoped status for 'alpha'");
expect(output).toContain("Sandbox: alpha");
expect(output).toContain("Model: nvidia/nemotron-live");
expect(output).toContain("Inference: healthy");
Expand Down
5 changes: 4 additions & 1 deletion src/lib/actions/sandbox/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ function printMissingLiveSandboxStatusGuidance(
);
}

// eslint-disable-next-line complexity
/* eslint-disable complexity */
/** Render sandbox-scoped status and surface recovery guidance for one registered sandbox. */
export async function showSandboxStatus(sandboxName: string): Promise<void> {
const preflight = await getSandboxStatusPreflight(registry.getSandbox(sandboxName));
// #2666: never let an unexpected throw from the gateway probe (e.g. openshell
Expand Down Expand Up @@ -181,6 +182,7 @@ export async function showSandboxStatus(sandboxName: string): Promise<void> {
}
if (sb) {
console.log("");
console.log(` Sandbox-scoped status for '${sb.name}':`);
console.log(` Sandbox: ${sb.name}`);
console.log(` Model: ${currentModel}`);
console.log(` Provider: ${currentProvider}`);
Expand Down Expand Up @@ -486,3 +488,4 @@ export async function showSandboxStatus(sandboxName: string): Promise<void> {
}
console.log("");
}
/* eslint-enable complexity */
33 changes: 32 additions & 1 deletion src/lib/cli/public-dispatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,31 @@ function printDispatchUsageError(
process.exit(1);
}

/** Returns the sandbox-like positional argument passed to global `status`, if one exists. */
function findGlobalStatusSandboxArgument(args: readonly string[]): string | null {
for (const arg of args) {
if (arg === "--json") {
continue;
}
if (arg.startsWith("-")) {
return null;
}
return arg;
}
return null;
}

/** Prints the correction for `status <name>` and exits with the usage-error status code. */
function printGlobalStatusScopeHint(sandboxName: string, args: readonly string[]): never {
const jsonFlag = args.includes("--json") ? " --json" : "";
console.error(` '${CLI_NAME} status' shows the global sandbox/service overview.`);
console.error(` It does not take a sandbox name.`);
console.error("");
console.error(` Run: ${CLI_NAME} ${sandboxName} status${jsonFlag}`);
console.error(` Or for global JSON: ${CLI_NAME} status --json`);
process.exit(2);
}

async function recoverRequestedSandboxIfNeeded(
sandboxName: string,
action: string,
Expand Down Expand Up @@ -282,7 +307,8 @@ async function runPublicTranslationResult(

// ── Dispatch ─────────────────────────────────────────────────────

// eslint-disable-next-line complexity
/* eslint-disable complexity */
/** Normalize public argv and route it to oclif or sandbox-first command handlers. */
export async function dispatchCli(argv: string[] = process.argv.slice(2)): Promise<void> {
if (argv[0] === "internal" || argv[0] === "sandbox") {
await runNativeOclifArgv(argv);
Expand All @@ -305,6 +331,10 @@ export async function dispatchCli(argv: string[] = process.argv.slice(2)): Promi
}

if (normalized.kind === "global") {
if (normalized.command === "status") {
const sandboxName = findGlobalStatusSandboxArgument(normalized.args);
if (sandboxName) printGlobalStatusScopeHint(sandboxName, normalized.args);
}
await runPublicTranslationResult(
translatePublicGlobalArgv(normalized.command, normalized.args),
);
Expand Down Expand Up @@ -387,3 +417,4 @@ export async function dispatchCli(argv: string[] = process.argv.slice(2)): Promi
console.error(` Run '${CLI_NAME} help' for usage.`);
process.exit(1);
}
/* eslint-enable complexity */
3 changes: 2 additions & 1 deletion src/lib/cli/public-display-defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ const PUBLIC_DISPLAY_LAYOUT: Record<string, readonly PublicDisplayLayout[]> = {
{
group: "Sandbox Management",
order: 4,
description: "Sandbox health + NIM status",
description: "One sandbox's health, gateway, inference, and NIM status",
},
],
setup: [
Expand Down Expand Up @@ -454,6 +454,7 @@ const PUBLIC_DISPLAY_LAYOUT: Record<string, readonly PublicDisplayLayout[]> = {
{
group: "Services",
order: 36,
description: "Global sandbox and host service status",
flags: "[--json]",
},
],
Expand Down
1 change: 1 addition & 0 deletions src/lib/inventory/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ describe("inventory commands", () => {
log: (message = "") => lines.push(message),
});

expect(lines).toContain(" Global status (registered sandboxes and host services):");
expect(lines).toContain(" Sandboxes:");
// Default sandbox shows the live gateway model (#2369), annotated with
// the onboarded model when they differ.
Expand Down
3 changes: 2 additions & 1 deletion src/lib/inventory/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,10 @@ export function showStatusCommand(deps: ShowStatusCommandDeps): void {
const sandboxList = deps.listSandboxes();
const { sandboxes } = sandboxList;
const resolvedDefault = resolveDefaultSandboxName(() => sandboxList) ?? null;
log("");
log(" Global status (registered sandboxes and host services):");
if (sandboxes.length > 0) {
const live = deps.getLiveInference();
log("");
log(" Sandboxes:");
for (const sb of sandboxes) {
const isDefault = sb.name === resolvedDefault;
Expand Down
22 changes: 16 additions & 6 deletions test/cli-oclif-compatibility.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,15 @@ describe("oclif compatibility dispatch", () => {

const runOclifArgv = vi.fn(async () => undefined);
const runOclifCommandById = vi.fn(async () => undefined);
const stderr: string[] = [];
const errorSpy = vi.spyOn(console, "error").mockImplementation((message = "") => {
stderr.push(String(message));
});
const exitSpy = vi.spyOn(process, "exit").mockImplementation(((
code?: string | number | null,
) => {
throw new Error(`process.exit:${String(code)}`);
}) as never);

process.env.NEMOCLAW_DISABLE_AUTO_DISPATCH = "1";
requireCache[runnerPath] = {
Expand All @@ -348,15 +357,16 @@ describe("oclif compatibility dispatch", () => {
delete require.cache[publicDispatchPath];
const { dispatchCli } = require(cliPath);

await dispatchCli(["status", "bogus"]);
await expect(dispatchCli(["status", "bogus"])).rejects.toThrow("process.exit:2");

expect(runOclifCommandById).toHaveBeenCalledWith(
"status",
["bogus"],
expect.objectContaining({ rootDir: process.cwd() }),
);
expect(exitSpy).toHaveBeenCalledWith(2);
expect(stderr.join("\n")).toContain("Run: nemoclaw bogus status");
expect(runOclifCommandById).not.toHaveBeenCalled();
expect(runOclifArgv).not.toHaveBeenCalled();

errorSpy.mockClear();
exitSpy.mockClear();
stderr.length = 0;
runOclifArgv.mockClear();
runOclifCommandById.mockClear();

Expand Down
13 changes: 11 additions & 2 deletions test/cli/status-routing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ describe("CLI status routing", () => {
const r = run("status --help");
expect(r.code).toBe(0);
expect(r.out).toContain("status [--json]");
expect(r.out).toContain("Show sandbox list and service status");
expect(r.out).toContain("Show global sandbox and host service status");
expect(r.out).toContain("Use `<name> status` for one sandbox");
});

it("sandbox status --help advertises --json flag", () => {
Expand All @@ -23,6 +24,7 @@ describe("CLI status routing", () => {
expect(r.code).toBe(0);
expect(r.out).toContain("--json");
expect(r.out).toContain("$ nemoclaw sandbox status <name> [--json]");
expect(r.out).toContain("$ nemoclaw alpha status");
expect(r.out).toContain("$ nemoclaw sandbox status alpha --json");

const alias = runWithEnv("alpha status --help", { HOME: home });
Expand All @@ -39,7 +41,14 @@ describe("CLI status routing", () => {
it("status rejects unexpected positional arguments through current dispatch path", () => {
const r = run("status bogus");
expect(r.code).toBe(2);
expect(r.out).toContain("Unexpected argument: bogus");
expect(r.out).toContain("'nemoclaw status' shows the global sandbox/service overview");
expect(r.out).toContain("Run: nemoclaw bogus status");
});

it("status preserves --json in wrong-form sandbox status guidance", () => {
const r = run("status --json alpha");
expect(r.code).toBe(2);
expect(r.out).toContain("Run: nemoclaw alpha status --json");
});

it("sandbox-first status rejects unexpected positional arguments through command-id dispatch", () => {
Expand Down
12 changes: 12 additions & 0 deletions test/root-help.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ describe("root help", () => {
expect(output).not.toContain("Landlock enforced");
});

it("explains global commands versus sandbox-scoped commands", () => {
const log = vi.spyOn(console, "log").mockImplementation(() => {});

renderRootHelp();

const output = log.mock.calls.map(([line]) => String(line)).join("\n");
expect(output).toContain("Global commands inspect host-wide state");
expect(output).toContain("sandbox commands start with a sandbox name");
expect(output).toContain("nemoclaw status");
expect(output).toContain("nemoclaw <name> status");
});

it("shows channel as a required positional argument in channel command signatures", () => {
const log = vi.spyOn(console, "log").mockImplementation(() => {});

Expand Down
Loading