: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): default step error handling to continue (#95198)
Meikel Ratz3274a68599e4
diff --git a/nodejs/src/cdp/services/hogflows/hogflow-executor.service.test.ts b/nodejs/src/cdp/services/hogflows/hogflow-executor.service.test.tsindex 49a5c6e445b6..0c469e29e279 100644--- a/nodejs/src/cdp/services/hogflows/hogflow-executor.service.test.ts+++ b/nodejs/src/cdp/services/hogflows/hogflow-executor.service.test.ts@@ -1752,6 +1752,35 @@ describe('Hogflow Executor', () => {)})+ // Steps saved before error handling was configurable, and steps the author never+ // touched, carry no on_error. They get the documented default: continue.+ it('continues to next action when on_error is not set', async () => {+ const action = hogFlow.actions.find((a) => a.id === 'function_id_1')!+ delete action.on_error++ const functionHandler = executor['actionHandlers']['function']+ jest.spyOn(functionHandler, 'execute').mockResolvedValueOnce({+ error: new Error('Mocked handler error'),+ })++ const invocation = createExampleHogFlowInvocation(hogFlow, {+ event: {+ ...createHogExecutionGlobals().event,+ properties: { name: 'Test User' },+ },+ })+ invocation.state.currentAction = {+ id: 'function_id_1',+ startedAtTimestamp: DateTime.now().toMillis(),+ }++ const result = await executor.executeCurrentAction(invocation)++ expect(result.error).toBe('Mocked handler error')+ expect(result.finished).toBe(false)+ expect(result.invocation.state.currentAction?.id).toBe('middle_action')+ })+it('stores the output variable of a failed step so the next action can branch on it', async () => {const action = hogFlow.actions.find((a) => a.id === 'function_id_1')!action.on_error = 'continue'diff --git a/nodejs/src/cdp/services/hogflows/hogflow-executor.service.ts b/nodejs/src/cdp/services/hogflows/hogflow-executor.service.tsindex f22f6e5f3a51..d3496a7ff75c 100644--- a/nodejs/src/cdp/services/hogflows/hogflow-executor.service.ts+++ b/nodejs/src/cdp/services/hogflows/hogflow-executor.service.ts@@ -785,7 +785,8 @@ export class HogFlowExecutorService {}/**- * If the action has on_error set to 'continue' then we continue to the next action instead of failing the flow+ * Unless the action has on_error set to 'abort' we continue to the next action instead of failing the flow.+ * An action without on_error gets the default, which is to continue.*/private maybeContinueToNextActionOnError(result: CyclotronJobInvocationResult<CyclotronJobInvocationHogFlow>@@ -799,9 +800,10 @@ export class HogFlowExecutorService {if (invocation.state.currentAction?.delayUntilUnresolved) {return}- // If current action's on_error is set to 'continue', we move to the next action instead of failing the flow+ // Unless the current action's on_error is set to 'abort', we move to the next action instead of+ // failing the flow. 'continue' is the default, so an action that never had on_error set gets it too.const currentAction = ensureCurrentAction(invocation)- if (currentAction?.on_error === 'continue') {+ if (currentAction?.on_error !== 'abort') {const nextAction = findContinueAction(invocation)if (nextAction) {this.logAction(diff --git a/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanelBuildDetail.tsx b/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanelBuildDetail.tsxindex 1a9675215087..0f4944dcb2f5 100644--- a/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanelBuildDetail.tsx+++ b/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanelBuildDetail.tsx@@ -453,7 +453,7 @@ export function HogFlowEditorPanelBuildDetail(): JSX.Element | null {{ value: 'continue', label: 'Continue to next step' },{ value: 'abort', label: 'Exit the workflow' },]}- value={action.on_error || 'abort'}+ value={action.on_error || 'continue'}onChange={(value) =>setWorkflowAction(action.id, {...action,