: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(replay-vision): name the project timezone on scout schedules (#95327)
posthog[bot]914940097e28
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex c2b2ba0d68b5..3217e5ef6e40 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -8825,13 +8825,13 @@ snapshots:scenes-app-replay-vision--scanner-scan-drought--light:hash: v1.k794b7964.d3e3119d983ea105adcd26771cfdfbe14e082892971e48cb4000de6ca48e44df.pfdBzR5cE9sN8GjQF_54zIi5OvM-4nGsvyzsZd9TLSkscenes-app-replay-vision--scanner-scouts--dark:- hash: v1.k794b7964.174b7e25770bf4078971ec6b27ede47c0e76f7b08d54ae2744b1df565358a306.j4XgQXlEtlJH60fRmBnJhujHhRN2iVkocBhPgNkOwgE+ hash: v1.k794b7964.8a95f790a279c39ae389ddef6327f09b607f61f3bf42026498beeca2779090e7.9CJc3oR8vxy97OUqFWI7gIvIwG9MvbpHWy_FeZ-qqnAscenes-app-replay-vision--scanner-scouts--light:- hash: v1.k794b7964.e5ee11bc93e87a49bd54ccb36fe71f608e8ab17de86365fb9e9f47ea89d49b98.uQGAYBhOYxVMRtTluS0asETRSmXep-NxTAqFL1Gz0Eg+ hash: v1.k794b7964.e574601527f6ee932adff3244f99b0422f8a32972d28e4391277387d26d967f1.BHVJsxaI0JG0RbtqtSvRrHgo2l7M60-mgfH2ZOFt8xgscenes-app-replay-vision--scanner-scouts-empty--dark:- hash: v1.k794b7964.b0561ed7865305dcaff884b4e30ff6b9e5424677062f570f455a2e23a3a00c0e.Ms68iJ7r9TRcGaT_CxUs3o7JxoMpAevF6p6-wDINvi8+ hash: v1.k794b7964.7f7434025d5fec47b6866e48735766c1c9125655617ebf63d2e92d2b740678fc.s_ygEWntMkDhp6ACIlK2h_KjJyScohJUaMaRQ_ARzmcscenes-app-replay-vision--scanner-scouts-empty--light:- hash: v1.k794b7964.2a1c47e6ee8210c8aa146f945a35e929a29fda069a8cbfdb6fa8895824c79579.gTji4ohO1iT-41yXqxfP1CqCtRuEZKko4iq3BGKmlRs+ hash: v1.k794b7964.ff3212b72908a9571d47b33e570197ecb4aeca4a3893ff4d6acbc669c5e24a56.7m1DF3U4Bzz3jCHIq6q5wRapDG-uvOdBJ3EfSbdBWM4scenes-app-replay-vision--scanner-templates--dark:hash: v1.k794b7964.5730130a0ab80bc33dc701a8cc69c354f8ac4f50df6c4a25f6b0627a4e90ceeb.0zwSfaSwHJZ0F2c__vQj7Bj3VUvQZD3nu5zcrxJym9oscenes-app-replay-vision--scanner-templates--light:diff --git a/frontend/src/lib/components/ScheduledRunStatus.tsx b/frontend/src/lib/components/ScheduledRunStatus.tsxindex e79c3a0c2ebe..8ac61aa17d06 100644--- a/frontend/src/lib/components/ScheduledRunStatus.tsx+++ b/frontend/src/lib/components/ScheduledRunStatus.tsx@@ -1,7 +1,12 @@+import { useValues } from 'kea'import type { ReactNode } from 'react'import { IconCalendar, IconClock } from '@posthog/icons'-import { Link } from '@posthog/lemon-ui'+import { Link, Tooltip } from '@posthog/lemon-ui'++import { shortTimeZone } from 'lib/utils/timezones'+import { teamLogic } from 'scenes/teamLogic'+import { urls } from 'scenes/urls'interface NextScheduledRunProps {children: ReactNode@@ -40,3 +45,28 @@ export function ProjectTimezoneNotice({ timezone, settingsUrl }: ProjectTimezone</div>)}++/** Inline project timezone abbreviation, e.g. "(PST)", with a tooltip linking to settings. */+export function ProjectTimezoneHint(): JSX.Element | null {+ const { currentTeam } = useValues(teamLogic)+ if (!currentTeam) {+ return null+ }+ const tz = shortTimeZone(currentTeam.timezone) ?? currentTeam.timezone+ return (+ <Tooltip+ interactive+ title={+ <>+ Times are in the{' '}+ <Link to={urls.settings('environment-customization', 'date-and-time')} target="_blank">+ project's timezone+ </Link>{' '}+ ({currentTeam.timezone})+ </>+ }+ >+ <span className="text-muted font-normal">({tz})</span>+ </Tooltip>+ )+}diff --git a/frontend/src/lib/components/TZLabel/index.tsx b/frontend/src/lib/components/TZLabel/index.tsxindex be175fdbac7f..8c59f21a8f56 100644--- a/frontend/src/lib/components/TZLabel/index.tsx+++ b/frontend/src/lib/components/TZLabel/index.tsx@@ -29,7 +29,7 @@ const BASE_OUTPUT_FORMAT_WITH_SECONDS = 'ddd, MMM D, YYYY h:mm:ss A'const tickerListeners = new Set<() => void>()let tickerId: number | null = null-function subscribeToTicker(listener: () => void): () => void {+export function subscribeToTicker(listener: () => void): () => void {tickerListeners.add(listener)if (tickerId === null) {tickerId = window.setInterval(() => tickerListeners.forEach((tick) => tick()), 1000)diff --git a/frontend/src/scenes/feature-flags/FeatureFlagSchedule.tsx b/frontend/src/scenes/feature-flags/FeatureFlagSchedule.tsxindex f056e47244e3..26d885d8fac5 100644--- a/frontend/src/scenes/feature-flags/FeatureFlagSchedule.tsx+++ b/frontend/src/scenes/feature-flags/FeatureFlagSchedule.tsx@@ -27,6 +27,7 @@ import {Link,} from '@posthog/lemon-ui'+import { ProjectTimezoneHint } from 'lib/components/ScheduledRunStatus'import { TZLabel } from 'lib/components/TZLabel'import { describeCron } from 'lib/cron'import { dayjs } from 'lib/dayjs'@@ -65,31 +66,6 @@ import { ScheduleTimeline } from './ScheduleTimeline'export const DAYJS_FORMAT = 'MMMM DD, YYYY h:mm A'-/** Shows the project timezone abbreviation (e.g. "PST") with a tooltip linking to settings. */-function ScheduleTimezoneHint(): JSX.Element | null {- const { currentTeam } = useValues(teamLogic)- if (!currentTeam) {- return null- }- const tz = shortTimeZone(currentTeam.timezone) ?? currentTeam.timezone- return (- <Tooltip- interactive- title={- <>- Times are in the{' '}- <Link to={urls.settings('environment-customization', 'date-and-time')} target="_blank">- project's timezone- </Link>{' '}- ({currentTeam.timezone})- </>- }- >- <span className="text-muted font-normal">({tz})</span>- </Tooltip>- )-}-type AggregationLabel = (groupTypeIndex: number | null | undefined, deferToUserWording?: boolean) => Nounfunction getScheduledVariantsPayloads(@@ -643,7 +619,7 @@ export default function FeatureFlagSchedule(): JSX.Element {</Tooltip>) : (<>- Date and time <ScheduleTimezoneHint />+ Date and time <ProjectTimezoneHint /></>)}</label>@@ -902,7 +878,7 @@ export default function FeatureFlagSchedule(): JSX.Element {{scheduleDateMarker ? (<>{` on ${scheduleDateMarker.format(DAYJS_FORMAT)} `}- <ScheduleTimezoneHint />+ <ProjectTimezoneHint /></>) : (' on the scheduled date'@@ -1150,7 +1126,7 @@ export default function FeatureFlagSchedule(): JSX.Element {'Next run') : (<>- Date and time <ScheduleTimezoneHint />+ Date and time <ProjectTimezoneHint /></>)}</label>diff --git a/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx b/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsxindex e8490f49ba23..d5e7e053b80f 100644--- a/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx+++ b/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx@@ -658,7 +658,8 @@ const digestScoutConfig = {pause_reason: null,source_product: 'replay_vision',source_id: summarizerScanner.id,- cron_schedule: '0 9 * * *',+ run_cron_schedule: '0 9 * * *',+ run_interval_minutes: 1440,output_destinations: [],created_at: '2026-05-02T09:00:00Z',}diff --git a/products/replay_vision/frontend/replay_scanners/components/ScannerScoutRow.tsx b/products/replay_vision/frontend/replay_scanners/components/ScannerScoutRow.tsxindex 66dbc7df37d8..2f2d2753ec30 100644--- a/products/replay_vision/frontend/replay_scanners/components/ScannerScoutRow.tsx+++ b/products/replay_vision/frontend/replay_scanners/components/ScannerScoutRow.tsx@@ -3,6 +3,7 @@ import { useActions, useValues } from 'kea'import { IconChevronRight, IconEye, IconGear, IconTrash } from '@posthog/icons'import { LemonButton, LemonDialog, LemonSwitch, Tooltip } from '@posthog/lemon-ui'+import { ProjectTimezoneHint } from 'lib/components/ScheduledRunStatus'import { TZLabel } from 'lib/components/TZLabel'import { LemonSkeleton } from 'lib/lemon-ui/LemonSkeleton'import { LemonTable } from 'lib/lemon-ui/LemonTable'@@ -11,6 +12,7 @@ import { capitalizeFirstLetter } from 'lib/utils/strings'import { teamLogic } from 'scenes/teamLogic'import type { SignalScoutConfigApi } from 'products/signals/frontend/generated/api.schemas'+import { ScoutNextRunLabel } from 'products/signals/frontend/inbox/components/config/scouts/ScoutNextRunLabel'import { nextRunAt, scoutCadenceLabel } from 'products/signals/frontend/inbox/utils/scoutGroups'import { prettifyScoutSkillName } from 'products/signals/frontend/inbox/utils/scoutRunsWindow'@@ -18,6 +20,8 @@ import { getReplayVisionEditDisabledReason } from '../../utils/accessControl'import { replayScannerLogic } from '../replayScannerLogic'import { scannerScoutLogic } from '../scannerScoutLogic'+const CLOCK_TIME_RE = /\d{1,2}:\d{2}/+/** One scout on the scanner's Scouts tab: name, cadence, the on/off switch, its* settings, and the link into the Inbox (the one place the underlying scout shows through). */export function ScannerScoutRow({@@ -62,38 +66,47 @@ export function ScannerScoutRow({const runDisabledReason =editDisabledReason ?? (rollups.get(config.skill_name)?.runningRun ? 'This scout is already running' : undefined)- const timezone = currentTeam?.timezone ?? 'UTC'- const now = new Date()- const next = nextRunAt(config, timezone, now)- const nextRunText =- !next || !config.enabled- ? null- : next <= now- ? 'due now'- : next.toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit', timeZone: timezone })+ const cadenceText = capitalizeFirstLetter(scoutCadenceLabel(config))+ // Only a clock time is evaluated in the project timezone; "every 30 minutes" has none to name.+ const namesClockTime = CLOCK_TIME_RE.test(cadenceText)+ const hasNextRun = nextRunAt(config, currentTeam?.timezone ?? 'UTC', new Date()) !== nullreturn (<div className={cn('flex flex-col rounded border bg-surface-primary', !config.enabled && 'opacity-65')}><div className="flex flex-wrap items-center gap-x-4 gap-y-2 px-4 py-2.5">- <button- type="button"- className="-mx-1 flex min-w-0 flex-1 cursor-pointer items-center gap-2 rounded px-1 py-1 text-left transition-colors hover:bg-surface-secondary"- onClick={() => toggleScoutExpanded(config.skill_name)}- aria-label={`${expanded ? 'Hide' : 'Show'} reports from ${prettifyScoutSkillName(config.skill_name)}`}- aria-expanded={expanded}- data-attr="vision-scout-row-expand"- >- <IconChevronRight- className={cn('shrink-0 text-base transition-transform', expanded && 'rotate-90')}- />- <span className="flex min-w-0 flex-1 flex-col gap-0.5">- <span className="text-sm font-medium">{prettifyScoutSkillName(config.skill_name)}</span>- <span className="text-[11px] text-muted">- {capitalizeFirstLetter(scoutCadenceLabel(config))}- {nextRunText && ` · next run ${nextRunText}`}+ {/* Outside the expand button: the next-run popover has clickable rows. */}+ <div className="flex min-w-0 flex-1 flex-col gap-0.5">+ <button+ type="button"+ className="-mx-1 flex min-w-0 cursor-pointer items-center gap-2 rounded px-1 py-1 text-left transition-colors hover:bg-surface-secondary"+ onClick={() => toggleScoutExpanded(config.skill_name)}+ aria-label={`${expanded ? 'Hide' : 'Show'} reports from ${prettifyScoutSkillName(config.skill_name)}`}+ aria-expanded={expanded}+ data-attr="vision-scout-row-expand"+ >+ <IconChevronRight+ className={cn('shrink-0 text-base transition-transform', expanded && 'rotate-90')}+ />+ <span className="truncate text-sm font-medium">+ {prettifyScoutSkillName(config.skill_name)}</span>+ </button>+ <span className="pl-6 text-[11px] text-muted">+ {cadenceText}+ {namesClockTime && (+ <>+ {' '}+ <ProjectTimezoneHint />+ </>+ )}+ {hasNextRun && (+ <>+ {' · next run '}+ <ScoutNextRunLabel config={config} />+ </>+ )}</span>- </button>+ </div><div className="flex shrink-0 items-center gap-1"><Tooltip title="Scout settings"><LemonButtondiff --git a/products/replay_vision/frontend/replay_scanners/components/ScannerScoutsTab.tsx b/products/replay_vision/frontend/replay_scanners/components/ScannerScoutsTab.tsxindex ce0cc19e46db..9a728d7ebf09 100644--- a/products/replay_vision/frontend/replay_scanners/components/ScannerScoutsTab.tsx+++ b/products/replay_vision/frontend/replay_scanners/components/ScannerScoutsTab.tsx@@ -4,6 +4,7 @@ import { useMemo } from 'react'import { IconCalendar, IconPencil, IconPlus, IconTrends, IconWarning } from '@posthog/icons'import { LemonBanner, LemonButton, LemonCard, LemonTag } from '@posthog/lemon-ui'+import { ProjectTimezoneHint } from 'lib/components/ScheduledRunStatus'import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'import { AccessControlLevel, AccessControlResourceType } from '~/types'@@ -47,21 +48,21 @@ function ScoutTemplateCard({<LemonCard hoverEffect={false} className="flex flex-col gap-3 p-3"><div className="flex min-w-0 items-start gap-2"><span className="mt-0.5 shrink-0 text-muted">{TEMPLATE_ICONS[template.key]}</span>- <div className="min-w-0">- <h3 className="m-0 text-sm font-semibold">{template.title}</h3>- <p className="m-0 text-xs text-muted">{template.description}</p>+ <div className="flex min-w-0 flex-col gap-2">+ <div>+ <h3 className="m-0 text-sm font-semibold">{template.title}</h3>+ <p className="m-0 text-xs text-muted">{template.description}</p>+ </div>+ {/* The scratch card carries the same default cron, but it isn't a ready-made scout,+ so advertising a schedule would promise more than it hands you. */}+ {template.key !== 'scratch' && (+ <LemonTag type="muted" size="small" className="self-start">+ {templateScheduleLabel(template)} <ProjectTimezoneHint />+ </LemonTag>+ )}</div></div>- <div className="mt-auto flex items-center justify-between gap-2">- {/* The scratch card carries the same default cron, but it isn't a ready-made scout,- so advertising a schedule would promise more than it hands you. */}- {template.key === 'scratch' ? (- <span />- ) : (- <LemonTag type="muted" size="small">- {templateScheduleLabel(template)}- </LemonTag>- )}+ <div className="mt-auto flex justify-end"><LemonButtontype="primary"size="small"@@ -139,15 +140,18 @@ export function ScannerScoutsTab({ scannerId }: { scannerId: string }): JSX.Elemworth a look. Pick a starting point, then review and edit it before saving.</p></div>- <div className="grid gap-2 md:grid-cols-2 xl:grid-cols-4">- {templates.map((template) => (- <ScoutTemplateCard- key={template.key}- template={template}- disabledReason={createDisabledReason}- onUse={() => openCreateModal(template.key)}- />- ))}+ {/* Container query: the scene is much narrower than the viewport with a side panel open. */}+ <div className="@container">+ <div className="grid gap-2 @md:grid-cols-2 @4xl:grid-cols-4">+ {templates.map((template) => (+ <ScoutTemplateCard+ key={template.key}+ template={template}+ disabledReason={createDisabledReason}+ onUse={() => openCreateModal(template.key)}+ />+ ))}+ </div></div></section>diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutNextRunLabel.test.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutNextRunLabel.test.tsxnew file mode 100644index 000000000000..b057ad33bc0e--- /dev/null+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutNextRunLabel.test.tsx@@ -0,0 +1,66 @@+import '@testing-library/jest-dom'++import { act, cleanup, render, screen } from '@testing-library/react'++import { initKeaTests } from '~/test/init'++import type { SignalScoutConfigApi } from 'products/signals/frontend/generated/api.schemas'++import { ScoutNextRunLabel } from './ScoutNextRunLabel'++const NOW = new Date('2026-07-21T12:00:00Z')+const MINUTE_MS = 60 * 1000++const config: SignalScoutConfigApi = {+ id: 'config-1',+ skill_name: 'signals-scout-general',+ description: 'General scout',+ scout_origin: 'canonical',+ owners: [],+ enabled: true,+ status: 'active',+ pause_reason: null,+ emit: true,+ run_interval_minutes: 30,+ run_cron_schedule: null,+ output_destinations: {},+ structured_output_schema: null,+ mcp_gateway_server_ids: [],+ last_run_at: '2026-07-21T11:50:00Z',+ consecutive_failure_count: 0,+ status_changed_at: null,+ auto_pause_exempt: false,+ network_access: 'trusted',+ model: null,+ tags: [],+ source_product: null,+ source_id: null,+ created_at: '2026-07-21T00:00:00Z',+ write_scopes: [],+}++describe('ScoutNextRunLabel', () => {+ beforeEach(() => {+ jest.useFakeTimers({ now: NOW })+ initKeaTests()+ })++ afterEach(() => {+ cleanup()+ jest.useRealTimers()+ })++ it('turns over to "Due now" as the run falls due, with no reload', () => {+ render(<ScoutNextRunLabel config={config} />)++ act(() => {+ jest.advanceTimersByTime(19 * MINUTE_MS)+ })+ expect(screen.queryByText('Due now')).not.toBeInTheDocument()++ act(() => {+ jest.advanceTimersByTime(2 * MINUTE_MS)+ })+ expect(screen.getByText('Due now')).toBeInTheDocument()+ })+})diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutNextRunLabel.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutNextRunLabel.tsxindex e06fbebf170d..e240a7bbbb34 100644--- a/products/signals/frontend/inbox/components/config/scouts/ScoutNextRunLabel.tsx+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutNextRunLabel.tsx@@ -1,8 +1,10 @@import { useValues } from 'kea'+import { useEffect, useState } from 'react'import { Tooltip } from '@posthog/lemon-ui'-import { TZLabel } from 'lib/components/TZLabel'+import { TZLabel, subscribeToTicker } from 'lib/components/TZLabel'+import { usePageVisibility } from 'lib/hooks/usePageVisibility'import { teamLogic } from 'scenes/teamLogic'import type { SignalScoutConfigApi as SignalScoutConfig } from 'products/signals/frontend/generated/api.schemas'@@ -16,13 +18,29 @@ import { nextRunAt } from '../../../utils/scoutGroups'*/export function ScoutNextRunLabel({ config }: { config: SignalScoutConfig }): JSX.Element {const { currentTeam } = useValues(teamLogic)- const now = new Date()- const next = nextRunAt(config, currentTeam?.timezone ?? 'UTC', now)+ const { isVisible } = usePageVisibility()+ const [, refresh] = useState(0)+ const now = Date.now()+ const next = nextRunAt(config, currentTeam?.timezone ?? 'UTC', new Date(now))+ const dueAt = next?.getTime() ?? null+ const isDue = dueAt !== null && dueAt <= now++ // Surfaces that don't poll never re-render this, so it flips itself to "Due now".+ useEffect(() => {+ if (dueAt === null || isDue || !isVisible) {+ return+ }+ return subscribeToTicker(() => {+ if (dueAt <= Date.now()) {+ refresh((count) => count + 1)+ }+ })+ }, [dueAt, isDue, isVisible])if (!next) {return <span className="text-muted">—</span>}- if (next.getTime() <= now.getTime()) {+ if (isDue) {return (<Tooltip title="Past its scheduled time. The scheduler picks it up on its next pass, usually within half an hour."><span>Due now</span>