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(onboarding): allow dismissing stale runs and clamp the elapsed timer (#74037)

Fernando Gomesd1406c39456c
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 3620cb817158..716d124f20a3 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -7711,9 +7711,9 @@ snapshots:
scenes-other-onboarding-shared-wizard-cloud-run--run-it-yourself--light:
hash: v1.k794b7964.6929d887dd4bcc9ac0c6fcc32e16d829771b0f97f38af905b7e62752c0b39a97.p5weyrIGjeKhnV6FuarEp-O82xPcQjs8cKYuLGLiEzc
scenes-other-onboarding-shared-wizard-sync-card--all-states--dark:
- hash: v1.k794b7964.c2680b2e5066715a5caf292f6c2f62453c11ef9efba55da9447b9c7e045d29b4.OHXSrZvJDQRwp3-m3pMUP78D1ncOUJZniMHLEgebdhI
+ hash: v1.k794b7964.610af7be0cbae0d8376dd7e61322612efdddbcb3d05be1fc6ac207652703b43a.bedJrmXY8fLxRiAI-ETzr2ook0bKDAyyluxsI0fgAPA
scenes-other-onboarding-shared-wizard-sync-card--all-states--light:
- hash: v1.k794b7964.ad65b946a5b7047aca4d2dd00a20402b9a39d27af424b9f6a1efe9e765f1ffe9.2iLK2CGn5yzUsqr994YZBAGtzyIw7BfxmA_knJ3NSDM
+ hash: v1.k794b7964.4d66c7e4d4abbf5853fd62ca35c61eab1a81a53074d7353dfeb99475160505f5.Ineb2GA1mTqEg3KwUd_P0Y6hbdM6FKJRxuBzCNfYOFU
scenes-other-onboarding-shared-wizard-sync-card--cloud-keeping-ci-green--dark:
hash: v1.k794b7964.fba9c3af456f60a00dec760305609433d1d8ffb609f1573352f71cb29f1fa6b2.2tmy7T0O1t2rw1SYTOXCMCePVPleYZWjuUnc4EU5a7Q
scenes-other-onboarding-shared-wizard-sync-card--cloud-keeping-ci-green--light:
@@ -7746,6 +7746,10 @@ snapshots:
hash: v1.k794b7964.c69534afe39d0311b0ed3247beb145b94381706a25f2e6c7b5d3415c87564375.ViSw0_amXLmDYynCEuR_kgnY5Ncm4ULveglgIJoTIaU
scenes-other-onboarding-shared-wizard-sync-card--playground--light:
hash: v1.k794b7964.0cfae6b396d23d4bf84998b078b2bc21d231cff6ca91c6ad72287015ffbc3612.G64MtMVMRObRn64tStKU_8edvGJThXVEEXPHQhxtMOY
+ scenes-other-onboarding-shared-wizard-sync-card--stalled--dark:
+ hash: v1.k794b7964.5d437bffa8c9834cf88a783f58dbab3f625c27839ac872f0c2db7fd4b08f4ed8.sOK517AeohAmtL0coLOcSFfAB90HUEtQGr2HwmZLoi8
+ scenes-other-onboarding-shared-wizard-sync-card--stalled--light:
+ hash: v1.k794b7964.b52a107e85cd22687e6bc1dcf23a4067f185915e7aaa4518b39ef1bbfefe87ac.TU0cv3huC_bueumE3zh9JXnBoRGtM6FKvdbtqCcUL4c
scenes-other-org-member-invites--current-user-is-admin--dark:
hash: v1.k794b7964.a513d2d2902b9bed180ef998cfa04a5e291f1cc8072d67739072199cf25debec.Ubcb2mL9HqKazuyRseAkOQVNa1J9hrioFTBZpVnE8PE
scenes-other-org-member-invites--current-user-is-admin--light:
diff --git a/frontend/src/scenes/onboarding/shared/wizard-sync/WizardSyncCard.stories.tsx b/frontend/src/scenes/onboarding/shared/wizard-sync/WizardSyncCard.stories.tsx
index 8ed43df02309..8635e0518863 100644
--- a/frontend/src/scenes/onboarding/shared/wizard-sync/WizardSyncCard.stories.tsx
+++ b/frontend/src/scenes/onboarding/shared/wizard-sync/WizardSyncCard.stories.tsx
@@ -130,6 +130,20 @@ export const CompletedLocal: Story = {
},
}
+// A run still nominally in flight that has gone quiet: the clock is replaced by the reason it stopped
+// meaning anything, and the X dismisses rather than minimizes.
+export const Stalled: Story = {
+ args: {
+ mode: 'cloud',
+ elapsedSeconds: 42 * 3600,
+ stale: true,
+ dismissTooltip: 'Dismiss',
+ progress: progress({
+ steps: cloudSteps(['completed', 'completed', 'in_progress', 'pending', 'pending', 'pending']),
+ }),
+ },
+}
+
export const Failed: Story = {
args: {
mode: 'cloud',
@@ -154,6 +168,7 @@ export const AllStates: Story = {
{ label: 'Local, running', args: LocalRunning.args },
{ label: 'Completed', args: Completed.args },
{ label: 'Completed, local (dashboard payoff)', args: CompletedLocal.args },
+ { label: 'Stalled', args: Stalled.args },
{ label: 'Failed', args: Failed.args },
]
return (
@@ -165,6 +180,7 @@ export const AllStates: Story = {
progress={args!.progress!}
elapsedSeconds={args!.elapsedSeconds!}
mode={args!.mode!}
+ stale={args!.stale}
dashboard={args!.dashboard}
onExpand={() => {}}
onDismiss={() => {}}
diff --git a/frontend/src/scenes/onboarding/shared/wizard-sync/WizardSyncCard.tsx b/frontend/src/scenes/onboarding/shared/wizard-sync/WizardSyncCard.tsx
index 0891027830dd..aeb97d96e0ef 100644
--- a/frontend/src/scenes/onboarding/shared/wizard-sync/WizardSyncCard.tsx
+++ b/frontend/src/scenes/onboarding/shared/wizard-sync/WizardSyncCard.tsx
@@ -15,6 +15,7 @@ import { urls } from 'scenes/urls'
import {
currentTaskLabel,
+ elapsedLabel,
formatElapsed,
pipClass,
prNameLabel,
@@ -62,6 +63,7 @@ export function WizardSyncCard({
progress,
elapsedSeconds,
mode,
+ stale = false,
dashboard,
onDashboardClick,
onExpand,
@@ -71,6 +73,8 @@ export function WizardSyncCard({
progress: InstallationProgress
elapsedSeconds: number
mode: WizardSyncMode
+ /** The run has gone quiet: the clock is replaced by the reason it stopped meaning anything. */
+ stale?: boolean
/** Dashboard the wizard built, when detected — the completed card's payoff for runs with no PR. */
dashboard?: DetectedDashboard | null
/** Telemetry hook for the dashboard CTA — navigation itself rides the button's `to`. */
@@ -108,7 +112,9 @@ export function WizardSyncCard({
</p>
<p className="m-0 text-xs text-muted truncate">{syncHeadline(progress)}</p>
</div>
- <span className="text-xs text-muted tabular-nums shrink-0">{formatElapsed(elapsedSeconds)}</span>
+ <span className="text-xs text-muted tabular-nums shrink-0" title={formatElapsed(elapsedSeconds)}>
+ {elapsedLabel(elapsedSeconds, stale)}
+ </span>
</div>
{total > 0 ? (
diff --git a/frontend/src/scenes/onboarding/shared/wizard-sync/WizardSyncFab.tsx b/frontend/src/scenes/onboarding/shared/wizard-sync/WizardSyncFab.tsx
index 933253eab01b..808f34a1782b 100644
--- a/frontend/src/scenes/onboarding/shared/wizard-sync/WizardSyncFab.tsx
+++ b/frontend/src/scenes/onboarding/shared/wizard-sync/WizardSyncFab.tsx
@@ -10,7 +10,7 @@ import { elapsedSecondsFrom } from 'lib/utils/datetime'
import { onboardingEventUsageLogic } from '../../onboardingEventUsageLogic'
import { activeCloudRunLogic, CloudRunHandle } from './activeCloudRunLogic'
import { finishedLocalRunLogic } from './finishedLocalRunLogic'
-import { formatElapsed, syncHeadline, toneTextClass } from './helpers'
+import { elapsedLabel, isRunStale, isStreamLost, syncHeadline, toneTextClass } from './helpers'
import {
InstallationProgress,
installationProgressLogic,
@@ -45,10 +45,12 @@ function useNow(frozen: boolean = false): number {
function WizardSyncLauncher({
progress,
elapsedSeconds,
+ stale = false,
onRestore,
}: {
progress: InstallationProgress
elapsedSeconds: number
+ stale?: boolean
onRestore: () => void
}): JSX.Element {
return (
@@ -70,7 +72,7 @@ function WizardSyncLauncher({
>
<StatusGlyph progress={progress} />
<span className="text-sm font-medium">PostHog setup</span>
- <span className="text-xs text-muted tabular-nums">{formatElapsed(elapsedSeconds)}</span>
+ <span className="text-xs text-muted tabular-nums">{elapsedLabel(elapsedSeconds, stale)}</span>
</button>
)
}
@@ -86,6 +88,7 @@ function WizardSyncDialog({
onClear,
onCancel,
cancelling = false,
+ stale = false,
onDashboardClick,
}: {
progress: InstallationProgress
@@ -97,6 +100,8 @@ function WizardSyncDialog({
onClear?: () => void
onCancel?: () => void
cancelling?: boolean
+ /** The run has gone quiet for long enough that it can be dismissed without orphaning live work. */
+ stale?: boolean
onDashboardClick?: () => void
}): JSX.Element {
const isTerminal = progress.phase === 'completed' || progress.phase === 'error'
@@ -106,7 +111,7 @@ function WizardSyncDialog({
<div className="flex items-center justify-between text-xs">
<span className={cn('font-medium', toneTextClass(progress))}>{syncHeadline(progress)}</span>
<span className="text-muted tabular-nums">
- {mode === 'cloud' ? 'Cloud run' : 'On your machine'} · {formatElapsed(elapsedSeconds)}
+ {mode === 'cloud' ? 'Cloud run' : 'On your machine'} · {elapsedLabel(elapsedSeconds, stale)}
</span>
</div>
<InstallationProgressContent
@@ -115,7 +120,11 @@ function WizardSyncDialog({
dashboard={dashboard}
onDashboardClick={onDashboardClick}
/>
- {isTerminal && onClear && (
+ {/* A stale run gets the same exit as a terminal one: nothing is reporting on it, so
+ leaving Cancel as the only control would strand the user behind a request that
+ cannot bring it back. Cancel stays available below for as long as the run is not
+ terminal, since the backend may still be holding a sandbox for it. */}
+ {(isTerminal || stale) && onClear && (
<LemonButton type="secondary" onClick={onClear} className="self-end">
Dismiss this run
</LemonButton>
@@ -144,6 +153,8 @@ function WizardSyncSurface({
progress,
startedAt,
endedAt,
+ lastActivityAt = null,
+ streamLost = false,
mode,
runKey,
onClear,
@@ -155,6 +166,12 @@ function WizardSyncSurface({
/** When the run finished — freezes the elapsed timer so a finished run that stays on screen
* until dismissed shows its duration, not a clock that keeps counting. */
endedAt?: string
+ /** When the run's stream last delivered anything (cloud runs only), for the staleness check. */
+ lastActivityAt?: number | null
+ /** Nothing is currently carrying this run's updates (cloud runs only): the stream failed or
+ * closed, or the logic has already given up on it. Silence only counts as staleness while this
+ * holds. See `isStreamLost` for why a stream still connecting does not qualify. */
+ streamLost?: boolean
mode: WizardSyncMode
runKey: string
onClear?: () => void
@@ -179,6 +196,9 @@ function WizardSyncSurface({
const elapsedSeconds = startedAt ? elapsedSecondsFrom(startedAt, Number.isNaN(endMs) ? now : endMs) : 0
const minimized = dismissedKey === runKey
const isTerminal = progress.phase === 'completed' || progress.phase === 'error'
+ // Only cloud runs can zombie like this: their handle is persisted browser state that outlives the
+ // run, where a local run is gated by the session detector's own liveness poll.
+ const stale = mode === 'cloud' && !isTerminal && isRunStale(startedAt, lastActivityAt, streamLost, now)
const dashboard = progress.phase === 'completed' ? detectedDashboard : null
const eventProps = { runKey, mode, phase: progress.phase }
@@ -217,6 +237,7 @@ function WizardSyncSurface({
reportWizardSyncMinimized(eventProps)
dismiss(runKey)
}
+ const dismissible = isTerminal || prOpened || stale
return (
<>
@@ -225,6 +246,7 @@ function WizardSyncSurface({
<WizardSyncLauncher
progress={progress}
elapsedSeconds={elapsedSeconds}
+ stale={stale}
onRestore={() => {
reportWizardSyncRestored(eventProps)
restore()
@@ -235,17 +257,19 @@ function WizardSyncSurface({
progress={progress}
elapsedSeconds={elapsedSeconds}
mode={mode}
+ stale={stale}
dashboard={dashboard}
onDashboardClick={handleDashboardClick}
onExpand={() => {
reportWizardSyncExpanded(eventProps)
openDialog()
}}
- // Mid-run, the X only minimizes — hiding a live run for good would orphan
- // it. Once the run is terminal or the PR exists, the user's part is done,
- // so the X becomes the real dismissal (the run never leaves on its own).
- onDismiss={(isTerminal || prOpened) && handleClear ? handleClear : handleMinimize}
- dismissTooltip={(isTerminal || prOpened) && handleClear ? 'Dismiss' : 'Minimize'}
+ // Mid-run the X only minimizes, since hiding a live run for good would
+ // orphan it. Once the run is terminal, the PR exists, or the run has gone
+ // quiet long enough to count as stale, the X becomes the real dismissal
+ // (the run never leaves on its own).
+ onDismiss={dismissible && handleClear ? handleClear : handleMinimize}
+ dismissTooltip={dismissible && handleClear ? 'Dismiss' : 'Minimize'}
/>
)}
</div>
@@ -253,6 +277,7 @@ function WizardSyncSurface({
progress={progress}
elapsedSeconds={elapsedSeconds}
mode={mode}
+ stale={stale}
dashboard={dashboard}
onDashboardClick={handleDashboardClick}
isOpen={dialogOpen}
@@ -267,7 +292,7 @@ function WizardSyncSurface({
// A cloud run: the Installation layer streams the pipeline; elapsed comes from the handle's kickoff stamp.
function WizardSyncCloudFab({ handle }: { handle: CloudRunHandle }): JSX.Element {
- const { installationProgress, taskRunState } = useValues(
+ const { installationProgress, taskRunState, lastActivityAt, taskConnectionStatus, isStalled } = useValues(
installationProgressLogic({ mode: 'cloud', runId: handle.runId, taskId: handle.taskId })
)
const { cancellingRun } = useValues(activeCloudRunLogic)
@@ -278,6 +303,8 @@ function WizardSyncCloudFab({ handle }: { handle: CloudRunHandle }): JSX.Element
progress={installationProgress}
startedAt={handle.startedAt}
endedAt={isTerminal ? (taskRunState?.completed_at ?? taskRunState?.updated_at) : undefined}
+ lastActivityAt={lastActivityAt}
+ streamLost={isStreamLost(taskConnectionStatus, isStalled)}
mode="cloud"
runKey={handle.runId}
onClear={clearActiveCloudRun}
diff --git a/frontend/src/scenes/onboarding/shared/wizard-sync/helpers.test.ts b/frontend/src/scenes/onboarding/shared/wizard-sync/helpers.test.ts
index caf0ea768925..943aa794bb65 100644
--- a/frontend/src/scenes/onboarding/shared/wizard-sync/helpers.test.ts
+++ b/frontend/src/scenes/onboarding/shared/wizard-sync/helpers.test.ts
@@ -1,7 +1,86 @@
-import { activeStep, prName } from './helpers'
+import {
+ activeStep,
+ elapsedLabel,
+ formatElapsed,
+ isRunStale,
+ isStreamLost,
+ prName,
+ STALE_RUN_MAX_AGE_MS,
+ STALE_RUN_SILENCE_MS,
+} from './helpers'
import type { InstallationStep } from './installationProgressLogic'
+import type { TaskRunConnectionStatus } from './taskRunStreamLogic'
+
+const NOW = new Date('2026-01-01T12:00:00Z').getTime()
+const iso = (msBeforeNow: number): string => new Date(NOW - msBeforeNow).toISOString()
describe('wizard-sync helpers', () => {
+ it.each([
+ ['m:ss under an hour', 125, '2:05'],
+ ['h:mm:ss past the hour', 3725, '1:02:05'],
+ ['clamps negatives to zero', -10, '0:00'],
+ // The clock is driven by a persisted handle that outlives the run it names, so a run nobody
+ // settled would otherwise count up for as long as the browser keeps the handle.
+ ['clamps a runaway clock to the display cap', 42 * 3600, '6:00:00+'],
+ ])('formatElapsed %s', (_name, seconds, expected) => {
+ expect(formatElapsed(seconds)).toBe(expected)
+ })
+
+ it('elapsedLabel replaces a stale run clock with the reason it stopped mattering', () => {
+ expect(elapsedLabel(125, false)).toBe('2:05')
+ expect(elapsedLabel(125, true)).toBe('Stalled')
+ })
+
+ describe('isRunStale', () => {
+ it.each([
+ ['a run that just reported', iso(60_000), NOW - 60_000, true, false],
+ [
+ 'a run silent past the window with no stream left',
+ iso(60 * 60_000),
+ NOW - STALE_RUN_SILENCE_MS - 1000,
+ true,
+ true,
+ ],
+ // The long agent phase and the 15 minute CI follow-up sleep both publish nothing. A run
+ // whose stream is up is being watched, however little it has to say.
+ [
+ 'a run silent past the window on a live stream',
+ iso(60 * 60_000),
+ NOW - STALE_RUN_SILENCE_MS - 1000,
+ false,
+ false,
+ ],
+ // No activity at all: the kickoff stamp is what the silence is measured from.
+ ['a run that never reported, still inside the window', iso(60_000), null, true, false],
+ ['a run that never reported, past the window', iso(STALE_RUN_SILENCE_MS + 1000), null, true, true],
+ // The age cap is the second gate: a handle this old outlived a full day of reloads, so it
+ // stands whatever the transport is doing.
+ ['a fresh report on a day-old handle', iso(STALE_RUN_MAX_AGE_MS + 1000), NOW - 1000, false, true],
+ // A legacy handle carries no kickoff stamp, so neither gate has anything to measure.
+ ['a handle with no startedAt and no activity', undefined, null, true, false],
+ ])('%s', (_name, startedAt, lastActivityAt, streamLost, expected) => {
+ expect(isRunStale(startedAt, lastActivityAt, streamLost, NOW)).toBe(expected)
+ })
+ })
+
+ describe('isStreamLost', () => {
+ const cases: [string, TaskRunConnectionStatus, boolean, boolean][] = [
+ ['an open stream is carrying updates', 'open', false, false],
+ // Every mount of a long-lived run starts here, and so does every reconnect. Calling these
+ // lost would stale a healthy run for the length of a connect and offer to dismiss it.
+ ['a stream still connecting has not failed yet', 'connecting', false, false],
+ ['a stream not yet started has not failed yet', 'idle', false, false],
+ ['a failed stream is lost', 'error', false, true],
+ ['a closed stream is lost', 'closed', false, true],
+ // The stream that never gets past connecting: the run logic gives up after its own
+ // window and says so here, so a permanently connecting stream is still reachable.
+ ['a stream the logic gave up on is lost whatever it reports', 'connecting', true, true],
+ ]
+ it.each(cases)('%s', (_name, status, isStalled, expected) => {
+ expect(isStreamLost(status, isStalled)).toBe(expected)
+ })
+ })
+
it('activeStep prefers the wizard sub-step over the pipeline stage containing it', () => {
// The card headline would otherwise read "Running setup wizard" while the wizard is
// reporting something more specific like "Install SDK".
diff --git a/frontend/src/scenes/onboarding/shared/wizard-sync/helpers.ts b/frontend/src/scenes/onboarding/shared/wizard-sync/helpers.ts
index 91ca2807b3a5..f0a1b47fedec 100644
--- a/frontend/src/scenes/onboarding/shared/wizard-sync/helpers.ts
+++ b/frontend/src/scenes/onboarding/shared/wizard-sync/helpers.ts
@@ -1,16 +1,76 @@
import { InstallationProgress, InstallationStep, InstallationStepStatus } from './installationProgressLogic'
+import type { TaskRunConnectionStatus } from './taskRunStreamLogic'
-// "m:ss", or "h:mm:ss" once a run passes the hour mark (cloud runs can be long).
+// Ceiling on the displayed elapsed time. The clock is driven by a persisted handle that outlives the
+// run it names, so without a cap a run nobody ever settled counts up for as long as the browser keeps
+// the handle. Display only: telemetry keeps the true elapsed.
+export const MAX_DISPLAY_ELAPSED_SECONDS = 6 * 60 * 60
+
+// "m:ss", or "h:mm:ss" once a run passes the hour mark (cloud runs can be long). Anything past the
+// display cap reads as the cap with a trailing "+".
export function formatElapsed(totalSeconds: number): string {
- const s = Math.max(0, Math.floor(totalSeconds))
+ const raw = Math.max(0, Math.floor(totalSeconds))
+ const s = Math.min(MAX_DISPLAY_ELAPSED_SECONDS, raw)
const hours = Math.floor(s / 3600)
const minutes = Math.floor((s % 3600) / 60)
const seconds = s % 60
const ss = seconds.toString().padStart(2, '0')
+ const clamped = raw > s ? '+' : ''
if (hours > 0) {
- return `${hours}:${minutes.toString().padStart(2, '0')}:${ss}`
+ return `${hours}:${minutes.toString().padStart(2, '0')}:${ss}${clamped}`
+ }
+ return `${minutes}:${ss}${clamped}`
+}
+
+// Silence alone says nothing about a cloud run: the pipeline is designed to go quiet for long
+// stretches, publishing nothing between the agent starting and the PR opening, and its CI follow-up
+// loop sleeps a quarter hour at a time. So the silence window only counts while the stream that
+// would carry those updates is down, and it is set wider than the longest designed quiet period.
+// The age cap is the second, independent gate, for a handle that survived a day of reloads without
+// its run ever settling.
+export const STALE_RUN_SILENCE_MS = 30 * 60 * 1000
+export const STALE_RUN_MAX_AGE_MS = 24 * 60 * 60 * 1000
+
+/**
+ * Whether the transport that would carry a run's updates is down, which is what turns silence into
+ * evidence. `idle` and `connecting` are the states every stream passes through before it has had a
+ * chance to say anything, including on each mount of a run that is already hours old and on every
+ * reconnect in between: counting them would call a healthy long run stale for the length of a
+ * connect, and offer a dismiss that orphans it. A stream that never gets past them is still caught,
+ * by `isStalled`, which the run logic sets once it gives up.
+ */
+export function isStreamLost(status: TaskRunConnectionStatus, isStalled: boolean): boolean {
+ return isStalled || status === 'error' || status === 'closed'
+}
+
+/**
+ * Whether a still-running run has gone stale, meaning its surfaces should offer a dismiss instead of
+ * only a minimize. `lastActivityAt` is when the stream last delivered anything (null when it never
+ * has, in which case the handle's kickoff stamp stands in), and `streamLost` says whether the
+ * transport that would deliver more is down right now. The stamp is a client clock and the silence
+ * window is wide enough to absorb the skew against it.
+ */
+export function isRunStale(
+ startedAt: string | undefined,
+ lastActivityAt: number | null,
+ streamLost: boolean,
+ now: number
+): boolean {
+ const startedMs = startedAt ? new Date(startedAt).getTime() : NaN
+ if (!Number.isNaN(startedMs) && now - startedMs > STALE_RUN_MAX_AGE_MS) {
+ return true
+ }
+ if (!streamLost) {
+ return false
}
- return `${minutes}:${ss}`
+ const silentSince = lastActivityAt ?? startedMs
+ return !Number.isNaN(silentSince) && now - silentSince > STALE_RUN_SILENCE_MS
+}
+
+// What the widgets print where the elapsed clock goes. A stale run's clock is meaningless, so it is
+// replaced by the reason it stopped mattering.
+export function elapsedLabel(elapsedSeconds: number, stale: boolean = false): string {
+ return stale ? 'Stalled' : formatElapsed(elapsedSeconds)
}
// The short status line shown in the collapsed card header.
diff --git a/frontend/src/scenes/onboarding/shared/wizard-sync/installationProgressLogic.ts b/frontend/src/scenes/onboarding/shared/wizard-sync/installationProgressLogic.ts
index b96c9aa3b220..ac430791452b 100644
--- a/frontend/src/scenes/onboarding/shared/wizard-sync/installationProgressLogic.ts
+++ b/frontend/src/scenes/onboarding/shared/wizard-sync/installationProgressLogic.ts
@@ -366,6 +366,7 @@ export interface installationProgressLogicValues {
activeCloudRun: CloudRunHandle | null // activeCloudRunLogic
dismissedSessionId: string | null // finishedLocalRunLogic
isStalled: boolean // taskRunStreamLogic
+ lastActivityAt: number | null // taskRunStreamLogic
progressSteps: TaskRunProgressStep[] // taskRunStreamLogic
taskConnectionStatus: TaskRunConnectionStatus // taskRunStreamLogic
taskRunState: TaskRunStreamState | null // taskRunStreamLogic
@@ -477,7 +478,13 @@ export const installationProgressLogic = kea<installationProgressLogicType>([
connect((props: InstallationProgressLogicProps) => ({
values: [
taskRunStreamLogic({ runId: props.runId ?? '', taskId: props.taskId ?? '' }),
- ['taskRunState', 'progressSteps', 'connectionStatus as taskConnectionStatus', 'isStalled'],
+ [
+ 'taskRunState',
+ 'progressSteps',
+ 'connectionStatus as taskConnectionStatus',
+ 'isStalled',
+ 'lastActivityAt',
+ ],
wizardSessionStreamLogic({ workflowId: WORKFLOW_ID }),
['latestSession', 'connectionStatus as sessionConnectionStatus'],
finishedLocalRunLogic,
diff --git a/frontend/src/scenes/onboarding/shared/wizard-sync/taskRunStreamLogic.test.ts b/frontend/src/scenes/onboarding/shared/wizard-sync/taskRunStreamLogic.test.ts
index 9f56b1388d28..2e4ba638e807 100644
--- a/frontend/src/scenes/onboarding/shared/wizard-sync/taskRunStreamLogic.test.ts
+++ b/frontend/src/scenes/onboarding/shared/wizard-sync/taskRunStreamLogic.test.ts
@@ -587,6 +587,22 @@ describe('taskRunStreamLogic transport', () => {
expect(logic.values.isStalled).toBe(true)
})
+ it('stamps lastActivityAt from delivered updates, never from connection events', async () => {
+ logic.actions.connect()
+ const stream = MockEventSource.last()
+ stream.emitOpen()
+ await expectLogic(logic).toDispatchActions(['connectionOpened'])
+ // A stream that reconnects forever without ever saying anything must not read as a run that
+ // is alive: only what the pipeline actually delivers counts as activity.
+ expect(logic.values.lastActivityAt).toBeNull()
+
+ stream.emitMessage(
+ JSON.stringify({ type: 'task_run_state', status: 'in_progress', updated_at: '2026-01-01T00:05:00Z' })
+ )
+ await expectLogic(logic).toDispatchActions(['taskRunStateUpdated'])
+ expect(logic.values.lastActivityAt).toEqual(expect.any(Number))
+ })
+
it('keeps the no-state stall through a scheduled reconnect', async () => {
// The regression: a reconnect clears isStalled, and a per-connect timer would be re-armed
// for another full window (or, armed once per lifetime, never re-armed at all), putting the
diff --git a/frontend/src/scenes/onboarding/shared/wizard-sync/taskRunStreamLogic.ts b/frontend/src/scenes/onboarding/shared/wizard-sync/taskRunStreamLogic.ts
index b22ed6757f39..9d1fdedac447 100644
--- a/frontend/src/scenes/onboarding/shared/wizard-sync/taskRunStreamLogic.ts
+++ b/frontend/src/scenes/onboarding/shared/wizard-sync/taskRunStreamLogic.ts
@@ -200,6 +200,7 @@ export interface taskRunStreamLogicValues {
connectionStatus: TaskRunConnectionStatus
isComplete: boolean
isStalled: boolean
+ lastActivityAt: number | null
lastError: string | null
progressSteps: TaskRunProgressStep[]
taskRunState: TaskRunStreamState | null
@@ -329,6 +330,20 @@ export const taskRunStreamLogic = kea<taskRunStreamLogicType>([
},
},
],
+ // When the stream last delivered anything about the run, on the client's clock. Deliberately
+ // not derived from the run's own `updated_at`, which the backend only moves on status and
+ // stage transitions, so a reconnect replaying an old state would read as fresh news. Nor
+ // from connection events, or a stream that reconnects forever without ever saying anything
+ // would keep looking healthy. Note this goes quiet on a perfectly healthy run: the pipeline
+ // publishes nothing through the agent phase, so silence alone is never enough to judge a run
+ // dead (see isRunStale, which also requires the transport to be down).
+ lastActivityAt: [
+ null as number | null,
+ {
+ taskRunStateUpdated: () => Date.now(),
+ progressStepUpdated: () => Date.now(),
+ },
+ ],
// Last-write-wins per (group, step), kept in arrival order so the UI renders a stable timeline.
progressSteps: [
[] as TaskRunProgressStep[],