mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
fix(config): don't share the cached models mapping with normalized entries
Companion to the no-mutate fix: normalized['models'] retained a reference to the caller's (possibly cached) models dict, and the normalized entry escapes into long-lived runtime state (agent._custom_providers). Shallow-copy so runtime writes can never reach the shared config cache.
This commit is contained in:
parent
bfe4cbdc2a
commit
3c6e7b1b11
1 changed files with 4 additions and 1 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue