refactor(onboard): extract provider host state#5171
Conversation
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
|
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 (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughA new module centralizes inference provider host-state detection (Ollama, vLLM, Windows-host reachability, WSL context) with injectable dependencies. The onboarding ChangesInference Provider Host State Detection
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
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)
Comment |
E2E Advisor RecommendationRequired E2E: Dispatch hint: Auto-dispatched E2E: Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
Dispatch hint
|
Vitest E2E Scenario RecommendationRequired Vitest E2E scenarios: Dispatch required Vitest E2E scenarios:
Full Vitest E2E advisor summaryVitest E2E Scenario AdvisorBase: Required Vitest E2E scenarios
Optional Vitest E2E scenarios
Relevant changed files
|
PR Review AdvisorFindings: 0 needs attention, 0 worth checking, 0 nice ideas Consider writing more tests for
This is an automated advisory review. A human maintainer must make the final merge decision. |
Selective E2E Results — ✅ All requested jobs passedRun: 27302116386
|
|
Validation update for the draft host-state slice at
This leaves the PR in good draft-stack shape. The only missing live confidence is a real GPU local-provider run, which looks blocked by infrastructure rather than by this branch. |
|
Next draft stack slice opened: #5173 ( This branch is based on #5171 and keeps shrinking Local validation before opening #5173:
Full |
…nu-merge-update # Conflicts: # test/e2e/test-onboard-inference-smoke.sh
…' into codex/tmp-provider-host-state-merge-update
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/lib/onboard/provider-host-state.ts (1)
121-121: ⚡ Quick winAvoid host literal drift; reuse
OLLAMA_HOST_DOCKER_INTERNALLine 121 hardcodes
host.docker.internaleven though this module already importsOLLAMA_HOST_DOCKER_INTERNAL. Reusing the constant keeps probe logic aligned with the host-resolution contract.Proposed fix
- `http://host.docker.internal:${OLLAMA_PORT}/api/tags`, + `http://${OLLAMA_HOST_DOCKER_INTERNAL}:${OLLAMA_PORT}/api/tags`,🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/lib/onboard/provider-host-state.ts` at line 121, Replace the hardcoded host literal in the tags probe URL with the existing OLLAMA_HOST_DOCKER_INTERNAL constant: change the template literal `http://host.docker.internal:${OLLAMA_PORT}/api/tags` to use `OLLAMA_HOST_DOCKER_INTERNAL` (keeping the existing OLLAMA_PORT and path `/api/tags`) so the probe uses the shared host-resolution constant; locate this change in the code that constructs the probe URL in provider-host-state (look for the string/variable that builds the tags endpoint).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/lib/onboard/provider-host-state.ts`:
- Around line 65-66: The code calls deps.isWsl() without passing the injected
runtime overrides, so input.platform and input.env are ignored; update the calls
to deps.isWsl() (the calls around the resolve/host-state logic at ~lines
147-153) to pass the overrides: deps.isWsl(input.platform, input.env) (or
equivalent parameter names) so the injected input.platform and input.env are
used when resolving WSL state; ensure every place that currently calls
deps.isWsl() in this module is updated to pass those two arguments.
---
Nitpick comments:
In `@src/lib/onboard/provider-host-state.ts`:
- Line 121: Replace the hardcoded host literal in the tags probe URL with the
existing OLLAMA_HOST_DOCKER_INTERNAL constant: change the template literal
`http://host.docker.internal:${OLLAMA_PORT}/api/tags` to use
`OLLAMA_HOST_DOCKER_INTERNAL` (keeping the existing OLLAMA_PORT and path
`/api/tags`) so the probe uses the shared host-resolution constant; locate this
change in the code that constructs the probe URL in provider-host-state (look
for the string/variable that builds the tags endpoint).
🪄 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: dc6ef38d-d554-41e7-958d-f69dc6664355
📒 Files selected for processing (3)
src/lib/onboard.tssrc/lib/onboard/provider-host-state.test.tssrc/lib/onboard/provider-host-state.ts
Selective E2E Results — ✅ All requested jobs passedRun: 27332576377
|
Selective E2E Results — ✅ All requested jobs passedRun: 27333190216
|
Summary
Extracts provider host-state detection from
setupNiminto a typed helper so the provider menu and dispatch branches consume one coherent local inference snapshot. This keeps the provider-selection behavior unchanged while moving Ollama, Windows-host Ollama, vLLM, and install-menu probes out of the large onboard entrypoint.Related Issue
Refs #3802
Changes
src/lib/onboard/provider-host-state.tsto collect local Ollama, Windows-host Ollama, vLLM, Docker runtime, install-menu, and GPU capability state.setupNimto consume the new host-state object before building the provider menu.Type of Change
Verification
npx prek run --all-filespassesnpm testpassesnpm run docsbuilds without warnings (doc changes only)Local verification run:
npx @biomejs/biome format --write src/lib/onboard.ts src/lib/onboard/provider-host-state.ts src/lib/onboard/provider-host-state.test.tsnpx @biomejs/biome lint src/lib/onboard.ts src/lib/onboard/provider-host-state.ts src/lib/onboard/provider-host-state.test.tsnpm run build:clinpm run typecheck:clinpx vitest run src/lib/onboard/provider-host-state.test.ts src/lib/onboard/provider-menu.test.ts src/lib/onboard/vllm-menu.test.ts src/lib/onboard/ollama-install-menu.test.ts test/onboard.test.tsgit diff --checkKnown local environment note: full
npx prek run --all-filesand fullnpm testremain locally blocked by the unrelatedtest/release-latest-tag.test.tsfixture commit signing issue on this workstation. This PR does not touch that file.Signed-off-by: Carlos Villela cvillela@nvidia.com
Summary by CodeRabbit
Refactor
Tests