Compare commits

...

1 Commits

Author SHA1 Message Date
Alexander Whitestone
81aa6f921f fix: suppress fallback_model warnings for blank/disabled fields (#373)
Some checks failed
Forge CI / smoke-and-build (pull_request) Failing after 56s
When fallback_model is present in config.yaml but has blank fields or
explicitly set enabled: false, treat it as intentionally disabled rather
than emitting startup warnings about missing provider/model fields.

Changes:
- gateway/run.py _load_fallback_model(): return None for empty dicts or
  enabled:false fallback_model entries
- hermes_cli/config.py validate_config_structure(): skip warnings when
  fallback_model has enabled: false; improved hint messages to suggest
  the enabled: false convention
2026-04-13 18:17:02 -04:00
2 changed files with 25 additions and 5 deletions

View File

@@ -1026,6 +1026,16 @@ class GatewayRunner:
cfg = _y.safe_load(_f) or {}
fb = cfg.get("fallback_providers") or cfg.get("fallback_model") or None
if fb:
# Treat empty dict / disabled fallback as "not configured"
if isinstance(fb, dict):
_enabled = fb.get("enabled")
if _enabled is False or (
isinstance(_enabled, str)
and _enabled.strip().lower() in ("false", "0", "no", "off")
):
return None
if not fb.get("provider") and not fb.get("model"):
return None
return fb
except Exception:
pass

View File

@@ -1421,6 +1421,7 @@ def validate_config_structure(config: Optional[Dict[str, Any]] = None) -> List["
))
# ── fallback_model must be a top-level dict with provider + model ────
# Blank or explicitly disabled fallback is intentional — skip validation.
fb = config.get("fallback_model")
if fb is not None:
if not isinstance(fb, dict):
@@ -1430,20 +1431,29 @@ def validate_config_structure(config: Optional[Dict[str, Any]] = None) -> List["
"Change to:\n"
" fallback_model:\n"
" provider: openrouter\n"
" model: anthropic/claude-sonnet-4",
" model: anthropic/claude-sonnet-4\n"
"Or disable with:\n"
" fallback_model:\n"
" enabled: false",
))
elif fb:
if not fb.get("provider"):
# Skip warnings when fallback is explicitly disabled (enabled: false)
_enabled = fb.get("enabled")
if _enabled is False or (isinstance(_enabled, str) and _enabled.strip().lower() in ("false", "0", "no", "off")):
pass # intentionally disabled — no warnings
elif not fb.get("provider"):
issues.append(ConfigIssue(
"warning",
"fallback_model is missing 'provider' field — fallback will be disabled",
"Add: provider: openrouter (or another provider)",
"Add: provider: openrouter (or another provider)\n"
"Or disable with: enabled: false",
))
if not fb.get("model"):
elif not fb.get("model"):
issues.append(ConfigIssue(
"warning",
"fallback_model is missing 'model' field — fallback will be disabled",
"Add: model: anthropic/claude-sonnet-4 (or another model)",
"Add: model: anthropic/claude-sonnet-4 (or another model)\n"
"Or disable with: enabled: false",
))
# ── Check for fallback_model accidentally nested inside custom_providers ──