Skip to content

Commit 412cc00

Browse files
authored
Improve legacy configuration migration error handling and cleanup (#470)
- Change migration to always clean up legacy keys, even on partial failures - Upgrade migration messages from Debug to Warn/Info for better visibility - Add explicit warning when failures occur that manual configuration is needed - Remove early return on failures to ensure legacy keys are always deleted - Prevents migration retry loops when some clients fail to configure
1 parent a947c9f commit 412cc00

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

MCPForUnity/Editor/Migrations/LegacyServerSrcMigration.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,21 @@ private static void RunMigrationIfNeeded()
4242

4343
var summary = MCPServiceLocator.Client.ConfigureAllDetectedClients();
4444

45-
if (summary.FailureCount > 0 || summary.SuccessCount == 0)
45+
if (summary.FailureCount > 0)
4646
{
47-
if (summary.Messages != null && summary.Messages.Count > 0)
47+
McpLog.Warn($"Legacy configuration migration finished with errors ({summary.GetSummaryMessage()}). details:");
48+
if (summary.Messages != null)
4849
{
49-
McpLog.Debug("Legacy configuration migration details:");
5050
foreach (var message in summary.Messages)
5151
{
52-
McpLog.Debug($" {message}");
52+
McpLog.Warn($" {message}");
5353
}
5454
}
55-
McpLog.Warn($"Legacy configuration migration incomplete ({summary.GetSummaryMessage()}). Will retry next session.");
56-
return;
55+
McpLog.Warn("Legacy keys will be removed to prevent migration loop. Please configure failing clients manually.");
56+
}
57+
else
58+
{
59+
McpLog.Info($"Legacy configuration migration complete ({summary.GetSummaryMessage()})");
5760
}
5861

5962
if (hasServerSrc)
@@ -67,8 +70,6 @@ private static void RunMigrationIfNeeded()
6770
EditorPrefs.DeleteKey(UseEmbeddedKey);
6871
McpLog.Info(" ✓ Removed legacy key: MCPForUnity.UseEmbeddedServer");
6972
}
70-
71-
McpLog.Info($"Legacy configuration migration complete ({summary.GetSummaryMessage()})");
7273
}
7374
catch (Exception ex)
7475
{

0 commit comments

Comments
 (0)