Commit 726986a
fix(onboard): recreate gateway when Docker network is missing (#9671)
<!-- markdownlint-disable MD041 -->
## Summary
Onboarding reused a running NemoClaw-managed OpenShell gateway even when
its configured Docker network was missing, so later sandbox creation
failed with a Docker 404. This change verifies the exact configured
network before reuse, marks an authoritative gateway stale when that
network is absent, and stops safely when inspection is inconclusive.
## Related Issue
Fixes #9594
## Changes
- Inspect the configured Docker network through the existing managed
gateway reuse boundary and classify exact evidence as present, absent,
or inconclusive.
- Mark a reused NemoClaw-managed OpenShell gateway stale only after its
process identity and lifecycle authority are proven, then let the
existing gateway lifecycle owner retire and restart it.
- Fail before provider or sandbox mutation when network inspection is
inconclusive or the gateway is not under NemoClaw lifecycle authority.
The change does not create, remove, or modify a foreign Docker network.
- Add regression coverage for the missing-network failure, exact-name
validation, permission and malformed-output failures, foreign-gateway
handling, restart ordering, and partial restart failure state.
- Reproduce the escaped defect before the production fix: `npx vitest
run --project cli src/lib/onboard/gateway-reuse.test.ts` failed 1 of 9
tests because the missing network was reported as healthy. The final
focused run passed 47 of 47 tests.
## Type of Change
- [x] Code change (feature, bug fix, or refactor)
- [ ] Code change with doc updates
- [ ] Doc only (prose changes, no code sample modifications)
- [ ] Doc only (includes code sample changes)
## Quality Gates
- [x] Tests added or updated for changed behavior
- [ ] Existing tests cover changed behavior — justification:
- [ ] Tests not applicable — justification:
- [x] Sensitive paths changed (security, policy, credentials, preflight,
onboarding, inference, runner, sandbox, or messaging)
- [x] Sensitive-path review completed or maintainer-approved waiver
recorded — reviewer/approval link/justification: Root-cause and
sensitive-workflow review passed exact commit
`6d136ebc0c8c43b7120ef213a06681a1c4d42203`. It covered command
construction, exact lifecycle authority, present/absent/inconclusive
result classification, foreign resource isolation, pre-mutation failure,
restart ordering, and partial failure state.
- [x] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue: The user approved a
narrow waiver for `env-var-docs`, which fails identically on clean base
`01e0b92645a68d4ff772dce20ee5758def7211cc` because
`NEMOCLAW_BEDROCK_RUNTIME_ADAPTER_PORT` and
`NEMOCLAW_HTTPS_PIN_RUNTIME_ADAPTER_PORT` are both documented and still
retained in the stale allowlist. This PR changes neither entry; every
other applicable hook passed.
## DGX Station Hardware Evidence
- [ ] Tested on DGX Station
- Tested commit: not applicable; `scripts/prepare-dgx-station-host.sh`
is unchanged
- Station profile/scenario: not applicable
- Result: not applicable
- Supporting evidence: not applicable
## Documentation Writer Review
- [x] Documentation writer reviewed the completed changes
- Result: `no-docs-needed`
- Reviewed commit: `6d136ebc0c8c43b7120ef213a06681a1c4d42203`
- AGENTS.md blob: `513518cdfca42e3a18fed71109e6d0eb60151d13`
- Evidence: The change restores the documented stale-gateway recreation
behavior when the configured Docker network is absent. It does not
change a command, configuration, default, or schema. The existing
behavior is documented in `docs/reference/commands.mdx` lines 884-890.
- Agent surface: Codex Desktop
<!-- docs-review-head-sha: a608468 -->
<!-- docs-review-agents-blob-sha: 513518c -->
## Verification
- [x] PR description includes a `Signed-off-by:` line and every commit
appears as `Verified` in GitHub
- [ ] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or
`npm run validate:pr` passed after refreshing `origin/main` when hooks
were skipped or unavailable — commit-message and pre-push hooks passed;
all applicable pre-commit hooks passed except the narrowly waived
inherited `env-var-docs` failure recorded above
- [x] Targeted behavior tests pass for the current change set, or tests
are marked not applicable above — command/result or justification: `npx
vitest run --project cli src/lib/onboard/gateway-reuse.test.ts
src/lib/onboard/machine/handlers/gateway.test.ts` passed 47 of 47 tests.
The final `npm run test:changed` passed 32 growth guardrails and 47
affected tests. `npm run typecheck:cli` and `npm run checks:repository`
passed.
- [ ] Applicable broad gate passed — `npm test` for broad
runtime/test-harness changes; `npm run check` for repo-wide
validation/coverage changes — command/result: not applicable to this
focused onboarding lifecycle fix; the targeted tests, changed-test
selection, CLI typecheck, repository checks, and normal hooks except the
recorded waiver passed
- [x] Quality Gates section completed with required justifications or
waivers
- [x] No secrets, API keys, or credentials committed
- [ ] `npm run docs` builds without warnings (doc changes only)
- [ ] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)
---
Signed-off-by: Rebecca Sliter <571084+rsliter@users.noreply.github.com>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Added Docker network verification before reusing gateways.
- Added detection for available, missing, or unverifiable networks.
- Automatically marks gateways stale and recreates them when their
managed network is missing.
- Added safeguards to prevent state changes when network verification
fails.
- **Bug Fixes**
- Improved gateway lifecycle handling during network recreation and
failed restarts.
- Ensured gateway listener and process reuse consistently validate
network availability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Rebecca Sliter <571084+rsliter@users.noreply.github.com>
Co-authored-by: Prekshi Vyas <34834085+prekshivyas@users.noreply.github.com>1 parent 9ed1547 commit 726986a
4 files changed
Lines changed: 341 additions & 15 deletions
File tree
- src/lib
- onboard
- machine/handlers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
742 | 742 | | |
743 | 743 | | |
744 | 744 | | |
745 | | - | |
746 | | - | |
| 745 | + | |
747 | 746 | | |
748 | 747 | | |
749 | 748 | | |
| |||
756 | 755 | | |
757 | 756 | | |
758 | 757 | | |
| 758 | + | |
759 | 759 | | |
760 | 760 | | |
761 | 761 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
13 | 79 | | |
14 | 80 | | |
15 | 81 | | |
| |||
96 | 162 | | |
97 | 163 | | |
98 | 164 | | |
99 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
100 | 169 | | |
101 | 170 | | |
102 | 171 | | |
| |||
108 | 177 | | |
109 | 178 | | |
110 | 179 | | |
111 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
112 | 184 | | |
113 | 185 | | |
114 | 186 | | |
115 | 187 | | |
116 | 188 | | |
117 | 189 | | |
118 | 190 | | |
| 191 | + | |
| 192 | + | |
119 | 193 | | |
120 | 194 | | |
121 | 195 | | |
| |||
158 | 232 | | |
159 | 233 | | |
160 | 234 | | |
161 | | - | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
162 | 261 | | |
163 | 262 | | |
164 | 263 | | |
| |||
167 | 266 | | |
168 | 267 | | |
169 | 268 | | |
170 | | - | |
| 269 | + | |
171 | 270 | | |
172 | 271 | | |
173 | 272 | | |
| |||
176 | 275 | | |
177 | 276 | | |
178 | 277 | | |
179 | | - | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
180 | 282 | | |
181 | | - | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
182 | 304 | | |
183 | | - | |
| 305 | + | |
| 306 | + | |
184 | 307 | | |
185 | 308 | | |
186 | 309 | | |
187 | 310 | | |
| 311 | + | |
188 | 312 | | |
189 | 313 | | |
190 | 314 | | |
191 | 315 | | |
192 | 316 | | |
| 317 | + | |
193 | 318 | | |
194 | 319 | | |
195 | 320 | | |
196 | 321 | | |
197 | 322 | | |
198 | 323 | | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
199 | 342 | | |
200 | 343 | | |
201 | 344 | | |
| |||
0 commit comments