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.

chore(cohorts): realtime flag targeting for persons (#103111)

Matheus Batista83a6b3793e2a
diff --git a/products/feature_flags/backend/realtime_targeting.py b/products/feature_flags/backend/realtime_targeting.py
index c0b765b82f0f..8a28db68b764 100644
--- a/products/feature_flags/backend/realtime_targeting.py
+++ b/products/feature_flags/backend/realtime_targeting.py
@@ -28,6 +28,9 @@ def is_realtime_cohort_flag_targeting_enabled(request: Any, *, team: Team) -> bo
REALTIME_COHORT_FLAG_TARGETING_FLAG,
user.distinct_id,
groups={"organization": organization_id, "project": str(team.uuid)},
+ # Local evaluation cannot read stored person properties, so a condition on email
+ # needs it passed here. Without it, every check outside the rollout calls out.
+ person_properties={"email": user.email},
group_properties={"organization": {"id": organization_id}, "project": {"id": team.id}},
only_evaluate_locally=False,
send_feature_flag_events=False,