fix: default agent profile to 'Auto (Optimized)' for all users

Add one-time migration to reset selectedAgentProfile to 'auto' for
existing users. This ensures the optimized per-phase model selection
is the default experience for everyone.

The migration:
- Runs once on settings load (tracked by _migratedAgentProfileToAuto flag)
- Sets selectedAgentProfile to 'auto'
- Persists the change to settings.json
- Users can still change their preference afterward

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
AndyMik90
2025-12-20 12:18:39 +01:00
parent 37ace0a39a
commit 08aa2ff02b
@@ -95,6 +95,7 @@ export function registerSettingsHandlers(
IPC_CHANNELS.SETTINGS_GET,
async (): Promise<IPCResult<AppSettings>> => {
let settings = { ...DEFAULT_APP_SETTINGS };
let needsSave = false;
if (existsSync(settingsPath)) {
try {
@@ -105,6 +106,15 @@ export function registerSettingsHandlers(
}
}
// Migration: Reset agent profile to 'auto' for existing users (one-time)
// This ensures all users get the optimized 'auto' profile as the default
const settingsAny = settings as Record<string, unknown>;
if (!settingsAny._migratedAgentProfileToAuto) {
settings.selectedAgentProfile = 'auto';
settingsAny._migratedAgentProfileToAuto = true;
needsSave = true;
}
// If no manual autoBuildPath is set, try to auto-detect
if (!settings.autoBuildPath) {
const detectedPath = detectAutoBuildSourcePath();
@@ -113,6 +123,15 @@ export function registerSettingsHandlers(
}
}
// Persist migration changes
if (needsSave) {
try {
writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
} catch {
// Ignore write errors during migration
}
}
return { success: true, data: settings as AppSettings };
}
);