Commit cfa7682
feat: sandbox survival across gateway restarts (NVIDIA#1466)
## Summary
- **Bump minimum OpenShell to v0.0.22** — enables sandbox persistence
across gateway restarts (deterministic k3s node name + workspace PVC +
gateway resume from volume)
- **Auto-recover OpenClaw processes** — when the sandbox pod survives a
restart but the OpenClaw gateway didn't re-run, `nemoclaw connect` and
`nemoclaw status` detect it and transparently restart via SSH
- **E2E test** — proves the full survival scenario with real NVIDIA
inference: onboard → baseline inference → plant marker file → stop
gateway → restart gateway → verify sandbox survived → verify marker
persisted → verify inference works post-restart (24/24 tests passed)
### How it works (joint OpenShell + NemoClaw solution)
OpenShell v0.0.22 persists the infrastructure layer:
- Gateway resumes from Docker volume state (PR NVIDIA/OpenShell#488)
- SSH handshake secrets survive as K8s Secrets (PR NVIDIA/OpenShell#488)
- Deterministic k3s node name prevents PVC orphaning (PR
NVIDIA/OpenShell#739)
- Default 1Gi workspace PVC at `/sandbox` (PR NVIDIA/OpenShell#739)
NemoClaw restores the application layer:
- Detects "sandbox alive, OpenClaw dead" via HTTP probe (curl
localhost:18789)
- Cleans stale lock/temp files, restarts gateway via SSH
- Re-establishes dashboard port forward (18789)
- `nemoclaw status` shows `OpenClaw: running | recovered | not running`
with guidance
### User experience after this PR
```
laptop closes → Docker stops → laptop opens
→ Docker auto-restarts container
→ OpenShell gateway resumes, sandbox pod reschedules with workspace intact
→ user runs: nemoclaw my-assistant connect
→ NemoClaw detects OpenClaw not running, auto-restarts, reconnects port forward
→ user is back where they left off
```
### Context
Reported by @SenthilKumar-Ravichandran after testing OpenShell v0.0.22
on Brev VMs — PVC persistence works, but the user-defined ENTRYPOINT
(`nemoclaw-start`) does not re-run after pod restart on some platforms.
## Test plan
- [x] Unit tests pass (826/826 in main working directory)
- [x] E2E sandbox survival test passes with real NVIDIA inference
(24/24)
- [x] `nemoclaw status` shows `OpenClaw: running` when gateway is alive
- [x] `nemoclaw status` shows `OpenClaw: recovered` after auto-restart
- [x] ShellCheck passes on new E2E test
- [ ] Validate on Brev VM (where ENTRYPOINT doesn't re-run)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Adds automatic gateway health monitoring with in-sandbox recovery
attempts, re-establishes dashboard port-forwarding, and provides clearer
status output with actionable recovery instructions.
* **Tests**
* Adds an end-to-end test validating sandbox persistence and continuity
across gateway stop/start cycles, including live inference and
marker-file persistence checks.
* **Chores**
* Bumped minimum OpenShell version requirement to 0.0.22.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>1 parent 2fd4cf7 commit cfa7682
3 files changed
Lines changed: 669 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 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 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
178 | 339 | | |
179 | 340 | | |
180 | 341 | | |
| |||
961 | 1122 | | |
962 | 1123 | | |
963 | 1124 | | |
| 1125 | + | |
964 | 1126 | | |
965 | 1127 | | |
966 | 1128 | | |
| |||
1050 | 1212 | | |
1051 | 1213 | | |
1052 | 1214 | | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
1053 | 1237 | | |
1054 | 1238 | | |
1055 | 1239 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
37 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
0 commit comments