Skip to content

fix: detect sandbox context in status command to prevent false negatives#69

Merged
kjw3 merged 2 commits intomainfrom
fix/status-sandbox-detection
Mar 17, 2026
Merged

fix: detect sandbox context in status command to prevent false negatives#69
kjw3 merged 2 commits intomainfrom
fix/status-sandbox-detection

Conversation

@ericksoa
Copy link
Copy Markdown
Contributor

@ericksoa ericksoa commented Mar 17, 2026

Summary

Fixes #25openclaw nemoclaw status reported "not running" and "Not configured" even inside an active sandbox with working inference.

Root cause: getSandboxStatus() and getInferenceStatus() shell out to openshell host commands. Inside a sandbox, those commands aren't available, so both calls fail silently and return false negatives.

Fix: Added isInsideSandbox() detection (checks for /sandbox/.openclaw or /sandbox/.nemoclaw, consistent with existing sandbox path conventions in migrate.ts and migration-state.ts). When inside a sandbox:

  • Skips the openshell host commands entirely (they'd always fail)
  • Sandbox section shows "active (inside sandbox)" instead of "not running"
  • Inference section shows "unable to query from inside sandbox" instead of "Not configured"
  • A banner explains the context and directs users to run host commands for full details
  • JSON output includes insideSandbox: boolean at the top level and in each subsection

Test results

All 9 test cases passed. Tests ran in Docker containers simulating host and sandbox environments with mock openshell commands.

# Scenario Assertions Result
1 Host — no sandbox running, no openshell 6 PASS
2 Host — sandbox running, inference configured 13 PASS
3 Host — sandbox running, no inference 11 PASS
4 Inside sandbox — core bug scenario 13 PASS
5 Inside sandbox — JSON output 7 PASS
6 Host — JSON output (both scenarios) 6 PASS
7 Inside sandbox — with prior plugin state + rollback 18 PASS
8 Slash command /nemoclaw status — unaffected 11 PASS
9 Regression — openclaw nemoclaw logs unchanged 8 PASS

Total: 93 assertions, 0 failures

Additionally, 22 unit tests added with vitest covering all status command scenarios.

Key validations:

  • Test 4 (core bug): No more false-negative "not running"/"Not configured" inside active sandboxes
  • Tests 1-3, 6: Host behavior unchanged — genuine "not running"/"Not configured" still reported correctly
  • Tests 8-9: slash.ts and logs.ts are completely unaffected (separate code paths, verified via diff)

ericksoa and others added 2 commits March 16, 2026 20:00
When running inside an active OpenShell sandbox, `openshell` host commands
are unavailable, causing `openclaw nemoclaw status` to silently report
"not running" and "Not configured" even though the sandbox is active and
inference is working. This adds sandbox detection so the status command
reports accurate context instead of false negatives.

Closes #25

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds 22 unit tests covering all status command scenarios:
- Host with no openshell (blank state)
- Host with running sandbox and configured inference
- Host with running sandbox but no inference
- Inside sandbox (core bug fix — no false negatives)
- Inside sandbox with prior plugin state and rollback
- Edge cases (custom sandbox name, detection via either marker dir, missing uptime)

Also sets up vitest as the project test framework.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kjw3 kjw3 self-assigned this Mar 17, 2026
@kjw3
Copy link
Copy Markdown
Contributor

kjw3 commented Mar 17, 2026

Before:

ubuntu@brev-grsrygs3o:~/NemoClaw$ nemoclaw e2e69-main connect
sandbox@e2e69-main:~$ openclaw nemoclaw status
(node:492) [UNDICI-EHPA] Warning: EnvHttpProxyAgent is experimental, expect them to change at any time.
(Use `node --trace-warnings ...` to show where the warning was created)
(node:500) [UNDICI-EHPA] Warning: EnvHttpProxyAgent is experimental, expect them to change at any time.
(Use `node --trace-warnings ...` to show where the warning was created)
18:25:49 [plugins] plugins.allow is empty; discovered non-bundled plugins may auto-load: nemoclaw (/sandbox/.openclaw/extensions/nemoclaw/dist/index.js). Set plugins.allow to explicit trusted ids.
18:25:49 [plugins] 
18:25:50 [plugins]   ┌─────────────────────────────────────────────────────┐
18:25:50 [plugins]   │  NemoClaw registered                                │
18:25:50 [plugins]   │                                                     │
18:25:50 [plugins]   │  Endpoint:  build.nvidia.com                        │
18:25:50 [plugins]   │  Model:     nvidia/nemotron-3-super-120b-a12b       │
18:25:50 [plugins]   │  Commands:  openclaw nemoclaw <command>             │
18:25:50 [plugins]   └─────────────────────────────────────────────────────┘
18:25:50 [plugins] 

🦞 OpenClaw 2026.3.11 (29dc654) — Your AI assistant, now without the $3,499 headset.

18:25:50 [plugins] NemoClaw Status
18:25:50 [plugins] ===============
18:25:50 [plugins] 
18:25:50 [plugins] Plugin State:
18:25:50 [plugins]   No operations have been performed yet.
18:25:50 [plugins] 
18:25:50 [plugins] Sandbox:
18:25:50 [plugins]   Status:  not running
18:25:50 [plugins] 
18:25:50 [plugins] Inference:
18:25:50 [plugins]   Not configured

After:

ubuntu@brev-grsrygs3o:~/NemoClaw$ nemoclaw e2e69 connect
sandbox@e2e69:~$ openclaw nemoclaw status
(node:758) [UNDICI-EHPA] Warning: EnvHttpProxyAgent is experimental, expect them to change at any time.
(Use `node --trace-warnings ...` to show where the warning was created)
(node:774) [UNDICI-EHPA] Warning: EnvHttpProxyAgent is experimental, expect them to change at any time.
(Use `node --trace-warnings ...` to show where the warning was created)
18:17:55 [plugins] plugins.allow is empty; discovered non-bundled plugins may auto-load: nemoclaw (/sandbox/.openclaw/extensions/nemoclaw/dist/index.js). Set plugins.allow to explicit trusted ids.
18:17:55 [plugins] 
18:17:55 [plugins]   ┌─────────────────────────────────────────────────────┐
18:17:55 [plugins]   │  NemoClaw registered                                │
18:17:55 [plugins]   │                                                     │
18:17:55 [plugins]   │  Endpoint:  build.nvidia.com                        │
18:17:55 [plugins]   │  Model:     nvidia/nemotron-3-super-120b-a12b       │
18:17:55 [plugins]   │  Commands:  openclaw nemoclaw <command>             │
18:17:55 [plugins]   └─────────────────────────────────────────────────────┘
18:17:55 [plugins] 

🦞 OpenClaw 2026.3.11 (29dc654) — I don't sleep, I just enter low-power mode and dream of clean diffs.

18:17:55 [plugins] NemoClaw Status
18:17:55 [plugins] ===============
18:17:55 [plugins] 
18:17:55 [plugins] Context: running inside an active OpenShell sandbox
18:17:55 [plugins]   Host sandbox state is not inspectable from inside the sandbox.
18:17:55 [plugins]   Run 'openshell sandbox status' on the host for full details.
18:17:55 [plugins] 
18:17:55 [plugins] Plugin State:
18:17:55 [plugins]   No operations have been performed yet.
18:17:55 [plugins] 
18:17:55 [plugins] Sandbox:
18:17:55 [plugins]   Name:    openclaw
18:17:55 [plugins]   Status:  active (inside sandbox)
18:17:55 [plugins]   Note:    Cannot query host sandbox state from within the sandbox.
18:17:55 [plugins] 
18:17:55 [plugins] Inference:
18:17:55 [plugins]   Status:  unable to query from inside sandbox
18:17:55 [plugins]   Note:    Run 'openshell inference get' on the host to check.

@kjw3 kjw3 merged commit 85bcde4 into main Mar 17, 2026
Ryuketsukami pushed a commit to Ryuketsukami/NemoClaw that referenced this pull request Mar 24, 2026
…ves (NVIDIA#69)

* fix: detect sandbox context in status command to prevent false negatives

When running inside an active OpenShell sandbox, `openshell` host commands
are unavailable, causing `openclaw nemoclaw status` to silently report
"not running" and "Not configured" even though the sandbox is active and
inference is working. This adds sandbox detection so the status command
reports accurate context instead of false negatives.

Closes NVIDIA#25

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: add vitest unit tests for status command sandbox detection

Adds 22 unit tests covering all status command scenarios:
- Host with no openshell (blank state)
- Host with running sandbox and configured inference
- Host with running sandbox but no inference
- Inside sandbox (core bug fix — no false negatives)
- Inside sandbox with prior plugin state and rollback
- Edge cases (custom sandbox name, detection via either marker dir, missing uptime)

Also sets up vitest as the project test framework.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
jessesanford pushed a commit to jessesanford/NemoClaw that referenced this pull request Mar 24, 2026
…ves (NVIDIA#69)

* fix: detect sandbox context in status command to prevent false negatives

When running inside an active OpenShell sandbox, `openshell` host commands
are unavailable, causing `openclaw nemoclaw status` to silently report
"not running" and "Not configured" even though the sandbox is active and
inference is working. This adds sandbox detection so the status command
reports accurate context instead of false negatives.

Closes NVIDIA#25

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: add vitest unit tests for status command sandbox detection

Adds 22 unit tests covering all status command scenarios:
- Host with no openshell (blank state)
- Host with running sandbox and configured inference
- Host with running sandbox but no inference
- Inside sandbox (core bug fix — no false negatives)
- Inside sandbox with prior plugin state and rollback
- Edge cases (custom sandbox name, detection via either marker dir, missing uptime)

Also sets up vitest as the project test framework.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
mafueee pushed a commit to mafueee/NemoClaw that referenced this pull request Mar 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix openclaw nemoclaw status so plugin status reflects real sandbox state instead of always reporting "not running"

2 participants