: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
fix(experiments): lower health warnings that need no fix (#123691)
Marcel Poelkerd13f7bae07e9
diff --git a/frontend/src/scenes/experiments/stories/ExperimentHealthDebugTab.stories.tsx b/frontend/src/scenes/experiments/stories/ExperimentHealthDebugTab.stories.tsxindex 15ca3bed0a40..f17c738cdb64 100644--- a/frontend/src/scenes/experiments/stories/ExperimentHealthDebugTab.stories.tsx+++ b/frontend/src/scenes/experiments/stories/ExperimentHealthDebugTab.stories.tsx@@ -70,6 +70,7 @@ const HEALTH_INPUTS: ExperimentHealthInputsApi = {flag_last_called_at: '2025-05-21T09:12:00Z',flag_called: true,flag_called_during_run: true,+ flag_called_after_end: null,exposure_events: {custom_event: null,required_flag_key: 'experiment-with-mean-metric',diff --git a/products/experiments/backend/health/checks/flag_state.py b/products/experiments/backend/health/checks/flag_state.pyindex e36669cafe6d..6a0e5d1142ff 100644--- a/products/experiments/backend/health/checks/flag_state.py+++ b/products/experiments/backend/health/checks/flag_state.py@@ -9,8 +9,11 @@ A running experiment whose flag has a 0% rollout is the exception. The flag servvariant then, so people who still get one get it from the customer's own assignment, which only the flag's callsshow. Only the server reports that case.-A paused experiment is the other exception. Only the server reads the experiment's activity log, so only the server+A paused experiment is another exception. Only the server reads the experiment's activity log, so only the servertells a pause from the experiment from a flag disabled elsewhere, and reports the pause with its own subcode.++An ended experiment whose flag has no recorded call since the end is the last exception. Only the server reads the+flag's latest call, so only the server reports that case, with its own subcode."""from datetime import UTC, datetime, timedelta@@ -48,6 +51,7 @@ NOT_STARTED_BUT_MULTIPLE_VARIANTS_ROLLED_OUT = "not_started_but_multiple_variantRUNNING_BUT_FLAG_DELETED = "running_but_flag_deleted"ASSIGNED_OUTSIDE_FLAG_SERVICE = "assigned_outside_flag_service"PAUSED_FROM_EXPERIMENT = "paused_from_experiment"+ENDED_FLAG_NOT_CALLED = "ended_flag_not_called"# The experiment's Pause and Resume write activity log entries since August 25, 2026, and a pause before then has# none. So a missing entry shows that the flag was disabled outside the experiment only for an experiment launched@@ -100,16 +104,7 @@ def flag_state(ctx: HealthContext) -> CheckOutcome:traffic = ctx.condition_set_trafficif traffic is not None and traffic.people_assigned_outside >= _MIN_PEOPLE_ASSIGNED_OUTSIDE:return _assigned_outside(traffic)- return _finding(- code=ExperimentHealthFindingCode.FLAG_OFF_WHILE_RUNNING,- subcode=RUNNING_BUT_NO_ROLLOUT,- title="The experiment is running, but no new users are being exposed",- detail=(- "The linked feature flag has a 0% rollout, so no new users are being exposed. "- "Users exposed earlier are still included in the results. End the experiment with a "- "conclusion, or increase the rollout percentage to expose users."- ),- )+ return _no_rollout(observed=traffic is not None and not outside_assignment_unsettled(ctx, traffic))if single_variant_shipped:variant_key = shipped_variant_key(flag)shipped = f'Variant "{variant_key}" is' if variant_key else "One variant is"@@ -127,15 +122,9 @@ def flag_state(ctx: HealthContext) -> CheckOutcome:)elif ctx.has_ended:if flag.active and _has_multiple_variants_active(flag) and not zero_rollout and not single_variant_shipped:- return _finding(- code=ExperimentHealthFindingCode.FLAG_LIVE_AFTER_END,- subcode=ENDED_BUT_MULTIPLE_VARIANTS_ROLLED_OUT,- title=_NOT_RUNNING_BUT_EXPOSED_TITLE,- detail=(- "This experiment has ended, but the linked feature flag is still active and distributing "- "traffic across multiple variants. Disable the flag, or resume the experiment."- ),- )+ if ctx.flag_called_after_end is False and ctx.ended_at is not None:+ return _ended_flag_not_called(ctx.ended_at, ctx.team_timezone)+ return _live_after_end(called_after_end=ctx.flag_called_after_end is True)elif not ctx.archived:# The draft state is also reached again when resetting experiment measurements.if flag.active and _has_multiple_variants_active(flag) and not zero_rollout:@@ -195,18 +184,87 @@ def _flag_disabled(pause: PauseHistory | None) -> ExperimentHealthFinding:)+def _no_rollout(*, observed: bool) -> ExperimentHealthFinding:+ """`observed` says whether the flag's calls were read over a window long enough to show users assigned outside+ the flag service. Without that, the finding says only what the rollout shows."""+ if observed:+ return _finding(+ code=ExperimentHealthFindingCode.FLAG_OFF_WHILE_RUNNING,+ subcode=RUNNING_BUT_NO_ROLLOUT,+ title="The experiment is running, but no new users are being exposed",+ detail=(+ "The linked feature flag has a 0% rollout, so no new users are being exposed. "+ "Users exposed earlier are still included in the results. End the experiment with a "+ "conclusion, or increase the rollout percentage to expose users."+ ),+ )+ return _finding(+ code=ExperimentHealthFindingCode.FLAG_OFF_WHILE_RUNNING,+ subcode=RUNNING_BUT_NO_ROLLOUT,+ title="The experiment is running, but its feature flag has a 0% rollout",+ detail=(+ "The linked feature flag has a 0% rollout, so PostHog serves no variant. Only users whose variant your "+ "own code assigns are exposed. If your code doesn't assign variants, no new users are being exposed. "+ "Users exposed earlier are still included in the results. End the experiment with a conclusion, or "+ "increase the rollout percentage to expose users."+ ),+ )+++def _live_after_end(*, called_after_end: bool) -> ExperimentHealthFinding:+ if called_after_end:+ return _finding(+ code=ExperimentHealthFindingCode.FLAG_LIVE_AFTER_END,+ subcode=ENDED_BUT_MULTIPLE_VARIANTS_ROLLED_OUT,+ title=_NOT_RUNNING_BUT_EXPOSED_TITLE,+ detail=(+ "This experiment has ended, but the linked feature flag is still active and distributing "+ "traffic across multiple variants. Disable the flag, or resume the experiment."+ ),+ )+ # Without a call recorded after the end, the finding says only what the flag's settings show.+ return _finding(+ code=ExperimentHealthFindingCode.FLAG_LIVE_AFTER_END,+ subcode=ENDED_BUT_MULTIPLE_VARIANTS_ROLLED_OUT,+ title="The experiment has ended, but its feature flag is still active with multiple variants",+ detail=(+ "This experiment has ended, but the linked feature flag is still active with multiple variants, so users "+ "still get one of them whenever your code reads the flag. Disable the flag, or resume the experiment."+ ),+ )+++def _ended_flag_not_called(ended_at: datetime, team_timezone: str) -> ExperimentHealthFinding:+ # Info, because a flag that nothing reads exposes nobody. The finding says only what `last_called_at` shows,+ # because reads that record no call can still get a variant.+ return _finding(+ code=ExperimentHealthFindingCode.FLAG_LIVE_AFTER_END,+ subcode=ENDED_FLAG_NOT_CALLED,+ severity=ExperimentHealthFindingSeverity.INFO,+ title="The feature flag is still active after the experiment ended",+ detail=(+ f"The experiment ended on {format_change_time(ended_at, team_timezone)}, and the linked feature flag is "+ "still active with multiple variants. PostHog hasn't recorded a call of the flag since then. Reading only "+ "a payload or a list of all flags records no call, and neither does a call with send_event set to false, "+ "so your code may still read the flag that way. If nothing reads the flag anymore, disable or archive it "+ "to clean up."+ ),+ evidence={"ended_at": ended_at.astimezone(UTC).isoformat()},+ )++def needs_outside_assignment_check(ctx: HealthContext) -> bool:"""Whether this check reads the flag's calls: a running experiment whose flag has a 0% rollout."""flag = ctx.flagreturn ctx.is_running and not ctx.is_paused and flag is not None and not flag.deleted and _has_zero_rollout(flag)-def outside_assignment_unsettled(ctx: HealthContext, traffic: ConditionSetTraffic, *, now: datetime) -> bool:+def outside_assignment_unsettled(ctx: HealthContext, traffic: ConditionSetTraffic) -> bool:"""Whether `traffic` holds too few people assigned outside the flag service only because its window is young."""return (needs_outside_assignment_check(ctx)and traffic.people_assigned_outside < _MIN_PEOPLE_ASSIGNED_OUTSIDE- and now - traffic.since < _OUTSIDE_ASSIGNMENT_SETTLED_AFTER+ and traffic.until - traffic.since < _OUTSIDE_ASSIGNMENT_SETTLED_AFTER)diff --git a/products/experiments/backend/health/checks/zero_exposures.py b/products/experiments/backend/health/checks/zero_exposures.pyindex 4ccf7ffe7510..10c7ef6ad929 100644--- a/products/experiments/backend/health/checks/zero_exposures.py+++ b/products/experiments/backend/health/checks/zero_exposures.py@@ -37,10 +37,12 @@ def zero_exposures(ctx: HealthContext) -> CheckOutcome:# Deleting a flag changes its key, so its calls stop moving `last_called_at`. The flag-state check reports the# deletion.if flag is None or flag.deleted:- return _cause_unknown(evidence, unit)+ return _cause_unknown(evidence, unit, ended=ctx.has_ended)if ctx.is_paused:+ # Info, because the flag-state check already reports the pause, and a pause needs no fix.return _finding(subcode=EXPERIMENT_PAUSED,+ severity=ExperimentHealthFindingSeverity.INFO,title=f"No {unit}s exposed: the experiment is paused",detail=("The experiment is paused, so its feature flag serves no variants and nobody is counted as exposed. "@@ -51,7 +53,7 @@ def zero_exposures(ctx: HealthContext) -> CheckOutcome:)events = ctx.exposure_eventsif events is None:- return _cause_unknown(evidence, unit)+ return _cause_unknown(evidence, unit, ended=ctx.has_ended)if events.required_flag_key is None:# A custom event or an action carries the variant in a property that client SDKs add to every event, so the# flag's calls say nothing about these exposures.@@ -60,69 +62,128 @@ def zero_exposures(ctx: HealthContext) -> CheckOutcome:counted = f'{sender} the event "{events.custom_event}"'else:counted = f"{sender} an event that matches the exposure action"+ rule = (+ f"{unit.capitalize()}s are counted as exposed when {counted} with one of the experiment's variants in "+ f'the property "{events.variant_property}".'+ )+ if ctx.has_ended:+ title = f"No {unit}s exposed: no events matched the exposure criteria"+ detail = (+ f"No {unit}s were exposed while the experiment ran, because no event matched the exposure criteria. "+ f"{rule} If your code sent the event, check that the exposure criteria, such as the test account "+ f"filter, don't leave out your {unit}s."+ )+ else:+ title = f"No {unit}s exposed: no events match the exposure criteria"+ detail = (+ f"{rule} No event has matched during the experiment, so nobody is counted. Check that your code sends "+ "the event with the variant, and that the exposure criteria, such as the test account filter, don't "+ f"leave out your {unit}s."+ )+ # A warning also after the end, because the exposure query reruns over the events up to the end, so a fix to+ # the exposure criteria brings back the results.return _finding(subcode=CUSTOM_EXPOSURE_NOT_MATCHED,- title=f"No {unit}s exposed: no events match the exposure criteria",- detail=(- f"{unit.capitalize()}s are counted as exposed when {counted} with one of the experiment's variants in "- f'the property "{events.variant_property}". No event has matched during the experiment, so nobody is '- "counted. Check that your code sends the event with the variant, and that the exposure criteria, such "- f"as the test account filter, don't leave out your {unit}s."- ),+ severity=ExperimentHealthFindingSeverity.WARNING,+ title=title,+ detail=detail,evidence=evidence,actions=(ExperimentHealthFindingActionKind.EDIT_EXPOSURE_CRITERIA,),)flag_key = events.required_flag_keyif ctx.flag_called_during_run is False:- return _finding(- subcode=FLAG_NOT_CALLED,- title=f"No {unit}s exposed: the feature flag has no recorded calls",- detail=(+ no_call_recorded = (+ "Reading only a payload or a list of all flags records no call, and neither does a call with send_event "+ "set to false."+ )+ if ctx.has_ended:+ title = f"No {unit}s exposed: the feature flag had no recorded calls"+ detail = (+ f"No {unit}s were exposed while the experiment ran, because PostHog didn't record a call of the feature "+ f'flag "{flag_key}" in that time. {unit.capitalize()}s are counted when your code reads this flag\'s '+ f"value. {no_call_recorded}"+ )+ else:+ title = f"No {unit}s exposed: the feature flag has no recorded calls"+ detail = (f'PostHog hasn\'t recorded a call of the feature flag "{flag_key}" during the experiment, so nobody is 'f"counted as exposed. {unit.capitalize()}s are counted when your code reads this flag's value, for ""example with getFeatureFlag in the browser or with get_flag on the result of evaluate_flags in Python. "- "Reading only a payload or a list of all flags records no call, and neither does a call with "- f"send_event set to false. New calls can take up to {LAST_CALLED_AT_LAG} to show up here."- ),+ f"{no_call_recorded} New calls can take up to {LAST_CALLED_AT_LAG} to show up here."+ )+ # Info after the end, because no change to the code can expose more users then, so the finding only explains+ # the empty results.+ return _finding(+ subcode=FLAG_NOT_CALLED,+ severity=ExperimentHealthFindingSeverity.INFO if ctx.has_ended else ExperimentHealthFindingSeverity.WARNING,+ title=title,+ detail=detail,evidence=evidence,actions=(),)if ctx.flag_called_during_run is True:- # Calls made before the group is set carry no group key, and the exposure query drops them.- groups = " A call counts only when it carries the group, so set the group before your code reads the flag."activation = (f' With the activation "{events.activation}" set, a {unit} also needs a matching event after the flag call.'if events.activationelse "")- return _finding(- subcode=CALLS_NOT_COUNTED,- title=f"No {unit}s exposed, although the feature flag is called",- detail=(+ if ctx.has_ended:+ group_rule = " A call counts only when it carries the group." if unit == "group" else ""+ title = f"No {unit}s exposed, although the feature flag was called"+ detail = (+ f"No {unit}s were exposed while the experiment ran, although PostHog recorded calls of the feature "+ f'flag "{flag_key}" in that time. A call counts when the flag returns one of the experiment\'s '+ f"variants and the {unit} passes the exposure criteria.{group_rule}{activation} Check that the "+ f"exposure criteria, such as the test account filter, don't leave out your {unit}s."+ )+ else:+ # Calls made before the group is set carry no group key, and the exposure query drops them.+ group_rule = (+ " A call counts only when it carries the group, so set the group before your code reads the flag."+ if unit == "group"+ else ""+ )+ title = f"No {unit}s exposed, although the feature flag is called"+ detail = (f'PostHog has recorded calls of the feature flag "{flag_key}" during the experiment, but none of them '"counts as an exposure. A call counts when the flag returns one of the experiment's variants and the "- f"{unit} passes the exposure criteria.{groups if unit == 'group' else ''}{activation} Check that the "- f"flag's release conditions include your {unit}s, and that the exposure criteria, such as the test "- "account filter, don't leave them out."- ),+ f"{unit} passes the exposure criteria.{group_rule}{activation} Check that the flag's release "+ f"conditions include your {unit}s, and that the exposure criteria, such as the test account filter, "+ "don't leave them out."+ )+ return _finding(+ subcode=CALLS_NOT_COUNTED,+ severity=ExperimentHealthFindingSeverity.WARNING,+ title=title,+ detail=detail,evidence=evidence,actions=(ExperimentHealthFindingActionKind.OPEN_FEATURE_FLAG,ExperimentHealthFindingActionKind.EDIT_EXPOSURE_CRITERIA,),)- return _cause_unknown(evidence, unit)+ return _cause_unknown(evidence, unit, ended=ctx.has_ended)-def _cause_unknown(evidence: dict[str, int], unit: str) -> ExperimentHealthFinding:- return _finding(- subcode=None,- title=f"No {unit}s exposed",- detail=(+def _cause_unknown(evidence: dict[str, int], unit: str, *, ended: bool) -> ExperimentHealthFinding:+ if ended:+ detail = (+ f"No {unit}s were exposed while the experiment ran, so it shows no results. "+ f"{unit.capitalize()}s are counted when the exposure event is sent for them. If your code sent it, "+ "check that the exposure criteria match the events it sent."+ )+ else:+ detail = (f"No {unit}s have been exposed to this experiment, so it shows no results. "f"{unit.capitalize()}s are counted when the exposure event is sent for them. Check that your code ""evaluates the linked feature flag and that the exposure criteria match the events you send."- ),+ )+ # Info after the end, because with the cause unknown the finding names no fix that is sure to bring back results.+ return _finding(+ subcode=None,+ severity=ExperimentHealthFindingSeverity.INFO if ended else ExperimentHealthFindingSeverity.WARNING,+ title=f"No {unit}s exposed",+ detail=detail,evidence=evidence,actions=(ExperimentHealthFindingActionKind.EDIT_EXPOSURE_CRITERIA,),)@@ -131,6 +192,7 @@ def _cause_unknown(evidence: dict[str, int], unit: str) -> ExperimentHealthFindidef _finding(*,subcode: str | None,+ severity: ExperimentHealthFindingSeverity,title: str,detail: str,evidence: dict[str, int],@@ -139,7 +201,7 @@ def _finding(return ExperimentHealthFinding(code=ExperimentHealthFindingCode.ZERO_EXPOSURES,subcode=subcode,- severity=ExperimentHealthFindingSeverity.WARNING,+ severity=severity,title=title,detail=detail,evidence=evidence,diff --git a/products/experiments/backend/health/condition_set_traffic.py b/products/experiments/backend/health/condition_set_traffic.pyindex f13660bd6aa7..52dc91b757eb 100644--- a/products/experiments/backend/health/condition_set_traffic.py+++ b/products/experiments/backend/health/condition_set_traffic.py@@ -81,7 +81,7 @@ _SCANNED_PROPERTIES = frozenset(_LOCALLY_EVALUATED_REASON = "Evaluated locally"# Part of the cache key. Raise it when the fields of `ConditionSetTraffic` change, because an answer cached with# other fields can't be read back into it.-_ANSWER_SHAPE = 2+_ANSWER_SHAPE = 3_MAX_CONDITION_SETS = 1000_SCAN_LOCK_SECONDS = QUERY_TIMEOUT_SECONDS + 5_WAIT_FOR_SCAN_SECONDS = QUERY_TIMEOUT_SECONDS + 1@@ -217,6 +217,7 @@ def query_condition_set_traffic(people_assigned_outside += int(set_assigned_outside)return ConditionSetTraffic(since=window_start,+ until=window_end,team_timezone=team.timezone,people_by_set=people_by_set,calls=calls,@@ -262,7 +263,7 @@ def _scan(except Exception as error:cache_failed_scan(cache_key, error)return None- asked_again_sooner = has_too_few_people(ctx, traffic) or outside_assignment_unsettled(ctx, traffic, now=now)+ asked_again_sooner = has_too_few_people(ctx, traffic) or outside_assignment_unsettled(ctx, traffic)cache.set(cache_key, asdict(traffic), _TOO_FEW_PEOPLE_CACHE_SECONDS if asked_again_sooner else _ANSWER_CACHE_SECONDS)diff --git a/products/experiments/backend/health/context.py b/products/experiments/backend/health/context.pyindex de3db4bfc7ad..d45a3d768d6e 100644--- a/products/experiments/backend/health/context.py+++ b/products/experiments/backend/health/context.py@@ -24,6 +24,7 @@ from products.experiments.backend.facade.contracts import (ExperimentHealthFlagChangeKind,ExperimentHealthMetricCompileErrorKind,)+from products.experiments.backend.health.delays import ENDED_FLAG_QUIET_PERIOD, LAST_CALLED_AT_LAG_DURATIONfrom products.experiments.backend.hogql_queries.exposure_query_logic import (DEFAULT_EXPOSURE_EVENT,EXPERIMENT_EXPOSURE_EVENT,@@ -177,6 +178,8 @@ class ConditionSetTraffic:# The latest of launch, the flag's last save and the start of the window.since: datetime+ # The end of the window, which is the time of the scan.+ until: datetimeteam_timezone: str# People by the condition set that served their latest call of the flag's current version.people_by_set: Mapping[int, int]@@ -304,8 +307,11 @@ class HealthContext:is_launched: boolis_running: boolhas_ended: bool+ # None while the experiment has not ended.+ ended_at: datetime | Noneis_paused: boolarchived: bool+ team_timezone: strflag: FlagState | None# Whether PostHog has recorded a call of the flag. None when the experiment has no flag, or when PostHog can't# record the calls of this organization's flags.@@ -315,6 +321,11 @@ class HealthContext:# answer this. None before launch, when the experiment has no flag, when the flag's latest call came after the# end, or when PostHog can't record the calls of this organization's flags.flag_called_during_run: bool | None+ # Whether the flag's latest recorded call came after the end. False only when no call is recorded in the+ # ENDED_FLAG_QUIET_PERIOD after the end, also for a flag without a recorded call. None before the end, when the+ # experiment has no flag, before that period is over, or when PostHog can't record the calls of this+ # organization's flags.+ flag_called_after_end: bool | None# Whether the team has an active flag, which posthog-js needs to request flags on page load. None when not read:# it is read only for a draft whose flag has no recorded call.team_has_active_flag: bool | None@@ -463,6 +474,20 @@ def _flag_called_during_run(experiment: Experiment, flag_called: bool | None) ->return None if _flag_calls_unrecorded(experiment) else False+def _flag_called_after_end(experiment: Experiment) -> bool | None:+ end_date = experiment.end_date+ # django-stubs types the id as int, but an unsaved instance can carry None.+ feature_flag_id: int | None = experiment.feature_flag_id+ if not experiment.is_stopped or end_date is None or feature_flag_id is None:+ return None+ last_called_at = experiment.feature_flag.last_called_at+ if last_called_at is not None and last_called_at > end_date:+ return True+ if timezone.now() - end_date < ENDED_FLAG_QUIET_PERIOD + LAST_CALLED_AT_LAG_DURATION:+ return None+ return None if _flag_calls_unrecorded(experiment) else False++def _flag_calls_unrecorded(experiment: Experiment) -> bool:# The task that sets `last_called_at` reads `$feature_flag_called` from the events table, unless it is set to# read flag_evaluations. On FLAG_EVALUATIONS_ONLY, ingestion writes no `$feature_flag_called` to the events table@@ -607,11 +632,14 @@ def load_health_context(is_launched=experiment.is_launched,is_running=experiment.is_running,has_ended=experiment.is_stopped,+ ended_at=experiment.end_date if experiment.is_stopped else None,is_paused=experiment.is_paused,archived=experiment.archived,+ team_timezone=experiment.team.timezone,flag=_load_flag_state(experiment),flag_called=flag_called,flag_called_during_run=_flag_called_during_run(experiment, flag_called),+ flag_called_after_end=_flag_called_after_end(experiment),team_has_active_flag=(has_active_flags(experiment.team) if flag_called is False and not experiment.is_launched else None),diff --git a/products/experiments/backend/health/delays.py b/products/experiments/backend/health/delays.pyindex 8d01b4378868..c163f918e4db 100644--- a/products/experiments/backend/health/delays.py+++ b/products/experiments/backend/health/delays.py@@ -1,8 +1,17 @@+from datetime import timedelta+# A new experiment often has no exposure in its first hours, so the zero exposures finding waits as long as the# experiments scout does.ZERO_EXPOSURES_GRACE_HOURS = 24# `last_called_at` moves only when `sync_feature_flag_last_called` runs, every 30 minutes (`posthog/tasks/scheduled.py`).# A run reads the calls up to a buffer before its start (`FEATURE_FLAG_LAST_CALLED_AT_SYNC_*_BUFFER_SECONDS`, 1 or 6-# minutes by default), so a call waits up to one interval plus that buffer. Update this when the schedule changes.+# minutes by default), so a call waits up to one interval plus that buffer. Update both when the schedule changes, and+# keep them equal: the findings say the text, and the context waits the duration.LAST_CALLED_AT_LAG = "an hour"+LAST_CALLED_AT_LAG_DURATION = timedelta(hours=1)++# An ended experiment's flag counts as unread only after this long without a recorded call after the end. Many+# products get no traffic at night or over a weekend, so a shorter wait reads a quiet weekend as a flag that nothing+# reads.+ENDED_FLAG_QUIET_PERIOD = timedelta(days=3)diff --git a/products/experiments/backend/health/inputs_payload.py b/products/experiments/backend/health/inputs_payload.pyindex f362375ccbd8..35ab326a09aa 100644--- a/products/experiments/backend/health/inputs_payload.py+++ b/products/experiments/backend/health/inputs_payload.py@@ -237,6 +237,7 @@ def health_inputs_payload(inputs: HealthInputs) -> dict[str, Any]:"flag_last_called_at": inputs.flag_last_called_at,"flag_called": ctx.flag_called,"flag_called_during_run": ctx.flag_called_during_run,+ "flag_called_after_end": ctx.flag_called_after_end,"exposure_events": {"custom_event": ctx.exposure_events.custom_event,"required_flag_key": ctx.exposure_events.required_flag_key,diff --git a/products/experiments/backend/health/test/factories.py b/products/experiments/backend/health/test/factories.pyindex 99687fa7d098..96e6e5319fed 100644--- a/products/experiments/backend/health/test/factories.py+++ b/products/experiments/backend/health/test/factories.py@@ -19,11 +19,14 @@ RUNNING_CONTEXT = HealthContext(is_launched=True,is_running=True,has_ended=False,+ ended_at=None,is_paused=False,archived=False,+ team_timezone="Europe/Berlin",flag=None,flag_called=None,flag_called_during_run=None,+ flag_called_after_end=None,team_has_active_flag=None,baseline_variant_key=None,primary_metric_count=1,diff --git a/products/experiments/backend/health/test/test_condition_set_traffic.py b/products/experiments/backend/health/test/test_condition_set_traffic.pyindex 31dc8333b10a..fa0b8d652ab9 100644--- a/products/experiments/backend/health/test/test_condition_set_traffic.py+++ b/products/experiments/backend/health/test/test_condition_set_traffic.py@@ -36,6 +36,7 @@ FULL_ACCESS = ExperimentHealthReaderAccess()TRAFFIC = ConditionSetTraffic(since=datetime(2026, 10, 1, tzinfo=UTC),+ until=datetime(2026, 10, 8, tzinfo=UTC),team_timezone="UTC",people_by_set={1: 30, 2: 970},calls=2000,@@ -44,6 +45,7 @@ TRAFFIC = ConditionSetTraffic()TOO_FEW_PEOPLE = ConditionSetTraffic(since=datetime(2026, 10, 1, tzinfo=UTC),+ until=datetime(2026, 10, 8, tzinfo=UTC),team_timezone="UTC",people_by_set={1: 3, 2: 50},calls=100,@@ -234,7 +236,7 @@ class TestLoadConditionSetTraffic(BaseTest):)self.experiment = Experiment.objects.get(pk=self.experiment.pk)if saved_at is not None:- answer = replace(answer, since=saved_at)+ answer = replace(answer, since=saved_at, until=timezone.now())first, _ = self._load(answer)with time_machine.travel(timezone.now() + next_load_after):diff --git a/products/experiments/backend/health/test/test_conditions_changed.py b/products/experiments/backend/health/test/test_conditions_changed.pyindex 59b97029de24..67caa0bf5a28 100644--- a/products/experiments/backend/health/test/test_conditions_changed.py+++ b/products/experiments/backend/health/test/test_conditions_changed.py@@ -86,6 +86,7 @@ def _traffic(people_by_set: dict[int, int]) -> ConditionSetTraffic:calls = 2 * sum(people_by_set.values())return ConditionSetTraffic(since=datetime(2026, 9, 13, 8, 0, tzinfo=UTC),+ until=datetime(2026, 9, 20, 8, 0, tzinfo=UTC),team_timezone="Europe/Berlin",people_by_set=people_by_set,calls=calls,diff --git a/products/experiments/backend/health/test/test_flag_state.py b/products/experiments/backend/health/test/test_flag_state.pyindex bb433a411f38..5e631160675d 100644--- a/products/experiments/backend/health/test/test_flag_state.py+++ b/products/experiments/backend/health/test/test_flag_state.py@@ -1,5 +1,5 @@from dataclasses import replace-from datetime import UTC, datetime+from datetime import UTC, datetime, timedeltafrom typing import Anyfrom unittest import TestCase@@ -53,9 +53,11 @@ SHIPPED_TO_SOME = {}-def _traffic(people_assigned_outside: int) -> ConditionSetTraffic:+def _traffic(people_assigned_outside: int, *, window: timedelta = timedelta(days=7)) -> ConditionSetTraffic:+ since = datetime(2026, 10, 12, 13, 4, tzinfo=UTC)return ConditionSetTraffic(- since=datetime(2026, 10, 12, 13, 4, tzinfo=UTC),+ since=since,+ until=since + window,team_timezone="Europe/Berlin",people_by_set={},calls=3 * people_assigned_outside,@@ -71,6 +73,7 @@ def _pause_history(*, launched_at: datetime, paused_at: datetime | None) -> PausLAUNCHED_BEFORE_PAUSE_ENTRIES = datetime(2026, 8, 1, 9, 0, tzinfo=UTC)LAUNCHED_AFTER_PAUSE_ENTRIES = datetime(2026, 9, 1, 9, 0, tzinfo=UTC)PAUSED_AT = datetime(2026, 10, 12, 13, 4, tzinfo=UTC)+ENDED_AT = datetime(2026, 10, 14, 8, 30, tzinfo=UTC)def _context(@@ -82,12 +85,15 @@ def _context(archived: bool = False,traffic: ConditionSetTraffic | None = None,pause_history: PauseHistory | None = None,+ flag_called_after_end: bool | None = None,) -> HealthContext:return replace(RUNNING_CONTEXT,**status,+ ended_at=ENDED_AT if status["has_ended"] else None,is_paused=status["is_running"] and not active,archived=archived,+ flag_called_after_end=flag_called_after_end,flag=parse_flag_state(active=active,deleted=deleted,@@ -143,6 +149,16 @@ class TestFlagState(TestCase):_context(ENDED, active=True, filters=MULTIVARIANT),(ExperimentHealthFindingCode.FLAG_LIVE_AFTER_END, "ended_but_multiple_variants_rolled_out", None),),+ (+ "ended_flag_not_called_since_the_end",+ _context(ENDED, active=True, filters=MULTIVARIANT, flag_called_after_end=False),+ (ExperimentHealthFindingCode.FLAG_LIVE_AFTER_END, "ended_flag_not_called", None),+ ),+ (+ "ended_flag_called_after_the_end",+ _context(ENDED, active=True, filters=MULTIVARIANT, flag_called_after_end=True),+ (ExperimentHealthFindingCode.FLAG_LIVE_AFTER_END, "ended_but_multiple_variants_rolled_out", None),+ ),("ended_zero_rollout", _context(ENDED, active=True, filters=ZERO_ROLLOUT), None),("ended_flag_disabled", _context(ENDED, active=False, filters=MULTIVARIANT), None),("ended_single_variant_shipped", _context(ENDED, active=True, filters=SHIPPED_VARIANT), None),@@ -259,6 +275,60 @@ class TestFlagState(TestCase):"The feature flag is active before launch",),),+ (+ "ended_flag_not_called_since_the_end",+ _context(ENDED, active=True, filters=MULTIVARIANT, flag_called_after_end=False),+ (+ "ended_flag_not_called",+ ExperimentHealthFindingSeverity.INFO,+ "The feature flag is still active after the experiment ended",+ ),+ ),+ (+ "ended_flag_called_after_the_end",+ _context(ENDED, active=True, filters=MULTIVARIANT, flag_called_after_end=True),+ (+ "ended_but_multiple_variants_rolled_out",+ ExperimentHealthFindingSeverity.WARNING,+ "The experiment is not running, but users are exposed to multiple variants",+ ),+ ),+ (+ "ended_flag_calls_after_the_end_unknown",+ _context(ENDED, active=True, filters=MULTIVARIANT),+ (+ "ended_but_multiple_variants_rolled_out",+ ExperimentHealthFindingSeverity.WARNING,+ "The experiment has ended, but its feature flag is still active with multiple variants",+ ),+ ),+ (+ "running_zero_rollout_traffic_unknown",+ _context(RUNNING, active=True, filters=ZERO_ROLLOUT),+ (+ "running_but_no_rollout",+ ExperimentHealthFindingSeverity.WARNING,+ "The experiment is running, but its feature flag has a 0% rollout",+ ),+ ),+ (+ "running_zero_rollout_young_window",+ _context(RUNNING, active=True, filters=ZERO_ROLLOUT, traffic=_traffic(0, window=timedelta(hours=2))),+ (+ "running_but_no_rollout",+ ExperimentHealthFindingSeverity.WARNING,+ "The experiment is running, but its feature flag has a 0% rollout",+ ),+ ),+ (+ "running_zero_rollout_too_few_assigned_outside",+ _context(RUNNING, active=True, filters=ZERO_ROLLOUT, traffic=_traffic(9)),+ (+ "running_but_no_rollout",+ ExperimentHealthFindingSeverity.WARNING,+ "The experiment is running, but no new users are being exposed",+ ),+ ),])def test_severity_follows_whether_the_state_needs_action(@@ -269,27 +339,41 @@ class TestFlagState(TestCase):assert isinstance(finding, ExperimentHealthFinding)self.assertEqual((finding.subcode, finding.severity, finding.title), expected)- def test_a_pause_from_the_experiment_names_its_date(self) -> None:- finding = flag_state(- _context(- RUNNING,- active=False,- filters=MULTIVARIANT,- pause_history=_pause_history(launched_at=LAUNCHED_AFTER_PAUSE_ENTRIES, paused_at=PAUSED_AT),- )- )-- assert isinstance(finding, ExperimentHealthFinding)- self.assertEqual(- (finding.detail, dict(finding.evidence)),+ @parameterized.expand(+ [(+ "pause_from_the_experiment",+ _context(+ RUNNING,+ active=False,+ filters=MULTIVARIANT,+ pause_history=_pause_history(launched_at=LAUNCHED_AFTER_PAUSE_ENTRIES, paused_at=PAUSED_AT),+ ),"The experiment was paused on October 12, 2026 at 3:04 PM CEST, so the linked feature flag serves no ""variants. Users exposed before the pause stay in the results. Their events during the pause can ""still count toward their variant, although the flag doesn't serve it to them then. Resume the ""experiment when you want to expose users again.",{"paused_at": "2026-10-12T13:04:00+00:00"},),- )+ (+ "flag_not_called_since_the_end",+ _context(ENDED, active=True, filters=MULTIVARIANT, flag_called_after_end=False),+ "The experiment ended on October 14, 2026 at 10:30 AM CEST, and the linked feature flag is still "+ "active with multiple variants. PostHog hasn't recorded a call of the flag since then. Reading only a "+ "payload or a list of all flags records no call, and neither does a call with send_event set to "+ "false, so your code may still read the flag that way. If nothing reads the flag anymore, disable or "+ "archive it to clean up.",+ {"ended_at": "2026-10-14T08:30:00+00:00"},+ ),+ ]+ )+ def test_names_the_date_of_the_state(+ self, _name: str, ctx: HealthContext, detail: str, evidence: dict[str, str]+ ) -> None:+ finding = flag_state(ctx)++ assert isinstance(finding, ExperimentHealthFinding)+ self.assertEqual((finding.detail, dict(finding.evidence)), (detail, evidence))def test_variants_assigned_outside_the_flag_service_are_info(self) -> None:finding = flag_state(_context(RUNNING, active=True, filters=ZERO_ROLLOUT, traffic=_traffic(1234)))diff --git a/products/experiments/backend/health/test/test_forced_variant.py b/products/experiments/backend/health/test/test_forced_variant.pyindex dc92653ce0ef..41e2be4f3f44 100644--- a/products/experiments/backend/health/test/test_forced_variant.py+++ b/products/experiments/backend/health/test/test_forced_variant.py@@ -92,6 +92,7 @@ def _traffic(people_by_set: dict[int, int], *, remotely_evaluated: float = 1.0)calls = 2 * sum(people_by_set.values())return ConditionSetTraffic(since=datetime(2026, 10, 12, 13, 4, tzinfo=UTC),+ until=datetime(2026, 10, 19, 13, 4, tzinfo=UTC),team_timezone="Europe/Berlin",people_by_set=people_by_set,calls=calls,@@ -119,6 +120,11 @@ class TestForcedVariantReleaseCondition(TestCase):_context([{**EVERYONE, "variant": "control"}]),("all_conditions_pinned", ExperimentHealthFindingSeverity.WARNING, "1", "control", None),),+ (+ "draft_catch_all_override",+ _context([{**EVERYONE, "variant": "control"}], status=DRAFT),+ ("all_conditions_pinned", ExperimentHealthFindingSeverity.WARNING, "1", "control", None),+ ),("cohorts_forced_into_both_variants",_context([{**IOS, "variant": "test"}, {**STAFF, "variant": "control"}]),diff --git a/products/experiments/backend/health/test/test_zero_exposures.py b/products/experiments/backend/health/test/test_zero_exposures.pyindex bd64b701592f..52d7f4ebc2ea 100644--- a/products/experiments/backend/health/test/test_zero_exposures.py+++ b/products/experiments/backend/health/test/test_zero_exposures.py@@ -1,7 +1,8 @@from dataclasses import replace-from datetime import UTC, datetime+from datetime import UTC, datetime, timedeltafrom typing import Any+import time_machinefrom posthog.test.base import BaseTestfrom unittest import TestCase@@ -11,7 +12,11 @@ from parameterized import parameterizedfrom posthog.schema import MultipleVariantHandling-from products.experiments.backend.facade.contracts import ExperimentHealthFinding, ExperimentHealthFindingActionKind+from products.experiments.backend.facade.contracts import (+ ExperimentHealthFinding,+ ExperimentHealthFindingActionKind,+ ExperimentHealthFindingSeverity,+)from products.experiments.backend.health.checks.zero_exposures import (CALLS_NOT_COUNTED,CUSTOM_EXPOSURE_NOT_MATCHED,@@ -20,7 +25,7 @@ from products.experiments.backend.health.checks.zero_exposures import (zero_exposures,)from products.experiments.backend.health.context import ExposureEvents, ExposureTotals, FlagState, load_health_context-from products.experiments.backend.health.test.factories import RUNNING_CONTEXT+from products.experiments.backend.health.test.factories import ENDED, RUNNING_CONTEXTfrom products.experiments.backend.models.experiment import Experimentfrom products.feature_flags.backend.facade.edits import FlagVariantfrom products.feature_flags.backend.facade.enums import FlagEvaluationsMode@@ -28,6 +33,8 @@ from products.feature_flags.backend.models.feature_flag import FeatureFlagfrom products.feature_flags.backend.models.organization_feature_flags_config import OrganizationFeatureFlagsConfigAction = ExperimentHealthFindingActionKind+WARNING = ExperimentHealthFindingSeverity.WARNING+INFO = ExperimentHealthFindingSeverity.INFOFLAG = FlagState(active=True,@@ -58,48 +65,81 @@ ACTION = replace(CUSTOM_EVENT, custom_event=None)LAUNCHED_AT = datetime(2026, 10, 1, tzinfo=UTC)ENDED_AT = datetime(2026, 10, 10, tzinfo=UTC)+NOW = datetime(2026, 10, 20, 12, 0, tzinfo=UTC)class TestZeroExposures(TestCase):@parameterized.expand([- ("flag_not_called", {"flag_called_during_run": False}, FLAG_NOT_CALLED, ()),+ ("flag_not_called", {"flag_called_during_run": False}, FLAG_NOT_CALLED, (), WARNING),("flag_called",{"flag_called_during_run": True},CALLS_NOT_COUNTED,(Action.OPEN_FEATURE_FLAG, Action.EDIT_EXPOSURE_CRITERIA),+ WARNING,),- ("calls_unknown", {"flag_called_during_run": None}, None, (Action.EDIT_EXPOSURE_CRITERIA,)),- ("paused", {"is_paused": True, "flag_called_during_run": True}, EXPERIMENT_PAUSED, ()),+ ("calls_unknown", {"flag_called_during_run": None}, None, (Action.EDIT_EXPOSURE_CRITERIA,), WARNING),+ ("paused", {"is_paused": True, "flag_called_during_run": True}, EXPERIMENT_PAUSED, (), INFO),("custom_event_whatever_the_flag_calls",{"exposure_events": CUSTOM_EVENT, "flag_called_during_run": False},CUSTOM_EXPOSURE_NOT_MATCHED,(Action.EDIT_EXPOSURE_CRITERIA,),+ WARNING,),("action",{"exposure_events": ACTION, "flag_called_during_run": False},CUSTOM_EXPOSURE_NOT_MATCHED,(Action.EDIT_EXPOSURE_CRITERIA,),+ WARNING,),("unreadable_criteria",{"exposure_events": None, "flag_called_during_run": False},None,(Action.EDIT_EXPOSURE_CRITERIA,),+ WARNING,),("deleted_flag",{"flag": replace(FLAG, deleted=True), "flag_called_during_run": False},None,(Action.EDIT_EXPOSURE_CRITERIA,),+ WARNING,+ ),+ ("ended_flag_not_called", {**ENDED, "flag_called_during_run": False}, FLAG_NOT_CALLED, (), INFO),+ (+ "ended_flag_called",+ {**ENDED, "flag_called_during_run": True},+ CALLS_NOT_COUNTED,+ (Action.OPEN_FEATURE_FLAG, Action.EDIT_EXPOSURE_CRITERIA),+ WARNING,+ ),+ (+ "ended_calls_unknown",+ {**ENDED, "flag_called_during_run": None},+ None,+ (Action.EDIT_EXPOSURE_CRITERIA,),+ INFO,+ ),+ (+ "ended_custom_event",+ {**ENDED, "exposure_events": CUSTOM_EVENT, "flag_called_during_run": False},+ CUSTOM_EXPOSURE_NOT_MATCHED,+ (Action.EDIT_EXPOSURE_CRITERIA,),+ WARNING,),])def test_names_the_cause(- self, _name: str, changes: dict[str, Any], subcode: str | None, actions: tuple[Action, ...]+ self,+ _name: str,+ changes: dict[str, Any],+ subcode: str | None,+ actions: tuple[Action, ...],+ severity: ExperimentHealthFindingSeverity,) -> None:ctx = replace(RUNNING_CONTEXT, **{"flag": FLAG, "exposures": NO_EXPOSURES, "exposure_events": FLAG_CALLS, **changes}@@ -108,7 +148,8 @@ class TestZeroExposures(TestCase):finding = zero_exposures(ctx)assert isinstance(finding, ExperimentHealthFinding)- self.assertEqual((finding.subcode, finding.actions), (subcode, actions))+ self.assertEqual((finding.subcode, finding.actions, finding.severity), (subcode, actions, severity))+ self.assertEqual(finding.detail.startswith("No users were exposed while the experiment ran"), ctx.has_ended)@parameterized.expand([@@ -185,7 +226,7 @@ class TestExposureActivation(BaseTest):class TestFlagCalledDuringRun(BaseTest):@parameterized.expand([- ("never_called", LAUNCHED_AT, None, None, FlagEvaluationsMode.EVENTS, False),+ ("never_called", LAUNCHED_AT, None, None, FlagEvaluationsMode.EVENTS, False, None),("called_after_launch",LAUNCHED_AT,@@ -193,6 +234,7 @@ class TestFlagCalledDuringRun(BaseTest):datetime(2026, 10, 2, tzinfo=UTC),FlagEvaluationsMode.EVENTS,True,+ None,),("called_before_launch_only",@@ -201,6 +243,7 @@ class TestFlagCalledDuringRun(BaseTest):datetime(2026, 9, 1, tzinfo=UTC),FlagEvaluationsMode.EVENTS,False,+ None,),("called_before_launch_with_calls_kept_out_of_events",@@ -209,6 +252,7 @@ class TestFlagCalledDuringRun(BaseTest):datetime(2026, 9, 1, tzinfo=UTC),FlagEvaluationsMode.FLAG_EVALUATIONS_ONLY,None,+ None,),("ended_called_during_the_run",@@ -217,6 +261,7 @@ class TestFlagCalledDuringRun(BaseTest):datetime(2026, 10, 5, tzinfo=UTC),FlagEvaluationsMode.EVENTS,True,+ False,),("ended_called_after_the_end",@@ -225,18 +270,48 @@ class TestFlagCalledDuringRun(BaseTest):datetime(2026, 10, 15, tzinfo=UTC),FlagEvaluationsMode.EVENTS,None,+ True,+ ),+ ("ended_never_called", LAUNCHED_AT, ENDED_AT, None, FlagEvaluationsMode.EVENTS, False, False),+ (+ "ended_called_during_the_run_with_calls_kept_out_of_events",+ LAUNCHED_AT,+ ENDED_AT,+ datetime(2026, 10, 5, tzinfo=UTC),+ FlagEvaluationsMode.FLAG_EVALUATIONS_ONLY,+ True,+ None,+ ),+ (+ "ended_inside_the_quiet_period",+ LAUNCHED_AT,+ NOW - timedelta(days=3, minutes=59),+ datetime(2026, 10, 5, tzinfo=UTC),+ FlagEvaluationsMode.EVENTS,+ True,+ None,+ ),+ (+ "ended_past_the_quiet_period",+ LAUNCHED_AT,+ NOW - timedelta(days=3, minutes=61),+ datetime(2026, 10, 5, tzinfo=UTC),+ FlagEvaluationsMode.EVENTS,+ True,+ False,),- ("draft", None, None, None, FlagEvaluationsMode.EVENTS, None),+ ("draft", None, None, None, FlagEvaluationsMode.EVENTS, None, None),])- def test_reads_the_calls_during_the_run(+ def test_reads_the_calls_during_and_after_the_run(self,_name: str,start_date: datetime | None,end_date: datetime | None,last_called_at: datetime | None,mode: FlagEvaluationsMode,- expected: bool | None,+ during_run: bool | None,+ after_end: bool | None,) -> None:OrganizationFeatureFlagsConfig.objects.update_or_create(organization=self.organization, defaults={"flag_evaluations_mode": mode}@@ -260,7 +335,7 @@ class TestFlagCalledDuringRun(BaseTest):team=self.team, name="exp", feature_flag=flag, start_date=start_date, end_date=end_date)- with override_settings(FEATURE_FLAG_LAST_CALLED_AT_SYNC_SOURCE="events"):+ with override_settings(FEATURE_FLAG_LAST_CALLED_AT_SYNC_SOURCE="events"), time_machine.travel(NOW, tick=False):ctx = load_health_context(experiment)- self.assertEqual(ctx.flag_called_during_run, expected)+ self.assertEqual((ctx.flag_called_during_run, ctx.flag_called_after_end), (during_run, after_end))diff --git a/products/experiments/backend/presentation/serializers.py b/products/experiments/backend/presentation/serializers.pyindex c6b04291e80c..5f51289ea922 100644--- a/products/experiments/backend/presentation/serializers.py+++ b/products/experiments/backend/presentation/serializers.py@@ -3455,6 +3455,15 @@ class ExperimentHealthInputsSerializer(serializers.Serializer):"came after the end, or when the organization's flag calls can't be read."),)+ flag_called_after_end = serializers.BooleanField(+ allow_null=True,+ help_text=(+ "Whether PostHog has recorded a call of the flag after the end. The flag state check reads it on an ended "+ "experiment whose flag is still active with multiple variants. False only after 3 days without a "+ "recorded call. Null before the end, before those 3 days are over, or when the organization's flag "+ "calls can't be read."+ ),+ )exposure_events = ExperimentHealthInputsExposureEventsSerializer(allow_null=True,help_text="The events the exposure criteria count. Null when the stored exposure criteria don't parse.",diff --git a/products/experiments/backend/presentation/views.py b/products/experiments/backend/presentation/views.pyindex 5e9aeed937df..c88e686d87e0 100644--- a/products/experiments/backend/presentation/views.py+++ b/products/experiments/backend/presentation/views.py@@ -1016,6 +1016,10 @@ class EnterpriseExperimentsViewSet(`running_but_flag_disabled`, as a warning. A caller who can't view the linked flag'shistory gets the warning, because the pause is not read. A draft whose flag is alreadyactive with multiple variants gets `not_started_but_multiple_variants_rolled_out` as info.+ An ended experiment whose flag is still active with multiple variants gets+ `ended_but_multiple_variants_rolled_out` as a warning, or `ended_flag_not_called` as info+ when the flag's `last_called_at` shows no call in the 3 days after the end. The info waits+ an extra hour, because `last_called_at` trails a call.A running experiment whose first primary metric is a funnel gets the info`early_significance` (subcode `below_detectable_effect`) when a significant variant'sdiff --git a/products/experiments/backend/test/test_presentation_api.py b/products/experiments/backend/test/test_presentation_api.pyindex 802f361061d5..bca3d5da0019 100644--- a/products/experiments/backend/test/test_presentation_api.py+++ b/products/experiments/backend/test/test_presentation_api.py@@ -104,6 +104,7 @@ _WITH_A_SECOND_CONDITION = {}_HEALTH_TRAFFIC = ConditionSetTraffic(since=datetime(2026, 10, 12, tzinfo=UTC),+ until=datetime(2026, 10, 19, tzinfo=UTC),team_timezone="UTC",people_by_set={1: 120, 2: 880},calls=2000,diff --git a/products/experiments/frontend/generated/api.schemas.ts b/products/experiments/frontend/generated/api.schemas.tsindex 7d951512f6f4..d115d264a013 100644--- a/products/experiments/frontend/generated/api.schemas.ts+++ b/products/experiments/frontend/generated/api.schemas.ts@@ -3667,6 +3667,11 @@ export interface ExperimentHealthInputsApi {* @nullable*/flag_called_during_run: boolean | null+ /**+ * Whether PostHog has recorded a call of the flag after the end. The flag state check reads it on an ended experiment whose flag is still active with multiple variants. False only after 3 days without a recorded call. Null before the end, before those 3 days are over, or when the organization's flag calls can't be read.+ * @nullable+ */+ flag_called_after_end: boolean | null/** The events the exposure criteria count. Null when the stored exposure criteria don't parse. */exposure_events: ExperimentHealthInputsExposureEventsApi | null/** Whether the project has received each event that the metrics and the exposure criteria name, by event name. A name that ingestion keeps no record of is absent. */diff --git a/products/experiments/frontend/generated/api.ts b/products/experiments/frontend/generated/api.tsindex 5874deaeb68c..daec45124e10 100644--- a/products/experiments/frontend/generated/api.ts+++ b/products/experiments/frontend/generated/api.ts@@ -766,6 +766,10 @@ export const getExperimentsHealthRetrieveUrl = (projectId: string, id: number) =* `running_but_flag_disabled`, as a warning. A caller who can't view the linked flag's* history gets the warning, because the pause is not read. A draft whose flag is already* active with multiple variants gets `not_started_but_multiple_variants_rolled_out` as info.+ * An ended experiment whose flag is still active with multiple variants gets+ * `ended_but_multiple_variants_rolled_out` as a warning, or `ended_flag_not_called` as info+ * when the flag's `last_called_at` shows no call in the 3 days after the end. The info waits+ * an extra hour, because `last_called_at` trails a call.** A running experiment whose first primary metric is a funnel gets the info* `early_significance` (subcode `below_detectable_effect`) when a significant variant'sdiff --git a/products/experiments/frontend/health/debug/healthDebugInputs.ts b/products/experiments/frontend/health/debug/healthDebugInputs.tsindex fb5099fa099c..c817bd0dc7e7 100644--- a/products/experiments/frontend/health/debug/healthDebugInputs.ts+++ b/products/experiments/frontend/health/debug/healthDebugInputs.ts@@ -152,6 +152,11 @@ export function buildFlagFacts(experiment: Experiment, state: HealthInputsState)value: serverValue(state, ({ flag_called_during_run }) => yesNoUnknown(flag_called_during_run)),help: "The zero-exposures finding says the flag has no recorded calls when this is No. Unknown before launch, when the latest call came after the end, or when the organization's flag calls skip the events table.",},+ {+ label: 'Called after the end',+ value: serverValue(state, ({ flag_called_after_end }) => yesNoUnknown(flag_called_after_end)),+ help: "When this is No, the flag-state finding for an ended experiment is info. No needs 3 days without a recorded call after the end. Unknown before the end, before those 3 days are over, or when the organization's flag calls skip the events table.",+ },]}diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 3586dccbdcb9..fa1492e612d8 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -48357,6 +48357,11 @@ export namespace Schemas {* @nullable*/flag_called_during_run: boolean | null;+ /**+ * Whether PostHog has recorded a call of the flag after the end. The flag state check reads it on an ended experiment whose flag is still active with multiple variants. False only after 3 days without a recorded call. Null before the end, before those 3 days are over, or when the organization's flag calls can't be read.+ * @nullable+ */+ flag_called_after_end: boolean | null;/** The events the exposure criteria count. Null when the stored exposure criteria don't parse. */exposure_events: ExperimentHealthInputsExposureEvents | null;/** Whether the project has received each event that the metrics and the exposure criteria name, by event name. A name that ingestion keeps no record of is absent. */