mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-08 13:12:08 +00:00
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.
This commit is contained in:
parent
e670d9cdd6
commit
d91083b2f7
1 changed files with 3 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue