From a49f0fc29038379c36c8910022209ebe5a822f59 Mon Sep 17 00:00:00 2001 From: Glenn-Agent Date: Sat, 5 Sep 2026 09:35:04 +0530 Subject: [PATCH 1/3] fix: add Ollama timeout recovery hint Signed-off-by: Glenn-Agent --- src/lib/inference/local.test.ts | 21 +++++++++++++++++++++ src/lib/inference/local.ts | 9 +++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/lib/inference/local.test.ts b/src/lib/inference/local.test.ts index 79f0b392e8c..b574dcd6a7d 100644 --- a/src/lib/inference/local.test.ts +++ b/src/lib/inference/local.test.ts @@ -635,10 +635,31 @@ 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).not.toContain("sudo systemctl restart ollama"); expect(result?.detail).toContain("http://127.0.0.1:11434/api/tags"); expect(result?.probeLabel).toBe("ollama backend"); }); + it("suggests restarting Ollama when the local backend probe times out (#10674)", () => { + const result = probeLocalProviderHealth("ollama-local", { + runCurlProbeImpl: () => ({ + ok: false, + httpStatus: 0, + curlStatus: 28, + body: "", + stderr: "Operation timed out", + message: "curl failed (exit 28): Operation timed out", + }), + loadOllamaProxyTokenImpl: () => null, + }); + + expect(result?.ok).toBe(false); + expect(result?.detail).toContain("stale runner processes from a previous model"); + expect(result?.detail).toContain("holding GPU memory"); + expect(result?.detail).toContain("sudo systemctl restart ollama"); + expect(result?.probeLabel).toBe("ollama backend"); + }); + // #3265 — auth-proxy subprobe scenarios. Status was previously a single // probe to :11434 that ignored the auth proxy at :11435 entirely, so a // broken proxy hid behind a "healthy" backend. diff --git a/src/lib/inference/local.ts b/src/lib/inference/local.ts index 6ab4945efdb..7a962ba1932 100644 --- a/src/lib/inference/local.ts +++ b/src/lib/inference/local.ts @@ -1029,11 +1029,16 @@ function buildLocalProviderProbeDetail( const label = getLocalProviderLabel(provider) || "Local inference provider"; if (result.httpStatus === 0) { switch (provider) { - case "ollama-local": + case "ollama-local": { + const timeoutRecovery = + result.curlStatus === 28 + ? " If Ollama is running but the probe times out, stale runner processes from a previous model may be holding GPU memory; run 'sudo systemctl restart ollama' and retry." + : ""; return ( `${label} is selected for inference, but the host probe to ${endpoint} failed. ` + - `Start Ollama and retry. (${result.message})` + `Start Ollama and retry.${timeoutRecovery} (${result.message})` ); + } case "vllm-local": return ( `${label} is selected for inference, but the host probe to ${endpoint} failed. ` + From 1c6c8089afe9925c6524255ecd2d500fea45f839 Mon Sep 17 00:00:00 2001 From: Glenn-Agent Date: Sun, 6 Sep 2026 09:36:48 +0530 Subject: [PATCH 2/3] test: keep Ollama recovery coverage within budget --- src/lib/inference/local.test.ts | 36 ++++++--------------------------- 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/src/lib/inference/local.test.ts b/src/lib/inference/local.test.ts index b574dcd6a7d..8966ea8f881 100644 --- a/src/lib/inference/local.test.ts +++ b/src/lib/inference/local.test.ts @@ -619,44 +619,20 @@ describe("local inference helpers", () => { expect(result?.ok).toBe(expected); }); - it("reports a clear local provider outage when the host probe cannot connect", () => { + it.each([ + { curlStatus: 7, message: "Failed to connect", recoveryHint: false }, + { curlStatus: 28, message: "Operation timed out", recoveryHint: true }, + ])("reports local Ollama outage details for curl exit $curlStatus", ({ curlStatus, message, recoveryHint }) => { const result = probeLocalProviderHealth("ollama-local", { - runCurlProbeImpl: () => ({ - ok: false, - httpStatus: 0, - curlStatus: 7, - body: "", - stderr: "Failed to connect", - message: "curl failed (exit 7): Failed to connect", - }), + runCurlProbeImpl: () => ({ ok: false, httpStatus: 0, curlStatus, body: "", stderr: message, message }), loadOllamaProxyTokenImpl: () => null, }); 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).not.toContain("sudo systemctl restart ollama"); expect(result?.detail).toContain("http://127.0.0.1:11434/api/tags"); - expect(result?.probeLabel).toBe("ollama backend"); - }); - - it("suggests restarting Ollama when the local backend probe times out (#10674)", () => { - const result = probeLocalProviderHealth("ollama-local", { - runCurlProbeImpl: () => ({ - ok: false, - httpStatus: 0, - curlStatus: 28, - body: "", - stderr: "Operation timed out", - message: "curl failed (exit 28): Operation timed out", - }), - loadOllamaProxyTokenImpl: () => null, - }); - - expect(result?.ok).toBe(false); - expect(result?.detail).toContain("stale runner processes from a previous model"); - expect(result?.detail).toContain("holding GPU memory"); - expect(result?.detail).toContain("sudo systemctl restart ollama"); + expect(result?.detail.includes("sudo systemctl restart ollama")).toBe(recoveryHint); expect(result?.probeLabel).toBe("ollama backend"); }); From b9c1b3b42e6ee1ccac7dac415568b58227f6aa22 Mon Sep 17 00:00:00 2001 From: Glenn-Agent Date: Mon, 7 Sep 2026 09:32:53 +0530 Subject: [PATCH 3/3] test: assert Ollama non-timeout detail boundary --- src/lib/inference/local.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/inference/local.test.ts b/src/lib/inference/local.test.ts index 8966ea8f881..9037f8518b2 100644 --- a/src/lib/inference/local.test.ts +++ b/src/lib/inference/local.test.ts @@ -633,6 +633,8 @@ describe("local inference helpers", () => { expect(result?.detail).toContain("Start Ollama and retry"); expect(result?.detail).toContain("http://127.0.0.1:11434/api/tags"); expect(result?.detail.includes("sudo systemctl restart ollama")).toBe(recoveryHint); + expect(result?.detail.includes("stale runner processes from a previous model")).toBe(recoveryHint); + expect(result?.detail.includes("holding GPU memory")).toBe(recoveryHint); expect(result?.probeLabel).toBe("ollama backend"); });