Repository navigation
feat(onboard): pull Ollama models via HTTP when reaching Windows host - #2768
Conversation
Signed-off-by: zyang-dev <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughModel-pull logic for Ollama is refactored: a new async Changes
Sequence Diagram(s)sequenceDiagram
participant Onboard as Onboarding
participant Dispatcher as pullOllamaModel
participant HTTP as "Ollama HTTP API"
participant CLI as "ollama CLI"
participant TTY as "Output / TTY"
Onboard->>Dispatcher: prepareOllamaModel(host, model)
alt host resolves to Windows/Docker-internal
Dispatcher->>HTTP: POST /api/pull (stream)
HTTP->>HTTP: stream JSON events (progress/status/error)
HTTP->>TTY: emit TTY/non-TTY updates
TTY-->>Dispatcher: progress/status events -> final {ok,message}
else other hosts
Dispatcher->>CLI: run `ollama pull` (subprocess)
CLI->>TTY: capture stdout/stderr
TTY-->>Dispatcher: CLI output -> final {ok,message}
end
Dispatcher-->>Onboard: Promise resolves {ok, message}
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Review rate limit: 9/10 reviews remaining, refill in 6 minutes. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/lib/onboard-ollama-proxy.ts`:
- Around line 329-353: In pullOllamaModelViaHttp, the request body currently
uses { name: model } which is invalid for Ollama's /api/pull; change the payload
to use { model: model, stream: true } (or shorthand { model, stream: true })
when constructing the `body` passed to JSON.stringify so the API identifies the
model correctly; keep all other options (TIMEOUT_MS, curl args, etc.) unchanged.
- Around line 440-458: The handler currently attached to proc.on("exit", ...)
should be switched to proc.on("close", ...) so the promise resolves only after
the child process's stdio is fully drained; replace the "exit" listener with a
"close" listener while keeping the same logic that calls finishLine(), checks
sawError, inspects code (using TIMEOUT_MS and the code === 28 branch) and
resolves with sawSuccess, ensuring you preserve references to proc, finishLine,
sawError, sawSuccess and TIMEOUT_MS.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: d8c89e14-5e7e-41f8-a1ee-272a081cf9b7
📒 Files selected for processing (2)
src/lib/onboard-ollama-proxy.tssrc/lib/onboard.ts
Signed-off-by: zyang-dev <[email protected]>
## Summary Updates NemoClaw documentation for the v0.0.32 release candidate, covering user-facing changes that landed since v0.0.31 and promoting the docs version switcher to 0.0.32. ## Changes - Document Windows-host Ollama support from WSL, including HTTP model pulls and avoiding duplicate Ollama instances on port 11434. Matches dev PR #2768. - Add Ollama GPU memory cleanup behavior for provider switches, service stops, and sandbox destroy. Matches dev PR #2651. - Document Hugging Face token forwarding for remote deploy workflows that pull gated model repositories. Matches dev PR #2729. - Add runtime sandbox and policy context injection to the architecture reference. Matches dev PR #2751. - Bump `docs/versions1.json` and regenerated `docs/project.json` to 0.0.32 for release prep. No separate dev PR. ## Type of Change - [ ] Code change (feature, bug fix, or refactor) - [ ] Code change with doc updates - [ ] Doc only (prose changes, no code sample modifications) - [x] Doc only (includes code sample changes) ## Verification - [ ] `npx prek run --all-files` passes - [ ] `npm test` passes - [ ] Tests added or updated for new or changed behavior - [x] No secrets, API keys, or credentials committed - [x] Docs updated for user-facing behavior changes - [ ] `make docs` builds without warnings (doc changes only) - [x] 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) ## AI Disclosure - [x] AI-assisted — tool: Cursor --- Signed-off-by: Miyoung Choi <[email protected]> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Added guidance for deploying with Hugging Face gated models * Improved Windows/WSL Ollama configuration instructions * Documented GPU memory cleanup behavior during model transitions * Enhanced architecture and command reference documentation * Version bumped to 0.0.32 <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary
When Ollama runs on the Windows host (now detected from WSL via
host.docker.internalafter #2707),nemoclaw onboardcould detect it but couldn't pull new models becausepullOllamaModelshells out to theollamaCLI. This PR adds an HTTP/api/pullpath that runs only when the resolved host ishost.docker.internal. Native Linux/macOS keeps the existing CLI shell-out unchanged.Changes
src/lib/onboard-ollama-proxy.ts:pullOllamaModeltopullOllamaModelViaCli(no logic change).pullOllamaModelViaHttp(model): streamsPOST /api/pullvia curl with--connect-timeout 10 --max-time 600, parses NDJSON, renders an in-place progress bar with throttled status updates. Falls back to throttled per-line output when stdout is not a TTY.pullOllamaModel: routes to HTTP only whengetResolvedOllamaHost() ===OLLAMA_HOST_DOCKER_INTERNAL; otherwise CLI.prepareOllamaModelasync so the dispatcher can await.Already-downloaded layers are kept; re-running the pull resumes them.).src/lib/onboard.ts: twoprepareOllamaModelcallers updated toawait.Type of Change
Verification
npx prek run --all-filespassesnpm testpassesmake docsbuilds without warnings (doc changes only)AI Disclosure
Signed-off-by: zyang-dev [email protected]
Summary by CodeRabbit
New Features
Bug Fixes