fix(#5619): clear stale cfg overrides on profile switch

This commit is contained in:
Rod Boev
2026-07-05 16:33:01 -04:00
parent 4c3a4e011e
commit 2f815f040c
2 changed files with 76 additions and 1 deletions
+3 -1
View File
@@ -521,7 +521,7 @@ def _refresh_config_cache(config_path: Path | None = None) -> None:
Callers must hold _cfg_lock when invoking this helper because it mutates
shared state.
"""
global _cfg_mtime, _cfg_path, _cfg_fingerprint
global _cfg_mtime, _cfg_path, _cfg_fingerprint, cfg
if config_path is None:
config_path = _get_config_path()
_cfg_cache.clear()
@@ -582,6 +582,8 @@ def _refresh_config_cache(config_path: Path | None = None) -> None:
logger.debug("Failed to load yaml config from %s", config_path)
_apply_config_defaults(_cfg_cache)
_cfg_fingerprint = _fingerprint_config(_cfg_cache)
# A real reload retargets the legacy cfg alias to the cache for this path.
cfg = _cfg_cache
# Bust the models cache so the next request sees fresh config values.
# Only delete the disk cache when config has actually changed -- not on
# first-ever load (when _old_cfg_mtime == 0.0, i.e. server start or