# Files changed · PR \#22222 · pingdotgg/t3code

[View on GitCafe](https://git.cafe/pingdotgg/t3code/pull/22222/diffs)

Repository: [pingdotgg/t3code](https://git.cafe/pingdotgg/t3code)

Visibility: public

[revert: fourteen unverified desktop fixes from the takeover campaign](https://git.cafe/pingdotgg/t3code/pull/22222.md)

Version: 3

Head commit: 4c3db70e5652994bbf72b23acc92e99fa2924e9c

Base commit: 41b513d99aac6ba4d4a4000a3a3a1320b0f79dad

Comparison base: 41b513d99aac6ba4d4a4000a3a3a1320b0f79dad

Showing up to 20 entries from this revision. If the pull request changes, reopen the first page before continuing.

## apps/desktop/src/app/DesktopApp.ts

Status: modified; +4; −3

```diff
@@ -153,8 +153,7 @@
     const instances = yield* pool.list;
     yield* Effect.forEach(
       instances,
-      // Exceeds the backend's 30s graceful termination and output drain budget.
-      (instance) => instance.stop({ timeout: Duration.seconds(45) }),
+      (instance) => instance.stop({ timeout: Duration.seconds(5) }),
       { concurrency: "unbounded" },
     );
   },
@@ -240,7 +239,9 @@
   }
 
   if (!(yield* Ref.get(state.quitting))) {
+    if (settings.wslOnly === true && settings.wslBackendEnabled === true) {
+      yield* desktopWindow.showConnectingSplash;
+    }
-    yield* desktopWindow.showConnectingSplash;
     yield* primaryBackend.start;
     yield* logBootstrapInfo("bootstrap backend start requested");
     yield* appActivation.start.pipe(
```

## apps/desktop/src/app/DesktopClerk.test.ts

Status: modified; +2; −68

```diff
@@ -1,7 +1,6 @@
 // @effect-diagnostics nodeBuiltinImport:off globalFetchInEffect:off - Hosted handoff test uses a real localhost listener without an OpenAI account.
 import * as NodeHttp from "node:http";
-import * as NodePath from "node:path";
+import * as NodePath from "@effect/platform-node/NodePath";
-import * as PlatformNodePath from "@effect/platform-node/NodePath";
 import { codexAuthHandoffUrl, readCodexAuthDelivery } from "@t3tools/shared/codexAuthHandoff";
 import { EnvironmentId, ProviderInstanceId } from "@t3tools/contracts";
 import * as HostProcess from "@t3tools/shared/HostProcess";
@@ -60,15 +59,11 @@
     copyText: () => Effect.void,
   },
   listeners = new Map<string, (...args: unknown[]) => void>(),
-  isPackaged = false,
 ) => {
   const environment = DesktopEnvironment.DesktopEnvironment.of({
     stateDir: "/tmp/t3-state",
     isDevelopment,
     appDataDirectory: "/tmp/app-data",
-    isPackaged,
-    dirname: platform === "win32" ? String.raw`C:\T3 Code\dist-electron` : "/tmp/dist-electron",
-    path: platform === "win32" ? NodePath.win32 : NodePath.posix,
     platform,
   } as unknown as DesktopEnvironment.DesktopEnvironment["Service"]);
 
@@ -100,7 +95,7 @@
   return DesktopClerk.layer.pipe(
     Layer.provide(
       Layer.mergeAll(
-        PlatformNodePath.layerPosix,
+        NodePath.layerPosix,
         Layer.succeed(DesktopEnvironment.DesktopEnvironment, environment),
         Layer.succeed(ElectronApp.ElectronApp, electronApp),
         Layer.succeed(ElectronShell.ElectronShell, shell),
@@ -116,68 +111,7 @@
     requestSingleInstanceLockMock.mockReset().mockReturnValue(true);
     storageMock.mockReset();
   });
-
-  it.effect.each([
-    { platform: "win32", isPackaged: false, isDevelopment: false, registers: true },
-    { platform: "win32", isPackaged: false, isDevelopment: true, registers: false },
-    { platform: "win32", isPackaged: true, isDevelopment: false, registers: false },
-    { platform: "darwin", isPackaged: false, isDevelopment: false, registers: false },
-    { platform: "linux", isPackaged: false, isDevelopment: false, registers: false },
-  ] as const)(
-    "registers an entry point only for unpackaged non-development Windows ($platform, packaged=$isPackaged, development=$isDevelopment)",
-    ({ platform, isPackaged, isDevelopment, registers }) => {
-      const events: string[] = [];
-      storageMock.mockReturnValue(storageAdapter);
-      createClerkBridgeMock.mockImplementation(() => {
-        events.push("bridge");
-        return { cleanup: vi.fn() };
-      });
-      const setAsDefaultProtocolClient = vi.fn(() =>
-        Effect.sync(() => {
-          events.push("register");
-          return true;
-        }),
-      );
-      const electronApp = {
-        on: () => Effect.void,
-        setAsDefaultProtocolClient,
-      } as unknown as ElectronApp.ElectronApp["Service"];
 
-      return Effect.gen(function* () {
-        const clerk = yield* DesktopClerk.DesktopClerk;
-        yield* clerk.configure;
-
-        assert.deepEqual(
-          setAsDefaultProtocolClient.mock.calls,
-          registers
-            ? [["t3code", process.execPath, [String.raw`C:\T3 Code\dist-electron\main.cjs`]]]
-            : [],
-        );
-        assert.deepEqual(events, registers ? ["bridge", "register"] : ["bridge"]);
-      }).pipe(
-        Effect.scoped,
-        Effect.provide(
-          layerDesktopClerk(
-            isDevelopment,
-            [],
-            platform,
-            undefined,
-            undefined,
-            undefined,
-            isPackaged,
-          ),
-        ),
-        Effect.provideService(ElectronApp.ElectronApp, electronApp),
-        Effect.provideService(
-          ElectronWindow.ElectronWindow,
-          {} as ElectronWindow.ElectronWindow["Service"],
-        ),
-        Effect.provideService(DesktopWebLinks.DesktopWebLinks, ignoreWebLinks),
-        Effect.provideService(HostProcess.Arguments, ["electron"]),
-      );
-    },
-  );
-
   it.effect("acquires and releases the SDK bridge with the layer", () => {
     const cleanup = vi.fn();
     const events: string[] = [];
```

## apps/desktop/src/app/DesktopClerk.ts

Status: modified; +0; −14

```diff
@@ -151,20 +151,6 @@
       const context = yield* Effect.context<ElectronWindow.ElectronWindow>();
       const runPromise = Effect.runPromiseWith(context);
 
-      // Clerk's bare scheme registration omits the app entry on unpackaged Windows.
-      // Development callbacks also need dev server environment this command cannot restore.
-      if (
-        !environment.isPackaged &&
-        !environment.isDevelopment &&
-        environment.platform === "win32"
-      ) {
-        yield* electronApp.setAsDefaultProtocolClient(
-          ElectronProtocol.getDesktopScheme(environment.isDevelopment),
-          process.execPath,
-          [environment.path.join(environment.dirname, "main.cjs")],
-        );
-      }
-
       const startProviderAuthHandoff = (value: string | undefined) => {
         if (!value) return false;
         const request = readCodexAuthHandoff(value, environment.isDevelopment);
```

## apps/desktop/src/app/DesktopLifecycle.test.ts

Status: modified; +9; −110

```diff
@@ -1,13 +1,6 @@
-// @effect-diagnostics-next-line nodeBuiltinImport:off - A real Node process verifies OS signal ownership outside Effect's process runtime.
-import * as NodeChildProcess from "node:child_process";
-import * as NodeReadline from "node:readline";
-import * as NodeURL from "node:url";
-
 import { assert, describe, it } from "@effect/vitest";
-import * as HostProcess from "@t3tools/shared/HostProcess";
 import * as Deferred from "effect/Deferred";
 import * as Effect from "effect/Effect";
-import * as Fiber from "effect/Fiber";
 import * as Layer from "effect/Layer";
 import * as Ref from "effect/Ref";
 
@@ -110,67 +103,6 @@
 }
 
 describe("DesktopLifecycle", () => {
-  it.skipIf(HostProcess.Platform.defaultValue() === "win32")(
-    "leaves SIGTERM to the lifecycle until its graceful shutdown completes",
-    async ({ onTestFinished }) => {
-      const runner = new URL("./DesktopRuntime.ts", import.meta.url).href;
-      const child = NodeChildProcess.spawn(
-        process.execPath,
-        [
-          "--experimental-strip-types",
-          "--input-type=module",
-          "-e",
-          `
-      import * as Effect from 'effect/Effect';
-      import * as Deferred from 'effect/Deferred';
-      import { runMain } from ${JSON.stringify(runner)};
-      process.stdin.resume();
-      let released = false;
-      runMain(Effect.scoped(Effect.gen(function* () {
-        const done = yield* Deferred.make();
-        yield* Effect.addFinalizer(() => Effect.sync(() => console.log(released ? 'CLEANED' : 'PREMATURE')));
-        process.once('SIGTERM', () => {
-          console.log('STOPPING');
-          process.stdin.once('data', () => {
-            released = true;
-            void Effect.runPromise(Deferred.succeed(done, undefined)).then(() => process.stdin.destroy());
-          });
-        });
-        console.log('READY');
-        yield* Deferred.await(done);
-      })));
-    `,
-        ],
-        {
-          cwd: NodeURL.fileURLToPath(new URL("../../", import.meta.url)),
-          stdio: ["pipe", "pipe", "pipe"],
-        },
-      );
-      const exited = new Promise<readonly [number | null, string | null]>((resolve, reject) => {
-        child.once("exit", (code, signal) => resolve([code, signal]));
-        child.once("error", reject);
-      });
-      const lines: string[] = [];
-      let stderr = "";
-      child.stderr.on("data", (chunk) => {
-        stderr += chunk;
-      });
-      onTestFinished(async () => {
-        if (child.exitCode === null && child.signalCode === null) {
-          child.kill("SIGKILL");
-          await exited;
-        }
-      });
-      for await (const line of NodeReadline.createInterface({ input: child.stdout })) {
-        lines.push(line);
-        if (line === "READY") child.kill("SIGTERM");
-        if (line === "STOPPING") child.stdin.write("finish");
-      }
-      assert.deepEqual(await exited, [0, null], stderr);
-      assert.deepEqual(lines, ["READY", "STOPPING", "CLEANED"]);
-    },
-  );
-
   it.effect.each(["darwin", "win32", "linux"] satisfies ReadonlyArray<NodeJS.Platform>)(
     "lets the updater's quit event proceed on %s",
     (platform) => {
@@ -226,18 +158,12 @@
     },
   );
 
-  it.effect("destroys windows and retains signal ownership until backend shutdown completes", () =>
+  it.effect("destroys windows before waiting for backend shutdown", () =>
     Effect.gen(function* () {
       const appListeners = new Map<string, (...args: readonly unknown[]) => void>();
       const shutdownRequested = yield* Deferred.make<void>();
       const allowShutdown = yield* Deferred.make<void>();
       const quitRequested = yield* Deferred.make<void>();
-      const backendStopping = yield* Deferred.make<void>();
-      const finishBackendShutdown = yield* Deferred.make<void>();
-      const originalSignals = {
-        SIGINT: process.listeners("SIGINT"),
-        SIGTERM: process.listeners("SIGTERM"),
-      };
       const events: string[] = [];
 
       const quit = Effect.sync(() => {
@@ -278,47 +204,20 @@
       yield* Effect.scoped(
         Effect.gen(function* () {
           const lifecycle = yield* DesktopLifecycle.DesktopLifecycle;
-          const shutdown = yield* DesktopShutdown.DesktopShutdown;
-          const program = yield* Effect.scoped(
-            Effect.gen(function* () {
-              yield* Effect.addFinalizer(() =>
-                Deferred.succeed(backendStopping, undefined).pipe(
-                  Effect.andThen(Deferred.await(finishBackendShutdown)),
+          yield* lifecycle.register;
-                  Effect.andThen(shutdown.markComplete),
-                ),
-              );
-              yield* lifecycle.register;
-              const event = { preventDefault: () => undefined } as Electron.Event;
-              appListeners.get("before-quit")?.(event);
-              yield* shutdown.awaitRequest;
-            }),
-          ).pipe(Effect.forkScoped);
 
-          yield* Deferred.await(backendStopping);
-          yield* Effect.addFinalizer(() =>
-            Deferred.succeed(finishBackendShutdown, undefined).pipe(Effect.asVoid),
-          );
+          const event = { preventDefault: () => undefined } as Electron.Event;
+          appListeners.get("before-quit")?.(event);
 
+          yield* Deferred.await(shutdownRequested);
+          const eventsBeforeCleanup = [...events];
+          yield* Deferred.succeed(allowShutdown, undefined);
+          yield* Deferred.await(quitRequested);
-          for (const signal of ["SIGINT", "SIGTERM"] as const) {
-            const listeners = process
-              .listeners(signal)
-              .filter((listener) => !originalSignals[signal].includes(listener));
-            assert.lengthOf(listeners, 1, `${signal} must remain owned during backend cleanup`);
-            listeners[0]?.(signal);
-          }
-          assert.deepEqual(events, ["flush", "destroy", "request"]);
-          assert.equal(appListeners.size, 0, "Electron listeners still follow the program scope");
-          assert.isFalse(yield* shutdown.isComplete);
 
-          yield* Deferred.succeed(finishBackendShutdown, undefined);
-          yield* Fiber.join(program);
-          yield* Deferred.await(quitRequested);
+          assert.deepEqual(eventsBeforeCleanup, ["flush", "destroy", "request"]);
           assert.deepEqual(events, ["flush", "destroy", "request", "quit"]);
         }),
       ).pipe(Effect.provide(layer));
-
-      assert.deepEqual(process.listeners("SIGINT"), originalSignals.SIGINT);
-      assert.deepEqual(process.listeners("SIGTERM"), originalSignals.SIGTERM);
     }),
   );
 
```

## apps/desktop/src/app/DesktopLifecycle.ts

Status: modified; +99; −104

```diff
@@ -160,113 +160,108 @@
 }
 
 /** @public Service construction is part of the canonical Effect module API. */
-export const make = Effect.gen(function* () {
-  const signalScope = yield* Scope.Scope;
-  return DesktopLifecycle.of({
-    relaunch: Effect.fn("desktop.lifecycle.relaunch")(function* (reason) {
-      const electronApp = yield* ElectronApp.ElectronApp;
-      const environment = yield* DesktopEnvironment.DesktopEnvironment;
-      const state = yield* DesktopState.DesktopState;
-      yield* logLifecycleInfo("desktop relaunch requested", { reason });
-      yield* Effect.gen(function* () {
-        yield* Effect.yieldNow;
-        yield* Ref.set(state.quitting, true);
-        yield* requestDesktopShutdownAndWait();
-        if (environment.isDevelopment) {
+export const make = DesktopLifecycle.of({
+  relaunch: Effect.fn("desktop.lifecycle.relaunch")(function* (reason) {
+    const electronApp = yield* ElectronApp.ElectronApp;
+    const environment = yield* DesktopEnvironment.DesktopEnvironment;
+    const state = yield* DesktopState.DesktopState;
+    yield* logLifecycleInfo("desktop relaunch requested", { reason });
+    yield* Effect.gen(function* () {
-          yield* electronApp.exit(75);
-          return;
-        }
-        yield* electronApp.relaunch({
-          execPath: process.execPath,
-          args: process.argv.slice(1),
-        });
-        yield* electronApp.exit(0);
-      }).pipe(
-        Effect.catchCause((cause) => {
-          const error = new DesktopLifecycleRelaunchError({ reason, cause });
-          return logLifecycleError(error.message, { error });
-        }),
-        Effect.forkDetach,
-        Effect.asVoid,
-      );
-    }),
-    register: Effect.gen(function* () {
-      const desktopWindow = yield* DesktopWindow.DesktopWindow;
-      const electronWindow = yield* ElectronWindow.ElectronWindow;
-      const electronApp = yield* ElectronApp.ElectronApp;
-      const electronTheme = yield* ElectronTheme.ElectronTheme;
-      const environment = yield* DesktopEnvironment.DesktopEnvironment;
-      const context = yield* Effect.context<DesktopLifecycleRegistrationServices>();
-      const runEffect = Effect.runPromiseWith(context);
-      let quitAllowed = false;
-      let updaterQuitAllowed = false;
-      yield* electronTheme.onUpdated(() => {
-        void runEffect(
-          desktopWindow.syncAppearance.pipe(Effect.withSpan("desktop.lifecycle.themeUpdated")),
-        );
+      yield* Effect.yieldNow;
+      yield* Ref.set(state.quitting, true);
+      yield* requestDesktopShutdownAndWait();
+      if (environment.isDevelopment) {
+        yield* electronApp.exit(75);
+        return;
+      }
+      yield* electronApp.relaunch({
+        execPath: process.execPath,
+        args: process.argv.slice(1),
       });
+      yield* electronApp.exit(0);
+    }).pipe(
+      Effect.catchCause((cause) => {
+        const error = new DesktopLifecycleRelaunchError({ reason, cause });
+        return logLifecycleError(error.message, { error });
+      }),
+      Effect.forkDetach,
+      Effect.asVoid,
+    );
+  }),
+  register: Effect.gen(function* () {
+    const desktopWindow = yield* DesktopWindow.DesktopWindow;
+    const electronWindow = yield* ElectronWindow.ElectronWindow;
+    const electronApp = yield* ElectronApp.ElectronApp;
+    const electronTheme = yield* ElectronTheme.ElectronTheme;
+    const environment = yield* DesktopEnvironment.DesktopEnvironment;
+    const context = yield* Effect.context<DesktopLifecycleRegistrationServices>();
+    const runEffect = Effect.runPromiseWith(context);
+    let quitAllowed = false;
+    let updaterQuitAllowed = false;
+    yield* electronTheme.onUpdated(() => {
+      void runEffect(
+        desktopWindow.syncAppearance.pipe(Effect.withSpan("desktop.lifecycle.themeUpdated")),
+      );
+    });
+    yield* electronApp.onBeforeQuitForUpdate(() => {
+      // Electron's updater owns the remaining quit/install/relaunch sequence.
+      // Cancelling the following app "before-quit" event breaks that sequence,
+      // most visibly on macOS where the native updater performs the relaunch.
-      yield* electronApp.onBeforeQuitForUpdate(() => {
+      updaterQuitAllowed = true;
-        // Electron's updater owns the remaining quit/install/relaunch sequence.
+      // This event is synchronous and the updater's quit proceeds as soon as
+      // the listener returns, so a forked destroyAll would race the quit
+      // and windows could still be open when the process exits (visible on
+      // macOS). Destroy them inline.
+      Effect.runSyncWith(context)(
+        electronWindow.destroyAll.pipe(
+          Effect.andThen(logLifecycleInfo("allowing updater-controlled quit")),
+          Effect.catchCause((cause) =>
+            logLifecycleError("failed to destroy windows before updater quit", { cause }),
-        // Cancelling the following app "before-quit" event breaks that sequence,
-        // most visibly on macOS where the native updater performs the relaunch.
-        updaterQuitAllowed = true;
-        // This event is synchronous and the updater's quit proceeds as soon as
-        // the listener returns, so a forked destroyAll would race the quit
-        // and windows could still be open when the process exits (visible on
-        // macOS). Destroy them inline.
-        Effect.runSyncWith(context)(
-          electronWindow.destroyAll.pipe(
-            Effect.andThen(logLifecycleInfo("allowing updater-controlled quit")),
-            Effect.catchCause((cause) =>
-              logLifecycleError("failed to destroy windows before updater quit", { cause }),
-            ),
-            Effect.withSpan("desktop.lifecycle.beforeQuitForUpdate"),
           ),
+          Effect.withSpan("desktop.lifecycle.beforeQuitForUpdate"),
+        ),
+      );
+    });
+    yield* electronApp.on("before-quit", (event: Electron.Event) => {
+      handleBeforeQuit(
+        event,
+        runEffect,
+        () => quitAllowed || updaterQuitAllowed,
+        () => {
+          quitAllowed = true;
+        },
+      );
+    });
+    yield* electronApp.on("activate", () => {
+      void runEffect(
+        Effect.gen(function* () {
+          const state = yield* DesktopState.DesktopState;
+          if (yield* Ref.get(state.quitting)) return;
+          yield* desktopWindow.activate;
+        }).pipe(Effect.withSpan("desktop.lifecycle.activate")),
+      );
+    });
+    yield* electronApp.on("window-all-closed", () => {
+      void runEffect(
+        Effect.gen(function* () {
+          const app = yield* ElectronApp.ElectronApp;
+          const state = yield* DesktopState.DesktopState;
+          if (environment.platform !== "darwin" && !(yield* Ref.get(state.quitting))) {
+            yield* app.quit;
+          }
+        }).pipe(Effect.withSpan("desktop.lifecycle.windowAllClosed")),
+      );
+    });
+
+    if (environment.platform !== "win32") {
+      yield* addScopedListener(process, "SIGINT", () => {
-        );
+        quitFromSignal("SIGINT", runEffect);
       });
-      yield* electronApp.on("before-quit", (event: Electron.Event) => {
-        handleBeforeQuit(
-          event,
-          runEffect,
-          () => quitAllowed || updaterQuitAllowed,
-          () => {
-            quitAllowed = true;
-          },
-        );
-      });
-      yield* electronApp.on("activate", () => {
-        void runEffect(
-          Effect.gen(function* () {
-            const state = yield* DesktopState.DesktopState;
-            if (yield* Ref.get(state.quitting)) return;
-            yield* desktopWindow.activate;
-          }).pipe(Effect.withSpan("desktop.lifecycle.activate")),
-        );
-      });
-      yield* electronApp.on("window-all-closed", () => {
-        void runEffect(
-          Effect.gen(function* () {
-            const app = yield* ElectronApp.ElectronApp;
-            const state = yield* DesktopState.DesktopState;
-            if (environment.platform !== "darwin" && !(yield* Ref.get(state.quitting))) {
+      yield* addScopedListener(process, "SIGTERM", () => {
+        quitFromSignal("SIGTERM", runEffect);
-              yield* app.quit;
-            }
-          }).pipe(Effect.withSpan("desktop.lifecycle.windowAllClosed")),
-        );
       });
-
-      if (environment.platform !== "win32") {
+    }
+  }).pipe(Effect.withSpan("desktop.lifecycle.register")),
-        // The layer outlives program finalizers, so repeated signals stay owned
-        // while backends stop. Electron listeners still follow the program scope.
-        yield* addScopedListener(process, "SIGINT", () => {
-          quitFromSignal("SIGINT", runEffect);
-        }).pipe(Scope.provide(signalScope));
-        yield* addScopedListener(process, "SIGTERM", () => {
-          quitFromSignal("SIGTERM", runEffect);
-        }).pipe(Scope.provide(signalScope));
-      }
-    }).pipe(Effect.withSpan("desktop.lifecycle.register")),
-  });
 });
 
+export const layer = Layer.succeed(DesktopLifecycle, make);
-export const layer = Layer.effect(DesktopLifecycle, make);
```

## apps/desktop/src/app/DesktopLinuxUrlHandler.test.ts

Status: modified; +27; −91

```diff
@@ -22,31 +22,8 @@
   readonly files: Array<{ readonly path: string; readonly content: string }>;
   readonly commands: Array<{ readonly command: string; readonly args: ReadonlyArray<string> }>;
   readonly copies: Array<{ readonly source: string; readonly destination: string }>;
-  readonly binaryReads: string[];
-  readonly binaryWrites: Array<{
-    readonly path: string;
-    readonly bytes: Uint8Array;
-    readonly mode: number | undefined;
-  }>;
 }
 
-const iconSource = "/tmp/.mount_T3/resources/app.asar/apps/desktop/prod-resources/icon.png";
-const iconPath = "/home/alice/.local/share/icons/com.t3tools.T3Code.desktop.png";
-const iconBytes = new Uint8Array([0x89, 0x50, 0x00, 0xff, 0x80, 0x0a]);
-const currentDesktopEntry = DesktopLinuxUrlHandler.renderUrlHandlerDesktopEntry({
-  displayName: "T3 Code (Alpha)",
-  execTarget: "/home/alice/Applications/T3-Code.AppImage",
-  scheme: "t3code",
-  iconPath,
-});
-const registrationCommands = [
-  { command: "update-desktop-database", args: ["/home/alice/.local/share/applications"] },
-  {
-    command: "xdg-mime",
-    args: ["default", "com.t3tools.T3Code.desktop", "x-scheme-handler/t3code"],
-  },
-];
-
 const makeEnvironment = (path: Path.Path, overrides: Record<string, unknown> = {}) =>
   DesktopEnvironment.DesktopEnvironment.of({
     platform: "linux",
@@ -87,8 +64,7 @@
     readonly writeError?: PlatformError.PlatformError;
     readonly existingEntry?: string;
     readonly iconSource?: string;
-    readonly existingIcon?: Uint8Array;
-    readonly iconReadError?: PlatformError.PlatformError;
+    readonly iconCopyError?: PlatformError.PlatformError;
   } = {},
 ) =>
   DesktopLinuxUrlHandler.layer.pipe(
@@ -111,34 +87,11 @@
         }),
         FileSystem.layerNoop({
           copyFile: (source, destination) =>
+            input.iconCopyError
+              ? Effect.fail(input.iconCopyError)
+              : Effect.sync(() => {
+                  recorded.copies.push({ source, destination });
-            Effect.sync(() => {
-              recorded.copies.push({ source, destination });
-            }),
-          readFile: (path) =>
-            Effect.gen(function* () {
-              recorded.binaryReads.push(path);
-              if (path === input.iconSource) {
+                }),
-                if (input.iconReadError) return yield* input.iconReadError;
-                return new Uint8Array(iconBytes);
-              }
-              if (path === iconPath && input.existingIcon !== undefined) {
-                return input.existingIcon;
-              }
-              return yield* PlatformError.systemError({
-                _tag: "NotFound",
-                module: "FileSystem",
-                method: "readFile",
-                pathOrDescriptor: path,
-              });
-            }),
-          writeFile: (path, bytes, options) =>
-            Effect.sync(() => {
-              recorded.binaryWrites.push({
-                path,
-                bytes: new Uint8Array(bytes),
-                mode: options?.mode,
-              });
-            }),
           readFileString: () => Effect.succeed(input.existingEntry ?? ""),
           makeDirectory: (path) =>
             Effect.sync(() => {
@@ -203,8 +156,6 @@
   files: [],
   commands: [],
   copies: [],
-  binaryReads: [],
-  binaryWrites: [],
 });
 
 describe("DesktopLinuxUrlHandler", () => {
@@ -355,57 +306,42 @@
 
   it.effect("installs a persistent icon even when the desktop entry is already current", () => {
     const recorded = emptyRecording();
+    const iconPath = "/home/alice/.local/share/icons/com.t3tools.T3Code.desktop.png";
     return Effect.gen(function* () {
       yield* runRegister(recorded, {
+        iconSource: "/tmp/.mount_T3/resources/icon.png",
+        existingEntry: DesktopLinuxUrlHandler.renderUrlHandlerDesktopEntry({
+          displayName: "T3 Code (Alpha)",
+          execTarget: "/home/alice/Applications/T3-Code.AppImage",
+          scheme: "t3code",
-        iconSource,
-        existingEntry: currentDesktopEntry,
+          iconPath,
+        }),
       });
       assert.deepEqual(recorded.files, []);
-      assert.deepEqual(recorded.copies, []);
-      assert.deepEqual(recorded.binaryReads, [iconSource, iconPath]);
-      assert.deepEqual(recorded.binaryWrites, [{ path: iconPath, bytes: iconBytes, mode: 0o600 }]);
-      assert.deepEqual(recorded.commands, registrationCommands);
+      assert.deepEqual(recorded.copies, [
+        { source: "/tmp/.mount_T3/resources/icon.png", destination: iconPath },
+      ]);
+      assert.equal(recorded.commands.at(-1)?.command, "xdg-mime");
     });
   });
 
-  it.effect("refreshes a stale icon and skips equal bytes on the next registration", () => {
+  it.effect("still registers the handler when copying its icon fails", () => {
     const recorded = emptyRecording();
     return Effect.gen(function* () {
       yield* runRegister(recorded, {
+        iconSource: "/tmp/.mount_T3/resources/icon.png",
-        iconSource,
-        existingEntry: currentDesktopEntry,
-        existingIcon: new Uint8Array([0x89, 0x50, 0x00, 0xfe, 0x80, 0x0a]),
+        iconCopyError: PlatformError.systemError({
-      });
-      assert.deepEqual(recorded.binaryWrites, [{ path: iconPath, bytes: iconBytes, mode: 0o600 }]);
-      yield* runRegister(recorded, {
-        iconSource,
-        existingEntry: currentDesktopEntry,
-        existingIcon: new Uint8Array(recorded.binaryWrites[0]!.bytes),
-      });
-      assert.equal(recorded.binaryWrites.length, 1);
-      assert.deepEqual(recorded.copies, []);
-      assert.deepEqual(recorded.files, []);
-      assert.deepEqual(recorded.commands, [...registrationCommands, ...registrationCommands]);
-    });
-  });
-
-  it.effect("still registers the handler when reading its icon fails", () => {
-    const recorded = emptyRecording();
-    return Effect.gen(function* () {
-      yield* runRegister(recorded, {
-        iconSource,
-        iconReadError: PlatformError.systemError({
           _tag: "PermissionDenied",
           module: "FileSystem",
+          method: "copyFile",
+          description: "read-only icon directory",
-          method: "readFile",
-          description: "unreadable bundled icon",
         }),
       });
-      assert.deepEqual(recorded.binaryReads, [iconSource]);
-      assert.deepEqual(recorded.binaryWrites, []);
-      assert.deepEqual(recorded.copies, []);
       assert.equal(recorded.files.length, 1);
+      assert.deepEqual(
+        recorded.commands.map(({ command }) => command),
+        ["update-desktop-database", "xdg-mime"],
+      );
-      assert.deepEqual(recorded.commands, registrationCommands);
     });
   });
 
```

## apps/desktop/src/app/DesktopLinuxUrlHandler.ts

Status: modified; +2; −6

```diff
@@ -301,16 +301,12 @@
     yield* Effect.gen(function* () {
       const { png } = yield* assets.iconPaths;
       if (Option.isNone(png)) return;
-      // Electron's copyFile extracts ASAR entries to temporary files it never removes.
-      const icon = yield* fileSystem.readFile(png.value);
-      const current = yield* fileSystem.readFile(iconPath).pipe(Effect.option);
-      if (Option.isSome(current) && sameBytes(current.value, icon)) return;
       // The AppImage mount is temporary; the chooser needs the icon after exit.
       yield* fileSystem.makeDirectory(iconsDir, { recursive: true });
-      yield* fileSystem.writeFile(iconPath, icon, { mode: 0o600 });
+      yield* fileSystem.copyFile(png.value, iconPath);
     }).pipe(
       Effect.catch((error) =>
-        logWarning("URL handler icon install failed", { iconPath, category: error.reason._tag }),
+        logWarning("URL handler icon copy failed", { iconPath, category: error.reason._tag }),
       ),
     );
 
```

## apps/desktop/src/app/DesktopPreReadyPlatform.test.ts

Status: modified; +14; −76

```diff
@@ -12,10 +12,10 @@
   registerSchemesMock,
   setDesktopNameMock,
   mkdirSyncMock,
-  readFileSyncMock,
   writeFileSyncMock,
   copyFileSyncMock,
   execFileSyncMock,
+  readFileSyncMock,
 } = vi.hoisted(() => ({
   appendSwitchMock: vi.fn(),
   getSwitchValueMock: vi.fn(),
@@ -23,10 +23,10 @@
   registerSchemesMock: vi.fn(),
   setDesktopNameMock: vi.fn(),
   mkdirSyncMock: vi.fn(),
-  readFileSyncMock: vi.fn(),
   writeFileSyncMock: vi.fn(),
   copyFileSyncMock: vi.fn(),
   execFileSyncMock: vi.fn(),
+  readFileSyncMock: vi.fn(),
 }));
 
 vi.mock("electron", () => ({
@@ -59,11 +59,6 @@
 
 import * as DesktopPreReadyPlatform from "./DesktopPreReadyPlatform.ts";
 
-const iconSource = "/tmp/.mount_T3/resources/app.asar/apps/desktop/prod-resources/icon.png";
-const iconPath = "/xdg/icons/com.t3tools.T3Code.desktop.png";
-const desktopEntryPath = "/xdg/applications/com.t3tools.T3Code.desktop";
-const iconBytes = Buffer.from([0x89, 0x50, 0x00, 0xff, 0x80, 0x0a]);
-
 describe("DesktopPreReadyPlatform", () => {
   beforeEach(() => {
     appendSwitchMock.mockReset();
@@ -72,15 +67,10 @@
     registerSchemesMock.mockReset();
     setDesktopNameMock.mockReset();
     mkdirSyncMock.mockReset();
-    readFileSyncMock.mockReset();
     writeFileSyncMock.mockReset();
     copyFileSyncMock.mockReset();
     execFileSyncMock.mockReset();
+    readFileSyncMock.mockReset().mockReturnValue("{}");
-    readFileSyncMock.mockReset().mockImplementation((path: string) => {
-      if (path.endsWith("/desktop-settings.json")) return "{}";
-      if (path === iconSource) return Buffer.from(iconBytes);
-      throw new Error(`missing file: ${path}`);
-    });
   });
 
   it.effect("persists Linux scaling synchronously across relaunches and settings rewrites", () => {
@@ -222,13 +212,14 @@
     let desktopName = "t3code.desktop";
     let desktopEntry = previousEntry;
     let iconInstalled = false;
+    copyFileSyncMock.mockImplementation((_source: string, destination: string) => {
+      iconInstalled = destination === "/xdg/icons/com.t3tools.T3Code.desktop.png";
+    });
     setDesktopNameMock.mockImplementation((name: string) => {
       desktopName = name;
     });
+    writeFileSyncMock.mockImplementation((path: string, contents: string) => {
+      if (path === "/xdg/applications/com.t3tools.T3Code.desktop") desktopEntry = contents;
-    writeFileSyncMock.mockImplementation((path: string, contents: string | Buffer) => {
-      if (path === iconPath)
-        iconInstalled = Buffer.isBuffer(contents) && contents.equals(iconBytes);
-      if (path === desktopEntryPath && typeof contents === "string") desktopEntry = contents;
     });
 
     return Effect.scoped(
@@ -253,15 +244,6 @@
           "Icon=/xdg/icons/com.t3tools.T3Code.desktop.png",
         );
         assert.isTrue(identity.iconInstalled);
-        assert.deepEqual(
-          readFileSyncMock.mock.calls.filter(([path]) => path === iconSource),
-          [[iconSource]],
-        );
-        assert.deepEqual(
-          writeFileSyncMock.mock.calls.filter(([path]) => path === iconPath),
-          [[iconPath, iconBytes, { mode: 0o600 }]],
-        );
-        assert.equal(copyFileSyncMock.mock.calls.length, 0);
       }),
     ).pipe(Effect.ensuring(Effect.sync(() => vi.unstubAllEnvs())));
   });
@@ -278,62 +260,18 @@
     );
   });
 
-  it.effect("refreshes a stale icon once across repeated launches", () => {
-    vi.stubEnv("VITE_DEV_SERVER_URL", "");
-    vi.stubEnv("XDG_DATA_HOME", "/xdg");
-    getSwitchValueMock.mockReturnValue("");
-    let installedIcon = Buffer.from([0x89, 0x50, 0x00, 0xfe, 0x80, 0x0a]);
-    readFileSyncMock.mockImplementation((path: string) => {
-      if (path === iconSource) return Buffer.from(iconBytes);
-      if (path === iconPath) return Buffer.from(installedIcon);
-      return "{}";
-    });
-    writeFileSyncMock.mockImplementation((path: string, contents: Buffer) => {
-      if (path === iconPath) installedIcon = Buffer.from(contents);
-    });
-
-    return Effect.gen(function* () {
-      yield* DesktopPreReadyPlatform.make;
-      assert.deepEqual(installedIcon, iconBytes);
-      yield* DesktopPreReadyPlatform.make;
-      assert.deepEqual(
-        writeFileSyncMock.mock.calls.filter(([path]) => path === iconPath),
-        [[iconPath, iconBytes, { mode: 0o600 }]],
+  it.effect("still prepares the portal entry when the bundled icon cannot be copied", () => {
-      );
-      assert.equal(copyFileSyncMock.mock.calls.length, 0);
-      assert.equal(
-        writeFileSyncMock.mock.calls.filter(([path]) => path === desktopEntryPath).length,
-        2,
-      );
-      assert.equal(setDesktopNameMock.mock.calls.length, 2);
-    }).pipe(
-      Effect.provideService(HostProcess.Platform, "linux"),
-      Effect.ensuring(Effect.sync(() => vi.unstubAllEnvs())),
-    );
-  });
-
-  it.effect("still prepares the portal entry when the bundled icon cannot be read", () => {
-    vi.stubEnv("VITE_DEV_SERVER_URL", "");
-    vi.stubEnv("XDG_DATA_HOME", "/xdg");
     getSwitchValueMock.mockReturnValue("");
+    copyFileSyncMock.mockImplementation(() => {
+      throw new Error("missing bundled icon");
-    readFileSyncMock.mockImplementation((path: string) => {
-      if (path === iconSource) throw new Error("unreadable bundled icon");
-      return "{}";
     });
     return Effect.gen(function* () {
       yield* DesktopPreReadyPlatform.make;
-      assert.isTrue(readFileSyncMock.mock.calls.some(([path]) => path === iconSource));
-      assert.equal(copyFileSyncMock.mock.calls.length, 0);
-      assert.equal(writeFileSyncMock.mock.calls.length, 1);
-      const [path, contents] = writeFileSyncMock.mock.calls[0]!;
-      assert.equal(path, desktopEntryPath);
+      const contents = writeFileSyncMock.mock.calls[0]?.[1];
       assert.include(contents, "MimeType=x-scheme-handler/t3code;");
+      assert.include(contents, "Icon=");
-      assert.include(contents, `Icon=${iconPath}`);
       assert.equal(setDesktopNameMock.mock.calls.length, 1);
-    }).pipe(
+    }).pipe(Effect.provideService(HostProcess.Platform, "linux"));
-      Effect.provideService(HostProcess.Platform, "linux"),
-      Effect.ensuring(Effect.sync(() => vi.unstubAllEnvs())),
-    );
   });
 
   it.effect(
```

## apps/desktop/src/app/DesktopPreReadyPlatform.ts

Status: modified; +3; −10

```diff
@@ -92,21 +92,14 @@
           : undefined;
         if (iconPath !== undefined) {
           try {
-            // Electron's copyFile extracts ASAR entries to temporary files it never removes.
-            const icon = NodeFS.readFileSync(
+            NodeFS.mkdirSync(NodePath.posix.dirname(iconPath), { recursive: true });
+            NodeFS.copyFileSync(
               NodePath.posix.join(
                 Electron.app.getAppPath(),
                 "apps/desktop/prod-resources/icon.png",
               ),
+              iconPath,
             );
-            let current: Buffer | null = null;
-            try {
-              current = NodeFS.readFileSync(iconPath);
-            } catch {}
-            if (current === null || !current.equals(icon)) {
-              NodeFS.mkdirSync(NodePath.posix.dirname(iconPath), { recursive: true });
-              NodeFS.writeFileSync(iconPath, icon, { mode: 0o600 });
-            }
           } catch {}
         }
         NodeFS.writeFileSync(
```

## apps/desktop/src/app/DesktopRuntime.ts

Status: deleted; +0; −11

```diff
@@ -1,11 +1,0 @@
-import * as Runtime from "effect/Runtime";
-
-// DesktopLifecycle owns signals and waits for backend shutdown before quitting
-// Electron. NodeRuntime's competing signal handler interrupts that sequence.
-export const runMain = Runtime.makeRunMain(({ fiber, teardown }) => {
-  fiber.addObserver((exit) => {
-    teardown(exit, (code) => {
-      if (code !== 0) process.exit(code);
-    });
-  });
-});
```

## apps/desktop/src/backend/DesktopBackendManager.test.ts

Status: modified; +10; −21

```diff
@@ -262,7 +262,7 @@
         assert.equal(spawnedCommand.options.additionalFds?.fd5?.type, "output");
         assert.equal(
           Duration.toMillis(Duration.fromInputUnsafe(spawnedCommand.options.forceKillAfter)),
-          30_000,
+          5_000,
         );
 
         assert.deepEqual(yield* decodeBootstrap(bootstrapJson), configWithObservability);
@@ -1546,15 +1546,14 @@
     ),
   );
 
-  it.effect("stopAllPoolInstances allows slow cleanup but bounds hung backends", () =>
+  it.effect("stopAllPoolInstances bounds the quit finalizer when backends hang", () =>
     Effect.scoped(
       Effect.gen(function* () {
         const teardownStarted = yield* Queue.unbounded<string>();
         const teardownFinished = yield* Queue.unbounded<string>();
-        const allowSlowTeardown = yield* Deferred.make<void>();
-        const allowHungTeardown = yield* Deferred.make<void>();
+        const allowTeardown = yield* Deferred.make<void>();
 
-        const makeInstance = (name: string, allowTeardown: Deferred.Deferred<void>) =>
+        const makeInstance = (name: string) =>
           makeTestInstance({
             spawnerLayer: Layer.succeed(
               ChildProcessSpawner.ChildProcessSpawner,
@@ -1576,8 +1575,8 @@
             httpClientLayer: layerHttpClient(() => Effect.never),
           });
 
-        const instance1 = yield* makeInstance("instance1", allowSlowTeardown);
-        const instance2 = yield* makeInstance("instance2", allowHungTeardown);
+        const instance1 = yield* makeInstance("instance1");
+        const instance2 = yield* makeInstance("instance2");
 
         yield* instance1.start;
         yield* instance2.start;
@@ -1595,25 +1594,15 @@
         ).pipe(Effect.provide(layerMockPool), Effect.forkChild);
 
         const started = yield* Queue.takeN(teardownStarted, 2);
-        yield* Effect.addFinalizer(() =>
-          Deferred.succeed(allowSlowTeardown, undefined).pipe(
-            Effect.andThen(Deferred.succeed(allowHungTeardown, undefined)),
-          ),
-        );
         assert.deepEqual(started.toSorted(), ["instance1", "instance2"]);
 
-        yield* TestClock.adjust(Duration.seconds(6));
-        assert.isUndefined(quitFiber.pollUnsafe());
-        yield* Deferred.succeed(allowSlowTeardown, undefined);
-        assert.equal(yield* Queue.take(teardownFinished), "instance1");
-        assert.isUndefined(quitFiber.pollUnsafe());
+        yield* TestClock.adjust(Duration.seconds(5));
-        yield* TestClock.adjust(Duration.seconds(39));
-
         yield* Fiber.join(quitFiber);
         assert.equal(yield* Queue.size(teardownFinished), 0);
 
+        yield* Deferred.succeed(allowTeardown, undefined);
+        const finished = yield* Queue.takeN(teardownFinished, 2);
-        yield* Deferred.succeed(allowHungTeardown, undefined);
+        assert.deepEqual(finished.toSorted(), ["instance1", "instance2"]);
-        assert.equal(yield* Queue.take(teardownFinished), "instance2");
       }).pipe(Effect.provide(TestClock.layer())),
     ),
   );
```

## apps/desktop/src/backend/DesktopBackendManager.ts

Status: modified; +3; −2

```diff
@@ -37,8 +37,9 @@
 const DEFAULT_BACKEND_READINESS_TIMEOUT = Duration.minutes(1);
 const DEFAULT_BACKEND_READINESS_INTERVAL = Duration.millis(100);
 const DEFAULT_BACKEND_READINESS_REQUEST_TIMEOUT = Duration.seconds(1);
+// Same as the service launcher. A killed backend leaves its agents running,
+// and a busy one needs a few seconds to stop every provider session.
+const DEFAULT_BACKEND_TERMINATE_GRACE = Duration.seconds(5);
-// Give busy backends time to stop provider sessions before forcing termination.
-const DEFAULT_BACKEND_TERMINATE_GRACE = Duration.seconds(30);
 const DEFAULT_BACKEND_OUTPUT_DRAIN_TIMEOUT = Duration.seconds(5);
 const BACKEND_READINESS_PATH = "/.well-known/t3/environment";
 const { logWarning: logBackendProcessWarning } =
```

## apps/desktop/src/electron/ElectronUpdater.test.ts

Status: modified; +2; −308

```diff
@@ -1,27 +1,8 @@
-// @effect-diagnostics nodeBuiltinImport:off -- Build real electron-updater disk fixtures with its SHA-512 encoding.
-import * as NodeServices from "@effect/platform-node/NodeServices";
-import * as NodeCrypto from "node:crypto";
-import * as NodeEvents from "node:events";
-import * as NodeModule from "node:module";
-import * as NodePath from "node:path";
-import * as Deferred from "effect/Deferred";
-import * as FileSystem from "effect/FileSystem";
-import * as Option from "effect/Option";
-import { AppImageUpdater } from "electron-updater/out/AppImageUpdater.js";
-import { DebUpdater } from "electron-updater/out/DebUpdater.js";
-import { MacUpdater } from "electron-updater/out/MacUpdater.js";
-import { GenericProvider } from "electron-updater/out/providers/GenericProvider.js";
-import type { UpdateDownloadedEvent } from "electron-updater/out/types.js";
-import { NsisUpdater } from "electron-updater/out/NsisUpdater.js";
-import * as DesktopUpdates from "../updates/DesktopUpdates.ts";
-import { flushCallbacks, makeHarness } from "../updates/updatesTestHarness.ts";
 import { assert, describe, it } from "@effect/vitest";
 import * as Effect from "effect/Effect";
-import type { VerifyUpdateCodeSignature } from "electron-updater";
 import { beforeEach, vi } from "vite-plus/test";
 
-const { autoUpdaterMock, updaterOverride } = vi.hoisted(() => ({
+const { autoUpdaterMock } = vi.hoisted(() => ({
-  updaterOverride: { current: undefined as import("electron-updater").AppUpdater | undefined },
   autoUpdaterMock: {
     allowDowngrade: false,
     allowPrerelease: false,
@@ -32,8 +13,6 @@
     fullChangelog: false,
     checkForUpdates: vi.fn(() => Promise.resolve(null)),
     downloadUpdate: vi.fn(() => Promise.resolve([])),
-    logger: { info: vi.fn(), warn: vi.fn(), error: vi.fn() },
-    verifyUpdateCodeSignature: undefined as VerifyUpdateCodeSignature | undefined,
     on: vi.fn(),
     quitAndInstall: vi.fn(),
     removeListener: vi.fn(),
@@ -42,9 +21,7 @@
 }));
 
 vi.mock("electron-updater", () => ({
-  get autoUpdater() {
-    return updaterOverride.current ?? autoUpdaterMock;
-  },
+  autoUpdater: autoUpdaterMock,
 }));
 
 import * as ElectronUpdater from "./ElectronUpdater.ts";
@@ -66,7 +43,6 @@
     autoUpdaterMock.quitAndInstall.mockClear();
     autoUpdaterMock.removeListener.mockClear();
     autoUpdaterMock.setFeedURL.mockClear();
-    autoUpdaterMock.verifyUpdateCodeSignature = undefined;
   });
 
   it.effect("scopes updater event listeners", () =>
@@ -160,286 +136,4 @@
       assert.deepEqual(autoUpdaterMock.quitAndInstall.mock.calls, [[true, false]]);
     }).pipe(Effect.provide(ElectronUpdater.layer)),
   );
-
-  describe("Windows update signature check", () => {
-    const publisherNames = ["T3 Tools Inc"];
-    const installerPath = "C:\\updater\\pending\\temp-T3-Code-x64.exe";
-    // execFile marks the error killed when the verifier exceeds its 20-second timeout.
-    const timedOut = () =>
-      Object.assign(new Error("Command failed: powershell.exe"), { killed: true });
-
-    const downloadVerifyingSignature = () => {
-      autoUpdaterMock.downloadUpdate.mockImplementationOnce(async () => {
-        const rejection = await autoUpdaterMock.verifyUpdateCodeSignature!(
-          publisherNames,
-          installerPath,
-        );
-        // NSIS accepts only null as a successful signature check.
-        if (rejection !== null) throw new Error(`Invalid signature: ${rejection}`);
-        return [];
-      });
-      return Effect.flatMap(ElectronUpdater.ElectronUpdater, (updater) => updater.downloadUpdate);
-    };
-
-    it.effect("retries a timed-out signature check with the same verifier and installer", () =>
-      Effect.gen(function* () {
-        const verify = vi
-          .fn<VerifyUpdateCodeSignature>()
-          .mockRejectedValueOnce(timedOut())
-          .mockResolvedValueOnce(null);
-        autoUpdaterMock.verifyUpdateCodeSignature = verify;
-
-        yield* downloadVerifyingSignature();
-
-        assert.deepEqual(verify.mock.calls, [
-          [publisherNames, installerPath],
-          [publisherNames, installerPath],
-        ]);
-      }).pipe(Effect.provide(ElectronUpdater.layer)),
-    );
-
-    it.effect("fails on invalid signatures, other errors and two timeouts on each download", () =>
-      Effect.gen(function* () {
-        const cases = [
-          { outcome: () => Promise.resolve("Invalid publisher"), calls: 1 },
-          { outcome: () => Promise.reject(new Error("Cannot execute PowerShell")), calls: 1 },
-          { outcome: () => Promise.reject(timedOut()), calls: 2 },
-        ];
-        for (const { outcome, calls } of cases) {
-          const verify = vi.fn<VerifyUpdateCodeSignature>(outcome);
-          autoUpdaterMock.verifyUpdateCodeSignature = verify;
-
-          // Reusing the installed verifier must neither stack retries nor exhaust future retries.
-          for (let download = 1; download <= 2; download++) {
-            const error = yield* downloadVerifyingSignature().pipe(Effect.flip);
-            assert.instanceOf(error, ElectronUpdater.ElectronUpdaterDownloadUpdateError);
-            assert.equal(verify.mock.calls.length, calls * download);
-          }
-        }
-      }).pipe(Effect.provide(ElectronUpdater.layer)),
-    );
-
-    it.effect("rejects a retry when the upstream capability probe skips verification", () =>
-      Effect.gen(function* () {
-        const verify = vi
-          .fn<VerifyUpdateCodeSignature>()
-          .mockRejectedValueOnce(timedOut())
-          .mockImplementationOnce(async () => {
-            // Upstream resolves null even though its failed capability probe skips verification.
-            autoUpdaterMock.logger.warn(
-              "Cannot execute ConvertTo-Json: spawnSync powershell.exe ETIMEDOUT. Ignoring signature validation due to unsupported powershell version. Please upgrade to powershell 3 or higher.",
-            );
-            return null;
-          });
-        autoUpdaterMock.verifyUpdateCodeSignature = verify;
-
-        const error = yield* downloadVerifyingSignature().pipe(Effect.flip);
-
-        assert.instanceOf(error, ElectronUpdater.ElectronUpdaterDownloadUpdateError);
-        assert.equal(verify.mock.calls.length, 2);
-      }).pipe(Effect.provide(ElectronUpdater.layer)),
-    );
-  });
 });
-
-describe("installed electron-updater cache recovery", () => {
-  it.effect.each([
-    {
-      name: "Intel Mac",
-      platform: "darwin",
-      Updater: MacUpdater,
-      selected: "x64.zip",
-      other: "arm64.zip",
-      rosetta: false,
-    },
-    {
-      name: "Apple Silicon running Intel",
-      platform: "darwin",
-      Updater: MacUpdater,
-      selected: "arm64.zip",
-      other: "x64.zip",
-      rosetta: true,
-    },
-    {
-      name: "Windows",
-      platform: "win32",
-      Updater: NsisUpdater,
-      selected: "x64.exe",
-      other: "arm64.exe",
-      rosetta: false,
-    },
-    {
-      name: "Debian",
-      platform: "linux",
-      Updater: DebUpdater,
-      selected: "x64.deb",
-      other: "x64.AppImage",
-      rosetta: false,
-    },
-    {
-      name: "AppImage",
-      platform: "linux",
-      Updater: AppImageUpdater,
-      selected: "x64.AppImage",
-      other: "x64.deb",
-      rosetta: false,
-    },
-  ] as const)("restores only the package selected by $name", (scenario) =>
-    Effect.scoped(
-      Effect.gen(function* () {
-        const fs = yield* FileSystem.FileSystem;
-        const directory = yield* fs.makeTempDirectoryScoped();
-        const cacheDirectory = NodePath.join(directory, "custom-updater-cache", "pending");
-        const configPath = NodePath.join(directory, "app-update.yml");
-        yield* fs.writeFileString(configPath, "updaterCacheDirName: custom-updater-cache\n");
-        yield* fs.makeDirectory(cacheDirectory, { recursive: true });
-
-        const require = NodeModule.createRequire(import.meta.url);
-        require("electron");
-        const electronModule = require.cache[require.resolve("electron")]!;
-        const childProcess = require("node:child_process") as typeof import("node:child_process");
-        const originalElectron = electronModule.exports;
-        const originalArch = Object.getOwnPropertyDescriptor(process, "arch")!;
-        yield* Effect.acquireRelease(
-          Effect.sync(() => {
-            // MacUpdater's native Squirrel bridge and host probes are OS boundaries.
-            electronModule.exports = { autoUpdater: new NodeEvents.EventEmitter() };
-            Object.defineProperty(process, "arch", { value: "x64", configurable: true });
-            return vi
-              .spyOn(childProcess, "execFileSync")
-              .mockReturnValue(scenario.rosetta ? "sysctl.proc_translated: 1" : "x86_64");
-          }),
-          (probe) =>
-            Effect.sync(() => {
-              probe.mockRestore();
-              Object.defineProperty(process, "arch", originalArch);
-              electronModule.exports = originalElectron;
-              updaterOverride.current = undefined;
-            }),
-        );
-
-        const extensions =
-          scenario.platform === "darwin"
-            ? ["arm64.dmg", "x64.dmg", "arm64.zip", "x64.zip"]
-            : scenario.platform === "win32"
-              ? ["arm64.exe", "x64.exe"]
-              : ["arm64.AppImage", "x64.AppImage", "arm64.deb", "x64.deb"];
-        const files = extensions.map((extension) => {
-          const url = `T3-Code-1.2.4-${extension}`;
-          return { url, sha512: NodeCrypto.createHash("sha512").update(url).digest("base64") };
-        });
-        const info = {
-          version: "1.2.4",
-          releaseDate: "2026-10-01T00:00:00Z",
-          files,
-          path: files[0]!.url,
-          sha512: files[0]!.sha512,
-        };
-        yield* Effect.acquireRelease(
-          Effect.sync(() =>
-            vi.spyOn(GenericProvider.prototype, "getLatestVersion").mockResolvedValue(info),
-          ),
-          (feed) => Effect.sync(() => feed.mockRestore()),
-        );
-
-        // A fresh instance for each launch forces disk validation rather than in-memory reuse.
-        yield* Effect.forEach([scenario.other, scenario.selected], (cachedExtension) =>
-          Effect.scoped(
-            Effect.gen(function* () {
-              const cached = files.find((file) => file.url.endsWith(`-${cachedExtension}`))!;
-              yield* fs.writeFileString(NodePath.join(cacheDirectory, cached.url), cached.url);
-              yield* fs.writeFileString(
-                NodePath.join(cacheDirectory, "update-info.json"),
-                JSON.stringify({
-                  fileName: cached.url,
-                  sha512: cached.sha512,
-                  isAdminRightsRequired: false,
-                }),
-              );
-              const updater = new scenario.Updater(undefined, {
-                version: "1.2.3",
-                name: "T3 Code",
-                isPackaged: true,
-                appUpdateConfigPath: configPath,
-                userDataPath: directory,
-                baseCachePath: directory,
-                whenReady: () => Promise.resolve(),
-                relaunch: vi.fn(),
-                quit: vi.fn(),
-                onQuit: vi.fn(),
-              });
-              updater.logger = null;
-              const networkDownload = vi.fn(() =>
-                Promise.reject(new Error("unexpected network download")),
-              );
-              Object.assign(updater, { httpExecutor: { download: networkDownload } });
-              if (updater instanceof MacUpdater) {
-                // Keep real selection, executeDownload, and hash validation; stop at native handoff.
-                Object.assign(updater, {
-                  updateDownloaded: async (_file: unknown, event: UpdateDownloadedEvent) => {
-                    updater.emit("update-downloaded", event);
-                    return [];
-                  },
-                });
-              }
-              updaterOverride.current = updater;
-              assert.deepEqual(
-                yield* ElectronUpdater.make.pendingDownloadDirectory,
-                Option.some(cacheDirectory),
-              );
-
-              const inspected = Deferred.makeUnsafe<void>();
-              const downloadFinished = Deferred.makeUnsafe<void>();
-              const download = vi.spyOn(updater, "downloadUpdate");
-              const harness = makeHarness({
-                platform: scenario.platform,
-                runningUnderArm64Translation: scenario.rosetta,
-                env: scenario.selected.endsWith("AppImage")
-                  ? { APPIMAGE: "/test/T3-Code.AppImage" }
-                  : {},
-                updater: {
-                  ...ElectronUpdater.make,
-                  downloadUpdate: ElectronUpdater.make.downloadUpdate.pipe(
-                    Effect.ensuring(Deferred.succeed(downloadFinished, undefined)),
-                  ),
-                },
-                fileSystem: {
-                  ...fs,
-                  readFileString: (path, encoding) =>
-                    path === "/missing/resources/package-type" && scenario.selected.endsWith("deb")
-                      ? Effect.succeed("deb")
-                      : fs.readFileString(path, encoding),
-                  exists: (path) =>
-                    fs.exists(path).pipe(Effect.tap(() => Deferred.succeed(inspected, undefined))),
-                },
-              });
-              yield* Effect.scoped(
-                Effect.gen(function* () {
-                  const updates = yield* DesktopUpdates.DesktopUpdates;
-                  yield* updates.configure;
-                  // AppImage activation reads the host environment; the fixture is intentionally not installed.
-                  vi.spyOn(updater, "isUpdaterActive").mockReturnValue(true);
-                  assert.isTrue((yield* updates.check("startup")).checked);
-                  yield* Deferred.await(inspected);
-                  yield* flushCallbacks;
-
-                  if (cachedExtension === scenario.other) {
-                    assert.equal(download.mock.calls.length, 0);
-                    assert.equal((yield* updates.getState).status, "available");
-                  } else {
-                    yield* Deferred.await(downloadFinished);
-                    yield* flushCallbacks;
-                    assert.equal(download.mock.calls.length, 1);
-                    assert.equal((yield* updates.getState).status, "downloaded");
-                    assert.equal((yield* updates.getState).downloadedVersion, "1.2.4");
-                  }
-                  assert.equal(networkDownload.mock.calls.length, 0);
-                }),
-              ).pipe(Effect.provide(harness.layer));
-            }),
-          ),
-        );
-      }),
-    ).pipe(Effect.provide(NodeServices.layer)),
-  );
-});
```

## apps/desktop/src/electron/ElectronUpdater.ts

Status: modified; +0; −54

```diff
@@ -1,12 +1,10 @@
 import * as Context from "effect/Context";
 import * as Effect from "effect/Effect";
 import * as Layer from "effect/Layer";
-import * as Option from "effect/Option";
 import * as Schema from "effect/Schema";
 import * as Scope from "effect/Scope";
 
 import { autoUpdater } from "electron-updater";
-import type { NsisUpdater, VerifyUpdateCodeSignature } from "electron-updater";
 
 type AutoUpdater = typeof autoUpdater;
 
@@ -69,7 +67,6 @@
     readonly setAllowDowngrade: (value: boolean) => Effect.Effect<void>;
     readonly setFullChangelog: (value: boolean) => Effect.Effect<void>;
     readonly setDisableDifferentialDownload: (value: boolean) => Effect.Effect<void>;
-    readonly pendingDownloadDirectory: Effect.Effect<Option.Option<string>>;
     readonly checkForUpdates: Effect.Effect<void, ElectronUpdaterCheckForUpdatesError>;
     readonly downloadUpdate: Effect.Effect<void, ElectronUpdaterDownloadUpdateError>;
     readonly quitAndInstall: (options: {
@@ -83,45 +80,6 @@
   }
 >()("@t3tools/desktop/electron/ElectronUpdater") {}
 
-const signatureChecksWithRetry = new WeakSet<VerifyUpdateCodeSignature>();
-
-const retrySignatureCheckAfterTimeout = () => {
-  // Only the Windows NSIS updater exposes this hook; its PowerShell check times out after 20 s.
-  const updater = autoUpdater as AutoUpdater &
-    Partial<Pick<NsisUpdater, "verifyUpdateCodeSignature">>;
-  const verify = updater.verifyUpdateCodeSignature;
-  if (verify === undefined || signatureChecksWithRetry.has(verify)) return;
-
-  const verifyWithRetry: VerifyUpdateCodeSignature = async (publisherNames, path) => {
-    try {
-      return await verify(publisherNames, path);
-    } catch (error) {
-      if (!(error instanceof Error && "killed" in error && error.killed === true)) throw error;
-    }
-
-    const logger = updater.logger;
-    let skipped = false;
-    updater.logger = {
-      info: (message) => logger?.info(message),
-      warn: (message) => {
-        // A failed capability probe makes electron-updater warn and return null without checking.
-        skipped ||= String(message).includes("Ignoring signature validation");
-        logger?.warn(message);
-      },
-      error: (message) => logger?.error(message),
-      debug: (message) => logger?.debug?.(message),
-    };
-    try {
-      const result = await verify(publisherNames, path);
-      return skipped ? "Signature validation was skipped after a timed-out check." : result;
-    } finally {
-      updater.logger = logger;
-    }
-  };
-  signatureChecksWithRetry.add(verifyWithRetry);
-  updater.verifyUpdateCodeSignature = verifyWithRetry;
-};
-
 /** @public Service construction is part of the canonical Effect module API. */
 export const make = ElectronUpdater.of({
   setFeedURL: (options) =>
@@ -165,17 +123,6 @@
       autoUpdater.disableDifferentialDownload = value;
       return Effect.void;
     }),
-  // Use the updater's helper so cache lookup follows the same configuration as downloads.
-  pendingDownloadDirectory: Effect.tryPromise(() =>
-    (
-      autoUpdater as unknown as {
-        getOrCreateDownloadHelper: () => Promise<{ readonly cacheDirForPendingUpdate: string }>;
-      }
-    ).getOrCreateDownloadHelper(),
-  ).pipe(
-    Effect.map((helper) => helper.cacheDirForPendingUpdate),
-    Effect.option,
-  ),
   checkForUpdates: Effect.suspend(() => {
     const channel = autoUpdater.channel;
     return Effect.tryPromise({
@@ -184,7 +131,6 @@
     }).pipe(Effect.asVoid);
   }),
   downloadUpdate: Effect.suspend(() => {
-    retrySignatureCheckAfterTimeout();
     const channel = autoUpdater.channel;
     return Effect.tryPromise({
       try: () => autoUpdater.downloadUpdate(),
```

## apps/desktop/src/ipc/DesktopIpcHandlers.ts

Status: modified; +0; −2

```diff
@@ -40,7 +40,6 @@
 import {
   getAppBranding,
   getLocalEnvironmentBootstraps,
-  readLocalEnvironmentBootstraps,
   getLocalEnvironmentBearerToken,
   getRelayTelemetryEnabled,
   getSystemLocale,
@@ -101,7 +100,6 @@
   yield* ipc.handleSync(getSystemLocale);
   yield* ipc.handleSync(getWindowFullscreenState);
   yield* ipc.handleSync(getLocalEnvironmentBootstraps);
-  yield* ipc.handle(readLocalEnvironmentBootstraps);
   yield* ipc.handleSync(getLocalEnvironmentEnabled);
   yield* ipc.handle(setLocalEnvironmentEnabled);
   yield* ipc.handle(getLocalEnvironmentBearerToken);
```

## apps/desktop/src/ipc/methods/window.ts

Status: modified; +47; −58

```diff
@@ -99,70 +99,59 @@
   }),
 });
 
+export const getLocalEnvironmentBootstraps = DesktopIpc.makeSyncIpcMethod({
+  channel: IpcChannels.GET_LOCAL_ENVIRONMENT_BOOTSTRAPS_CHANNEL,
+  result: Schema.Array(DesktopEnvironmentBootstrapSchema),
+  handler: Effect.fn("desktop.ipc.window.getLocalEnvironmentBootstraps")(function* () {
+    const pool = yield* DesktopBackendPool.DesktopBackendPool;
+    const configuration = yield* DesktopBackendConfiguration.DesktopBackendConfiguration;
+    const instances = yield* pool.list;
+    const bootstraps: DesktopEnvironmentBootstrap[] = [];
+    for (const instance of instances) {
+      const isPrimary = instance.id === PRIMARY_LOCAL_ENVIRONMENT_ID;
+      const config = yield* instance.currentConfig;
+      const snapshot = yield* instance.snapshot;
+      if (Option.isNone(config) || Option.isSome(config.value.preflightFailure)) {
+        const fatalPreflight =
+          Option.isSome(config) &&
+          Option.isSome(config.value.preflightFailure) &&
+          config.value.preflightFailure.value.fatal;
+        const stoppedPreflight =
+          Option.isSome(config) &&
+          Option.isSome(config.value.preflightFailure) &&
+          (!snapshot.desiredRunning || !snapshot.restartScheduled);
+        if (isPrimary || fatalPreflight || stoppedPreflight) continue;
+        bootstraps.push({
+          id: instance.id,
+          label: yield* instance.label,
+          runningDistro: null,
+          httpBaseUrl: null,
-const readLocalEnvironmentBootstrapSnapshot = Effect.fn(
-  "desktop.ipc.window.getLocalEnvironmentBootstraps",
-)(function* () {
-  const pool = yield* DesktopBackendPool.DesktopBackendPool;
-  const configuration = yield* DesktopBackendConfiguration.DesktopBackendConfiguration;
-  const instances = yield* pool.list;
-  const bootstraps: DesktopEnvironmentBootstrap[] = [];
-  for (const instance of instances) {
-    const isPrimary = instance.id === PRIMARY_LOCAL_ENVIRONMENT_ID;
-    const config = yield* instance.currentConfig;
-    const snapshot = yield* instance.snapshot;
-    if (Option.isNone(config) || Option.isSome(config.value.preflightFailure)) {
-      const fatalPreflight =
+          wsBaseUrl: null,
+        });
+        continue;
+      }
+      const { bootstrap, httpBaseUrl } = config.value;
+      const runningDistro = config.value.runningDistro ?? null;
-        Option.isSome(config) &&
-        Option.isSome(config.value.preflightFailure) &&
-        config.value.preflightFailure.value.fatal;
-      const stoppedPreflight =
-        Option.isSome(config) &&
-        Option.isSome(config.value.preflightFailure) &&
-        (!snapshot.desiredRunning || !snapshot.restartScheduled);
-      if (isPrimary || fatalPreflight || stoppedPreflight) continue;
       bootstraps.push({
         id: instance.id,
+        label: runningDistro === null ? yield* instance.label : `WSL (${runningDistro})`,
+        runningDistro,
+        httpBaseUrl: httpBaseUrl.href,
+        wsBaseUrl: toWebSocketBaseUrl(httpBaseUrl),
+        // A backend launched with the desktop secret accepts whichever token the secret derives
+        // for the current window, so hand out that one rather than the token frozen into its
-        label: yield* instance.label,
-        runningDistro: null,
-        httpBaseUrl: null,
+        // launch config.
+        ...(bootstrap.desktopBootstrapSecret
-        wsBaseUrl: null,
+          ? { bootstrapToken: yield* configuration.currentBootstrapToken }
+          : bootstrap.desktopBootstrapToken
+            ? { bootstrapToken: bootstrap.desktopBootstrapToken }
+            : {}),
       });
-      continue;
     }
-    const { bootstrap, httpBaseUrl } = config.value;
-    const runningDistro = config.value.runningDistro ?? null;
-    bootstraps.push({
-      id: instance.id,
-      label: runningDistro === null ? yield* instance.label : `WSL (${runningDistro})`,
-      runningDistro,
-      httpBaseUrl: httpBaseUrl.href,
-      wsBaseUrl: toWebSocketBaseUrl(httpBaseUrl),
-      // A backend launched with the desktop secret accepts whichever token the secret derives
-      // for the current window, so hand out that one rather than the token frozen into its
-      // launch config.
-      ...(bootstrap.desktopBootstrapSecret
-        ? { bootstrapToken: yield* configuration.currentBootstrapToken }
-        : bootstrap.desktopBootstrapToken
-          ? { bootstrapToken: bootstrap.desktopBootstrapToken }
-          : {}),
-    });
-  }
-  return bootstraps;
-});
-
-export const getLocalEnvironmentBootstraps = DesktopIpc.makeSyncIpcMethod({
-  channel: IpcChannels.GET_LOCAL_ENVIRONMENT_BOOTSTRAPS_CHANNEL,
+    return bootstraps;
+  }),
-  result: Schema.Array(DesktopEnvironmentBootstrapSchema),
-  handler: readLocalEnvironmentBootstrapSnapshot,
 });
 
-export const readLocalEnvironmentBootstraps = DesktopIpc.makeIpcMethod({
-  channel: IpcChannels.GET_LOCAL_ENVIRONMENT_BOOTSTRAPS_CHANNEL,
-  payload: Schema.Void,
-  result: Schema.Array(DesktopEnvironmentBootstrapSchema),
-  handler: readLocalEnvironmentBootstrapSnapshot,
-});
-
 function extractWslDistroFromEnvironmentId(envId: string): string | null {
   if (!envId.startsWith(DesktopWslBackend.WSL_INSTANCE_ID_PREFIX)) {
     return null;
```

## apps/desktop/src/ipc/methods/wsl.test.ts

Status: modified; +0; −37

```diff
@@ -120,43 +120,6 @@
     ),
   );
 
-  it.effect("does not enumerate distros until the WSL backend is enabled", () => {
-    const distros = [
-      { name: "Ubuntu", isDefault: true, version: 2 as const },
-      { name: "Debian", isDefault: false, version: 2 as const },
-    ];
-    const layer = Layer.mergeAll(
-      DesktopAppSettings.layerTest({
-        ...DesktopAppSettings.DEFAULT_DESKTOP_SETTINGS,
-        wslDistro: "Debian",
-      }),
-      DesktopWslEnvironment.layerTest({ isAvailable: true, distros }),
-      layerWslBackend(),
-      layerLifecycle([]),
-      layerUnusedLifecycleRuntime,
-    );
-
-    return Effect.gen(function* () {
-      const wsl = yield* DesktopWslEnvironment.DesktopWslEnvironment;
-      const state = yield* getWslState.handler(undefined).pipe(
-        Effect.provideService(DesktopWslEnvironment.DesktopWslEnvironment, {
-          ...wsl,
-          listDistros: Effect.die("must not enumerate distros"),
-        }),
-        Effect.flatMap(decodeWslState),
-      );
-      assert.equal(state.enabled, false);
-      assert.equal(state.available, true);
-      assert.equal(state.distro, "Debian");
-      assert.deepEqual(state.distros, []);
-
-      const enabledState = yield* invokeSetWslBackendEnabled(true);
-      assert.equal(enabledState.enabled, true);
-      assert.equal(enabledState.distro, "Debian");
-      assert.deepEqual(enabledState.distros, distros);
-    }).pipe(Effect.provide(layer));
-  });
-
   it.effect("stages dual-backend preferences before enabling without relaunching", () => {
     const relaunchReasons: Array<string> = [];
     const layer = Layer.mergeAll(
```

## apps/desktop/src/ipc/methods/wsl.ts

Status: modified; +3; −3

```diff
@@ -22,9 +22,9 @@
   const wslBackend = yield* DesktopWslBackend.DesktopWslBackend;
   const settings = yield* appSettings.get;
   const available = settings.localEnvironmentEnabled && (yield* wslEnvironment.isAvailable);
-  // Windows ships a wsl.exe stub that can prompt to install WSL when invoked.
-  // Keep disabled state reads from launching it to enumerate distros.
-  const distros = available && settings.wslBackendEnabled ? yield* wslEnvironment.listDistros : [];
+  // Only enumerate distros when WSL is actually available — listDistros on a
+  // non-WSL host would spawn wsl.exe and hit the timeout for nothing.
+  const distros = available ? yield* wslEnvironment.listDistros : [];
   const preflightError = yield* wslBackend.lastPreflightError;
   return {
     enabled: settings.wslBackendEnabled,
```

## apps/desktop/src/main.ts

Status: modified; +2; −2

```diff
@@ -6,6 +6,7 @@
 }
 
 import * as NodeHttpClient from "@effect/platform-node/NodeHttpClient";
+import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
 import * as NodeServices from "@effect/platform-node/NodeServices";
 // @effect-diagnostics-next-line nodeBuiltinImport:off - Version output must flush before Electron exits, without acquiring the runtime.
 import * as NodeFS from "node:fs";
@@ -21,7 +22,6 @@
 import type { RemoteT3RunnerOptions } from "@t3tools/ssh/tunnel";
 import serverPackageJson from "../../server/package.json" with { type: "json" };
 
-import * as DesktopRuntime from "./app/DesktopRuntime.ts";
 import * as DesktopIpc from "./ipc/DesktopIpc.ts";
 import * as ElectronApp from "./electron/ElectronApp.ts";
 import * as ElectronDialog from "./electron/ElectronDialog.ts";
@@ -242,4 +242,4 @@
   Layer.provideMerge(DesktopPreReadyPlatform.layer),
 );
 
-DesktopApp.program.pipe(Effect.provide(layerDesktopRuntime), DesktopRuntime.runMain);
+DesktopApp.program.pipe(Effect.provide(layerDesktopRuntime), NodeRuntime.runMain);
```

## apps/desktop/src/preload.ts

Status: modified; +8; −17

```diff
@@ -12,7 +12,6 @@
 
 import * as IpcChannels from "./ipc/channels.ts";
 import { mergeLegacyLocalStorage } from "./legacyLocalStorageMerge.ts";
-import { createPreloadSnapshot } from "./preloadSnapshot.ts";
 
 const SNAP_SHOT_EVENT_TYPES = new Set([
   "requested",
@@ -75,18 +74,6 @@
   return result as Awaited<ReturnType<DesktopBridge["ensureSshEnvironment"]>>;
 }
 
-const readBootstraps = (
-  result: unknown,
-): ReturnType<DesktopBridge["getLocalEnvironmentBootstraps"]> =>
-  Array.isArray(result) ? result : [];
-const localEnvironmentBootstraps = createPreloadSnapshot(
-  () => readBootstraps(ipcRenderer.sendSync(IpcChannels.GET_LOCAL_ENVIRONMENT_BOOTSTRAPS_CHANNEL)),
-  async () =>
-    readBootstraps(await ipcRenderer.invoke(IpcChannels.GET_LOCAL_ENVIRONMENT_BOOTSTRAPS_CHANNEL)),
-);
-// Changes take effect on relaunch, so renderer reads can reuse the startup value.
-let localEnvironmentEnabled: boolean | undefined;
-
 contextBridge.exposeInMainWorld("desktopBridge", {
   getAppBranding: () => {
     const result = ipcRenderer.sendSync(IpcChannels.GET_APP_BRANDING_CHANNEL);
@@ -116,13 +103,17 @@
     const result = ipcRenderer.sendSync(IpcChannels.GET_SYSTEM_LOCALE_CHANNEL);
     return typeof result === "string" ? result : null;
   },
-  getLocalEnvironmentBootstraps: localEnvironmentBootstraps.read,
+  getLocalEnvironmentBootstraps: () => {
-  readLocalEnvironmentBootstraps: localEnvironmentBootstraps.refresh,
+    const result = ipcRenderer.sendSync(IpcChannels.GET_LOCAL_ENVIRONMENT_BOOTSTRAPS_CHANNEL);
+    if (!Array.isArray(result)) {
+      return [];
+    }
+    return result as ReturnType<DesktopBridge["getLocalEnvironmentBootstraps"]>;
+  },
   getLocalEnvironmentBearerToken: () =>
     ipcRenderer.invoke(IpcChannels.GET_LOCAL_ENVIRONMENT_BEARER_TOKEN_CHANNEL),
   getLocalEnvironmentEnabled: () =>
-    (localEnvironmentEnabled ??=
+    ipcRenderer.sendSync(IpcChannels.GET_LOCAL_ENVIRONMENT_ENABLED_CHANNEL) !== false,
-      ipcRenderer.sendSync(IpcChannels.GET_LOCAL_ENVIRONMENT_ENABLED_CHANNEL) !== false),
   setLocalEnvironmentEnabled: (enabled) =>
     ipcRenderer.invoke(IpcChannels.SET_LOCAL_ENVIRONMENT_ENABLED_CHANNEL, enabled),
   getClientSettings: () => ipcRenderer.invoke(IpcChannels.GET_CLIENT_SETTINGS_CHANNEL),
```

[Next page](https://git.cafe/pingdotgg/t3code/pull/22222/diffs?after=ImFwcHMvZGVza3RvcC9zcmMvcHJlbG9hZC50cyI&expectedVersion=3&format=markdown)
