fix(cli): preserve setup config picker writes

Resync the setup wizard's in-memory config after the shared model picker writes to disk so the wizard's final save does not overwrite auxiliary choices or other provider updates.\n\nAdds a regression test for auxiliary task choices saved by the picker.
This commit is contained in:
stepanov1975 2026-05-08 20:54:55 +00:00 committed by Teknium
parent 3f552568c1
commit e13f242f01
2 changed files with 37 additions and 6 deletions

View file

@ -820,13 +820,12 @@ def setup_model_provider(config: dict, *, quick: bool = False):
# Re-sync the wizard's config dict from what cmd_model saved to disk.
# This is critical: cmd_model writes to disk via its own load/save cycle,
# and the wizard's final save_config(config) must not overwrite those
# changes with stale values (#4172).
# changes with stale values (#4172). Refresh the dict in place so callers
# that keep the same object see every section the shared model picker may
# have changed (model, custom_providers, auxiliary, provider metadata, etc.).
_refreshed = load_config()
config["model"] = _refreshed.get("model", config.get("model"))
if "custom_providers" in _refreshed:
config["custom_providers"] = _refreshed["custom_providers"]
else:
config.pop("custom_providers", None)
config.clear()
config.update(_refreshed)
# Derive the selected provider for downstream steps (vision setup).
selected_provider = None