Skip to content

: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.

fix(replay): repair the internal golink rewrite and inbox dead-click states (#77108)

posthog[bot]92f96348d739
diff --git a/frontend/src/lib/components/Support/supportLogic.test.ts b/frontend/src/lib/components/Support/supportLogic.test.ts
index 7c68a9d4151c..efe4c0fd99ef 100644
--- a/frontend/src/lib/components/Support/supportLogic.test.ts
+++ b/frontend/src/lib/components/Support/supportLogic.test.ts
@@ -31,10 +31,12 @@ describe('supportLogic', () => {
})
it('rewrites the session line to the internal golink for staff triage', () => {
- mockedGetReplayUrl.mockReturnValue(`${window.location.origin}/replay/abc?t=30`)
+ // posthog-js returns a project-scoped path, not one rooted at the current origin's /replay/ —
+ // this shape is what regressed the naive origin-prefix replace this test used to assert on.
+ mockedGetReplayUrl.mockReturnValue(`${window.location.origin}/project/sTMFPsFhdP1Ssg/replay/abc?t=30`)
const snippet = getPublicSupportSnippet(Region.US, organization, team, false)
expect(snippet).toContain('Session: http://go/session/abc?t=30')
- expect(snippet).not.toContain(`${window.location.origin}/replay/`)
+ expect(snippet).not.toContain(`${window.location.origin}/project/`)
})
it('omits the session line when there is no recording', () => {
diff --git a/frontend/src/lib/components/Support/supportLogic.ts b/frontend/src/lib/components/Support/supportLogic.ts
index c7cadc64f7eb..7c1e27de36f3 100644
--- a/frontend/src/lib/components/Support/supportLogic.ts
+++ b/frontend/src/lib/components/Support/supportLogic.ts
@@ -59,13 +59,20 @@ function getCurrentLocationLink(): string {
// The recording lives in PostHog's own telemetry project, which the reporting user is not a member
// of, so this link is for PostHog staff triaging the ticket/issue — never the user. We rewrite to the
-// internal http://go/session/ golink to make that explicit.
+// internal http://go/session/ golink to make that explicit. posthog-js returns a project-scoped path
+// (`/project/<token>/replay/<id>`), so pull the session id out of the `/replay/` segment rather than
+// assuming the URL starts with the current origin.
function getSessionReplayLink(): string {
const replayUrl = posthog.get_session_replay_url?.({ withTimestamp: true, timestampLookBack: 30 })
if (!replayUrl) {
return ''
}
- return `\nSession: ${replayUrl.replace(window.location.origin + '/replay/', 'http://go/session/')}`
+ const match = replayUrl.match(/\/replay\/([^/?#]+)([?#].*)?$/)
+ if (!match) {
+ return ''
+ }
+ const [, sessionId, queryAndHash] = match
+ return `\nSession: http://go/session/${sessionId}${queryAndHash ?? ''}`
}
function getErrorTrackingLink(uuid?: string): string {
diff --git a/frontend/src/scenes/inbox/components/signalCards/ScannerFindingSignalCard.tsx b/frontend/src/scenes/inbox/components/signalCards/ScannerFindingSignalCard.tsx
index f57386313d02..526bd3a8a199 100644
--- a/frontend/src/scenes/inbox/components/signalCards/ScannerFindingSignalCard.tsx
+++ b/frontend/src/scenes/inbox/components/signalCards/ScannerFindingSignalCard.tsx
@@ -3,7 +3,7 @@ import { useActions, useValues } from 'kea'
import { useEffect, useState } from 'react'
import { IconPlay } from '@posthog/icons'
-import { LemonTag } from '@posthog/lemon-ui'
+import { LemonTag, Spinner } from '@posthog/lemon-ui'
import { sessionRecordingInfoLogic } from 'lib/components/ViewRecordingButton/sessionRecordingInfoLogic'
import { RecordingPlayerType, useRecordingButton } from 'lib/components/ViewRecordingButton/ViewRecordingButton'
@@ -59,11 +59,12 @@ export function ScannerFindingSignalCard({ signal }: SignalCardProps): JSX.Eleme
// Batch-check the recording so the play affordance disables (rather than opening an empty player)
// when the recording wasn't captured or has expired.
const { checkRecordingInfo } = useActions(sessionRecordingInfoLogic)
- const { getRecordingExists } = useValues(sessionRecordingInfoLogic)
+ const { getRecordingExists, isRecordingExistsLoading } = useValues(sessionRecordingInfoLogic)
useEffect(() => {
checkRecordingInfo(extra.session_id)
}, [extra.session_id, checkRecordingInfo])
const hasRecording = getRecordingExists(extra.session_id)
+ const recordingCheckLoading = isRecordingExistsLoading(extra.session_id)
const { onClick: openRecording, disabledReason } = useRecordingButton({
sessionId: extra.session_id,
@@ -105,7 +106,7 @@ export function ScannerFindingSignalCard({ signal }: SignalCardProps): JSX.Eleme
<button
type="button"
onClick={openRecording}
- disabled={!!disabledReason}
+ disabled={!!disabledReason || recordingCheckLoading}
title={typeof disabledReason === 'string' ? disabledReason : undefined}
aria-label="Play recording"
className="group relative w-full aspect-video rounded overflow-hidden border bg-surface-secondary mb-2 cursor-pointer disabled:cursor-default disabled:opacity-70"
@@ -124,12 +125,19 @@ export function ScannerFindingSignalCard({ signal }: SignalCardProps): JSX.Eleme
thumbnailSrc ? 'bg-black/20 group-hover:bg-black/30' : 'group-hover:bg-fill-highlight-100'
)}
>
- <IconPlay
- className={clsx('size-10 drop-shadow', thumbnailSrc ? 'text-white' : 'text-tertiary')}
- aria-hidden
- />
+ {recordingCheckLoading ? (
+ <Spinner className={clsx('text-2xl', thumbnailSrc ? 'text-white' : 'text-tertiary')} />
+ ) : (
+ <IconPlay
+ className={clsx('size-10 drop-shadow', thumbnailSrc ? 'text-white' : 'text-tertiary')}
+ aria-hidden
+ />
+ )}
</div>
</button>
+ {hasRecording === false && (
+ <p className="text-xs text-tertiary mb-2">This recording is no longer available.</p>
+ )}
{/* Dot-separated meta line: affected user, finding window, active/total duration. */}
<div className="flex items-center gap-1.5 flex-wrap text-xs text-tertiary">
diff --git a/frontend/src/scenes/inbox/components/signalCards/SessionReplaySignalCard.tsx b/frontend/src/scenes/inbox/components/signalCards/SessionReplaySignalCard.tsx
index 9f3ef079beb1..1f0d34b46f91 100644
--- a/frontend/src/scenes/inbox/components/signalCards/SessionReplaySignalCard.tsx
+++ b/frontend/src/scenes/inbox/components/signalCards/SessionReplaySignalCard.tsx
@@ -1,9 +1,11 @@
+import { useValues } from 'kea'
import { useState } from 'react'
import { IconBug, IconCursorClick, IconGlobe, IconKeyboard } from '@posthog/icons'
import { LemonButton, LemonTag } from '@posthog/lemon-ui'
import type { LemonTagType } from '@posthog/lemon-ui'
+import { sessionRecordingInfoLogic } from 'lib/components/ViewRecordingButton/sessionRecordingInfoLogic'
import ViewRecordingButton, { RecordingPlayerType } from 'lib/components/ViewRecordingButton/ViewRecordingButton'
import { Dayjs, dayjs } from 'lib/dayjs'
import { LemonMarkdown } from 'lib/lemon-ui/LemonMarkdown'
@@ -109,6 +111,10 @@ export function SessionReplaySignalCard({ signal }: SignalCardProps): JSX.Elemen
const segmentSeekTime = recordingSeekTime(extra.session_start_time ?? undefined, extra.start_time)
+ const { getRecordingExists, isRecordingExistsLoading } = useValues(sessionRecordingInfoLogic)
+ const recordingExists = getRecordingExists(extra.session_id)
+ const recordingExistsLoading = isRecordingExistsLoading(extra.session_id)
+
const events = extra.event_history ?? []
const visibleEvents = showAllEvents ? events : events.slice(0, TIMELINE_PREVIEW_COUNT)
@@ -145,7 +151,11 @@ export function SessionReplaySignalCard({ signal }: SignalCardProps): JSX.Elemen
type="secondary"
size="small"
className="mb-2"
+ loading={recordingExistsLoading}
/>
+ {recordingExists === false && (
+ <p className="text-xs text-tertiary mb-2">This recording is no longer available.</p>
+ )}
{/* Dot-separated meta line: affected user, segment window, active/total duration. */}
<div className="flex items-center gap-1.5 flex-wrap text-xs text-tertiary mb-2">