diff --git a/app/MindWork AI Studio/Settings/ConfigMetaBase.cs b/app/MindWork AI Studio/Settings/ConfigMetaBase.cs index c8dd0aff..43fb5c29 100644 --- a/app/MindWork AI Studio/Settings/ConfigMetaBase.cs +++ b/app/MindWork AI Studio/Settings/ConfigMetaBase.cs @@ -159,11 +159,14 @@ public abstract record ConfigMetaBase(string SettingName) : IConfig /// /// Only an unmanaged setting holds a value which belongs to the user. When one configuration /// plugin takes a setting over from another, the current value belongs to the previous plugin, - /// so the snapshot of the user's value must survive that handover untouched. + /// so the snapshot of the user's value must survive that handover untouched.

+ /// The persisted editable default counts as managed as well: unlike a locked setting, it is not + /// restored into the in-memory state when the settings are loaded, so right after a start it is + /// the only evidence that a configuration plugin is already in charge. ///
public void CaptureUserValueSnapshot() { - if (this.ManagedMode is not null) + if (this.ManagedMode is not null || SettingsManagerAccess.ConfigurationData.ManagedEditableDefaults.ContainsKey(this.SettingName)) return; var snapshots = SettingsManagerAccess.ConfigurationData.ManagedUserValueSnapshots; diff --git a/app/MindWork AI Studio/Settings/ManagedConfiguration.Parsing.cs b/app/MindWork AI Studio/Settings/ManagedConfiguration.Parsing.cs index 0aadf8f6..41ac1d54 100644 --- a/app/MindWork AI Studio/Settings/ManagedConfiguration.Parsing.cs +++ b/app/MindWork AI Studio/Settings/ManagedConfiguration.Parsing.cs @@ -913,6 +913,13 @@ public static partial class ManagedConfiguration if (!MayManageSetting(configPluginId, configMeta)) return false; + // + // Remember the value the user had chosen before any configuration plugin took this setting + // over. Once no plugin manages it anymore, we hand that value back to the user: + // + if (successful) + configMeta.CaptureUserValueSnapshot(); + switch (successful) { case true: @@ -967,6 +974,15 @@ public static partial class ManagedConfiguration if (!MayManageSetting(configPluginId, configMeta)) return false; + // + // Remember the value the user had chosen before any configuration plugin took this setting + // over. Once no plugin manages it anymore, we hand that value back to the user. This has to + // happen before the managed state below changes, because only an unmanaged setting holds a + // value which belongs to the user: + // + if (successful) + configMeta.CaptureUserValueSnapshot(); + switch (successful) { case true when managedMode is ManagedConfigurationMode.LOCKED: