Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

fix(desktop): surface structured NVIDIA CUDA driver blockers in setup

Dongdong Chen03b26d21b5ef
diff --git a/apps/desktop/AGENTS.md b/apps/desktop/AGENTS.md
index 623426a6..9107a16c 100644
--- a/apps/desktop/AGENTS.md
+++ b/apps/desktop/AGENTS.md
@@ -158,11 +158,16 @@ Gateway and runs Agents. The daemon exits with the app.
In the report, `local-models` is the planned model served by Pi, shown with the model,
GPU, memory and download (the card's memory is the whole stack's, so
"with its services"); otherwise the named runtime, with why there is no
- local model. The page words each reason by its code and the counts it
- carries (`gpuIndex`, `freeBytes`, `requiredBytes`); the tool's message
- goes only to the main process log (`local_server.inspected`), never to
- the page. Under Customize the Local model card stays visible once the
- check ends: disabled, "Not available on this computer", with that reason.
+ local model. The page words each reason by its code and the structured
+ counts or numeric versions it carries (`gpuIndex`, `freeBytes`,
+ `requiredBytes`, `detectedCudaVersion`, `requiredCudaVersion`,
+ `driverVersion`); the tool's message goes only to the main process log
+ (`local_server.inspected`), never to the page. Under Customize the Local
+ model card stays visible once the check ends: disabled, "Not available on
+ this computer", with that reason. For `cuda-driver-update-required` and
+ `cuda-driver-version-unknown`, the page explains the NVIDIA driver
+ requirement and shows Check again (`local.recheck`) so the user can
+ re-check after updating the driver.
Off macOS the page names the system tray, not the menu bar.
Under Customize the local model runs only behind Pi: with another runtime
it is greyed (`aria-disabled`, still focusable), does not toggle, and says
diff --git a/apps/desktop/src/main/local-server.test.ts b/apps/desktop/src/main/local-server.test.ts
index 2a4fce87..c28b49a8 100644
--- a/apps/desktop/src/main/local-server.test.ts
+++ b/apps/desktop/src/main/local-server.test.ts
@@ -145,19 +145,38 @@ if (args.includes("--inspect")) {
}
process.stderr.write("Checked this computer in 1.5s.\n");
const lowMemory = eligible && fs.existsSync(path.join(target, "low-memory"));
- const reasons = eligible
+ const oldDriver = fs.existsSync(path.join(target, "old-driver"));
+ const reasons = oldDriver
+ ? [
+ {
+ code: "cuda-driver-update-required",
+ message: "Driver 535.98 supports CUDA 12.1; requires CUDA >= 12.4.",
+ detectedCudaVersion: "12.1",
+ requiredCudaVersion: "12.4",
+ driverVersion: "535.98",
+ },
+ {
+ code: "cuda-driver-version-unknown",
+ message: "Could not read driver CUDA version.",
+ detectedCudaVersion: "invalid prose",
+ requiredCudaVersion: "12.4",
+ driverVersion: "[N/A]",
+ },
+ ]
+ : eligible
? lowMemory
? [{ code: "free-memory-required", message: "Close other programs before installing.", freeBytes: 2899102924, requiredBytes: 13689304433 }]
: []
: [{ code: "facts-unavailable", message: "nvidia-smi was not found" }];
// With the plan priced on capacity, the installer recommends a runtime.
- const recommendation = eligible && !lowMemory ? "local-models" : "codex";
+ const recommendation = eligible && !lowMemory && !oldDriver ? "local-models" : "codex";
const local = {
- eligible: eligible && !lowMemory,
- state: lowMemory ? "blocked-now" : eligible ? "ready" : "unavailable",
- ...(lowMemory ? { basis: "capacity", memory: { ramAvailableBytes: 2899102924, ramRequiredBytes: 13689304433 } } : {}),
+ eligible: eligible && !lowMemory && !oldDriver,
+ state: oldDriver || lowMemory ? "blocked-now" : eligible ? "ready" : "unavailable",
+ ...(lowMemory && !oldDriver ? { basis: "capacity", memory: { ramAvailableBytes: 2899102924, ramRequiredBytes: 13689304433 } } : {}),
};
- process.stdout.write(JSON.stringify({ hardware, localModels: { ...local, reasons, estimate }, recommendation }) + "\n");
+ const finalEstimate = oldDriver ? { model: "", downloadBytes: null, diskBytes: null, memoryBytes: null } : estimate;
+ process.stdout.write(JSON.stringify({ hardware, localModels: { ...local, reasons, estimate: finalEstimate }, recommendation }) + "\n");
process.exit(0);
}
fs.mkdirSync(path.join(home, "installer"), { recursive: true });
@@ -1713,6 +1732,49 @@ describe("LocalServerModule", () => {
info.mockRestore();
});
+ it("forwards validated CUDA driver versions without leaking tool prose", async () => {
+ const info = vi.spyOn(silentLog, "info");
+ const f = fixture({ checkout: "/src" }, {}, (home) => {
+ mkdirSync(home, { recursive: true });
+ writeFileSync(path.join(home, "old-driver"), "");
+ });
+ await f.host.start();
+ f.module.inspect();
+ await waitForInstaller(() =>
+ expect(f.module.status().localModels).toMatchObject({
+ state: "checked",
+ eligible: false,
+ reasons: [
+ {
+ code: "cuda-driver-update-required",
+ detectedCudaVersion: "12.1",
+ requiredCudaVersion: "12.4",
+ driverVersion: "535.98",
+ },
+ {
+ code: "cuda-driver-version-unknown",
+ requiredCudaVersion: "12.4",
+ },
+ ],
+ recommendation: "codex",
+ }),
+ );
+ const serialized = JSON.stringify(f.module.status());
+ expect(serialized).not.toContain("invalid prose");
+ expect(serialized).not.toContain("Driver 535.98 supports CUDA 12.1");
+ expect(info).toHaveBeenCalledWith(
+ "local_server.inspected",
+ expect.objectContaining({
+ eligible: false,
+ reasons: [
+ "cuda-driver-update-required: Driver 535.98 supports CUDA 12.1; requires CUDA >= 12.4.",
+ "cuda-driver-version-unknown: Could not read driver CUDA version.",
+ ],
+ }),
+ );
+ info.mockRestore();
+ });
+
it("holds a local model that needs free memory until a check finds it", async () => {
const info = vi.spyOn(silentLog, "info");
const f = fixture({ checkout: "/src" }, {}, (home) => {
diff --git a/apps/desktop/src/main/local-server.ts b/apps/desktop/src/main/local-server.ts
index d2472b8d..f431171b 100644
--- a/apps/desktop/src/main/local-server.ts
+++ b/apps/desktop/src/main/local-server.ts
@@ -980,14 +980,27 @@ export class LocalServerModule implements Module {
)
: [];
// The page words each reason by its code and counts, never the tool's.
+ const version = (value: unknown) =>
+ typeof value === "string" && /^\d+(?:\.\d+){0,2}$/.test(value)
+ ? value
+ : null;
const reasons = listed.map((reason): SetupReason => {
const counted = (key: "gpuIndex" | "freeBytes" | "requiredBytes") =>
bytes(reason[key]) !== null ? { [key]: reason[key] as number } : {};
+ const versioned = (
+ key: "detectedCudaVersion" | "requiredCudaVersion" | "driverVersion",
+ ) => {
+ const value = version(reason[key]);
+ return value !== null ? { [key]: value } : {};
+ };
return {
code: reason.code as string,
...counted("gpuIndex"),
...counted("freeBytes"),
...counted("requiredBytes"),
+ ...versioned("detectedCudaVersion"),
+ ...versioned("requiredCudaVersion"),
+ ...versioned("driverVersion"),
};
});
const reasonLog = listed.map(({ code, message }) =>
diff --git a/apps/desktop/src/shared/setup.ts b/apps/desktop/src/shared/setup.ts
index b0cfd6d3..6449bff5 100644
--- a/apps/desktop/src/shared/setup.ts
+++ b/apps/desktop/src/shared/setup.ts
@@ -164,6 +164,10 @@ export interface SetupReason {
// or RAM on free-memory-required.
readonly freeBytes?: number;
readonly requiredBytes?: number;
+ // On cuda-driver-update-required / cuda-driver-version-unknown: numeric versions.
+ readonly detectedCudaVersion?: string;
+ readonly requiredCudaVersion?: string;
+ readonly driverVersion?: string;
}
export type SetupLocalModelsCheck =
diff --git a/apps/desktop/src/shell/setup-page.test.ts b/apps/desktop/src/shell/setup-page.test.ts
index 82f6c179..968f33cb 100644
--- a/apps/desktop/src/shell/setup-page.test.ts
+++ b/apps/desktop/src/shell/setup-page.test.ts
@@ -390,6 +390,51 @@ describe("setup page Quick Install recommendation", () => {
{ ...small, reasons: [reason({ code: "facts-unavailable" })] },
"Linger couldn't read this computer's memory, disk or GPU.",
],
+ [
+ {
+ ...small,
+ reasons: [
+ reason({
+ code: "cuda-driver-update-required",
+ detectedCudaVersion: "12.1",
+ requiredCudaVersion: "12.4",
+ driverVersion: "535.98",
+ }),
+ ],
+ },
+ "Your NVIDIA driver supports CUDA 12.1, but local models require CUDA 12.4 or newer. Update your NVIDIA driver, then choose Check again.",
+ ],
+ [
+ {
+ ...small,
+ reasons: [
+ reason({
+ code: "cuda-driver-update-required",
+ requiredCudaVersion: "12.4",
+ }),
+ ],
+ },
+ "Your NVIDIA driver is too old for local models (requires CUDA 12.4 or newer). Update your NVIDIA driver, then choose Check again.",
+ ],
+ [
+ {
+ ...small,
+ reasons: [
+ reason({
+ code: "cuda-driver-version-unknown",
+ requiredCudaVersion: "12.4",
+ }),
+ ],
+ },
+ "Linger couldn't read the CUDA version from your NVIDIA driver (requires CUDA 12.4 or newer). Update or reinstall your NVIDIA driver, then choose Check again.",
+ ],
+ [
+ {
+ ...small,
+ reasons: [reason({ code: "cuda-driver-version-unknown" })],
+ },
+ "Linger couldn't read the CUDA version from your NVIDIA driver. Update or reinstall your NVIDIA driver, then choose Check again.",
+ ],
[
{ ...small, reasons: [reason({ code: "unsupported-platform" })] },
"Local models don't run on this system.",
@@ -434,6 +479,45 @@ describe("setup page Quick Install recommendation", () => {
expect(document.body.textContent).not.toContain(TOOL_WORDS);
});
+ it("explains an outdated NVIDIA driver and lets the user check again", async () => {
+ const { run } = await openPage(
+ welcome({
+ ...small,
+ reasons: [
+ reason({
+ code: "cuda-driver-update-required",
+ detectedCudaVersion: "12.1",
+ requiredCudaVersion: "12.4",
+ driverVersion: "535.98",
+ }),
+ ],
+ }),
+ "welcome",
+ );
+ expect($("plan-why").textContent).toBe(
+ "Your NVIDIA driver supports CUDA 12.1, but local models require CUDA 12.4 or newer. Update your NVIDIA driver, then choose Check again.",
+ );
+ expect($("local-recheck").hidden).toBe(false);
+ $("local-customize").click();
+ document
+ .querySelector<HTMLButtonElement>(
+ '[data-plan="source"] [data-value="local"]',
+ )!
+ .click();
+ expect($("local-model-name").textContent).toBe(
+ "Not available on this computer",
+ );
+ expect($("local-model-needs").textContent).toBe(
+ "Your NVIDIA driver supports CUDA 12.1, but local models require CUDA 12.4 or newer. Update your NVIDIA driver, then choose Check again.",
+ );
+ expect(($("local-install") as HTMLButtonElement).disabled).toBe(true);
+ $("local-recheck").click();
+ await vi.waitFor(() =>
+ expect(run).toHaveBeenCalledWith({ op: "local.recheck" }),
+ );
+ expect(document.body.textContent).not.toContain(TOOL_WORDS);
+ });
+
it("says the stack's memory covers the model and its services", async () => {
await openPage(welcome(capable), "welcome");
$("local-customize").click();
diff --git a/apps/desktop/src/shell/setup.html b/apps/desktop/src/shell/setup.html
index ff71e8e5..0441ae33 100644
--- a/apps/desktop/src/shell/setup.html
+++ b/apps/desktop/src/shell/setup.html
@@ -3433,6 +3433,31 @@
return "Linger couldn't tell which programs are using the GPU, so it can't share it. Close programs that use the GPU.";
case "facts-unavailable":
return "Linger couldn't read this computer's memory, disk or GPU.";
+ case "cuda-driver-update-required": {
+ const has = reason.detectedCudaVersion;
+ const needs = reason.requiredCudaVersion;
+ if (has && needs)
+ return (
+ "Your NVIDIA driver supports CUDA " +
+ has +
+ ", but local models require CUDA " +
+ needs +
+ " or newer. Update your NVIDIA driver, then choose Check again."
+ );
+ if (needs)
+ return (
+ "Your NVIDIA driver is too old for local models (requires CUDA " +
+ needs +
+ " or newer). Update your NVIDIA driver, then choose Check again."
+ );
+ return "Your NVIDIA driver is too old for local models. Update your NVIDIA driver, then choose Check again.";
+ }
+ case "cuda-driver-version-unknown":
+ return reason.requiredCudaVersion
+ ? "Linger couldn't read the CUDA version from your NVIDIA driver (requires CUDA " +
+ reason.requiredCudaVersion +
+ " or newer). Update or reinstall your NVIDIA driver, then choose Check again."
+ : "Linger couldn't read the CUDA version from your NVIDIA driver. Update or reinstall your NVIDIA driver, then choose Check again.";
case "unsupported-platform":
return "Local models don't run on this system.";
// Blocked now, it names another inference app holding a Mac's
@@ -3455,6 +3480,10 @@
),
),
].join(" ");
+ const RECHECKABLE_REASONS = new Set([
+ "cuda-driver-update-required",
+ "cuda-driver-version-unknown",
+ ]);
// The held card's short line: what is free against what is needed.
const heldLine = (models) => {
const gpu = models.reasons?.find(
@@ -3630,8 +3659,15 @@
// none, disabled.
const settled =
models.state === "checked" || models.state === "unavailable";
+ const canRecheck =
+ held ||
+ (models.state === "checked" &&
+ !models.eligible &&
+ !!models.reasons?.some((reason) =>
+ RECHECKABLE_REASONS.has(reason.code),
+ ));
$("local-model").hidden = !shown && !settled;
- $("local-recheck").hidden = !held || !local.available;
+ $("local-recheck").hidden = !canRecheck || !local.available;
$("local-recheck").disabled = busy;
if (shown) {
$("local-sub").textContent = held
diff --git a/contracts/generated/typescript/src/generated/linger-installer/types.ts b/contracts/generated/typescript/src/generated/linger-installer/types.ts
index 8c231d1f..639e9e98 100644
--- a/contracts/generated/typescript/src/generated/linger-installer/types.ts
+++ b/contracts/generated/typescript/src/generated/linger-installer/types.ts
@@ -700,7 +700,7 @@ export interface components {
localModels: {
eligible: boolean;
/**
- * @description Upstream stack.state. blocked-now means the hardware can run the plan, but installing now would stop until other programs free memory; a tool without stack.state reports that case as basis capacity or reason free-memory-required.
+ * @description Upstream stack.state. blocked-now means the hardware can run the plan, but installing now would stop until a local blocker clears (such as freeing memory or updating the NVIDIA driver); a tool without stack.state reports memory blocks as basis capacity or reason free-memory-required.
* @enum {string}
*/
state: "ready" | "blocked-now" | "unavailable";
@@ -723,6 +723,12 @@ export interface components {
freeBytes?: number;
/** @description The memory the install needs free, for the same resource as freeBytes. */
requiredBytes?: number;
+ /** @description On cuda-driver-update-required, the CUDA version the installed NVIDIA driver reports. */
+ detectedCudaVersion?: string;
+ /** @description On cuda-driver-update-required and cuda-driver-version-unknown, the minimum CUDA version the pinned engine requires. */
+ requiredCudaVersion?: string;
+ /** @description On CUDA driver reasons, the installed NVIDIA driver version when known. */
+ driverVersion?: string;
}[];
/**
* @description Present when the upstream plan fits this computer's hardware only once other programs release the memory they hold now (reason free-memory-required); installing plans again against the memory free then.
diff --git a/contracts/openapi/linger-installer/openapi.yaml b/contracts/openapi/linger-installer/openapi.yaml
index 72d30dd7..c8dd6d45 100644
--- a/contracts/openapi/linger-installer/openapi.yaml
+++ b/contracts/openapi/linger-installer/openapi.yaml
@@ -1306,7 +1306,7 @@ components:
- ready
- blocked-now
- unavailable
- description: Upstream stack.state. blocked-now means the hardware can run the plan, but installing now would stop until other programs free memory; a tool without stack.state reports that case as basis capacity or reason free-memory-required.
+ description: Upstream stack.state. blocked-now means the hardware can run the plan, but installing now would stop until a local blocker clears (such as freeing memory or updating the NVIDIA driver); a tool without stack.state reports memory blocks as basis capacity or reason free-memory-required.
hardwareCapable:
type:
- boolean
@@ -1351,6 +1351,18 @@ components:
requiredBytes:
type: number
description: The memory the install needs free, for the same resource as freeBytes.
+ detectedCudaVersion:
+ type: string
+ pattern: '^\d+(?:\.\d+){0,2}$'
+ description: On cuda-driver-update-required, the CUDA version the installed NVIDIA driver reports.
+ requiredCudaVersion:
+ type: string
+ pattern: '^\d+(?:\.\d+){0,2}$'
+ description: On cuda-driver-update-required and cuda-driver-version-unknown, the minimum CUDA version the pinned engine requires.
+ driverVersion:
+ type: string
+ pattern: '^\d+(?:\.\d+){0,2}$'
+ description: On CUDA driver reasons, the installed NVIDIA driver version when known.
basis:
type: string
enum:
diff --git a/packages/local-installation/src/setup-plan.test.ts b/packages/local-installation/src/setup-plan.test.ts
index 2ad4fe7b..fa476f37 100644
--- a/packages/local-installation/src/setup-plan.test.ts
+++ b/packages/local-installation/src/setup-plan.test.ts
@@ -284,6 +284,56 @@ it("passes on the memory counts each reason carries", async () => {
{ code: "free-memory-required", message: "" },
]);
});
+it("passes on validated CUDA driver versions and drops malformed values", async () => {
+ const value = upstream(false);
+ const report = await inspectSetup({
+ localmodels: runner({
+ ...value,
+ stack: {
+ ...value.stack,
+ available: false,
+ state: "blocked-now",
+ hardwareCapable: true,
+ reasons: [
+ {
+ code: "cuda-driver-update-required",
+ message: "Driver supports CUDA 12.1; requires CUDA >= 12.4.",
+ detectedCudaVersion: "12.1",
+ requiredCudaVersion: "12.4",
+ driverVersion: "535.98",
+ },
+ {
+ code: "cuda-driver-version-unknown",
+ message: "Could not detect driver CUDA version.",
+ detectedCudaVersion: "CUDA 12.1",
+ requiredCudaVersion: "12.4",
+ driverVersion: "[N/A]",
+ },
+ ],
+ },
+ recommendation: "codex",
+ }),
+ });
+ expect(report.localModels).toMatchObject({
+ eligible: false,
+ state: "blocked-now",
+ hardwareCapable: true,
+ reasons: [
+ {
+ code: "cuda-driver-update-required",
+ message: "Driver supports CUDA 12.1; requires CUDA >= 12.4.",
+ detectedCudaVersion: "12.1",
+ requiredCudaVersion: "12.4",
+ driverVersion: "535.98",
+ },
+ {
+ code: "cuda-driver-version-unknown",
+ message: "Could not detect driver CUDA version.",
+ requiredCudaVersion: "12.4",
+ },
+ ],
+ });
+});
it("fails explicitly and redacts tool output when upstream is unavailable or malformed", async () => {
for (const response of [
{ code: 1, stdout: "private token", stderr: "secret" },
diff --git a/packages/local-installation/src/setup-plan.ts b/packages/local-installation/src/setup-plan.ts
index 2cfe3678..713fdb7a 100644
--- a/packages/local-installation/src/setup-plan.ts
+++ b/packages/local-installation/src/setup-plan.ts
@@ -39,6 +39,12 @@ export interface SetupReason {
freeBytes?: number;
/** The memory the install needs free, for the same resource. */
requiredBytes?: number;
+ /** On cuda-driver-update-required: the CUDA version the installed driver supports. */
+ detectedCudaVersion?: string;
+ /** On CUDA driver reasons: the minimum CUDA version the pinned engine needs. */
+ requiredCudaVersion?: string;
+ /** On CUDA driver reasons: the installed NVIDIA driver version when known. */
+ driverVersion?: string;
}
/** Whether local models can install now, as the localmodels tool says. */
export type LocalModelsState = "ready" | "blocked-now" | "unavailable";
@@ -255,6 +261,8 @@ export async function inspectSetup(
: "unavailable";
const ok = (bytes: unknown): bytes is number =>
typeof bytes === "number" && Number.isFinite(bytes) && bytes >= 0;
+ const version = (text: unknown): text is string =>
+ typeof text === "string" && /^\d+(?:\.\d+){0,2}$/.test(text);
const counts = (memory: SetupMemory) => {
if (!ok(memory.ramAvailableBytes) || !ok(memory.ramRequiredBytes))
return undefined;
@@ -308,12 +316,24 @@ export async function inspectSetup(
: {}),
...(memory ? { memory } : {}),
reasons: value.stack.reasons.map(
- ({ code, message, gpuIndex, freeBytes, requiredBytes }) => ({
+ ({
+ code,
+ message,
+ gpuIndex,
+ freeBytes,
+ requiredBytes,
+ detectedCudaVersion,
+ requiredCudaVersion,
+ driverVersion,
+ }) => ({
code,
message,
...(ok(gpuIndex) ? { gpuIndex } : {}),
...(ok(freeBytes) ? { freeBytes } : {}),
...(ok(requiredBytes) ? { requiredBytes } : {}),
+ ...(version(detectedCudaVersion) ? { detectedCudaVersion } : {}),
+ ...(version(requiredCudaVersion) ? { requiredCudaVersion } : {}),
+ ...(version(driverVersion) ? { driverVersion } : {}),
}),
),
...(capacity ? { basis: "capacity" as const } : {}),