diff --git a/src/lib/local-inference.test.ts b/src/lib/local-inference.test.ts index f01c2b10322..76a916d00a1 100644 --- a/src/lib/local-inference.test.ts +++ b/src/lib/local-inference.test.ts @@ -48,25 +48,25 @@ describe("local inference helpers", () => { }); it("returns the expected validation URL for vllm-local", () => { - expect(getLocalProviderValidationBaseUrl("vllm-local")).toBe("http://localhost:8000/v1"); + expect(getLocalProviderValidationBaseUrl("vllm-local")).toBe("http://127.0.0.1:8000/v1"); }); it("returns the expected health check command for ollama-local", () => { expect(getLocalProviderHealthEndpoint("ollama-local")).toBe( - "http://localhost:11434/api/tags", + "http://127.0.0.1:11434/api/tags", ); expect(getLocalProviderLabel("ollama-local")).toBe("Local Ollama"); expect(getLocalProviderHealthCheck("ollama-local")).toEqual( - ["curl", "-sf", "http://localhost:11434/api/tags"], + ["curl", "-sf", "http://127.0.0.1:11434/api/tags"], ); }); it("returns the expected validation and health check commands for vllm-local", () => { - expect(getLocalProviderValidationBaseUrl("ollama-local")).toBe("http://localhost:11434/v1"); - expect(getLocalProviderHealthEndpoint("vllm-local")).toBe("http://localhost:8000/v1/models"); + expect(getLocalProviderValidationBaseUrl("ollama-local")).toBe("http://127.0.0.1:11434/v1"); + expect(getLocalProviderHealthEndpoint("vllm-local")).toBe("http://127.0.0.1:8000/v1/models"); expect(getLocalProviderLabel("vllm-local")).toBe("Local vLLM"); expect(getLocalProviderHealthCheck("vllm-local")).toEqual( - ["curl", "-sf", "http://localhost:8000/v1/models"], + ["curl", "-sf", "http://127.0.0.1:8000/v1/models"], ); expect(getLocalProviderContainerReachabilityCheck("vllm-local")).toEqual([ "docker", "run", "--rm", @@ -99,7 +99,7 @@ describe("local inference helpers", () => { it("returns a clear error when ollama-local is unavailable", () => { const result = validateLocalProvider("ollama-local", () => ""); expect(result.ok).toBe(false); - expect(result.message).toMatch(/http:\/\/localhost:11434/); + expect(result.message).toMatch(/http:\/\/127.0.0.1:11434/); }); it("returns a clear error when ollama-local is not reachable from containers", () => { @@ -117,7 +117,7 @@ describe("local inference helpers", () => { it("returns a clear error when vllm-local is unavailable", () => { const result = validateLocalProvider("vllm-local", () => ""); expect(result.ok).toBe(false); - expect(result.message).toMatch(/http:\/\/localhost:8000/); + expect(result.message).toMatch(/http:\/\/127.0.0.1:8000/); }); it("probes local provider health successfully", () => { @@ -135,8 +135,8 @@ describe("local inference helpers", () => { expect(result).toEqual({ ok: true, providerLabel: "Local Ollama", - endpoint: "http://localhost:11434/api/tags", - detail: "Local Ollama is reachable on http://localhost:11434/api/tags.", + endpoint: "http://127.0.0.1:11434/api/tags", + detail: "Local Ollama is reachable on http://127.0.0.1:11434/api/tags.", }); }); @@ -155,7 +155,7 @@ describe("local inference helpers", () => { expect(result?.ok).toBe(false); expect(result?.detail).toContain("Local Ollama is selected for inference"); expect(result?.detail).toContain("Start Ollama and retry"); - expect(result?.detail).toContain("http://localhost:11434/api/tags"); + expect(result?.detail).toContain("http://127.0.0.1:11434/api/tags"); }); it("returns null when provider health probing is not supported", () => { @@ -267,7 +267,7 @@ describe("local inference helpers", () => { it("builds a background warmup command for ollama models", () => { const command = getOllamaWarmupCommand("nemotron-3-nano:30b"); expect(command).toEqual(expect.arrayContaining(["bash", "-c"])); - expect(command[2]).toMatch(/^nohup curl -s http:\/\/localhost:11434\/api\/generate /); + expect(command[2]).toMatch(/^nohup curl -s http:\/\/127.0.0.1:11434\/api\/generate /); expect(command[2]).toMatch(/"model":"nemotron-3-nano:30b"/); expect(command[2]).toMatch(/"keep_alive":"15m"/); }); @@ -288,7 +288,7 @@ describe("local inference helpers", () => { expect(command).toContain("-sS"); expect(command).toContain("--max-time"); expect(command).toContain("120"); - expect(command).toContain("http://localhost:11434/api/generate"); + expect(command).toContain("http://127.0.0.1:11434/api/generate"); const payload = command[command.length - 1]; expect(payload).toMatch(/"model":"nemotron-3-nano:30b"/); }); diff --git a/src/lib/local-inference.ts b/src/lib/local-inference.ts index 9c0a4b2c9bd..98f03310595 100644 --- a/src/lib/local-inference.ts +++ b/src/lib/local-inference.ts @@ -63,9 +63,9 @@ export function getLocalProviderBaseUrl(provider: string): string | null { export function getLocalProviderValidationBaseUrl(provider: string): string | null { switch (provider) { case "vllm-local": - return `http://localhost:${VLLM_PORT}/v1`; + return `http://127.0.0.1:${VLLM_PORT}/v1`; case "ollama-local": - return `http://localhost:${OLLAMA_PORT}/v1`; + return `http://127.0.0.1:${OLLAMA_PORT}/v1`; default: return null; } @@ -74,9 +74,9 @@ export function getLocalProviderValidationBaseUrl(provider: string): string | nu export function getLocalProviderHealthEndpoint(provider: string): string | null { switch (provider) { case "vllm-local": - return `http://localhost:${VLLM_PORT}/v1/models`; + return `http://127.0.0.1:${VLLM_PORT}/v1/models`; case "ollama-local": - return `http://localhost:${OLLAMA_PORT}/api/tags`; + return `http://127.0.0.1:${OLLAMA_PORT}/api/tags`; default: return null; } @@ -192,13 +192,13 @@ export function validateLocalProvider( case "vllm-local": return { ok: false, - message: `Local vLLM was selected, but nothing is responding on http://localhost:${VLLM_PORT}.`, + message: `Local vLLM was selected, but nothing is responding on http://127.0.0.1:${VLLM_PORT}.`, }; case "ollama-local": return { ok: false, message: - `Local Ollama was selected, but nothing is responding on http://localhost:${OLLAMA_PORT}.`, + `Local Ollama was selected, but nothing is responding on http://127.0.0.1:${OLLAMA_PORT}.`, }; default: return { ok: false, message: "The selected local inference provider is unavailable." }; @@ -220,13 +220,13 @@ export function validateLocalProvider( return { ok: false, message: - `Local vLLM is responding on localhost, but containers cannot reach http://host.openshell.internal:${VLLM_PORT}. Ensure the server is reachable from containers, not only from the host shell.`, + `Local vLLM is responding on 127.0.0.1, but containers cannot reach http://host.openshell.internal:${VLLM_PORT}. Ensure the server is reachable from containers, not only from the host shell.`, }; case "ollama-local": return { ok: false, message: - `Local Ollama is responding on localhost, but containers cannot reach the auth proxy at http://host.openshell.internal:${OLLAMA_CONTAINER_PORT}. Ensure the Ollama auth proxy is running.`, + `Local Ollama is responding on 127.0.0.1, but containers cannot reach the auth proxy at http://host.openshell.internal:${OLLAMA_CONTAINER_PORT}. Ensure the Ollama auth proxy is running.`, }; default: return { @@ -259,7 +259,7 @@ export function parseOllamaTags(output: unknown): string[] { export function getOllamaModelOptions(runCaptureImpl?: RunCaptureFn): string[] { const capture = runCaptureImpl ?? runCapture; - const tagsOutput = capture(["curl", "-sf", `http://localhost:${OLLAMA_PORT}/api/tags`], { + const tagsOutput = capture(["curl", "-sf", `http://127.0.0.1:${OLLAMA_PORT}/api/tags`], { ignoreError: true, }); const tagsParsed = parseOllamaTags(tagsOutput); @@ -304,7 +304,7 @@ export function getOllamaWarmupCommand(model: string, keepAlive = "15m"): string // names is not feasible. This is the one intentional bash -c exception. return [ "bash", "-c", - `nohup curl -s http://localhost:${OLLAMA_PORT}/api/generate -H 'Content-Type: application/json' -d ${shellQuote(payload)} >/dev/null 2>&1 &`, + `nohup curl -s http://127.0.0.1:${OLLAMA_PORT}/api/generate -H 'Content-Type: application/json' -d ${shellQuote(payload)} >/dev/null 2>&1 &`, ]; } @@ -322,7 +322,7 @@ export function getOllamaProbeCommand( return [ "curl", "-sS", "--max-time", String(timeoutSeconds), - `http://localhost:${OLLAMA_PORT}/api/generate`, + `http://127.0.0.1:${OLLAMA_PORT}/api/generate`, "-H", "Content-Type: application/json", "-d", payload, ]; diff --git a/src/lib/nim.test.ts b/src/lib/nim.test.ts index 85edca72308..fa251765334 100644 --- a/src/lib/nim.test.ts +++ b/src/lib/nim.test.ts @@ -186,7 +186,7 @@ describe("nim", () => { const runCapture = vi.fn((cmd: string | string[]) => { if (!Array.isArray(cmd)) throw new Error("expected argv array"); if (cmd[0] === "docker" && cmd.includes("inspect")) return "running"; - if (cmd[0] === "curl" && hasArg(cmd, "http://localhost:9000/v1/models")) return '{"data":[]}'; + if (cmd[0] === "curl" && hasArg(cmd, "http://127.0.0.1:9000/v1/models")) return '{"data":[]}'; return ""; }); const { nimModule, restore } = loadNimWithMockedRunner(runCapture); @@ -202,7 +202,7 @@ describe("nim", () => { state: "running", }); expect(commands.some((c) => c[0] === "docker" && c.includes("port"))).toBe(false); - expect(commands.some((c) => c.includes("http://localhost:9000/v1/models"))).toBe( + expect(commands.some((c) => c.includes("http://127.0.0.1:9000/v1/models"))).toBe( true, ); } finally { @@ -216,7 +216,7 @@ describe("nim", () => { if (!Array.isArray(cmd)) throw new Error("expected argv array"); if (cmd[0] === "docker" && cmd.includes("inspect")) return "running"; if (cmd[0] === "docker" && cmd.includes("port")) return mapping; - if (cmd[0] === "curl" && hasArg(cmd, "http://localhost:9000/v1/models")) return '{"data":[]}'; + if (cmd[0] === "curl" && hasArg(cmd, "http://127.0.0.1:9000/v1/models")) return '{"data":[]}'; return ""; }); const { nimModule, restore } = loadNimWithMockedRunner(runCapture); @@ -238,7 +238,7 @@ describe("nim", () => { if (!Array.isArray(cmd)) throw new Error("expected argv array"); if (cmd[0] === "docker" && cmd.includes("inspect")) return "running"; if (cmd[0] === "docker" && cmd.includes("port")) return ""; - if (cmd[0] === "curl" && hasArg(cmd, "http://localhost:8000/v1/models")) return '{"data":[]}'; + if (cmd[0] === "curl" && hasArg(cmd, "http://127.0.0.1:8000/v1/models")) return '{"data":[]}'; return ""; }); const { nimModule, restore } = loadNimWithMockedRunner(runCapture); diff --git a/src/lib/nim.ts b/src/lib/nim.ts index 03f17f4ba24..d30db81fa42 100644 --- a/src/lib/nim.ts +++ b/src/lib/nim.ts @@ -220,7 +220,7 @@ export function waitForNimHealth(port = VLLM_PORT, timeout = 300): boolean { while ((Date.now() - start) / 1000 < timeout) { try { - const result = runCapture(["curl", "-sf", `http://localhost:${hostPort}/v1/models`], { + const result = runCapture(["curl", "-sf", `http://127.0.0.1:${hostPort}/v1/models`], { ignoreError: true, }); if (result) { @@ -272,7 +272,7 @@ export function nimStatusByName(name: string, port?: number): NimStatus { resolvedHostPort = m ? Number(m[1]) : VLLM_PORT; } const health = runCapture( - ["curl", "-sf", `http://localhost:${resolvedHostPort}/v1/models`], + ["curl", "-sf", `http://127.0.0.1:${resolvedHostPort}/v1/models`], { ignoreError: true }, ); healthy = !!health; diff --git a/src/lib/onboard.ts b/src/lib/onboard.ts index 885d5dbf400..8f61f93b242 100644 --- a/src/lib/onboard.ts +++ b/src/lib/onboard.ts @@ -3243,12 +3243,12 @@ async function setupNim(gpu) { // Detect local inference options const hasOllama = !!runCapture("command -v ollama", { ignoreError: true }); const ollamaRunning = !!runCapture( - `curl -sf http://localhost:${OLLAMA_PORT}/api/tags 2>/dev/null`, + `curl -sf http://127.0.0.1:${OLLAMA_PORT}/api/tags 2>/dev/null`, { ignoreError: true, }, ); - const vllmRunning = !!runCapture(`curl -sf http://localhost:${VLLM_PORT}/v1/models 2>/dev/null`, { + const vllmRunning = !!runCapture(`curl -sf http://127.0.0.1:${VLLM_PORT}/v1/models 2>/dev/null`, { ignoreError: true, }); const requestedProvider = isNonInteractive() ? getNonInteractiveProvider() : null; @@ -3821,7 +3821,7 @@ async function setupNim(gpu) { endpointUrl = getLocalProviderBaseUrl(provider); // Query vLLM for the actual model ID const vllmModelsRaw = runCapture( - `curl -sf http://localhost:${VLLM_PORT}/v1/models 2>/dev/null`, + `curl -sf http://127.0.0.1:${VLLM_PORT}/v1/models 2>/dev/null`, { ignoreError: true, }, diff --git a/test/cli.test.ts b/test/cli.test.ts index c15ab40117f..e3151a37b21 100644 --- a/test/cli.test.ts +++ b/test/cli.test.ts @@ -1674,7 +1674,7 @@ describe("CLI dispatch", () => { expect(r.out).toContain("Inference:"); expect(r.out).toContain("unreachable"); expect(r.out).toContain("Start Ollama and retry"); - expect(r.out).toContain("http://localhost:11434/api/tags"); + expect(r.out).toContain("http://127.0.0.1:11434/api/tags"); }); it("does not treat a different connected gateway as a healthy nemoclaw gateway", () => { diff --git a/test/e2e/test-gpu-e2e.sh b/test/e2e/test-gpu-e2e.sh index 0d48026fd6a..6794dba836c 100755 --- a/test/e2e/test-gpu-e2e.sh +++ b/test/e2e/test-gpu-e2e.sh @@ -161,7 +161,7 @@ if [ "${NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE:-}" != "1" ]; then fi # Verify port 11434 is free (onboard needs to start Ollama on 127.0.0.1:11434) -if curl -sf http://localhost:11434/api/tags >/dev/null 2>&1; then +if curl -sf http://127.0.0.1:11434/api/tags >/dev/null 2>&1; then info "WARNING: Something is already listening on port 11434." info "Onboard may not be able to start Ollama." info "On ephemeral runners this should not happen." @@ -189,7 +189,7 @@ fi # If the Ollama installer started a system service, stop it so onboard # can start Ollama with OLLAMA_HOST=0.0.0.0:11434 (required for containers). # This needs the ollama process to be owned by our user, or systemctl access. -if curl -sf http://localhost:11434/api/tags >/dev/null 2>&1; then +if curl -sf http://127.0.0.1:11434/api/tags >/dev/null 2>&1; then info "Ollama service is running — attempting to stop for clean onboard..." # Try systemctl first (works if user has permissions) systemctl --user stop ollama 2>/dev/null || true @@ -198,7 +198,7 @@ if curl -sf http://localhost:11434/api/tags >/dev/null 2>&1; then pkill -f "ollama serve" 2>/dev/null || true sleep 2 - if curl -sf http://localhost:11434/api/tags >/dev/null 2>&1; then + if curl -sf http://127.0.0.1:11434/api/tags >/dev/null 2>&1; then info "Could not stop existing Ollama — onboard will use it as-is" else pass "Existing Ollama stopped — port 11434 is free for onboard" @@ -288,8 +288,8 @@ else fi # 4d: Ollama is running and reachable -if curl -sf http://localhost:11434/api/tags >/dev/null 2>&1; then - pass "Ollama running on localhost:11434 (started by onboard)" +if curl -sf http://127.0.0.1:11434/api/tags >/dev/null 2>&1; then + pass "Ollama running on 127.0.0.1:11434 (started by onboard)" else fail "Ollama not running — onboard should have started it" fi @@ -415,7 +415,7 @@ section "Phase 5: Local inference through sandbox" CONFIGURED_MODEL="${NEMOCLAW_MODEL:-}" if [ -n "$CONFIGURED_MODEL" ]; then # Verify the expected model is actually available in Ollama - if curl -sf http://localhost:11434/api/tags 2>/dev/null \ + if curl -sf http://127.0.0.1:11434/api/tags 2>/dev/null \ | python3 -c "import json,sys; m=[x['name'] for x in json.load(sys.stdin).get('models',[])]; sys.exit(0 if '$CONFIGURED_MODEL' in m or any('$CONFIGURED_MODEL' in x for x in m) else 1)" 2>/dev/null; then info "Using NEMOCLAW_MODEL: $CONFIGURED_MODEL (confirmed in Ollama)" else @@ -424,7 +424,7 @@ if [ -n "$CONFIGURED_MODEL" ]; then fi fi if [ -z "$CONFIGURED_MODEL" ]; then - CONFIGURED_MODEL=$(curl -sf http://localhost:11434/api/tags 2>/dev/null \ + CONFIGURED_MODEL=$(curl -sf http://127.0.0.1:11434/api/tags 2>/dev/null \ | python3 -c "import json,sys; m=json.load(sys.stdin).get('models',[]); print(m[0]['name'] if m else '')" 2>/dev/null || echo "") if [ -n "$CONFIGURED_MODEL" ]; then info "Auto-detected Ollama model: $CONFIGURED_MODEL" @@ -434,9 +434,9 @@ if [ -z "$CONFIGURED_MODEL" ]; then fi # 5a: Direct Ollama inference (host-side, OpenAI-compatible) -info "[LOCAL] Direct Ollama test → localhost:11434/v1/chat/completions..." +info "[LOCAL] Direct Ollama test → 127.0.0.1:11434/v1/chat/completions..." direct_response=$(curl -s --max-time 120 \ - -X POST http://localhost:11434/v1/chat/completions \ + -X POST http://127.0.0.1:11434/v1/chat/completions \ -H "Content-Type: application/json" \ -d "{ \"model\": \"$CONFIGURED_MODEL\", @@ -550,7 +550,7 @@ echo " What this tested (real user flow):" echo " - GPU detection (nvidia-smi)" echo " - Ollama binary install" echo " - install.sh --non-interactive with NEMOCLAW_PROVIDER=ollama" -echo " - Onboard: starts Ollama on localhost, starts auth proxy, pulls model, creates sandbox" +echo " - Onboard: starts Ollama on 127.0.0.1, starts auth proxy, pulls model, creates sandbox" echo " - Auth proxy: token persistence, auth reject/accept, container reachability, recovery" echo " - Local inference: direct + sandbox → gateway → auth proxy → Ollama on GPU" echo " - Destroy + uninstall --delete-models" diff --git a/test/onboard-selection.test.ts b/test/onboard-selection.test.ts index f80e29e4be3..3a647e4c091 100644 --- a/test/onboard-selection.test.ts +++ b/test/onboard-selection.test.ts @@ -136,9 +136,9 @@ runner.runCapture = (command) => { // Once onboard.ts is migrated to argv (#1889), these mocks can assert Array.isArray. const cmd = Array.isArray(command) ? command.join(" ") : command; if (cmd.includes("command -v ollama")) return "/usr/bin/ollama"; - if (cmd.includes("localhost:11434/api/tags")) return JSON.stringify({ models: [{ name: "nemotron-3-nano:30b" }] }); + if (cmd.includes("127.0.0.1:11434/api/tags")) return JSON.stringify({ models: [{ name: "nemotron-3-nano:30b" }] }); if (cmd.includes("ollama list")) return "nemotron-3-nano:30b abc 24 GB now\\nqwen3:32b def 20 GB now"; - if (cmd.includes("localhost:8000/v1/models")) return ""; + if (cmd.includes("127.0.0.1:8000/v1/models")) return ""; return ""; }; registry.updateSandbox = (_name, update) => updates.push(update); @@ -312,8 +312,8 @@ runner.runCapture = (command) => { // Once onboard.ts is migrated to argv (#1889), these mocks can assert Array.isArray. const cmd = Array.isArray(command) ? command.join(" ") : command; if (cmd.includes("command -v ollama")) return ""; - if (cmd.includes("localhost:11434/api/tags")) return ""; - if (cmd.includes("localhost:8000/v1/models")) return ""; + if (cmd.includes("127.0.0.1:11434/api/tags")) return ""; + if (cmd.includes("127.0.0.1:8000/v1/models")) return ""; return ""; }; @@ -408,8 +408,8 @@ runner.runCapture = (command) => { // Once onboard.ts is migrated to argv (#1889), these mocks can assert Array.isArray. const cmd = Array.isArray(command) ? command.join(" ") : command; if (cmd.includes("command -v ollama")) return ""; - if (cmd.includes("localhost:11434/api/tags")) return ""; - if (cmd.includes("localhost:8000/v1/models")) return ""; + if (cmd.includes("127.0.0.1:11434/api/tags")) return ""; + if (cmd.includes("127.0.0.1:8000/v1/models")) return ""; return ""; }; @@ -550,7 +550,7 @@ const { setupNim } = require(${onboardPath}); assert.ok(payload.lines.some((line) => line.includes("Chat Completions API available"))); }); - it("warms and validates Ollama via localhost before moving on", () => { + it("warms and validates Ollama via 127.0.0.1 before moving on", () => { const repoRoot = path.join(import.meta.dirname, ".."); const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "nemoclaw-onboard-ollama-validation-")); const fakeBin = path.join(tmpDir, "bin"); @@ -600,9 +600,9 @@ runner.runCapture = (command) => { // Once onboard.ts is migrated to argv (#1889), these mocks can assert Array.isArray. const cmd = Array.isArray(command) ? command.join(" ") : command; if (cmd.includes("command -v ollama")) return "/usr/bin/ollama"; - if (cmd.includes("localhost:11434/api/tags")) return JSON.stringify({ models: [{ name: "nemotron-3-nano:30b" }] }); + if (cmd.includes("127.0.0.1:11434/api/tags")) return JSON.stringify({ models: [{ name: "nemotron-3-nano:30b" }] }); if (cmd.includes("ollama list")) return "nemotron-3-nano:30b abc 24 GB now"; - if (cmd.includes("localhost:8000/v1/models")) return ""; + if (cmd.includes("127.0.0.1:8000/v1/models")) return ""; if (cmd.includes("api/generate")) return '{"response":"hello"}'; return ""; }; @@ -647,7 +647,7 @@ const { setupNim } = require(${onboardPath}); payload.lines.some((line) => line.includes("Loading Ollama model: nemotron-3-nano:30b")), ); assert.ok( - payload.commands.some((command) => command.includes("http://localhost:11434/api/generate")), + payload.commands.some((command) => command.includes("http://127.0.0.1:11434/api/generate")), ); }); @@ -697,9 +697,9 @@ runner.runCapture = (command) => { // Once onboard.ts is migrated to argv (#1889), these mocks can assert Array.isArray. const cmd = Array.isArray(command) ? command.join(" ") : command; if (cmd.includes("command -v ollama")) return "/usr/bin/ollama"; - if (cmd.includes("localhost:11434/api/tags")) return JSON.stringify({ models: [{ name: "nemotron-3-nano:30b" }] }); + if (cmd.includes("127.0.0.1:11434/api/tags")) return JSON.stringify({ models: [{ name: "nemotron-3-nano:30b" }] }); if (cmd.includes("ollama list")) return "nemotron-3-nano:30b abc 24 GB now"; - if (cmd.includes("localhost:8000/v1/models")) return ""; + if (cmd.includes("127.0.0.1:8000/v1/models")) return ""; if (cmd.includes("api/generate")) return '{"response":"hello"}'; return ""; }; @@ -800,9 +800,9 @@ runner.runCapture = (command) => { // Once onboard.ts is migrated to argv (#1889), these mocks can assert Array.isArray. const cmd = Array.isArray(command) ? command.join(" ") : command; if (cmd.includes("command -v ollama")) return "/usr/bin/ollama"; - if (cmd.includes("localhost:11434/api/tags")) return JSON.stringify({ models: [] }); + if (cmd.includes("127.0.0.1:11434/api/tags")) return JSON.stringify({ models: [] }); if (cmd.includes("ollama list")) return ""; - if (cmd.includes("localhost:8000/v1/models")) return ""; + if (cmd.includes("127.0.0.1:8000/v1/models")) return ""; if (cmd.includes("api/generate")) return '{"response":"hello"}'; return ""; }; @@ -910,9 +910,9 @@ runner.runCapture = (command) => { // Once onboard.ts is migrated to argv (#1889), these mocks can assert Array.isArray. const cmd = Array.isArray(command) ? command.join(" ") : command; if (cmd.includes("command -v ollama")) return "/usr/bin/ollama"; - if (cmd.includes("localhost:11434/api/tags")) return JSON.stringify({ models: [] }); + if (cmd.includes("127.0.0.1:11434/api/tags")) return JSON.stringify({ models: [] }); if (cmd.includes("ollama list")) return ""; - if (cmd.includes("localhost:8000/v1/models")) return ""; + if (cmd.includes("127.0.0.1:8000/v1/models")) return ""; if (cmd.includes("api/generate")) return '{"response":"hello"}'; return ""; }; @@ -2750,8 +2750,8 @@ runner.runCapture = (command) => { // Once onboard.ts is migrated to argv (#1889), these mocks can assert Array.isArray. const cmd = Array.isArray(command) ? command.join(" ") : command; if (cmd.includes("command -v ollama")) return ""; - if (cmd.includes("localhost:11434")) return ""; - if (cmd.includes("localhost:8000/v1/models")) return JSON.stringify({ data: [{ id: "meta-llama/Llama-3.3-70B-Instruct" }] }); + if (cmd.includes("127.0.0.1:11434")) return ""; + if (cmd.includes("127.0.0.1:8000/v1/models")) return JSON.stringify({ data: [{ id: "meta-llama/Llama-3.3-70B-Instruct" }] }); return ""; }; @@ -2862,8 +2862,8 @@ runner.runCapture = (command) => { // Once onboard.ts is migrated to argv (#1889), these mocks can assert Array.isArray. const cmd = Array.isArray(command) ? command.join(" ") : command; if (cmd.includes("command -v ollama")) return ""; - if (cmd.includes("localhost:11434")) return ""; - if (cmd.includes("localhost:8000/v1/models")) return ""; + if (cmd.includes("127.0.0.1:11434")) return ""; + if (cmd.includes("127.0.0.1:8000/v1/models")) return ""; return ""; };