: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(workflows): drop stale hogFunctionState when rehydrating reruns (#86386)
Meikel Ratz712f926ce507
diff --git a/nodejs/src/cdp/rerun/rerun-paginator.replay-fidelity.test.ts b/nodejs/src/cdp/rerun/rerun-paginator.replay-fidelity.test.tsindex c381ad32d156..23964715cfa9 100644--- a/nodejs/src/cdp/rerun/rerun-paginator.replay-fidelity.test.ts+++ b/nodejs/src/cdp/rerun/rerun-paginator.replay-fidelity.test.ts@@ -16,7 +16,10 @@ import { RerunPaginatorService } from './rerun-paginator.service'// where the executor resumes from. If rerun rehydration dropped it, the flow// would restart from the trigger and re-send emails that already went out. These// tests pin the fix: the rehydrated invocation carries `currentAction` forward,-// so replay resumes after the already-completed actions.+// so replay resumes after the already-completed actions — but WITHOUT its parked+// `hogFunctionState`, whose `globals.inputs` was stripped on persist; restoring+// it verbatim skips the input re-render and message actions then fail with+// "No recipient identifier found".describe('RerunPaginatorService replay fidelity (hog_flow)', () => {const teamId = 42const functionId = 'flow-1'@@ -78,8 +81,17 @@ describe('RerunPaginatorService replay fidelity (hog_flow)', () => {event: { uuid: 'evt-1', distinct_id: 'd-1', properties: {}, timestamp: '2026-06-01T09:00:00Z' },actionStepCount: 3,variables: { ticket_id: '123' },- // The flow had already advanced to (and parked at) the wait step.- currentAction: { id: 'wait_condition', startedAtTimestamp: 999 },+ // The flow had already advanced to (and parked at) this action. The parked+ // hogFunctionState is stored as `stripInputs` wrote it: `globals.inputs` gone.+ currentAction: {+ id: 'send_email',+ startedAtTimestamp: 999,+ hogFunctionState: {+ globals: { event: { uuid: 'evt-1' }, source: { name: 'Email', url: '' } },+ timings: [],+ attempts: 0,+ },+ },personId: 'person-1',}const rows = [@@ -106,8 +118,10 @@ describe('RerunPaginatorService replay fidelity (hog_flow)', () => {expect(opts).toEqual({ overwriteExisting: true })const invocation = enqueued[0] as CyclotronJobInvocationHogFlowexpect(invocation.id).toBe('inv-1')- // The resume point and per-actor context survive the round-trip.- expect(invocation.state?.currentAction).toEqual(persistedState.currentAction)+ // The resume point and per-actor context survive the round-trip, but the+ // input-stripped hogFunctionState does not — the action re-enters fresh so+ // inputs re-render against the current config instead of the stale snapshot.+ expect(invocation.state?.currentAction).toEqual({ id: 'send_email', startedAtTimestamp: 999 })expect(invocation.state?.personId).toBe('person-1')expect(invocation.state?.actionStepCount).toBe(3)expect(invocation.state?.variables).toEqual({ ticket_id: '123' })diff --git a/nodejs/src/cdp/rerun/rerun-paginator.service.ts b/nodejs/src/cdp/rerun/rerun-paginator.service.tsindex 95ebfe320fb7..bdfc5a2dfc98 100644--- a/nodejs/src/cdp/rerun/rerun-paginator.service.ts+++ b/nodejs/src/cdp/rerun/rerun-paginator.service.ts@@ -787,6 +787,16 @@ export class RerunPaginatorService {hogFlow,filterGlobals)+ // The parked per-action hog function state is not replayable:+ // `stripInputs` removed its `globals.inputs` (resolved secrets)+ // before the row was written, and `buildHogFunctionInvocation`+ // reuses a present `hogFunctionState` verbatim instead of+ // re-rendering inputs — a message action resumed with it fails+ // with "No recipient identifier found". Dropping it makes the+ // action re-enter fresh, so inputs re-render against the current+ // config, which is what a rerun intends anyway.+ const { hogFunctionState: _stripped, ...restoredCurrentAction } = persistedState.currentAction ?? {}+invocation.id = row.invocation_idinvocation.parentRunId = row.parent_run_id || nullinvocation.state = {@@ -802,7 +812,9 @@ export class RerunPaginatorService {// wait_until_condition the janitor gave up on) resume safely.// `personId` is carried for the same reason — the worker needs it// to reload person data for batch/manual triggers on resume.- currentAction: persistedState.currentAction,+ currentAction: persistedState.currentAction+ ? (restoredCurrentAction as CyclotronJobInvocationHogFlow['state']['currentAction'])+ : undefined,personId: persistedState.personId,// Sticky rerun counter — mirror the hog function path so the// lifecycle row producer can derive `attempts` / `is_retry`