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;