From 5e432a4a27ffb156d730db4f94be4e466b254434 Mon Sep 17 00:00:00 2001 From: Mika Kuns Date: Wed, 15 Apr 2026 10:10:02 +0200 Subject: [PATCH] fix(installer): fall back to Config on detection timeout when install.json exists Co-Authored-By: Claude Sonnet 4.6 --- src/ClaudeDo.Installer/App.xaml.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/ClaudeDo.Installer/App.xaml.cs b/src/ClaudeDo.Installer/App.xaml.cs index 10cb77c..fb4ff2f 100644 --- a/src/ClaudeDo.Installer/App.xaml.cs +++ b/src/ClaudeDo.Installer/App.xaml.cs @@ -1,4 +1,3 @@ -using System.IO; using System.Net.Http; using System.Reflection; using System.Windows; @@ -29,7 +28,13 @@ public partial class App : Application // Default install dir for detection — on upgrade we stay where we were. var detector = _services.GetRequiredService(); - var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); + using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)); + + // Read manifest up front so we can fall back to Config if the API times out + // on an existing install. If the API is slow, we do NOT want to drop an + // already-installed user into FreshInstall — that would risk overwriting them. + var existingManifest = InstallManifestStore.TryRead(context.InstallDirectory); + DetectedState state; try { @@ -37,7 +42,9 @@ public partial class App : Application } catch (OperationCanceledException) { - state = new DetectedState(InstallerMode.FreshInstall, null, null, null); + state = existingManifest is not null + ? new DetectedState(InstallerMode.Config, existingManifest, null, null) + : new DetectedState(InstallerMode.FreshInstall, null, null, null); } context.Mode = state.Mode;