Skip to content

The agent that grows with you

fix(agent): neutral wording for the init-fallback refusal summary

kshitijk4poorc3abdfb97823
diff --git a/agent/agent_init.py b/agent/agent_init.py
index 2222e02e48f..fab19f341b1 100644
--- a/agent/agent_init.py
+++ b/agent/agent_init.py
@@ -884,8 +884,10 @@ def _routed_client_kwargs(agent, fallback_model, _provider_timeout) -> Optional[
agent.model = _fb_model or _fb["model"]
return _client_kwargs_from_routed(_fb_client, _provider_timeout)
if _refused_entries:
+ # Neutral wording: the explicit-provider branch below raises the provider-specific
+ # missing-credentials message, not the generic "No LLM provider configured" one.
logger.warning(
- "No LLM provider configured: primary %r unresolvable and fallback entries refused: %s",
+ "Init-time provider resolution failed: primary %r unresolvable; fallback entries refused: %s",
agent.provider,
"; ".join(f"{_p} ({_r})" for _p, _r in _refused_entries),
)
diff --git a/tests/agent/test_init_fallback_refusal_warning.py b/tests/agent/test_init_fallback_refusal_warning.py
index 9cc33b2564a..59433cf56f3 100644
--- a/tests/agent/test_init_fallback_refusal_warning.py
+++ b/tests/agent/test_init_fallback_refusal_warning.py
@@ -92,3 +92,30 @@ def test_recovered_ladder_does_not_warn(tmp_path, monkeypatch, caplog):
assert agent.provider == "kimi"
assert agent._fallback_activated
assert not [r for r in caplog.records if r.levelno >= logging.WARNING]
+
+
+def test_explicit_provider_branch_warning_does_not_claim_no_provider_configured(
+ tmp_path, monkeypatch, caplog
+):
+ """An explicit non-OpenRouter primary raises the provider-specific missing-credentials
+ message; the refusal summary must still name every entry without asserting the
+ generic ``No LLM provider configured`` verdict that branch never produces."""
+ from agent import agent_init
+
+ monkeypatch.setenv("HERMES_HOME", str(tmp_path))
+ _refusing_router(monkeypatch)
+
+ agent = _agent()
+ agent.provider = "anthropic"
+ with caplog.at_level(logging.WARNING, logger="run_agent"):
+ with pytest.raises(RuntimeError) as excinfo:
+ agent_init._routed_client_kwargs(agent, _LADDER, 60)
+
+ assert "No LLM provider configured" not in str(excinfo.value)
+ warnings = [r for r in caplog.records if r.levelno >= logging.WARNING]
+ assert len(warnings) == 1
+ text = warnings[0].getMessage()
+ assert not text.startswith("No LLM provider configured")
+ assert "anthropic" in text
+ assert "deepseek" in text and "no usable credentials" in text
+ assert "kimi" in text and "kimi auth handshake refused" in text