fix(onboard): use 127.0.0.1 instead of localhost for local inference …#1716
fix(onboard): use 127.0.0.1 instead of localhost for local inference …#1716chandler-barlow wants to merge 7 commits into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (3)
📝 WalkthroughWalkthroughReplaced Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
test/onboard-selection.test.ts (1)
680-683:⚠️ Potential issue | 🟡 MinorUpdate stale
localhostmock literals in this test case.Line 680 and Line 682 still match
localhost, but the local inference commands now target127.0.0.1. This can missrunCapturematches and make this test path less reliable.✅ Suggested patch
- if (command.includes("localhost:11434/api/tags")) return JSON.stringify({ models: [{ name: "nemotron-3-nano:30b" }] }); + if (command.includes("127.0.0.1:11434/api/tags")) return JSON.stringify({ models: [{ name: "nemotron-3-nano:30b" }] }); if (command.includes("ollama list")) return "nemotron-3-nano:30b abc 24 GB now"; - if (command.includes("localhost:8000/v1/models")) return ""; + if (command.includes("127.0.0.1:8000/v1/models")) return "";🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@test/onboard-selection.test.ts` around lines 680 - 683, Update the two stale localhost mocks so the test matches the current local-inference addresses: change the checks that call command.includes("localhost:11434/api/tags") and command.includes("localhost:8000/v1/models") to recognize 127.0.0.1 (either by replacing the literal or adding an OR check to also match "127.0.0.1:11434/api/tags" and "127.0.0.1:8000/v1/models"); this ensures runCapture-based matching (and the if branches that return model/tag mocks) still fire for local inference.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@test/onboard-selection.test.ts`:
- Around line 680-683: Update the two stale localhost mocks so the test matches
the current local-inference addresses: change the checks that call
command.includes("localhost:11434/api/tags") and
command.includes("localhost:8000/v1/models") to recognize 127.0.0.1 (either by
replacing the literal or adding an OR check to also match
"127.0.0.1:11434/api/tags" and "127.0.0.1:8000/v1/models"); this ensures
runCapture-based matching (and the if branches that return model/tag mocks)
still fire for local inference.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 62695172-fe3d-4aee-82a6-58cd7fdf93a0
📒 Files selected for processing (4)
bin/lib/onboard.jssrc/lib/local-inference.test.tssrc/lib/local-inference.tstest/onboard-selection.test.ts
💤 Files with no reviewable changes (1)
- bin/lib/onboard.js
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/lib/onboard.ts (1)
2644-2649: Add a defensive null-guard beforerunCaptureon helper output.
getLocalProviderHealthCheck(...)can returnnull; guarding it avoids fragile runtime behavior if provider keys evolve later.♻️ Proposed hardening patch
- const ollamaRunning = !!runCapture(getLocalProviderHealthCheck("ollama-local"), { - ignoreError: true, - }); - const vllmRunning = !!runCapture(getLocalProviderHealthCheck("vllm-local"), { - ignoreError: true, - }); + const ollamaHealthCheck = getLocalProviderHealthCheck("ollama-local"); + const vllmHealthCheck = getLocalProviderHealthCheck("vllm-local"); + const ollamaRunning = !!( + ollamaHealthCheck && + runCapture(ollamaHealthCheck, { + ignoreError: true, + }) + ); + const vllmRunning = !!( + vllmHealthCheck && + runCapture(vllmHealthCheck, { + ignoreError: true, + }) + ); @@ - const vllmModelsRaw = runCapture(getLocalProviderHealthCheck("vllm-local"), { - ignoreError: true, - }); + const vllmHealthCheck = getLocalProviderHealthCheck("vllm-local"); + if (!vllmHealthCheck) { + console.error(" Local vLLM health check command is unavailable."); + process.exit(1); + } + const vllmModelsRaw = runCapture(vllmHealthCheck, { + ignoreError: true, + });Also applies to: 3173-3175
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/lib/onboard.ts` around lines 2644 - 2649, The code calls runCapture(getLocalProviderHealthCheck("ollama-local"), ...) and runCapture(getLocalProviderHealthCheck("vllm-local"), ...) without guarding that getLocalProviderHealthCheck(...) may return null; add a defensive null-check so you only call runCapture when getLocalProviderHealthCheck(...) returns a non-null value (e.g., compute const ollamaCheck = getLocalProviderHealthCheck("ollama-local") and only call runCapture(ollamaCheck, ...) if ollamaCheck is not null, similarly for vllmCheck), and apply the same null-guard pattern to the other occurrence around lines 3173-3175.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/lib/onboard.ts`:
- Around line 2644-2649: The code calls
runCapture(getLocalProviderHealthCheck("ollama-local"), ...) and
runCapture(getLocalProviderHealthCheck("vllm-local"), ...) without guarding that
getLocalProviderHealthCheck(...) may return null; add a defensive null-check so
you only call runCapture when getLocalProviderHealthCheck(...) returns a
non-null value (e.g., compute const ollamaCheck =
getLocalProviderHealthCheck("ollama-local") and only call
runCapture(ollamaCheck, ...) if ollamaCheck is not null, similarly for
vllmCheck), and apply the same null-guard pattern to the other occurrence around
lines 3173-3175.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 7cea2778-203f-4010-a89b-58dfdb58bfb0
📒 Files selected for processing (2)
src/lib/onboard.tssrc/lib/preflight.test.ts
|
✨ Thanks for submitting this PR, which proposes a fix for a bug with local inference service detection and may improve the overall reliability of the service . |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/lib/local-inference.ts (1)
162-208:⚠️ Potential issue | 🟠 MajorProbe target and failure messages are inconsistent.
validateLocalProvider()(Line 162) still executes a health check built fromgetLocalProviderHealthEndpoint(), which currently returnslocalhost(Line 68, Line 70), but the new messages on Line 173, Line 179, Line 201, and Line 207 claim checks against127.0.0.1. This can produce false negatives and misleading remediation text.🔧 Proposed fix
export function getLocalProviderHealthEndpoint(provider: string): string | null { switch (provider) { case "vllm-local": - return "http://localhost:8000/v1/models"; + return "http://127.0.0.1:8000/v1/models"; case "ollama-local": - return "http://localhost:11434/api/tags"; + return "http://127.0.0.1:11434/api/tags"; default: return null; } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/lib/local-inference.ts` around lines 162 - 208, The health-check messages in validateLocalProvider() are inconsistent with the actual probe target returned by getLocalProviderHealthEndpoint(); update validateLocalProvider() to derive the host/URL from getLocalProviderHealthEndpoint(provider) (or from getLocalProviderHealthCheck(provider)'s command) and interpolate that value into the failure messages for vllm-local and ollama-local instead of hardcoding "127.0.0.1" (or alternatively change getLocalProviderHealthEndpoint() to return 127.0.0.1 if you intend to probe that address); adjust the container-reachability messages similarly so they reference the same computed host/URL used by getLocalProviderContainerReachabilityCheck(provider) and runCapture.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/lib/local-inference.ts`:
- Around line 162-208: The health-check messages in validateLocalProvider() are
inconsistent with the actual probe target returned by
getLocalProviderHealthEndpoint(); update validateLocalProvider() to derive the
host/URL from getLocalProviderHealthEndpoint(provider) (or from
getLocalProviderHealthCheck(provider)'s command) and interpolate that value into
the failure messages for vllm-local and ollama-local instead of hardcoding
"127.0.0.1" (or alternatively change getLocalProviderHealthEndpoint() to return
127.0.0.1 if you intend to probe that address); adjust the
container-reachability messages similarly so they reference the same computed
host/URL used by getLocalProviderContainerReachabilityCheck(provider) and
runCapture.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 8899ac8e-04c9-4cef-aa09-d5fa939b53b1
📒 Files selected for processing (4)
src/lib/local-inference.test.tssrc/lib/local-inference.tssrc/lib/onboard.tstest/onboard-selection.test.ts
✅ Files skipped from review due to trivial changes (1)
- test/onboard-selection.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/lib/local-inference.test.ts
- src/lib/onboard.ts
|
Thanks for this fix — binding local inference to |
…detection Using `localhost` can resolve to IPv6 (::1) on some systems, causing health checks and probe commands to fail. Replace all host-side localhost references with explicit 127.0.0.1 for deterministic IPv4 behavior. Changes: - getLocalProviderValidationBaseUrl: localhost → 127.0.0.1 - getLocalProviderHealthEndpoint: localhost → 127.0.0.1 - validateLocalProvider error messages: localhost → 127.0.0.1 - getOllamaModelOptions curl: localhost → 127.0.0.1 - getOllamaWarmupCommand: localhost → 127.0.0.1 - getOllamaProbeCommand: localhost → 127.0.0.1 - onboard.ts detection curls: localhost → 127.0.0.1 - All test expectations updated to match Based on the original work in #1716 by @chandler-barlow, re-applied on the current TypeScript codebase after the JS→TS migration made the original PR unrebaseable. Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com> Co-Authored-By: Chandler Barlow <cbarlow@nvidia.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Thanks for this fix @chandler-barlow — the The codebase has changed significantly since this was opened (JS→TS migration in #1673, auth proxy in #1922), making a rebase impractical. We've re-applied your change on current main in #1978 with full attribution ( Closing this one in favor of #1978. Appreciate the contribution! |
…detection (#1978) ## Summary Supersedes #1716. Using `localhost` can resolve to IPv6 (`::1`) on some systems, causing local inference health checks, probe commands, and model queries to fail silently. This replaces all host-side `localhost` references with explicit `127.0.0.1` for deterministic IPv4 behavior. Based on the original work in #1716 by @chandler-barlow — the JS→TS migration (#1673) made the original PR unrebaseable, so the change has been re-applied on the current codebase with attribution. ## Changes - `src/lib/local-inference.ts`: validation URLs, health endpoints, error messages, model queries, warmup/probe commands - `src/lib/nim.ts`: NIM health check curls - `src/lib/onboard.ts`: Ollama and vLLM detection curls - `src/lib/local-inference.test.ts`: updated expectations - `src/lib/nim.test.ts`: updated mock matchers - `test/cli.test.ts`: updated status output assertion - `test/onboard-selection.test.ts`: updated mock matchers - `test/e2e/test-gpu-e2e.sh`: host-side Ollama curls ## Test plan - [x] 50 unit tests passing (local-inference + nim) - [x] Zero `http://localhost:11434` or `http://localhost:8000` references remain in src/ test/ scripts/ - [x] Dashboard URLs intentionally unchanged (different scope) Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved reliability of local inference and onboarding checks by standardizing local service addresses to the loopback IP. * **Tests** * Updated unit, integration, and end-to-end test expectations and scripts to match the adjusted loopback addressing and health-check behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Prekshi Vyas <prekshiv@nvidia.com> Co-authored-by: Chandler Barlow <cbarlow@nvidia.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Rationale
*Addressing review and resolved conflicts to close this pr
Using
localhostcan sometimes resolve to IPv6 addresses or behave inconsistently across different environments and network configurations.Changes
Switched to the explicit IPv4 loopback address
127.0.0.1for local inference service detection to improve reliability.Verification Results
npm test.Leading Standards
This PR follows the project's 'First Principles' approach, prioritizing deterministic behavior and zero-trust security defaults.
Summary by CodeRabbit
Bug Fixes
Refactor
Signed-off-by: Chandler Barlow cbarlow@nvidia.com