An always-on second brain you talk to. Voice notes in Telegram → typed, linked knowledge in your Obsidian vault. Runs 24/7 on the Claude subscription you already have.
Python ai-agentsai-automationclaudeclaude-codeebbinghausknowledge-graphllmmemory-systemobsidianpersonal-assistantpkmproductivitypythonsecond-braintelegram-botvoice-assistant
fix(cron): warn once when a recurring job is enabled but dormant
smixse188a38d7158
diff --git a/src/d_brain/services/cron_runner.py b/src/d_brain/services/cron_runner.pyindex 945e596..9c6bce9 100644--- a/src/d_brain/services/cron_runner.py+++ b/src/d_brain/services/cron_runner.py@@ -69,6 +69,7 @@ class CronRunner:self.max_consecutive_errors = max_consecutive_errorsself.retry_seconds = retry_secondsself.clock = clock or (lambda: datetime.now(UTC))+ self._warned_dormant: set[str] = set()# ── scheduling ───────────────────────────────────────────────────@@ -86,6 +87,22 @@ class CronRunner:def advance(jobs: list[CronJob]) -> None:for job in jobs:if not job.enabled or not job.state.next_run:+ # A recurring job without next_run can never fire —+ # broken state (hand-edited jobs.json), unlike an+ # at-job, which legitimately ends with None. Warn+ # once, not every tick.+ if (+ job.enabled+ and job.schedule.kind != "at"+ and job.id not in self._warned_dormant+ ):+ self._warned_dormant.add(job.id)+ logger.warning(+ "job %s is enabled but has no next_run — "+ "it will never fire; re-add or enable it "+ "via the cron CLI",+ job.id,+ )continuetry:due_at = datetime.fromisoformat(job.state.next_run)diff --git a/tests/test_cron_runner.py b/tests/test_cron_runner.pyindex b9554f5..08cac9d 100644--- a/tests/test_cron_runner.py+++ b/tests/test_cron_runner.py@@ -361,3 +361,33 @@ def test_wrap_job_prompt_contract():assert "d_brain.cron" in wrapped# marker instruction belongs to ask(wrap=True), never duplicated hereassert "<<<R:" not in wrapped+++def test_dormant_recurring_job_warns_once(tmp_path, caplog):+ # A recurring job with next_run=None can never fire again — that is+ # a broken state (hand-edited jobs.json), not a completed one-shot.+ # Surface it once, do not spam every tick.+ store = _store(tmp_path)+ _add_job(store, "stuck")+ store.mutate(lambda jobs: setattr(jobs[0].state, "next_run", None))+ runner = _runner(store, FakeSession([]))++ with caplog.at_level("WARNING"):+ assert runner.claim_due(NOW) == []+ assert runner.claim_due(NOW) == []++ warnings = [r for r in caplog.records if "stuck" in r.getMessage()]+ assert len(warnings) == 1+++def test_completed_one_shot_does_not_warn(tmp_path, caplog):+ # at-jobs legitimately end with next_run=None after success.+ store = _store(tmp_path)+ _add_job(store, "done", kind="at")+ store.mutate(lambda jobs: setattr(jobs[0].state, "next_run", None))+ runner = _runner(store, FakeSession([]))++ with caplog.at_level("WARNING"):+ assert runner.claim_due(NOW) == []++ assert [r for r in caplog.records if "done" in r.getMessage()] == []