From f7ac58f26754d32cba11b46eab5773ab664c06f1 Mon Sep 17 00:00:00 2001 From: Luke Parker <10430890+Hona@users.noreply.github.com> Date: Tue, 13 Oct 2026 10:39:52 +1000 Subject: [PATCH] fix(desktop): stage the bundled CLI per architecture (#54979) --- packages/desktop/src/main/service/cli-stages.ts | 4 ++-- packages/desktop/src/main/service/desktop-cli.ts | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/desktop/src/main/service/cli-stages.ts b/packages/desktop/src/main/service/cli-stages.ts index 32315559b28..379c688d119 100644 --- a/packages/desktop/src/main/service/cli-stages.ts +++ b/packages/desktop/src/main/service/cli-stages.ts @@ -1,7 +1,7 @@ import { Effect, FileSystem, Path } from "effect" -// Each version stages its own copy of the CLI, and only the current one is ever started again: a -// downgrade stages its copy anew. Windows refuses to delete an executable that has not exited yet, +// Each version and architecture stages its own copy of the CLI, and only the current one is ever started +// again: a downgrade stages its copy anew. Windows refuses to delete an executable that has not exited yet, // so a failed removal is logged and retried on the next launch. export const cleanStages = Effect.fn("DesktopCli.cleanStages")(function* (binary: string) { const fs = yield* FileSystem.FileSystem diff --git a/packages/desktop/src/main/service/desktop-cli.ts b/packages/desktop/src/main/service/desktop-cli.ts index 0c8144bb84f..d7397e90b5b 100644 --- a/packages/desktop/src/main/service/desktop-cli.ts +++ b/packages/desktop/src/main/service/desktop-cli.ts @@ -139,7 +139,9 @@ const ExecFailure = Schema.Struct({ stdout: Schema.optional(Schema.String), stde const installCli = Effect.fn("DesktopCli.install")(function* (source: string, version: string) { const fs = yield* FileSystem.FileSystem const path = yield* Path.Path - const directory = path.join(app.getPath("userData"), "cli", version.replace(/[^a-zA-Z0-9._-]/g, "-")) + // x64 and ARM64 installers share userData on Windows ARM64, so a same-version switch must not reuse the other copy. + const stage = `${version}-${process.arch}`.replace(/[^a-zA-Z0-9._-]/g, "-") + const directory = path.join(app.getPath("userData"), "cli", stage) const destination = path.join(directory, executableName()) if (existsSync(destination)) {