The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(background_review): say so when the configured review route falls back to the main model
teknium19910041d0f4b
diff --git a/agent/background_review.py b/agent/background_review.pyindex 63eb0e61815..3a07658c645 100644--- a/agent/background_review.py+++ b/agent/background_review.py@@ -256,10 +256,29 @@ def _resolve_review_runtime(agent: Any, task_cfg: Optional[Dict[str, Any]] = Non"args": list(rp.get("args") or []), "routed": True,}except Exception as e:- logger.debug("background-review aux routing failed (%s); using main model", e)+ _warn_review_routing_fallback(agent, task_provider, task_model, e)return parent+def _warn_review_routing_fallback(agent: Any, task_provider: str, task_model: str, error: Exception) -> None:+ """The configured review route could not be resolved, so the fork runs on the main model. That+ was a debug-level line nobody saw (#116055): the misrouted model never ran and nothing said so.+ User-visible notice once per agent (same rail as the reasoning_effort notice); log every time."""+ message = (+ f"⚠ auxiliary.background_review.provider='{task_provider}' (model '{task_model}') could not be "+ f"resolved: {str(error).splitlines()[0]} — background reviews run on the main model "+ f"{agent.provider}/{agent.model} instead. Run 'hermes doctor' to check auxiliary routing."+ )+ logger.warning("%s", message)+ if getattr(agent, "_warned_bg_review_routing", False):+ return+ agent._warned_bg_review_routing = True+ emit = getattr(agent, "_emit_warning", None)+ if callable(emit):+ with suppress(Exception):+ emit(message)++def _parent_can_emit_tool_calls(agent: Any) -> bool:"""Whether a fork inheriting ``agent``'s runtime could act at all: an agent-as-provider clientshim declaring ``SUPPORTS_HERMES_TOOL_CALLS = False`` (instance or class) is skipped — the forkdiff --git a/agent/curator.py b/agent/curator.pyindex cd90183ef3c..27c181d2ce1 100644--- a/agent/curator.py+++ b/agent/curator.py@@ -1011,7 +1011,7 @@ def _resolve_review_provider() -> tuple:explicit provider/model hits an auto-resolution path that fails for OAuth-only providers and pooled credentials(HTTP 400 "No models provided"). Never raises."""rp: Dict[str, Any] = {}- overrides, provider, model_name = {}, None, ""+ overrides, provider, model_name, binding = {}, None, "", Nonetry:from hermes_cli.config import load_config_readonlyfrom hermes_cli.runtime_provider import resolve_runtime_provider@@ -1026,7 +1026,8 @@ def _resolve_review_provider() -> tuple:if isinstance(rp.get("model"), str) and rp["model"].strip():model_name = rp["model"].strip()except Exception as e:- logger.debug("Curator provider resolution failed: %s", e, exc_info=True)+ logger.warning("curator: auxiliary.curator.provider '%s' (model '%s') could not be resolved: %s — the review "+ "runs on the main model instead", getattr(binding, "provider", None), model_name, e)return rp, model_name, provider, overridesdiff --git a/agent/moa_loop.py b/agent/moa_loop.pyindex 5ce755d512f..9bebe578950 100644--- a/agent/moa_loop.py+++ b/agent/moa_loop.py@@ -270,8 +270,9 @@ def _slot_runtime(slot: dict[str, Any]) -> dict[str, Any]:extra_body = overrides.get("extra_body") if isinstance(overrides, dict) else Noneif isinstance(extra_body, dict) and extra_body:out["extra_body"] = dict(extra_body)- except Exception as exc: # pragma: no cover - defensive- logger.debug("MoA slot runtime resolution failed for %s: %s", _slot_label(slot), exc)+ except Exception as exc:+ logger.warning("MoA slot %s: provider '%s' could not be resolved (%s); calling with bare provider/model",+ _slot_label(slot), provider, exc)return outwith _runtime_cache_lock:_runtime_cache[cache_key] = (now, out)diff --git a/tests/agent/test_background_review_cost_controls.py b/tests/agent/test_background_review_cost_controls.pyindex 20921bf40cd..9fe3fc2f1b2 100644--- a/tests/agent/test_background_review_cost_controls.py+++ b/tests/agent/test_background_review_cost_controls.py@@ -173,3 +173,23 @@ def test_enabled_false_disables_automatic_review():cfg = {"auxiliary": {"background_review": {"enabled": False}}}with patch("hermes_cli.config.load_config_readonly", return_value=cfg):assert br.load_background_review_settings()[0] is False+++def test_unresolvable_review_provider_falls_back_with_visible_warning(caplog):+ """The fork silently ran on the main model with only a debug line (#116055): the fallback must+ name the configured provider and reason at WARNING and reach the agent's user-visible warning rail."""+ import logging++ agent = _FakeAgent()+ emitted = []+ agent._emit_warning = emitted.append+ cfg = {"auxiliary": {"background_review": {"provider": "no-such-provider", "model": "review-model"}}}+ with patch("hermes_cli.config.load_config", return_value=cfg), patch("hermes_cli.config.load_config_readonly", return_value=cfg):+ with caplog.at_level(logging.WARNING, logger="agent.background_review"):+ rt = br._resolve_review_runtime(agent)+ br._resolve_review_runtime(agent)++ assert rt["routed"] is False and rt["model"] == "gpt-5.5"+ warnings = [r.getMessage() for r in caplog.records if r.levelno >= logging.WARNING]+ assert warnings and all("no-such-provider" in w and "review-model" in w for w in warnings)+ assert len(emitted) == 1 and "no-such-provider" in emitted[0] # once per agent on the user rail