The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(cron): W3 bound missed-fire details and ignore empty records
yoniebansbd7d4e30ebfc
diff --git a/hermes_cli/cron.py b/hermes_cli/cron.pyindex fed2d60abb0..30c9ee67b45 100644--- a/hermes_cli/cron.py+++ b/hermes_cli/cron.py@@ -564,11 +564,9 @@ def _cron_doctor_issues_for_job(job: Dict[str, Any]) -> List[str]:issues.append(f"last fire was late (scheduled {scheduled}, {_format_lateness(lateness)} late) — "f"scheduler was delayed")- if fire_err := job.get("last_fire_error"):+ if isinstance(fire_err := job.get("last_fire_error"), dict) and fire_err.get("detail"):# The handoff error survives next_run_at advancing beyond the failed dispatch.- detail = fire_err.get("detail") if isinstance(fire_err, dict) else str(fire_err)- at = fire_err.get("at", "?") if isinstance(fire_err, dict) else "?"- issues.append(f"missed scheduled fire at {at}: {detail}")+ issues.append(f"missed scheduled fire at {fire_err.get('at', '?')}: {_short_reason(fire_err['detail'])}")if job.get("enabled", True) and job.get("state") not in {"paused", "completed"}:next_run = str(job.get("next_run_at") or "").strip()issue = _next_run_overdue_issue(next_run) if next_run else "active job has no next_run_at"diff --git a/tests/hermes_cli/test_cron_satellite_diagnostics.py b/tests/hermes_cli/test_cron_satellite_diagnostics.pyindex 9a55f231429..e55772318d3 100644--- a/tests/hermes_cli/test_cron_satellite_diagnostics.py+++ b/tests/hermes_cli/test_cron_satellite_diagnostics.py@@ -91,6 +91,25 @@ def test_standalone_guidance_matches_profile_membership(profile, monkeypatch, caassert ("hermes --profile default gateway restart" in output) == (home_kind == "named")[email protected]("detail", ["unreachable " * 30 + "\nsecret second line", "", None])+def test_doctor_bounds_persisted_fire_errors(profile, capsys, detail):+ from cron import jobs+ from hermes_cli.cron import _short_reason, cron_doctor++ job = jobs.create_job(prompt="probe", schedule="every 1h")+ records = jobs.load_jobs()+ records[0]["last_fire_error"] = {"at": "test-time", "detail": detail}+ jobs.save_jobs(records)+ assert cron_doctor() == bool(detail)+ output = capsys.readouterr().out+ if detail:+ assert f"missed scheduled fire at test-time: {_short_reason(detail)}" in output+ assert detail not in output+ assert "secret second line" not in output+ else:+ assert "missed scheduled fire" not in output++@pytest.mark.parametrize("dispatch", ["catch_up", "late", "forward_error"])def test_doctor_reports_persisted_dispatch_health(profile, capsys, dispatch):from cron import jobs