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.

fix(aio): stop session settle probes filing error tracking issues (#96723)

posthog[bot]3a28813e3ad9
diff --git a/posthog/temporal/ai_observability/test_run_aggregate_evaluation.py b/posthog/temporal/ai_observability/test_run_aggregate_evaluation.py
index 3e7aa444b3a1..7cf69df1a0f1 100644
--- a/posthog/temporal/ai_observability/test_run_aggregate_evaluation.py
+++ b/posthog/temporal/ai_observability/test_run_aggregate_evaluation.py
@@ -15,6 +15,7 @@ from posthog.models import Organization, Team
from posthog.temporal.ai_observability.evaluation_types import EvaluationActivityResult
from posthog.temporal.ai_observability.evaluation_workflow_activities import RunEvaluationInputs
from posthog.temporal.ai_observability.run_aggregate_evaluation import (
+ _NOT_SETTLED_ERROR_TYPES,
INGESTION_LAG_MARGIN_SECONDS,
MAX_SETTLE_POLLS_PER_RUN,
CheckSessionSettledInputs,
@@ -34,6 +35,7 @@ from posthog.temporal.ai_observability.run_trace_evaluation import (
EmitTraceEvaluationEventInputs,
ExecuteTraceEvaluationInputs,
)
+from posthog.temporal.common.posthog_client import EXPECTED_CONTROL_FLOW_ERROR_TYPES
@pytest.fixture
@@ -205,6 +207,16 @@ class TestResolvePollInterval:
assert poll_budget_seconds // interval <= MAX_SETTLE_POLLS_PER_RUN
+class TestSettleErrorTypesAreNotReportedAsDefects:
+ def test_every_not_settled_type_is_exempt_from_error_tracking(self):
+ # A settle target whose type is absent from the exemption set files one error tracking
+ # issue per poll probe, so a new target must extend both sets together.
+ assert _NOT_SETTLED_ERROR_TYPES <= EXPECTED_CONTROL_FLOW_ERROR_TYPES
+
+ def test_a_runaway_session_still_reaches_error_tracking(self):
+ assert "session_runaway" not in EXPECTED_CONTROL_FLOW_ERROR_TYPES
+
+
def _mock_activities(calls: list[str], exclude: set[str] | None = None) -> list[Any]:
exclude = exclude or set()
diff --git a/posthog/temporal/common/posthog_client.py b/posthog/temporal/common/posthog_client.py
index 8e9bb9bb207d..b76b11ee980f 100644
--- a/posthog/temporal/common/posthog_client.py
+++ b/posthog/temporal/common/posthog_client.py
@@ -33,9 +33,13 @@ logger = get_write_only_logger()
# expected control flow, not a defect.
# "AIFeaturesCloudOnly" is raised by the AI observability guard on non-cloud deployments (see
# posthog/temporal/ai_observability/llm_endpoint.py). It reflects the deployment, not a defect.
+# "trace_not_settled" and "session_not_settled" are the aggregate-evaluation settle probes, whose
+# retry schedule is the poll loop. Each settle target keeps its own type, so a new target must
+# list its type here too; `_NOT_SETTLED_ERROR_TYPES` is tested against this set.
EXPECTED_CONTROL_FLOW_ERROR_TYPES = frozenset(
{
"trace_not_settled",
+ "session_not_settled",
"TransientRepartitionError",
"EmbeddingServiceUnavailable",
"AIFeaturesCloudOnly",