NemoClaw icon indicating copy to clipboard operation
NemoClaw copied to clipboard

[All Platforms][Onboard] onboard --resume can never recover after the sandbox image build fails: the route reservation it requires is already gone

Open Hokonoken opened this issue 4 months ago • 0 comments

Description

When nemoclaw onboard fails during sandbox image creation, the sandbox's route reservation is gone from the registry, and it is never recreated on a resumed run. The failure handler tells the user to run nemoclaw onboard --resume; the resumed run skips the inference steps that created the reservation, then step 6 asserts it exists, does not find it, and aborts with sandbox route reservation '<name>' disappeared while onboarding was in progress. Retry onboarding. — after which it again recommends --resume.

The result is a loop: the recommended recovery action can never succeed, no matter how many times it is run. Only --fresh escapes, which discards the completed steps.

This does not happen when onboarding fails before sandbox creation begins (for example on an invalid custom Dockerfile contract): there the registry entry survives and --resume works.

Environment

OS:            Ubuntu 24.04 (WSL2), x86_64
Node.js:       v24.18.0
Docker:        29.2.1
OpenShell CLI: 0.0.72
NemoClaw:      v0.0.78-5-g48e496780 (main; working tree also carried the
               test-only change from #6554, which touches no runtime code)

Steps to Reproduce

A custom Dockerfile that satisfies the tool-disclosure contract but fails during the build:

FROM ghcr.io/nvidia/nemoclaw/sandbox-base:latest
ARG NEMOCLAW_TOOL_DISCLOSURE=progressive
ENV NEMOCLAW_TOOL_DISCLOSURE=${NEMOCLAW_TOOL_DISCLOSURE}
RUN echo "failing during the image build, after validation" && exit 1
# 1. Fresh onboard that fails during the image build
nemoclaw onboard --name resume-probe2 --agent openclaw --no-gpu \
  --from /tmp/badbuild/Dockerfile --non-interactive --yes \
  --yes-i-accept-third-party-software --fresh

# 2. The registry entry is gone
node -e 'const j=require(process.env.HOME+"/.nemoclaw/sandboxes.json"); console.log(j.sandboxes["resume-probe2"] ? "present" : "ABSENT")'

# 3. Do exactly what the CLI just told you to do
nemoclaw onboard --resume --name resume-probe2 --agent openclaw --no-gpu \
  --from /tmp/badbuild/Dockerfile --non-interactive --yes \
  --yes-i-accept-third-party-software

Expected Result

Either --resume recreates the route reservation and continues, or the failure handler does not recommend --resume for this class of failure and points at --fresh instead.

Actual Result

Step 1 fails during the build and recommends resuming:

  Onboarding did not finish. Resume from the step that failed with:
    nemoclaw onboard --resume
  Completed steps are skipped; pass --fresh instead to start over.

Step 2 shows the entry is gone:

ABSENT

Step 3 — the recommended command — skips the step that would recreate it, and dies:

  [resume] Skipping inference (ollama-local / llama3.2:1b)
  ...
  [5/8] Messaging channels
  Error: sandbox route reservation 'resume-probe2' disappeared while onboarding was in progress. Retry onboarding.

  Onboarding did not finish. Resume from the step that failed with:
    nemoclaw onboard --resume

Running it a second time produces the identical error line. The loop does not converge.

For contrast, when the same onboard fails before creation (drop the ARG/ENV lines so the tool-disclosure contract check rejects the Dockerfile), the entry survives:

{"name":"resume-probe","provider":"ollama-local","model":"llama3.2:1b","pendingRouteReservation":true}

and --resume proceeds past that point.

Root cause

I watched the registry row appear and vanish by polling ~/.nemoclaw/sandboxes.json once per second during a fresh onboard whose build sleeps before failing:

t=9s   absent                  phase='[3/8] Configuring inference provider'
t=22s  absent                  phase='[4/8] Setting up inference provider'
t=26s  PRESENT(pending=true)   phase='[4/8] Setting up inference provider'
t=27s  absent                  phase='[6/8] Creating sandbox'
final: ABSENT

So, in order:

  • Step 4 creates the reservation. reserveSandboxInferenceRoute() (src/lib/state/registry.ts:563) writes the row with pendingRouteReservation: true, wired in as updateSandbox for the inference setup (src/lib/onboard.ts:3768). Note that on a fresh run the provider-inference handler does not reserve: its authoritativeReservationName is null unless authoritativeResumeConfig is set (handlers/provider-inference.ts:600-602).

  • Step 6 removes it immediately, before the build. The row exists with no live sandbox, so src/lib/onboard/tool-disclosure-flow.ts:66 (if (existingEntry && !liveExists && !preservedMcpState) registry.removeSandbox(sandboxName)) drops it. This is not a failure rollback — it happens at the top of the sandbox step regardless of what the build later does. Confirmed by printing a stack trace from registry.removeSandbox during the run:

    [[REMOVE_SANDBOX]] name=rp5
        at Object.removeSandbox (dist/lib/state/registry.js)
        at Object.prepareSandboxToolDisclosure (dist/lib/onboard/tool-disclosure-flow.js)
        at createSandboxWithBaseImageResolution (dist/lib/onboard.js)
        at async createAndRecord (dist/lib/onboard/machine/handlers/sandbox.js)
    
  • A failed build never re-registers it. On a successful run the entry is rewritten after creation; on a failed one it simply stays gone.

  • Resume never recreates it. The session marks the inference steps complete, so they are skipped ([resume] Skipping inference (...)), and assertGatewayRouteCompatible() (src/lib/onboard/machine/handlers/sandbox.ts:485) then hard-fails because getSandboxRegistryEntry(sandboxName) is null.

This also explains the contrast above: a Dockerfile-contract failure is raised before the tool-disclosure-flow removal, so that entry survives and its resume works.

Suggested fixes

Any one of these would break the loop; I'm happy to send a PR for whichever the maintainers prefer:

  1. Re-reserve on resume. Treat the reservation as a precondition of the sandbox step rather than an output of the inference steps: if the row is missing on resume and the session already carries a resolved provider/model, recreate it before assertGatewayRouteCompatible runs.
  2. Do not drop the reservation before the sandbox exists. The tool-disclosure-flow cleanup cannot distinguish a stale entry from a live reservation for the sandbox being onboarded right now; it could skip rows carrying pendingRouteReservation: true for the current sandboxName.
  3. Fix the advice. When the reservation is missing, the failure handler should recommend --fresh rather than the --resume that is guaranteed to fail.

Fix 3 alone still loses the completed steps, so 1 or 2 is the real repair; 3 is worth doing regardless so the message never points at a dead end.

Note on severity

The message does mention --fresh as an alternative on the same screen, so a user who reads carefully can escape. But the recommended action is impossible for this failure class, the error text (Retry onboarding.) does not say which retry, and re-running the recommendation is the natural reflex — it cost me three cycles before I read the handler.

Hokonoken avatar Jul 09 '26 09:07 Hokonoken