Skip to content

Session replay: idle tabs still produce 2-3 day recordings under one session id on 1.425.1 #4825

Description

@steadily-mondavarious

Bug: idle tabs still produce multi-day recordings under one session id on 1.425.1

SDK: posthog-js 1.425.1 (npm), Next.js 16 pages router, US cloud, project 55682.

Expected: SESSION_LENGTH_LIMIT_MILLISECONDS (24 h) caps a recording. lazy-loaded-session-recorder.ts says the session check now runs in every idle state so that idle tabs no longer "accrete multi-day recordings that blew straight through SESSION_LENGTH_LIMIT under one session id".

Observed: tabs left open over a weekend keep shipping snapshot data under the same session id for 2 to 3 days, with near-zero active time. In the 7 days to 2026-09-07 13:30Z the project has 152 recordings spanning more than 86,400 s; 48 started after 1.425.1 reached production, and 15 of those carry only $lib_version = 1.425.1 events (so not a stale-bundle tab). Three examples, single SDK version 1.425.1 throughout:

session_id first snapshot (UTC) span active
01a07916-11ad-7fa8-a71f-53152daa800a 2026-09-04 04:44:26 240,882 s (2.8 d) 0 s
01a07916-11a7-7c5c-8cc5-fb2ceb8cb25f 2026-09-04 12:28:26 213,042 s (2.5 d) 2 s
01a06939-3166-74ae-bd56-5d00aaa5d179 2026-09-03 21:42:31 170,694 s (2.0 d) 8 s

A fourth with real interaction: 01a068fe-0d49-720d-8725-c09c9de96ad7, first snapshot 2026-09-03 20:37:55, span 147,154 s, 471 s active, 104 events, all 1.425.1.

Measured with HogQL: min(min_first_timestamp), max(max_last_timestamp) and sum(active_milliseconds) grouped by session_id on raw_session_replay_events; SDK version from properties.$lib_version on the events sharing the $session_id.

Config that may matter: session_idle_timeout_seconds: 600, capture_pageview: false, capture_pageleave: true, session_recording.maskAllInputs: true, before_send: sampleByEvent(["$web_vitals"], 0.1). We also call sessionManager.resetSessionId() ourselves on route changes (feature flagged, live since 2026-09-03 18:40Z); the sessions above have no route changes in them, so that path was not involved.

Question: is the 24 h check expected to fire for a tab that emits no rrweb events at all while backgrounded (0 s active), or does it rely on the recorder receiving an event to run checkAndGetSessionAndWindowId? If the latter, the first event after wake-up appears to land on the old session id before rotation, extending max_last_timestamp past the cap.

Activity

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