NemoClaw icon indicating copy to clipboard operation
NemoClaw copied to clipboard

[Ubuntu 24.04][Sandbox] snapshot restore --to registers the clone with the source's dashboard port: clone dashboard-url points at the source, rebuild permanently blocked

Open Hokonoken opened this issue 4 months ago • 1 comments

Description

When snapshot restore --to <dst> auto-creates the destination sandbox, it registers <dst> by spreading the source's registry entry and overriding a handful of fields (src/lib/actions/sandbox/snapshot.ts:259, autoCreateSandboxFromSource):

registry.registerSandbox({
  ...srcEntry,
  name: dstName,
  createdAt: new Date().toISOString(),
  policies: [],
  observabilityEnabled: sourceObservabilityEnabled,
  nimContainer: null,      // explicitly cleared — "dst has its own lifecycle"
  sandboxGpuProof: null,   // explicitly cleared (#4231)
});

dashboardPort is not among the overrides, so the clone is registered with the source's dashboard port. nimContainer and sandboxGpuProof are already explicitly cleared for exactly this reason — a per-sandbox field must not be inherited by the clone (#4231) — dashboardPort is the same bug class, one field over. (hermesDashboardPort / hermesDashboardInternalPort look like the same class for Hermes-agent sandboxes; I only verified the OpenClaw field live.)

Platform scope: reproduced on Ubuntu 24.04/WSL2 x86_64, docker driver. The mechanism is a registry write in the CLI, so I would expect it everywhere, but I only ran it on this platform.

Reproduction (executed on unmodified main @ 8acb2808d)

# my-assistant onboarded normally; registry shows dashboardPort 18790
nemoclaw my-assistant snapshot restore baseline --to port-probe   # dst does not exist → auto-create path
# EXIT=0, port-probe reaches Ready

Registry after (~/.nemoclaw/sandboxes.json):

my-assistant  dashboardPort: 18790
port-probe    dashboardPort: 18790   <-- inherited

(An older clone created the same way on v0.0.78-x also carries 18790 — every clone of the same source stacks onto the same port.)

Consequences (both executed live)

  1. The clone's dashboard URL points at the source's dashboard. The host forward for 18790 is owned by the source only:

    $ openshell forward list | grep 18790
    my-assistant 0.0.0.0 18790 <pid> running
    
    $ nemoclaw port-probe dashboard-url
    Dashboard URL:
    http://127.0.0.1:18790/#token=<redacted>
    

    resolveDashboardPort (src/lib/dashboard-url-command.ts:61) reads the inherited registry field, so the printed URL is the source's dashboard.

  2. The clone can never be rebuilt/upgraded. The rebuild preflight (src/lib/onboard/authoritative-rebuild-target.ts:219) correctly refuses a dashboard port whose forward is owned by another sandbox — so every rebuild of the clone aborts:

    $ nemoclaw sandbox rebuild clone-test --yes
    Dashboard port 18790 belongs to sandbox 'my-assistant'.
    EXIT=1
    

    The preflight is doing its job; it is the registration that planted the conflict. The result is a sandbox that upgrade-sandboxes and any maintenance rebuild can never process.

Expected Result

The clone gets its own dashboard port — either allocated at registration (the onboard path's findAvailableDashboardPort exists for this) or left unset so the next connect/forward setup allocates one. Rebuilding a clone should not be permanently blocked by its own registration.

Environment

OS:            Ubuntu 24.04 (WSL2), x86_64
Docker:        29.2.1
OpenShell CLI: 0.0.72
NemoClaw:      main @ 8acb2808d (unmodified checkout, includes #6677)
Sandboxes:     openclaw agent, docker driver, local ollama, dedicated gateway port

Happy to send a PR clearing/re-allocating the field in autoCreateSandboxFromSource (and auditing the two Hermes port fields) if that direction suits the maintainers.

Hokonoken avatar Jul 13 '26 05:07 Hokonoken

✨ Thanks for the detailed report with code reference. The missing dashboardPort override (and likely hermesDashboardPort/hermesDashboardInternalPort) matches the same pattern fixed for nimContainer and sandboxGpuProof in #4231.


Related open issues:

wscurran avatar Jul 13 '26 14:07 wscurran