The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(cron): name the remediation commands in the empty-chain failure alert
Victor Kyriazakos4282c69120d5
diff --git a/cron/scheduler.py b/cron/scheduler.pyindex 8d02af6e9f4..d096b5f252c 100644--- a/cron/scheduler.py+++ b/cron/scheduler.py@@ -122,7 +122,11 @@ def _fallback_chain_phrase() -> str:return "Fallback chain was exhausted or unavailable."if chain:return "Fallback chain was exhausted or unavailable."- return "No fallback chain configured."+ return (+ "No fallback chain configured — add one with `hermes fallback add`, "+ "or set a cron fleet default via `cron.model` + `cron.model_provider` "+ "in config.yaml."+ )def _summarize_cron_failure_for_delivery(job: dict, error: str | None) -> str:diff --git a/tests/cron/test_cron_failure_alert_remediation_hint.py b/tests/cron/test_cron_failure_alert_remediation_hint.pynew file mode 100644index 00000000000..a30bc56a077--- /dev/null+++ b/tests/cron/test_cron_failure_alert_remediation_hint.py@@ -0,0 +1,47 @@+"""The empty-chain failure alert must tell the operator how to fix it.++Coatue field report (2026-08-11): a user whose cron died with "No fallback+chain configured." still cannot self-serve — the alert names the problem but+not the remedy. The empty-chain branch of _fallback_chain_phrase() must name+the exact commands: `hermes fallback add` for the chain, and the+cron.model / cron.model_provider fleet-default keys as the operator-level+alternative. The exhausted branch stays terse — the chain is intact and the+problem is provider-side, so no config command applies.+"""++import cron.scheduler as scheduler+from cron.scheduler import _summarize_cron_failure_for_delivery+++def test_empty_chain_alert_names_the_remediation_commands(monkeypatch):+ monkeypatch.setattr(scheduler, "load_config", lambda: {"fallback_providers": []})+ monkeypatch.setattr(scheduler, "get_fallback_chain", lambda cfg: [])+ job = {"name": "semi-analyst-radar", "id": "aaa111"}+ msg = _summarize_cron_failure_for_delivery(job, "Request timed out.")+ assert "No fallback chain configured" in msg+ assert "hermes fallback add" in msg+ assert "cron.model_provider" in msg+++def test_exhausted_chain_alert_does_not_carry_the_config_hint(monkeypatch):+ monkeypatch.setattr(+ scheduler, "load_config",+ lambda: {"fallback_providers": [{"provider": "openrouter", "model": "x"}]},+ )+ monkeypatch.setattr(+ scheduler, "get_fallback_chain",+ lambda cfg: [{"provider": "openrouter", "model": "x"}],+ )+ job = {"name": "semi-analyst-radar", "id": "aaa111"}+ msg = _summarize_cron_failure_for_delivery(job, "Request timed out.")+ assert "Fallback chain was exhausted or unavailable." in msg+ assert "hermes fallback add" not in msg+++def test_rate_limit_empty_chain_also_carries_the_hint(monkeypatch):+ monkeypatch.setattr(scheduler, "load_config", lambda: {"fallback_providers": []})+ monkeypatch.setattr(scheduler, "get_fallback_chain", lambda cfg: [])+ job = {"name": "kz-coverage", "id": "bbb222"}+ msg = _summarize_cron_failure_for_delivery(job, "HTTP 429: rate limit exceeded")+ assert "No fallback chain configured" in msg+ assert "hermes fallback add" in msgdiff --git a/tests/cron/test_cron_failure_summarizer_inactivity.py b/tests/cron/test_cron_failure_summarizer_inactivity.pyindex 46a2a2c723c..b5286af5c00 100644--- a/tests/cron/test_cron_failure_summarizer_inactivity.py+++ b/tests/cron/test_cron_failure_summarizer_inactivity.py@@ -45,7 +45,7 @@ def test_genuine_provider_timeout_with_no_fallback_configured(monkeypatch):error = "Request timed out."msg = _summarize_cron_failure_for_delivery(job, error)assert "provider timeout" in msg- assert "No fallback chain configured." in msg+ assert "No fallback chain configured" in msgassert "exhausted or unavailable" not in msg@@ -94,4 +94,4 @@ def test_rate_limit_classification_still_takes_priority_over_inactivity_text(monerror = "HTTP 429: weekly usage limit exceeded"msg = _summarize_cron_failure_for_delivery(job, error)assert "weekly usage limit" in msg- assert "No fallback chain configured." in msg+ assert "No fallback chain configured" in msg