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.

ci(desktop): gate desktop releases with Windows Pi smoke

shoudi zhengd6ce73058849
diff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.yml
index b1f2bd1b..a0ddd870 100644
--- a/.github/workflows/desktop-release.yml
+++ b/.github/workflows/desktop-release.yml
@@ -165,16 +165,41 @@ jobs:
# The hosted diagnostics receiver this build carries; a secret so
# the address stays masked. Without it Send Diagnostics is hidden.
LINGER_DIAGNOSTICS_UPLOAD_URL: ${{ secrets.LINGER_DIAGNOSTICS_UPLOAD_URL }}
+ - name: Record Windows Setup digest
+ if: matrix.target == 'win32-x64'
+ shell: bash
+ run: |
+ cd "$RELEASE_OUT/assets"
+ sha256sum "Linger-$DESKTOP_VERSION-windows-x64-setup.exe" > windows-setup.sha256
- name: Remove signing files
if: always()
run: rm -rf "$RUNNER_TEMP/signing"
- uses: actions/upload-artifact@v4
+ if: matrix.target != 'win32-x64'
with:
name: desktop-${{ matrix.target }}
path: ${{ env.RELEASE_OUT }}/assets/
if-no-files-found: error
compression-level: 0
retention-days: 14
+ - uses: actions/upload-artifact@v4
+ if: matrix.target == 'win32-x64'
+ with:
+ name: desktop-win32-x64
+ path: |
+ ${{ env.RELEASE_OUT }}/assets/Linger-${{ env.DESKTOP_VERSION }}-windows-x64-setup.exe
+ ${{ env.RELEASE_OUT }}/assets/windows-setup.sha256
+ if-no-files-found: error
+ compression-level: 0
+ retention-days: 14
+ - uses: actions/upload-artifact@v4
+ if: matrix.target == 'win32-x64'
+ with:
+ name: desktop-win32-x64-portable
+ path: ${{ env.RELEASE_OUT }}/assets/Linger-${{ env.DESKTOP_VERSION }}-windows-x64-portable.zip
+ if-no-files-found: error
+ compression-level: 0
+ retention-days: 14
# The installer again on its own, not zipped, so a tester downloads
# only the file they run instead of every package for the platform.
- uses: actions/upload-artifact@v7
@@ -184,8 +209,29 @@ jobs:
if-no-files-found: error
retention-days: 14
- release:
+ windows-smoke:
needs: [prepare, build]
+ runs-on: windows-2022
+ timeout-minutes: 25
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: actions/download-artifact@v4
+ with:
+ name: desktop-win32-x64
+ path: candidate
+ - name: Smoke the packaged Pi runtime with its managed MCP extension
+ shell: powershell
+ env:
+ DESKTOP_VERSION: ${{ needs.prepare.outputs.version }}
+ run: |
+ $setup = "candidate\Linger-$env:DESKTOP_VERSION-windows-x64-setup.exe"
+ $digest = (Get-Content -LiteralPath 'candidate\windows-setup.sha256' -Raw).Split(' ')[0]
+ scripts/ci/windows-desktop-smoke.ps1 -Setup $setup -ExpectedSha256 $digest
+
+ release:
+ needs: [prepare, build, windows-smoke]
if: needs.prepare.outputs.publish == 'true'
runs-on: ubuntu-24.04
permissions:
@@ -197,6 +243,9 @@ jobs:
pattern: desktop-*
path: release
merge-multiple: true
+ - name: Verify the Windows Setup that passed smoke
+ working-directory: release
+ run: sha256sum -c windows-setup.sha256 && rm windows-setup.sha256
# The signed update manifest over every platform's package. Without
# the key the release still goes out, with a warning and no manifest.
- name: Sign the update manifest
diff --git a/docs/desktop-release.md b/docs/desktop-release.md
index 9ad48983..546fa747 100644
--- a/docs/desktop-release.md
+++ b/docs/desktop-release.md
@@ -42,11 +42,23 @@ The workflow runs for `desktop-v*` tags and from Actions → Desktop release →
Run workflow. Its `build` jobs
run on `ubuntu-24.04` (the macOS and Windows runners have no Docker) and keep
the files as workflow artifacts for 14 days: `desktop-<target>`, a zip of
-every file for the platform, and the installer on its own, not zipped (the
-`.dmg`, the `-setup.exe`, the Linux `.tar.gz`), for testers to download
-directly. `release` writes `SHA256SUMS.txt`
-and creates the GitHub Release, or uploads the files again to an existing one.
-A manual run publishes only with `publish` set.
+every file for the platform (with the Windows portable archive split into
+`desktop-win32-x64-portable` so `desktop-win32-x64` carries only the Setup and
+its `windows-setup.sha256` digest), and the installer on its own, not zipped
+(the `.dmg`, the `-setup.exe`, the Linux `.tar.gz`), for testers to download
+directly. `windows-smoke` downloads `desktop-win32-x64`, verifies the Setup
+against `windows-setup.sha256`, and installs those bytes silently under a fresh
+standard user on `windows-2022`. It requests only packaged Pi preparation and
+checks the real Pi RPC handshake (`get_state`, `get_commands`) and the
+registered `mcp` command from the bundled managed MCP extension, with no
+`NODE_PATH` override. It starts no full Linger services, uses no model
+credentials, downloads no model weights, and does not verify the graphical
+installer, model inference, restart persistence, or uninstallation. `release`
+requires `windows-smoke` to pass, downloads `desktop-*`, checks the same
+`windows-setup.sha256` digest before removing that file, writes
+`SHA256SUMS.txt`, and creates the GitHub Release (or uploads the files again to
+an existing one). A manual run publishes only with `publish` set, and a
+`publish=false` run still executes `windows-smoke`.
The release goes to `RELEASE_REPO`, `simplexai-labs/linger` by default:
diff --git a/scripts/ci/windows-desktop-smoke.ps1 b/scripts/ci/windows-desktop-smoke.ps1
new file mode 100644
index 00000000..e491cba7
--- /dev/null
+++ b/scripts/ci/windows-desktop-smoke.ps1
@@ -0,0 +1,80 @@
+param(
+ [Parameter(Mandatory)][string]$Setup,
+ [Parameter(Mandatory)][string]$ExpectedSha256,
+ [string]$WorkerAccount
+)
+
+$ErrorActionPreference = 'Stop'
+$ProgressPreference = 'SilentlyContinue'
+$identity = [Security.Principal.WindowsIdentity]::GetCurrent()
+$isAdmin = [Security.Principal.WindowsPrincipal]::new($identity).IsInRole(
+ [Security.Principal.WindowsBuiltInRole]::Administrator
+)
+
+if ($ExpectedSha256 -notmatch '^[a-fA-F0-9]{64}$' -or
+ (Get-FileHash -LiteralPath $Setup -Algorithm SHA256).Hash -ne $ExpectedSha256) {
+ throw 'Setup SHA-256 does not match the build digest'
+}
+
+if ($WorkerAccount) {
+ if ($isAdmin -or $env:PROCESSOR_ARCHITECTURE -ne 'AMD64') {
+ throw 'The package smoke requires an ordinary Windows x64 user'
+ }
+ if ($identity.Name -ne $WorkerAccount -or
+ !(Test-Path -LiteralPath ("Registry::HKEY_USERS\" + $identity.User.Value)) -or
+ (Get-Item -LiteralPath $env:USERPROFILE).Name -notlike "$($WorkerAccount.Split('\')[-1])*" -or
+ !$env:LOCALAPPDATA.StartsWith("$env:USERPROFILE\", [StringComparison]::OrdinalIgnoreCase)) {
+ throw 'The smoke user does not have its own loaded profile'
+ }
+ $app = Join-Path $env:LOCALAPPDATA 'Programs\Linger'
+ if (Test-Path -LiteralPath $app) { throw 'The smoke profile is not clean' }
+ $setupWatch = [Diagnostics.Stopwatch]::StartNew()
+ $install = Start-Process -FilePath $Setup -ArgumentList '/S' -PassThru
+ if (!$install.WaitForExit(180000)) {
+ Stop-Process -Id $install.Id -Force
+ throw 'Silent Setup timed out'
+ }
+ if ($install.ExitCode -ne 0) { throw "Silent Setup failed: $($install.ExitCode)" }
+ @{ phase = 'setup'; setup_sha256 = $ExpectedSha256; elapsed_ms = $setupWatch.ElapsedMilliseconds } |
+ ConvertTo-Json -Compress
+ $env:ELECTRON_RUN_AS_NODE = '1'
+ $env:LINGER_HOME = Join-Path $env:LOCALAPPDATA 'LingerPackageSmoke'
+ Remove-Item Env:NODE_PATH,Env:NODE_OPTIONS -ErrorAction SilentlyContinue
+ & (Join-Path $app 'Linger.exe') (Join-Path $PSScriptRoot 'windows-pi-smoke.mjs') | Out-Host
+ exit $LASTEXITCODE
+}
+
+if (!$isAdmin) { throw 'Run the orchestrator on a disposable elevated Windows x64 runner' }
+$name = 'LingerSmoke' + [Guid]::NewGuid().ToString('N').Substring(0, 8)
+$scratch = Join-Path $env:ProgramData $name
+$password = ConvertTo-SecureString ('Aa9!' + [Guid]::NewGuid().ToString('N')) -AsPlainText -Force
+$account = New-LocalUser -Name $name -Password $password
+$workerProcess = $null
+try {
+ New-Item -ItemType Directory -Path $scratch | Out-Null
+ & icacls.exe $scratch /inheritance:r /grant:r '*S-1-5-32-544:(OI)(CI)F' '*S-1-5-18:(OI)(CI)F' "*$($account.SID.Value):(OI)(CI)RX" | Out-Null
+ if ($LASTEXITCODE -ne 0) { throw 'Could not isolate the smoke staging directory' }
+ Copy-Item -LiteralPath $PSCommandPath,(Join-Path $PSScriptRoot 'windows-pi-smoke.mjs') -Destination $scratch
+ $candidate = Join-Path $scratch 'Setup.exe'
+ Copy-Item -LiteralPath $Setup -Destination $candidate
+ $stdout = Join-Path $scratch 'stdout.log'
+ $stderr = Join-Path $scratch 'stderr.log'
+ $credentials = [pscredential]::new("$env:COMPUTERNAME\$name", $password)
+ $arguments = "-NoProfile -NonInteractive -ExecutionPolicy Bypass -File `"$scratch\windows-desktop-smoke.ps1`" -WorkerAccount `"$($credentials.UserName)`" -Setup `"$candidate`" -ExpectedSha256 $ExpectedSha256"
+ $workerProcess = Start-Process -FilePath "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe" -Credential $credentials -LoadUserProfile `
+ -WorkingDirectory $scratch -ArgumentList $arguments -RedirectStandardOutput $stdout -RedirectStandardError $stderr -PassThru
+ $null = $workerProcess.Handle
+ # Exceeds the worker's inner deadlines (180s setup + 45s startup + 780s Pi prep + 30s RPC probe)
+ # so inner diagnostics flush before the orchestrator aborts.
+ $finished = $workerProcess.WaitForExit(1140000)
+ Get-Content -LiteralPath $stdout -Tail 30
+ Get-Content -LiteralPath $stderr -Tail 30
+ if (!$finished) { throw 'Windows package smoke timed out' }
+ if ($workerProcess.ExitCode -ne 0) { throw "Windows package smoke failed: $($workerProcess.ExitCode)" }
+} finally {
+ if ($workerProcess -and !$workerProcess.HasExited) {
+ & taskkill.exe /PID $workerProcess.Id /T /F | Out-Null
+ }
+ Remove-LocalUser -SID $account.SID
+ if (Test-Path -LiteralPath $scratch) { Remove-Item -LiteralPath $scratch -Recurse -Force }
+}
diff --git a/scripts/ci/windows-pi-smoke.mjs b/scripts/ci/windows-pi-smoke.mjs
new file mode 100644
index 00000000..8d459981
--- /dev/null
+++ b/scripts/ci/windows-pi-smoke.mjs
@@ -0,0 +1,303 @@
+import { spawn, spawnSync } from "node:child_process";
+import { access, mkdir, readFile, readdir, writeFile } from "node:fs/promises";
+import { dirname, isAbsolute, join } from "node:path";
+import { createInterface } from "node:readline";
+import { setTimeout as delay } from "node:timers/promises";
+import { pathToFileURL } from "node:url";
+
+export function probePi(executable, args, options, timeoutMs = 30_000) {
+ return new Promise((resolve, reject) => {
+ const child = spawn(executable, args, { ...options, windowsHide: true });
+ const output = createInterface({ input: child.stdout });
+ const pending = new Set(["get_state", "get_commands"]);
+ let stderr = "";
+ let finished = false;
+ const timer = setTimeout(() => finish("RPC deadline exceeded"), timeoutMs);
+ function finish(reason) {
+ if (finished) return;
+ finished = true;
+ clearTimeout(timer);
+ output.close();
+ child.kill();
+ if (reason) {
+ const diagnostic = stderr.trim().slice(-1500).replaceAll("\x1b", "");
+ reject(
+ new Error(
+ `Pi smoke: ${reason}${diagnostic ? `\n${diagnostic}` : ""}`,
+ ),
+ );
+ } else {
+ resolve();
+ }
+ }
+ child.stderr.setEncoding("utf8").on("data", (chunk) => {
+ stderr = (stderr + chunk).slice(-1500);
+ });
+ child.on("error", (error) =>
+ finish(`process error: ${error.code ?? error.name}`),
+ );
+ child.on("close", (code) =>
+ finish(`process closed before handshake (exit ${code})`),
+ );
+ child.stdin.on("error", (error) => {
+ if (error.code !== "EPIPE") finish("RPC stdin failed");
+ });
+ output.on("line", (line) => {
+ let reply;
+ try {
+ reply = JSON.parse(line);
+ } catch {
+ return;
+ }
+ if (reply?.type === "extension_error")
+ return finish("extension initialization failed");
+ if (reply?.type !== "response" || !pending.has(reply.id)) return;
+ if (reply.command !== reply.id || reply.success !== true)
+ return finish("RPC command failed");
+ if (
+ reply.id === "get_commands" &&
+ !reply.data?.commands?.some(
+ (command) => command.name === "mcp" && command.source === "extension",
+ )
+ )
+ return finish("the managed MCP command was not registered");
+ pending.delete(reply.id);
+ if (!pending.size) finish();
+ });
+ for (const type of pending)
+ child.stdin.write(`${JSON.stringify({ id: type, type })}\n`);
+ });
+}
+
+async function main() {
+ const home = process.env.LINGER_HOME;
+ if (
+ process.platform !== "win32" ||
+ process.arch !== "x64" ||
+ !home ||
+ !isAbsolute(home)
+ )
+ throw new Error(
+ "Expected a Windows x64 package and an absolute smoke home",
+ );
+ const resources = join(dirname(process.execPath), "resources");
+ const node = join(resources, "runtime", "bin", "node.exe");
+ const installer = join(resources, "app", "dist", "installer", "installer.js");
+ const extension = join(
+ resources,
+ "cli",
+ "computer-tools",
+ "extensions",
+ "pi-mcp.mjs",
+ );
+ await access(node);
+ await access(installer);
+ await access(extension);
+ await mkdir(home);
+ const source = join(home, "unused-source");
+ await mkdir(source);
+ const managerEnv = { ...process.env };
+ delete managerEnv.ELECTRON_RUN_AS_NODE;
+ delete managerEnv.NODE_PATH;
+ delete managerEnv.NODE_OPTIONS;
+ const started = performance.now();
+ const manager = spawn(
+ node,
+ [
+ installer,
+ "--home",
+ home,
+ "--source-repo",
+ source,
+ "--instance",
+ "desktop",
+ "--external-computer",
+ "--no-open",
+ "--port",
+ "0",
+ ],
+ { cwd: home, env: managerEnv, windowsHide: true, stdio: "ignore" },
+ );
+ let managerError;
+ manager.on("error", (error) => {
+ managerError = error.code ?? error.name;
+ });
+ function checkManager() {
+ if (managerError || manager.exitCode !== null)
+ throw new Error(
+ `Packaged installer exited (${managerError ?? manager.exitCode})`,
+ );
+ }
+ try {
+ const launcher = join(home, "installer", "launch.html");
+ const startup = AbortSignal.timeout(45_000);
+ let session;
+ while (!session) {
+ checkManager();
+ const html = await readFile(launcher, "utf8").catch((error) => {
+ if (error.code !== "ENOENT") throw error;
+ return "";
+ });
+ session =
+ /href="(http:\/\/127\.0\.0\.1:\d{1,5})\/#token=([A-Za-z0-9_-]{43})"/.exec(
+ html,
+ );
+ if (!session) await delay(500, undefined, { signal: startup });
+ }
+ const [, origin, token] = session;
+ let cookie;
+ async function request(route, signal, body) {
+ checkManager();
+ const response = await fetch(origin + route, {
+ ...(body && { method: "POST", body: JSON.stringify(body) }),
+ headers: {
+ origin,
+ "content-type": "application/json",
+ ...(cookie && { cookie }),
+ },
+ signal: AbortSignal.any([signal, AbortSignal.timeout(10_000)]),
+ redirect: "error",
+ });
+ if (!response.ok)
+ throw new Error(
+ `Installer API returned ${response.status} at ${route}`,
+ );
+ if (route === "/api/session")
+ cookie = response.headers.getSetCookie()[0]?.split(";")[0];
+ return response.json();
+ }
+ await request("/api/session", startup, { token });
+ if (!cookie)
+ throw new Error("The packaged installer did not establish a session");
+ const preparation = AbortSignal.timeout(780_000);
+ let job = await request("/api/jobs", preparation, {
+ instance: "desktop",
+ preparation: "pi",
+ });
+ if (!/^[a-f0-9-]{36}$/.test(job.id))
+ throw new Error("Installer returned an invalid job ID");
+ const jobRoute = `/api/jobs/${job.id}`;
+ let lastStatus = "";
+ const logProgress = (current) => {
+ const key = `${current.state}:${current.stage ?? ""}:${current.message ?? ""}`;
+ if (key === lastStatus) return;
+ lastStatus = key;
+ console.log(
+ JSON.stringify({
+ phase: "pi_preparation_progress",
+ job_id: current.id,
+ state: current.state,
+ ...(current.stage ? { stage: current.stage } : {}),
+ ...(current.message ? { message: current.message } : {}),
+ elapsed_ms: Math.round(performance.now() - started),
+ }),
+ );
+ };
+ logProgress(job);
+ try {
+ while (job.state === "queued" || job.state === "running") {
+ await delay(1000, undefined, { signal: preparation });
+ job = await request(jobRoute, preparation);
+ logProgress(job);
+ }
+ } catch (error) {
+ if (preparation.aborted) {
+ console.log(
+ JSON.stringify({
+ phase: "pi_preparation_timeout",
+ job_id: job.id,
+ state: job.state,
+ ...(job.stage ? { stage: job.stage } : {}),
+ ...(job.message ? { message: job.message } : {}),
+ elapsed_ms: Math.round(performance.now() - started),
+ }),
+ );
+ }
+ throw error;
+ }
+ console.log(
+ JSON.stringify({
+ phase: "pi_preparation",
+ job_id: job.id,
+ state: job.state,
+ code: job.errorCode,
+ ...(job.message ? { message: job.message } : {}),
+ elapsed_ms: Math.round(performance.now() - started),
+ }),
+ );
+ if (job.state !== "succeeded")
+ throw new Error("Packaged Pi preparation did not succeed");
+
+ const root = join(home, "runtime", "harness", "tools", "pi");
+ const candidates = [];
+ for (const entry of await readdir(root, { withFileTypes: true })) {
+ if (!entry.isDirectory()) continue;
+ const candidate = join(root, entry.name, "pi.exe");
+ if (
+ await access(candidate).then(
+ () => true,
+ () => false,
+ )
+ )
+ candidates.push(candidate);
+ }
+ if (candidates.length !== 1)
+ throw new Error("Expected exactly one freshly installed Pi executable");
+ const config = join(home, "mcp.json");
+ await writeFile(config, '{"mcpServers":{}}', { flag: "wx", mode: 0o600 });
+ const env = {
+ ...process.env,
+ PI_CODING_AGENT_DIR: join(home, "pi-profile"),
+ LINGER_PI_MANAGED_MCP_CONFIG: config,
+ };
+ delete env.ELECTRON_RUN_AS_NODE;
+ delete env.NODE_PATH;
+ delete env.NODE_OPTIONS;
+ const probeStart = performance.now();
+ // Resource flags match PiRPCResourceArgs in
+ // apps/computer/local-daemon/internal/provider/native/pi_catalog.go.
+ await probePi(
+ candidates[0],
+ [
+ "--mode",
+ "rpc",
+ "--no-session",
+ "--no-extensions",
+ "--no-mcp",
+ "--no-skills",
+ "--no-prompt-templates",
+ "--no-context-files",
+ "--no-approve",
+ "--system-prompt",
+ "",
+ "--extension",
+ extension,
+ ],
+ { cwd: home, env },
+ );
+ console.log(
+ JSON.stringify({
+ phase: "pi_mcp_rpc",
+ result: "passed",
+ elapsed_ms: Math.round(performance.now() - probeStart),
+ }),
+ );
+ } finally {
+ if (manager.pid && manager.exitCode === null)
+ spawnSync("taskkill.exe", ["/PID", String(manager.pid), "/T", "/F"], {
+ stdio: "ignore",
+ timeout: 5000,
+ windowsHide: true,
+ });
+ }
+}
+
+if (
+ process.argv[1] &&
+ import.meta.url === pathToFileURL(process.argv[1]).href
+) {
+ main().catch((error) => {
+ console.error(error.message);
+ process.exitCode = 1;
+ });
+}
diff --git a/scripts/ci/windows-pi-smoke.test.ts b/scripts/ci/windows-pi-smoke.test.ts
new file mode 100644
index 00000000..b2577cc3
--- /dev/null
+++ b/scripts/ci/windows-pi-smoke.test.ts
@@ -0,0 +1,74 @@
+import { mkdtemp, rm } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { afterEach, expect, it } from "vitest";
+import { probePi } from "./windows-pi-smoke.mjs";
+
+const tempDirs: string[] = [];
+
+async function privateCwd() {
+ const dir = await mkdtemp(join(tmpdir(), "linger-windows-pi-smoke-"));
+ tempDirs.push(dir);
+ return dir;
+}
+
+afterEach(async () => {
+ await Promise.all(
+ tempDirs.splice(0).map((dir) => rm(dir, { recursive: true, force: true })),
+ );
+});
+
+function fixture(commands: unknown[]) {
+ return `
+ const readline = require("node:readline");
+ const lines = readline.createInterface({ input: process.stdin });
+ lines.on("line", (line) => {
+ const { id, type } = JSON.parse(line);
+ console.log(JSON.stringify({
+ id, type: "response", command: type, success: true,
+ data: type === "get_commands" ? { commands: ${JSON.stringify(commands)} } : {},
+ }));
+ });
+ `;
+}
+
+it("passes only after the state reply and MCP extension registration", async () => {
+ const cwd = await privateCwd();
+ const script = fixture([{ name: "mcp", source: "extension" }]);
+ await expect(
+ probePi(process.execPath, ["-e", script], { cwd }),
+ ).resolves.toBeUndefined();
+});
+
+it("rejects state success when the packaged extension did not load", async () => {
+ const cwd = await privateCwd();
+ const script = fixture([{ name: "mcp", source: "prompt" }]);
+ await expect(
+ probePi(process.execPath, ["-e", script], { cwd }),
+ ).rejects.toThrow("the managed MCP command was not registered");
+});
+
+it("retains bounded startup diagnostics on real subprocess exit", async () => {
+ const cwd = await privateCwd();
+ await expect(
+ probePi(
+ process.execPath,
+ ["-e", 'console.error("Cannot find module jiti"); process.exitCode = 1'],
+ { cwd },
+ ),
+ ).rejects.toThrow(
+ /process closed before handshake \(exit 1\)\nCannot find module jiti/,
+ );
+});
+
+it("kills a silent probe at its deadline", async () => {
+ const cwd = await privateCwd();
+ await expect(
+ probePi(
+ process.execPath,
+ ["-e", "setInterval(() => {}, 1000)"],
+ { cwd },
+ 200,
+ ),
+ ).rejects.toThrow("RPC deadline exceeded");
+});