From d91083b2f7d44b558f1e0b296257bf070f98b1c4 Mon Sep 17 00:00:00 2001 From: aydnOktay Date: Sat, 4 Jul 2026 15:08:49 -0700 Subject: [PATCH] fix(website-policy): key blocklist cache on the real default config path The cache used a '__default__' sentinel as its path key, so switching HERMES_HOME (profiles, tests) within one process kept serving the stale policy loaded from the previous home. Key the cache on the actual resolved default config path instead, so a home/config-path change naturally misses the cache. Trimmed from bundled PR #3923 (the other sub-fixes are superseded on main); authored by @aydnOktay. --- tools/website_policy.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/website_policy.py b/tools/website_policy.py index c621dcbf3c0..e193110fad9 100644 --- a/tools/website_policy.py +++ b/tools/website_policy.py @@ -137,7 +137,8 @@ def load_website_blocklist(config_path: Optional[Path] = None) -> Dict[str, Any] """ global _cached_policy, _cached_policy_path, _cached_policy_time - resolved_path = str(config_path) if config_path else "__default__" + default_path = str(_get_default_config_path()) + resolved_path = str(config_path) if config_path else default_path now = time.monotonic() # Return cached policy if still fresh and same path @@ -193,7 +194,7 @@ def load_website_blocklist(config_path: Optional[Path] = None) -> Dict[str, Any] if config_path == _get_default_config_path(): with _cache_lock: _cached_policy = result - _cached_policy_path = "__default__" + _cached_policy_path = resolved_path _cached_policy_time = now return result