fix(replay): stop session replay when over the mobile recordings quota - #825
Merged
Merged
Conversation
The server reports the mobile session replay quota as `quotaLimited: ["mobile_recordings"]` in remote config and keeps `sessionRecording` set, because web shares that field. Treat the value the same as `sessionRecording: false`. `quotaLimited` moves to `PostHogRemoteConfigResponse` so `/config` responses parse it. Generated-By: PostHog Desktop Task-Id: f115d189-5362-410f-9778-f87e6f59f5d6
Contributor
|
[Medium risk] Session replay disables when mobile recordings quota is exceeded. The PR appears safe to merge; no actionable regression was identified. Reviews (1) · Last reviewed commit: "fix(replay): stop session replay when ov..." |
arnohillen
requested review from
a team,
TueHaulund,
fasyy612 and
ksvat
and removed request for
a team
September 29, 2026 22:11
Contributor
posthog-android Compliance ReportDate: 2026-09-29 22:12:14 UTC ✅ All Tests Passed!46/46 tests passed Capture Tests✅ 29/29 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
arnohillen
marked this pull request as ready for review
September 29, 2026 22:25
turnipdabeets
approved these changes
Sep 29, 2026
5 of 23 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💡 Motivation and Context
Session replay now stops when the project is over its mobile session replay quota.
quotaLimited: ["mobile_recordings"]in remote config. Server change: PostHog/posthog#103077.sessionRecordingenabled in that case, because web recording is still allowed.Changes:
/confighasquotaLimitedwithmobile_recordings, the SDK handlessessionRecordingasfalse. Replay turns off, the cached recording config is removed, and the SDK logs a message./configdoes not report it, replay behaves normally again.quotaLimitedmoves fromPostHogFlagsResponseto its base classPostHogRemoteConfigResponse, so/configresponses parse it too./flagsresponses still expose it through inheritance. Declaring it on both classes is not possible, because Gson rejects two fields with the same JSON name in one class hierarchy. Both classes are@PostHogInternal. Theposthog.apidiff shows the constructor andcomponentNchanges onPostHogFlagsResponse.💚 How did you test it?
PostHogRemoteConfigTest: a/configwith a normalsessionRecordingobject andquotaLimited: ["mobile_recordings"]leaves replay inactive and evicts the cache. A second/configwithout it makes replay active again.PostHogRemoteConfig.kt(assertFalse(sut.isSessionReplayFlagActive()))../gradlew :posthog:test --tests 'com.posthog.internal.PostHogRemoteConfigTest': 111 tests pass.PostHogFeatureFlagsTest,PostHogFeatureFlagsV1TestandPostHogApiTestinposthogpass. They coverquotaLimited: ["feature_flags"]on/flags.FeatureFlagErrorTrackingTestandPostHogEvaluateFlagsTestinposthog-serverpass.spotlessCheckpasses.apiDumpregeneratedposthog/api/posthog.api.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
/configsession recording is processed, and reuses the existingsessionRecording: falsepath. The flags re-arm path and cold start read the cached recording config, so they stay off with no extra checks.quotaLimited, so no spec divergence applies.Created with PostHog Desktop