Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): apply startup updates independently
Lizi5876662abb70
diff --git a/apps/desktop/src/main/__tests__/updateService.test.ts b/apps/desktop/src/main/__tests__/updateService.test.tsindex dfdb1b1bf9..ceb44e11e6 100644--- a/apps/desktop/src/main/__tests__/updateService.test.ts+++ b/apps/desktop/src/main/__tests__/updateService.test.ts@@ -348,13 +348,12 @@ describe('startup update relaunch safety', () => {});});- it('keeps the patch staged (no relaunch) when auto-update is disabled', async () => {- await expect(runStartupUpdate({ enabled: false })).resolves.toMatchObject({ action: 'none' });- expect(logInfo).toHaveBeenCalledWith(- 'startup update relaunch deferred (%s); patch v%s remains ready',- 'disabled',- '0.0.65',- );+ it('auto-applies startup updates even when idle auto-install is disabled', async () => {+ await expect(runStartupUpdate({ enabled: false })).resolves.toMatchObject({+ hasUpdate: true,+ action: 'relaunch',+ version: '0.0.65',+ });});it('never runs the startup update flow (nor the native updater) on a dev build', async () => {@@ -364,7 +363,7 @@ describe('startup update relaunch safety', () => {await expect(runStartupUpdate()).resolves.toMatchObject({ hasUpdate: false, action: 'none' });});- it('re-checks the startup policy at the apply boundary, keeping manual apply separate', async () => {+ it('keeps startup and manual relaunch IPC paths separate', async () => {vi.useFakeTimers();fetchManifest.mockResolvedValue(updateManifest());download.mockImplementation(async ({ targetPath }: { targetPath: string }) => {@@ -385,25 +384,14 @@ describe('startup update relaunch safety', () => {await expect(startupHandler?.()).resolves.toMatchObject({ action: 'relaunch' });- // User flips the auto-update switch off during the renderer's presentation- // delay → the apply boundary must still honor it and defer (no relaunch).+ // Startup/Splash relaunch is independent from the background idle setting.readAutoUpdateSettings.mockReturnValue({ autoRelaunchOnIdle: false });- await expect(autoApplyHandler?.({}, 'dark')).resolves.toEqual({- accepted: false,- blockReason: 'disabled',- });expect(service.getUpdateStatus()).toBe('ready');- expect(logInfo).toHaveBeenCalledWith(- 'startup automatic relaunch deferred at apply boundary (%s)',- 'disabled',- );} finally {service.stopUpdateService();}});-});-describe('isUpdateRelaunchImminent', () => {/** Boots the startup flow (staging a patch) and hands back the live module. */async function bootWithStagedPatch(options: { enabled?: boolean } = {}) {vi.useFakeTimers();diff --git a/apps/desktop/src/main/updateService.ts b/apps/desktop/src/main/updateService.tsindex 7c61fa6410..97c25ef06e 100644--- a/apps/desktop/src/main/updateService.ts+++ b/apps/desktop/src/main/updateService.ts@@ -243,7 +243,6 @@ async function getAutoRelaunchBlockReasonForCurrentState(): Promise<AutoRelaunch* launched, so there is no in-flight agent turn / schedule / active session to* interrupt. We therefore relaunch into the updater as soon as a patch is ready,* gating only on the essentials:- * - `disabled` — user turned the auto-update relaunch switch off; respect it.* - `dev` — the native updater replaces the *installed* app; it can't* sanely update a dev / electron-forge instance, so never* auto-launch it there.@@ -255,7 +254,6 @@ async function getAutoRelaunchBlockReasonForCurrentState(): Promise<AutoRelaunch* full policy via getAutoRelaunchBlockReasonForCurrentState.)*/async function getStartupRelaunchBlockReason(): Promise<AutoRelaunchBlockReason | null> {- if (!readAutoUpdateSettings().autoRelaunchOnIdle) return 'disabled';if (isDev()) return 'dev';if (currentStatus !== 'ready') return 'not-ready';if (isRelaunching || autoRelaunchInProgress) return 'relaunching';@@ -265,7 +263,7 @@ async function getStartupRelaunchBlockReason(): Promise<AutoRelaunchBlockReason/*** Startup update checks apply a staged patch as soon as it is ready (the historic* behavior), gated only by the lightweight startup policy above. Whenever that- * policy blocks (auto-update off / dev / not ready / already relaunching) the+ * policy blocks (dev / not ready / relaunching) the* patch stays staged and the app enters normally, surfacing the UpdateBanner.*/async function buildStartupReadyReply(version: string | undefined): Promise<{