: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(tasks): mirror user-created agent logs (#79434)
Alessandro Pogliaghi79328a04a845
diff --git a/docs/internal/sandboxes-setup-guide.md b/docs/internal/sandboxes-setup-guide.mdindex d6f32f712b3d..85a447b75e4d 100644--- a/docs/internal/sandboxes-setup-guide.md+++ b/docs/internal/sandboxes-setup-guide.md@@ -239,9 +239,9 @@ The collector parses each JSON key into a queryable attribute and turns the emitso one run groups as a trace and can be pulled up with an attribute filter on `task_run_id`.```bash-# Which task origins to mirror (comma-separated). Defaults to signals scouts only.+# Which task origins to mirror (comma-separated). Defaults to signals scouts and user-created tasks.# Set empty to disable.-TASK_RUN_LOGS_MIRROR_ORIGIN_PRODUCTS=signals_scout+TASK_RUN_LOGS_MIRROR_ORIGIN_PRODUCTS=signals_scout,user_created```The mirror also has a **direct OTLP leg** that ships each batch straight to a logs ingest endpoint:diff --git a/posthog/settings/temporal.py b/posthog/settings/temporal.pyindex 115192ed2f46..0f7fafc99d77 100644--- a/posthog/settings/temporal.py+++ b/posthog/settings/temporal.py@@ -113,10 +113,9 @@ TASKS_CREDENTIAL_REFRESH_INITIAL_DELAY_SECONDS: int = get_from_env(# Entries appended to a run's S3 JSONL log are also emitted as structured stdout log lines;# the per-cluster OTel collector already ships container stdout into the region's internal# PostHog project's Logs, so no transport or credentials are needed here. Only runs whose-# task origin_product is in this list are mirrored — scoped to signals scouts for now;-# widen the list to cover more task origins, or set it empty to disable.+# task origin_product is in this list are mirrored. Set it empty to disable.TASK_RUN_LOGS_MIRROR_ORIGIN_PRODUCTS: list[str] = get_list(- os.getenv("TASK_RUN_LOGS_MIRROR_ORIGIN_PRODUCTS", "signals_scout")+ os.getenv("TASK_RUN_LOGS_MIRROR_ORIGIN_PRODUCTS", "signals_scout,user_created"))# Direct OTLP delivery for the mirror above. The token pins the destination: scout runsdiff --git a/products/tasks/backend/tests/test_run_log_mirror.py b/products/tasks/backend/tests/test_run_log_mirror.pyindex 4ec910624838..b07bea4f240c 100644--- a/products/tasks/backend/tests/test_run_log_mirror.py+++ b/products/tasks/backend/tests/test_run_log_mirror.py@@ -261,7 +261,7 @@ class TestAgentOtelTelemetryStateGate(SimpleTestCase):assert agent_otel_telemetry_enabled_for_state(None) is True-@override_settings(TASK_RUN_LOGS_MIRROR_ORIGIN_PRODUCTS=["signals_scout"])+@override_settings(TASK_RUN_LOGS_MIRROR_ORIGIN_PRODUCTS=["signals_scout", "user_created"])class TestAppendLogMirroring(TestCase):organization: Organizationteam: Team@@ -284,7 +284,8 @@ class TestAppendLogMirroring(TestCase):@parameterized.expand([(Task.OriginProduct.SIGNALS_SCOUT, True),- (Task.OriginProduct.USER_CREATED, False),+ (Task.OriginProduct.USER_CREATED, True),+ (Task.OriginProduct.AUTOMATION, False),])@patch("products.tasks.backend.logic.services.run_log_mirror.logger")