[Linux][Onboard]nemoclaw onboard --from <bad-path> validates too late — gateway and provider state applied before error
Description
Description
`nemoclaw onboard --from ` validates only the FORM of the flag (must have a value, value must not start with "--") at argument parse time. The actual path-existence check is deferred until step [6/8]
"Creating sandbox" inside src/lib/onboard.ts:3352-3357:Environmentif (fromDockerfile) { const fromResolved = path.resolve(fromDockerfile); if (!fs.existsSync(fromResolved)) { console.error(` Custom Dockerfile not found: ${fromResolved}`); process.exit(1); } ... }</code></pre><pre>Consequence: when the user passes a typo'd / non-existent path, the wizard runs through five preceding steps that have side effects on the host:[1/8] Preflight checks — read-only, OK [2/8] Starting OpenShell gateway — gateway container started [3/8] Inference provider setup — config written [4/8] Provider attachment — provider state written [5/8] Messaging channels — channel state written [6/8] Creating sandbox — finally exits with "Custom Dockerfile not found: …"
The user waits 60–120s before seeing the error.
process.exit(1)at [6/8] does NOT roll back the gateway/provider state already applied. This also breaks fast-fail expectations in automation: the calling script can't distinguish "bad --from path" from "real onboard failure" by exit timing.
Device: Linux CI runner (gitlab-runner pool) OS: Ubuntu 24.10 (kernel 6.11.0-18-generic) Architecture: x86_64 Node.js: v22.22.2 npm: 10.9.7 Docker: Docker version 28.4.0 OpenShell CLI: openshell 0.0.36 NemoClaw: v0.0.28 OpenClaw: 2026.4.9 Source ref: NemoClaw main @ 277048ec (v0.0.28-2-g277048ec)Steps to Reproduce
1. BAD_PATH=/tmp/no-such-dockerfile-12345
2. nemoclaw onboard --from "$BAD_PATH" --non-interactive \
--yes-i-accept-third-party-software
3. Watch [1/8] preflight pass, [2/8] gateway start succeed, etc.
4. Eventually at [6/8] Creating sandbox, error prints:
Custom Dockerfile not found: /tmp/no-such-dockerfile-12345 and process exits with code 1.
5. After exit, gateway container `openshell-cluster-nemoclaw` is still running; ~/.nemoclaw/onboard-session.json shows partial step states.
Expected Result
The wizard should validate `--from` at argument parsing (in src/lib/onboard-command.ts, near line 62-67 where the flag is currently form-validated), e.g.:
if (fromDockerfile) {
const resolved = path.resolve(fromDockerfile);
if (!fs.existsSync(resolved)) {
error(` --from path '${fromDockerfile}' not found.`);
// exits before any side-effect step
}
}
Result: non-zero exit immediately, no preflight banner, no gateway started, no provider written. Error message contains "not found" / "--from" so callers can match it.Actual Result
Error surfaces at step [6/8] only. Preceding steps' side effects (gateway container, provider config) remain on the host. Test tests/02-onboard/T5973150-build-context-cleanup-on-failure.test.ts:57 asserts the error matches /not found|no such file|invalid|--from/i within the first 400 chars of stdout/stderr — fails because the first 400 chars are the standard preflight banner, with no error in sight until ~60s in.
Bug Details
| Field | Value |
|---|---|
| Priority | Unprioritized |
| Action | Dev - Open - To fix |
| Disposition | Open issue |
| Module | Machine Learning - NemoClaw |
| Keyword | NemoClaw, NemoClaw_CLI&UX, NEMOCLAW_GH_SYNC_APPROVAL, NemoClaw_Onboard |
[NVB#6121349]
I was able to reproduce this on Brev with a fresh HOME and a missing custom Dockerfile path:
TMP_HOME="$(mktemp -d)"
BAD_PATH="/tmp/no-such-dockerfile-2589"
rm -f "$BAD_PATH"
HOME="$TMP_HOME" \
PATH="$PATH" \
NEMOCLAW_NON_INTERACTIVE=1 \
NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE=1 \
NVIDIA_API_KEY="${NVIDIA_API_KEY:?set NVIDIA_API_KEY first}" \
nemoclaw onboard \
--from "$BAD_PATH" \
--non-interactive \
--yes-i-accept-third-party-software
Before the fix, onboarding continued through preflight, gateway startup, inference configuration, and messaging setup before finally failing at [6/8] Creating sandbox with:
Custom Dockerfile not found: /tmp/no-such-dockerfile-2589
I submitted a fix in #2597. The PR validates --from <Dockerfile> during command parsing, so a missing path now exits immediately before onboarding side effects begin:
--from path not found: /tmp/no-such-dockerfile-2589
Validated on Brev with:
npm run build:cli
npm run typecheck:cli
npm test -- src/lib/onboard-command.test.ts
node ./bin/nemoclaw.js onboard --from /tmp/no-such-dockerfile-2589 --non-interactive --yes-i-accept-third-party-software