fix: parse JSON-string fallback_providers in YAML config - #63569
Conversation
Duplicate of #51594 (earliest open, Fixes #51560) — both add a |
|
Thanks for the focused shared-helper fix. The premise is confirmed on current main: Problems
Suggested changes
This is an automated hermes-sweeper review. |
When Hermes config set writes a list-valued key like fallback_providers, it serializes as a JSON string inside YAML. The YAML parser returns a string, not a list. _iter_fallback_entries() only handled dict and list types, silently returning empty for strings — which meant the fallback chain never populated and users hit rate-limit dead ends even with multiple fallback providers (including a local llama.cpp model) configured. Add a json.loads() parse guard in _iter_fallback_entries() for strings that look like JSON arrays/objects. The recursion handles both the single-dict legacy fallback_model shape and the multi-entry fallback_providers list shape transparently. Fixes: sessions stuck on rate-limited providers with no fallback activation
dc14077 to
9b702b9
Compare
9b702b9 to
275cad5
Compare
|
@teknium1 Added test_fallback_config.py with |
Problem
When
hermes config setwrites a list-valued config key likefallback_providers, it serializes the list as a JSON string inside YAML:The YAML parser returns this as a
str, not alist._iter_fallback_entries()infallback_config.pyonly handleddictandlisttypes — strings fell through toelse: return [].The fallback chain was silently always empty, even when users configured multiple fallback providers including a local llama.cpp model as a final safety net. Every rate limit from the primary provider (e.g., NVIDIA NIM) burned through all retries with zero fallback activation ever logged.
Users saw
"The model provider is rate-limiting requests..."despite having a fully working llama.cpp local server running atlocalhost:8080.Fix
Added a
json.loads()parse guard in_iter_fallback_entries()for strings that start with[or{. The parsed result is recursively fed back through the same function, so both the legacy single-dictfallback_modelformat and the multi-entryfallback_providerslist format work transparently.Non-JSON strings fall through to existing empty-return behavior unchanged. YAML-native lists/dicts continue to work as before.
Verification
config.yamlcontaining JSON-stringfallback_providers→ chain correctly returns 3 entriesget_fallback_chain()integration test passes with both string and list config valuesresolve_provider_client()