[All Platforms][Onboard] NEMOCLAW_GATEWAY_PORT override port persists on re-onboard after gateway cleanup
- Dominant language
- TypeScript
- Stars
- 22.5k
- Forks
- 3.1k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 715
Description
## Description
When a sandbox is first onboarded with `NEMOCLAW_GATEWAY_PORT` set to a non-default port (e.g. 9000), the override port is persisted to the sandbox registry. After gateway cleanup and a subsequent onboard WITHOUT the env var set, NemoClaw re-onboards using the previously overridden port instead of reverting to the default port (8080).
Platform scope: Reproduced on all 10 platforms in CI (Brev, DGX Spark, DGX Station, Ubuntu 22.04, Ubuntu 24.04, Ubuntu 24.04 GPU, Ubuntu 26.04 GPU, macOS, WSL ARM, WSL x86); other platforms not tested outside CI.
Regression: Unknown — earlier versions not tested.
## Environment
```text
Device: CI runner (various: Ubuntu, macOS, WSL, DGX, Brev)
OS: Multiple (Ubuntu 26.04 GPU / macOS / WSL / DGX Spark, etc.)
Architecture: x86_64 / arm64
Node.js: v22.23.1
npm: 10.9.8
Docker: Docker Engine 29.6.1
OpenShell CLI: openshell 0.0.85
NemoClaw: v0.0.96
OpenClaw: unknown
```
## Steps to Reproduce
1. Set `NEMOCLAW_GATEWAY_PORT=9000` in the environment
2. Run: `nemoclaw onboard`
3. Confirm onboard completes and gateway is listening on port 9000
4. Perform gateway cleanup (stop the gateway and clear its runtime files)
5. Unset `NEMOCLAW_GATEWAY_PORT` (do not set it)
6. Run: `nemoclaw onboard` (re-onboard the same sandbox)
7. Check which port the gateway is listening on
## Expected Result
After re-onboard without `NEMOCLAW_GATEWAY_PORT` set, the gateway uses the default port (8080). The override port (9000) is no longer listening.
## Actual Result
The gateway continues to listen on the override port (9000) even though `NEMOCLAW_GATEWAY_PORT` is no longer set. The persisted `gatewayPort` in the sandbox registry is used instead of the current default.
```text
AssertionError: override port must NOT listen after re-onboard: expected true to be false
```
## Logs
Not captured.
Contributor guide
Research direction
Start at the `nemoclaw onboard` entry point and trace how `NEMOCLAW_GATEWAY_PORT` and the sandbox registry's persisted `gatewayPort` are handled during re-onboarding after gateway cleanup. Reproduce the two-onboard sequence with port 9000, then without the variable; done means the second run listens on the default port 8080 and no longer listens on 9000.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100