Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(logs): expose alert cleanup task via facade (#64514)

Jon McCallum58d03ebab3dc
diff --git a/posthog/tasks/scheduled.py b/posthog/tasks/scheduled.py
index 07f949b990ea..1e975e21790a 100644
--- a/posthog/tasks/scheduled.py
+++ b/posthog/tasks/scheduled.py
@@ -81,7 +81,7 @@ from products.feature_flags.backend.tasks import (
refresh_expiring_flag_definitions_cache_entries,
refresh_expiring_flags_cache_entries,
)
-from products.logs.backend.tasks import logs_alert_events_cleanup_task
+from products.logs.backend.facade.tasks import logs_alert_events_cleanup_task
from products.reminders.backend.tasks import process_due_reminders
from products.streamlit_apps.backend.facade.api import (
auto_restart_crashed_streamlit_sandboxes,
diff --git a/products/logs/backend/facade/tasks.py b/products/logs/backend/facade/tasks.py
new file mode 100644
index 000000000000..a840d0f337d2
--- /dev/null
+++ b/products/logs/backend/facade/tasks.py
@@ -0,0 +1,11 @@
+"""Facade re-export for the logs Celery task.
+
+Core's beat schedule (``posthog/tasks/scheduled.py``) imports the task object and calls
+``.s()`` on it, so the wiring crosses the boundary as an object, not data. Re-exporting
+the task keeps that coupling at the facade boundary. Its ``name=`` is pinned in
+``tasks/tasks.py``, so the registered task identity is independent of the import path.
+"""
+
+from products.logs.backend.tasks.tasks import logs_alert_events_cleanup_task
+
+__all__ = ["logs_alert_events_cleanup_task"]