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): start a new installation past an attempt left waiting

chendongdongca2a0b1cc667
diff --git a/apps/desktop/src/main/local-server.test.ts b/apps/desktop/src/main/local-server.test.ts
index ddfbf7a2..b657365a 100644
--- a/apps/desktop/src/main/local-server.test.ts
+++ b/apps/desktop/src/main/local-server.test.ts
@@ -162,6 +162,7 @@ const installerApi = (
const updates = [running].flat();
const created: unknown[] = [];
const retried: unknown[] = [];
+ const canceled: string[] = [];
// The runtime the installation set up and its sign-in; tests change them.
const runtime: {
setupChoice: string;
@@ -207,6 +208,10 @@ const installerApi = (
return Response.json(job({ state: "queued" }), { status: 202 });
}
if (url.pathname === "/api/jobs") return Response.json({ items: jobs });
+ if (url.pathname === "/api/jobs/job/cancel" && init.method === "POST") {
+ canceled.push("job");
+ return Response.json(job({ state: "canceled" }), { status: 202 });
+ }
if (url.pathname === "/api/jobs/job/retry" && init.method === "POST") {
retried.push(JSON.parse(String(init.body)));
polls = 0;
@@ -256,7 +261,7 @@ const installerApi = (
}
return new Response(null, { status: 404 });
};
- return { handle, created, retried, runtime };
+ return { handle, created, retried, canceled, runtime };
};
const TEAMHUB = "http://127.0.0.1:4100";
@@ -1561,6 +1566,32 @@ describe("LocalServerModule", () => {
await f.host.stop("quit");
});
+ it("starts again past an attempt that stopped waiting for the person", async () => {
+ const f = fixture(
+ withCheckout,
+ {},
+ checkout,
+ installerApi([
+ {
+ id: "job",
+ instance: LOCAL_INSTANCE,
+ createdAt: "2026-11-03T00:00:00Z",
+ state: "waiting_user",
+ errorCode: "LOCAL_MODELS_UNAVAILABLE",
+ },
+ ]),
+ );
+ await f.host.start();
+ await f.module.begin({ runtime: "local" });
+ // The stopped attempt is closed first, or the installer hands it back.
+ expect(f.api.canceled).toEqual(["job"]);
+ expect(f.api.created).toEqual([
+ { instance: LOCAL_INSTANCE, setupChoice: "local-models" },
+ ]);
+ expect(f.module.status().phase).toBe("ready");
+ await f.host.stop("quit");
+ });
+
it("approves no local model the person did not choose", async () => {
const f = fixture(
withCheckout,
diff --git a/apps/desktop/src/main/local-server.ts b/apps/desktop/src/main/local-server.ts
index f1469212..7d679c24 100644
--- a/apps/desktop/src/main/local-server.ts
+++ b/apps/desktop/src/main/local-server.ts
@@ -2540,6 +2540,14 @@ export class InstallerApi {
)
job = latest;
else {
+ // The installer answers a new request with a job still waiting for
+ // the person, so an attempt that stopped there would be handed back,
+ // failed as it ended, on every later attempt.
+ if (latest?.state === "waiting_user")
+ await this.#json(
+ `/api/jobs/${encodeURIComponent(latest.id)}/cancel`,
+ {},
+ );
const setupChoice =
plan.runtime === "local"
? "local-models"