Commit eed5c46
fix(onboard): make the Ollama model pull timeout configurable (#3037)
## Summary
The Ollama model pull was wrapped with a hardcoded 10-minute wall-clock
timeout in both pull paths, so sustained network throughput below ~8
MB/s could not complete the default 4.7 GB qwen2.5:7b pull (each retry
resumed from the last layer but still hit SIGTERM at the next 10-minute
boundary). Replace the hardcoded value with a
`NEMOCLAW_OLLAMA_PULL_TIMEOUT` env-var override (seconds) defaulting to
30 minutes, and surface the override hint in the timeout error messages.
## Related Issue
Closes #2610
## Changes
- Add `DEFAULT_OLLAMA_PULL_TIMEOUT_MS` (30 minutes),
`getOllamaPullTimeoutMs()` (parses `NEMOCLAW_OLLAMA_PULL_TIMEOUT` in
seconds with fallback for unset / empty / non-numeric / non-positive
inputs), and `pullTimeoutErrorHint()` (prints elapsed minutes, the
resume-on-retry note, and the env var hint) in
`src/lib/onboard-ollama-proxy.ts`.
- Wire the helper into `pullOllamaModelViaCli` (replacing the hardcoded
`timeout: 600_000` on `spawnSync`) and `pullOllamaModelViaHttp`
(replacing the hardcoded `TIMEOUT_MS = 600_000` on the curl `--max-time`
deadline). The HTTP-path non-timeout error path retains its existing
wording.
- Export `getOllamaPullTimeoutMs` so the unit tests can exercise the
parser without shelling out to `ollama pull`.
- Add `test/ollama-pull-timeout.test.ts` covering: default fallback when
unset, empty, or whitespace; positive integer seconds → ms conversion;
truncated fractional seconds; non-numeric fallback; zero/negative
fallback.
## 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)
## Verification
- [x] `npx prek run --all-files` passes
- [x] `npm test` passes
- [x] Tests added or updated for new or changed behavior
- [x] No secrets, API keys, or credentials committed
- [ ] Docs updated for user-facing behavior changes
- [ ] `make 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: Tinson Lai <tinsonl@nvidia.com>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Added configurable Ollama model-pull timeout via environment variable
(30-minute default) with improved timeout error messaging.
* **Tests**
* Added test suite validating timeout configuration, conversion, and
error handling behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
Co-authored-by: Aaron Erickson <aerickson@nvidia.com>1 parent 6c07b82 commit eed5c46
2 files changed
Lines changed: 144 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
309 | 329 | | |
| 330 | + | |
310 | 331 | | |
311 | 332 | | |
312 | 333 | | |
313 | 334 | | |
314 | | - | |
| 335 | + | |
315 | 336 | | |
316 | 337 | | |
317 | 338 | | |
318 | | - | |
319 | | - | |
320 | | - | |
| 339 | + | |
321 | 340 | | |
322 | 341 | | |
323 | 342 | | |
| |||
332 | 351 | | |
333 | 352 | | |
334 | 353 | | |
335 | | - | |
| 354 | + | |
336 | 355 | | |
337 | 356 | | |
338 | 357 | | |
| |||
343 | 362 | | |
344 | 363 | | |
345 | 364 | | |
346 | | - | |
| 365 | + | |
347 | 366 | | |
348 | 367 | | |
349 | 368 | | |
| |||
450 | 469 | | |
451 | 470 | | |
452 | 471 | | |
453 | | - | |
| 472 | + | |
454 | 473 | | |
455 | 474 | | |
| 475 | + | |
456 | 476 | | |
457 | | - | |
458 | 477 | | |
459 | 478 | | |
460 | 479 | | |
| |||
551 | 570 | | |
552 | 571 | | |
553 | 572 | | |
| 573 | + | |
554 | 574 | | |
555 | 575 | | |
556 | 576 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 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 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
0 commit comments