# Scheduler Refactor Notes ## Issue: AutoCora Single-Day Window (found 2026-02-27) **Symptom:** Task `86b8grf16` ("LINKS - anti vibration rubber mounts", due Feb 18) has been sitting in "to do" forever with no Cora report generated. **Root cause:** `_find_qualifying_tasks()` in `tools/autocora.py` filters tasks to **exactly one calendar day** (the `target_date`, which defaults to today). The scheduler calls this daily with `today`: ```python today = datetime.now(UTC).strftime("%Y-%m-%d") result = submit_autocora_jobs(target_date=today, ctx=ctx) ``` If CheddahBot isn't running on the task's due date (or the DB is empty/wiped), the task is **permanently orphaned** — no catch-up, no retry, no visibility. **Affected task types:** All three `cora_categories` — Link Building, On Page Optimization, Content Creation. **What needs to change:** Auto-submit should also pick up overdue tasks (due date in the past, still "to do", no existing AutoCora job in KV store). --- ## Empty Database State (found 2026-02-27) `cheddahbot.db` has zero rows in all tables (kv_store, notifications, scheduled_tasks, etc.). Either fresh DB or wiped. This means: - No task state tracking is happening - No AutoCora job submissions are recorded - Folder watcher has no history - All loops show no `last_run` timestamps --- ## Context: Claude Scheduled Tasks Claude released scheduled tasks (2026-02-26). Need to evaluate whether parts of CheddahBot's scheduler (heartbeat, poll loop, ClickUp polling, folder watchers, AutoCora) could be replaced or augmented by Claude's native scheduling. --- ## Additional Issues to Investigate - [ ] `auto_execute: false` on Link Building — is this intentional given the folder-watcher pipeline? - [ ] Folder watcher at `Z:/cora-inbox` — does this path stay accessible? - [ ] No dashboard/UI surfacing "tasks waiting for action" — stuck tasks are invisible - [ ] AutoCora loop waits 30s before first poll, then runs every 5min — but auto-submit only checks today's tasks each cycle (redundant repeated calls)