diff --git a/cheddahbot/config.py b/cheddahbot/config.py index bfcdf14..024543d 100644 --- a/cheddahbot/config.py +++ b/cheddahbot/config.py @@ -49,6 +49,7 @@ class ClickUpConfig: error_status: str = "error" task_type_field_name: str = "Work Category" default_auto_execute: bool = False + poll_task_types: list[str] = field(default_factory=list) skill_map: dict = field(default_factory=dict) enabled: bool = False diff --git a/cheddahbot/scheduler.py b/cheddahbot/scheduler.py index 89b23a3..548037d 100644 --- a/cheddahbot/scheduler.py +++ b/cheddahbot/scheduler.py @@ -357,12 +357,14 @@ class Scheduler: now_ms = int(datetime.now(UTC).timestamp() * 1000) due_date_lt = now_ms + (self.DUE_DATE_WINDOW_WEEKS * 7 * 24 * 60 * 60 * 1000) + # Explicit allowlist of Work Category values to poll + allowed_types = self.config.clickup.poll_task_types or list(skill_map.keys()) + custom_fields_filter = None if self._field_filter_cache and self._field_filter_cache.get("options"): field_id = self._field_filter_cache["field_id"] options = self._field_filter_cache["options"] - # Only include options that map to skills we have - matching_opt_ids = [options[name] for name in skill_map if name in options] + matching_opt_ids = [options[name] for name in allowed_types if name in options] if matching_opt_ids: import json as _json @@ -378,12 +380,8 @@ class Scheduler: ) for task in tasks: - # ClickUp status filtering is the dedup: tasks in poll_statuses - # are eligible; once moved to "automation underway", they won't - # appear in the next poll. - - # Client-side verify: Work Category must be in skill_map - if task.task_type not in skill_map: + # Client-side verify: Work Category must be in allowed types AND skill_map + if task.task_type not in allowed_types or task.task_type not in skill_map: continue # Respect auto_execute flag — skip tasks that require manual trigger diff --git a/config.yaml b/config.yaml index bf9524a..8bed54d 100644 --- a/config.yaml +++ b/config.yaml @@ -43,6 +43,7 @@ email: clickup: poll_interval_minutes: 20 # 3x per hour poll_statuses: ["to do", "outline approved"] + poll_task_types: ["Press Release", "On Page Optimization", "Content Creation", "Link Building"] review_status: "internal review" pr_review_status: "pr needs review" in_progress_status: "in progress" diff --git a/tests/test_scheduler.py b/tests/test_scheduler.py index a36e296..a92bbe9 100644 --- a/tests/test_scheduler.py +++ b/tests/test_scheduler.py @@ -35,6 +35,7 @@ class _FakeClickUpConfig: error_status: str = "error" task_type_field_name: str = "Work Category" default_auto_execute: bool = True + poll_task_types: list[str] = field(default_factory=lambda: ["Press Release"]) skill_map: dict = field(default_factory=lambda: {"Press Release": _PR_MAPPING}) enabled: bool = True