fix(sandbox): target the sandbox's own gateway on non-default NEMOCLAW_GATEWAY_PORT#4987
Open
jahubba wants to merge 1 commit into
Open
fix(sandbox): target the sandbox's own gateway on non-default NEMOCLAW_GATEWAY_PORT#4987jahubba wants to merge 1 commit into
jahubba wants to merge 1 commit into
Conversation
Sandbox lifecycle commands (connect/destroy/doctor/snapshot) and the shared gateway recovery/health path (recoverNamedGatewayRuntime / getNamedGatewayLifecycleState) hardcoded the gateway name "nemoclaw" and ignored NEMOCLAW_GATEWAY_PORT. Since NVIDIA#4422 a non-default port registers the gateway as `nemoclaw-<port>`, so these paths targeted a gateway that does not exist: `doctor` reported a connected `nemoclaw-<port>` gateway as failed and tried to start one on the default port; destroy/snapshot operated on the wrong gateway/container name; connect's readiness gate mis-resolved the gateway. Add `resolveSandboxGatewayName()` (reads the sandbox's persisted gatewayName/gatewayPort) and thread it through these commands. Parameterize getNamedGatewayLifecycleState/recoverNamedGatewayRuntime with `gatewayName`, defaulting to the env-resolved per-port name so non-sandbox callers are unaffected. Adds unit tests for the resolver. Signed-off-by: Jason Hubbard <jasonahubbard@gmail.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Sandbox lifecycle commands (
connect/destroy/doctor/snapshot) and the shared gateway recovery/health path hardcoded the gateway registration namenemoclawand ignoredNEMOCLAW_GATEWAY_PORT. Since #4422 a non-default port registers the gateway asnemoclaw-<port>, so these paths targeted a gateway that doesn't exist:doctorreported a connectednemoclaw-<port>gateway as failed and tried to start one on the default port (often "Address already in use");destroy/snapshotused the wrong gateway/container name;connect's readiness gate mis-resolved. SettingNEMOCLAW_GATEWAY_PORTdid not help because the name was a literal.Related Issue
Fixes #4985. Completes the per-port migration started in #4422 (distinct from the multi-instance issue #4865).
Changes
src/lib/onboard/gateway-binding.ts— newresolveSandboxGatewayName(sb)resolving the sandbox's persistedgatewayName/gatewayPort(falls back to the bare default for older entries).src/lib/gateway-runtime-action.ts—getNamedGatewayLifecycleState/recoverNamedGatewayRuntimetake agatewayName, defaulting to the env-resolved per-port name (resolveGatewayName(GATEWAY_PORT)), so non-sandbox callers honorNEMOCLAW_GATEWAY_PORT; thehealthy_namedclassifier now compares against the resolved name instead of the literal"nemoclaw".src/lib/actions/sandbox/{connect,destroy,doctor,snapshot,gateway-state,policy-channel}.ts— resolve the gateway from the sandbox entry instead of the hardcodedNEMOCLAW_GATEWAY_NAMEconstant; thread it through gatewayselect/info/remove/destroy, the docker-driver container/DNS names, and the recovery/health calls.doctorstatus detail/hint now name the actual gateway.src/lib/onboard/gateway-binding.test.ts— unit tests forresolveSandboxGatewayName(name / port-derived / fallback).Behavior
nemoclaw-<port>from the registry; non-sandbox commands honorNEMOCLAW_GATEWAY_PORT.nemoclawname.startGatewayForRecovery()(the gateway start path) still reads onboarding's process-global port; the common "gateway already running" path is fully resolved here.Type of Change
Verification
npm run typecheck:cliclean; Biome clean. Relying on CI for the full matrix (a fixed set of NIM/GPU/install suites fail identically on a cleanmainon this aarch64 host).Signed-off-by: Jason Hubbard jasonahubbard@gmail.com