Skip to content

The agent that grows with you

fix(config): don't share the cached models mapping with normalized entries

teknium13c6e7b1b114d
diff --git a/hermes_cli/config.py b/hermes_cli/config.py
index d139e2e0b14..38669ed3521 100644
--- a/hermes_cli/config.py
+++ b/hermes_cli/config.py
@@ -1399,7 +1399,10 @@ def _normalize_custom_provider_entry(
models = entry.get("models")
if isinstance(models, dict) and models:
- normalized["models"] = models
+ # Shallow-copy: `entry` may alias a cached config sub-dict, and the
+ # normalized entry escapes into long-lived runtime state
+ # (agent._custom_providers) — don't share the cached models mapping.
+ normalized["models"] = dict(models)
elif isinstance(models, list) and models:
# Hand-edited configs (and older Hermes versions) may write
# ``models`` as a plain list of ids or as ``[{id: ...}]`` rows.