From 7bc1f04e27ad7d09fa186ba4cb2a780ce241093d Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Fri, 27 Mar 2026 22:48:27 +0700 Subject: [PATCH] fix(desktop): restore windows daemon bootstrap logging --- packages/app/src/runtime/host-runtime.ts | 37 +++++++++++++++++------- packages/desktop/src/main.ts | 2 +- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/packages/app/src/runtime/host-runtime.ts b/packages/app/src/runtime/host-runtime.ts index c228273bd..237a246e1 100644 --- a/packages/app/src/runtime/host-runtime.ts +++ b/packages/app/src/runtime/host-runtime.ts @@ -1162,19 +1162,34 @@ export class HostRuntimeStore { } private async bootstrapDesktop(): Promise { - try { - const daemon = await startDesktopDaemon(); - const connection = connectionFromListen(daemon.listen); - if (!connection || !daemon.serverId) { + let lastError: unknown = null; + + for (let attempt = 1; attempt <= 3; attempt += 1) { + try { + const daemon = await startDesktopDaemon(); + const connection = connectionFromListen(daemon.listen); + if (!connection || !daemon.serverId) { + return; + } + await this.upsertHostConnection({ + serverId: daemon.serverId, + label: daemon.hostname ?? undefined, + connection, + }); return; + } catch (error) { + lastError = error; + console.warn(`[HostRuntime] Failed to bootstrap desktop daemon (attempt ${attempt}/3)`, error); + if (attempt < 3) { + await new Promise((resolve) => { + setTimeout(resolve, attempt * 500); + }); + } } - await this.upsertHostConnection({ - serverId: daemon.serverId, - label: daemon.hostname ?? undefined, - connection, - }); - } catch (error) { - console.warn("[HostRuntime] Failed to bootstrap desktop daemon", error); + } + + if (lastError) { + console.warn("[HostRuntime] Desktop daemon bootstrap exhausted retries", lastError); } } diff --git a/packages/desktop/src/main.ts b/packages/desktop/src/main.ts index 1579045fd..e0a476968 100644 --- a/packages/desktop/src/main.ts +++ b/packages/desktop/src/main.ts @@ -1,5 +1,5 @@ import log from "electron-log/main"; -log.initialize(); +log.initialize({ spyRendererConsole: true }); import path from "node:path"; import { pathToFileURL } from "node:url";