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 configuremain
parent
a947c9f9bf
commit
412cc00f41
|
|
@ -42,18 +42,21 @@ namespace MCPForUnity.Editor.Migrations
|
||||||
|
|
||||||
var summary = MCPServiceLocator.Client.ConfigureAllDetectedClients();
|
var summary = MCPServiceLocator.Client.ConfigureAllDetectedClients();
|
||||||
|
|
||||||
if (summary.FailureCount > 0 || summary.SuccessCount == 0)
|
if (summary.FailureCount > 0)
|
||||||
{
|
{
|
||||||
if (summary.Messages != null && summary.Messages.Count > 0)
|
McpLog.Warn($"Legacy configuration migration finished with errors ({summary.GetSummaryMessage()}). details:");
|
||||||
|
if (summary.Messages != null)
|
||||||
{
|
{
|
||||||
McpLog.Debug("Legacy configuration migration details:");
|
|
||||||
foreach (var message in summary.Messages)
|
foreach (var message in summary.Messages)
|
||||||
{
|
{
|
||||||
McpLog.Debug($" {message}");
|
McpLog.Warn($" {message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
McpLog.Warn($"Legacy configuration migration incomplete ({summary.GetSummaryMessage()}). Will retry next session.");
|
McpLog.Warn("Legacy keys will be removed to prevent migration loop. Please configure failing clients manually.");
|
||||||
return;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
McpLog.Info($"Legacy configuration migration complete ({summary.GetSummaryMessage()})");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasServerSrc)
|
if (hasServerSrc)
|
||||||
|
|
@ -67,8 +70,6 @@ namespace MCPForUnity.Editor.Migrations
|
||||||
EditorPrefs.DeleteKey(UseEmbeddedKey);
|
EditorPrefs.DeleteKey(UseEmbeddedKey);
|
||||||
McpLog.Info(" ✓ Removed legacy key: MCPForUnity.UseEmbeddedServer");
|
McpLog.Info(" ✓ Removed legacy key: MCPForUnity.UseEmbeddedServer");
|
||||||
}
|
}
|
||||||
|
|
||||||
McpLog.Info($"Legacy configuration migration complete ({summary.GetSummaryMessage()})");
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue