Skip to content

Session replay (React Native): support v2 trigger groups (conditional recording) #4595

Open

Description

@ioannisj

Description

Mobile tracker for PostHog/posthog#35661 (Conditional Recording 3000). The replay trigger config is getting a v2 shape, and the mobile SDKs need to support it:

  • multiple trigger groups, e.g. (20% sampling + error event) or (linked flag + url)
  • minimum duration moving inside a group
  • per-SDK matching, e.g. 40% sampling on web and 33% on mobile
  • more trigger types on non-web SDKs (event and URL/screen triggers)
  • debug properties, so conditional recording can be debugged outside web too

Sibling SDK issues:

Activity

  1. github-actions commented on Aug 21, 2026

    @github-actions
    Contributor

    AI triage for #4595

    Conclusion: Confirmed feature gap: React Native supports legacy conditional-recording fields but does not evaluate the v2 trigger-group configuration.
    Confidence: 96%
    Suggested labels: feature, feature/replay, feature/mobile, react-native, team/client-libraries

    Confirmed as an open React Native parity gap.

    RN currently implements the legacy sessionRecording.linkedFlag and eventTriggers fields (released in 4.52.0), but does not read version: 2 or triggerGroups. A v2 response therefore bypasses the existing legacy gates and can start recording without applying per-group conditions or sampling.

    This should be handled as a coordinated conditional-recording change rather than a small parser update: it changes remote-config recording start conditions and can affect recording volume. Before implementation, align the mobile v2 wire contract and native-plugin requirements with iOS/Android, then add focused coverage for group OR/AND semantics, per-group sampling persistence across session rotation, event and screen matching, minimum-duration behavior, malformed/missing config, remote-config reloads, and debug-property emission.

    Investigation

    • React Native's replay evaluator reads only legacy linkedFlag and eventTriggers from persisted SessionReplay configuration. It has no version === 2 or triggerGroups handling.
    • The RN event-trigger implementation stores one activated-session value and AND-combines all legacy conditions. It cannot represent multiple independent groups, each with its own match type, sampling decision, activation state, or minimum duration.
    • RN 4.52.0 released legacy event-trigger support in PR feat(react-native): support session replay event triggers #3932, including session re-arming and linked-flag combination, but this is not v2 trigger-group support.
    • The browser remote-config schema defines v2 groups with id, name, sampleRate, optional minDurationMs, and event, URL, flag, and property conditions. Browser's v2 strategy persists sampling per group and registers replay debug properties.
    • No React Native implementation was found for v2 trigger-group parsing, group-level sampling, group minimum duration, URL/screen matching, property filtering, or replay debug properties.
    • The optional RN native plugin bridge exposes recording controls but no v2 trigger-group API, so JS/native responsibilities and minimum-duration support must be explicitly agreed before changing behavior.
    • This is a recording-start-condition and remote-config change. The replay incident guidance identifies these paths as capable of silently suppressing recordings or changing fleet-wide recording volume; failure behavior for absent, malformed, and delayed v2 config must be deliberate and tested.

    Relevant files: packages/react-native/src/posthog-rn.ts, packages/react-native/test/session-replay-event-triggers.spec.ts, packages/react-native/src/optional/OptionalPlugin.ts, packages/react-native/CHANGELOG.md, packages/browser-common/src/types/remote-config.ts, packages/browser/src/extensions/replay/external/recording-strategies.ts, packages/browser/playwright/mocked/session-recording/trigger-groups-v2.spec.ts, .agents/skills/replay-incident-risk/INCIDENTS.md

    Fix assessment

    • Straightforward: no
    • Risk: high
    • Reason: The current legacy gate is localized, but v2 requires a state model for multiple independently sampled and activated groups, persistence across session changes, screen/URL semantics, duration handling, diagnostics, and coordination with the native replay SDKs. A direct field parser would not safely preserve the required semantics.

    Fix PR skipped: An older related issue appears to cover the same report: #3796

    Pi session

    The resumable JSONL pi session for this run was saved to a private gist: https://gist.github.com/marandaneto/44dbb6b848b6ecd3dfd7c6785c8d904d

    Download it locally, then fork it into your own pi session:

    pi --fork path/to/session.jsonl

    Saved session:

    Close proposal

    None. No issue close action was taken.


    Generated by posthog-watcher-action using pi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions