Ticket: https://posthoghelp.zendesk.com/agent/tickets/45321
Users get re-bucketed after identify() despite "Persist flag across authentication" being enabled.
There seems to be a race condition: when preloadFeatureFlags (default: true) is in flight and user calls identify(), the subsequent reloadFeatureFlags() is dropped instead of queued.
iOS - PostHogRemoteConfig.swift:266-271
Android - PostHogRemoteConfig.kt:341-344
Both have:
if loadingFeatureFlags {
return // ← Dropped, never sends $anon_distinct_id
}
First request completes without $anon_distinct_id → server never stores hash key override → user re-bucketed.
A potential fix is to queue pending reload instead of dropping:
if loadingFeatureFlags {
pendingFlagsReload = true // ← Queue it
return
}
// After request completes, check pendingFlagsReload and retry