: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
chore(workflows): remove the incident replay banner (#91458)
Meikel Ratz052c8e9c591f
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex 7ed6845a0440..4a3404de39c2 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -570,7 +570,6 @@ export const FEATURE_FLAGS = {WORKFLOWS_DELAY_UNTIL_DATE: 'workflows-delay-until-date', // owner: @dmarchuk #team-workflowsWORKFLOWS_EMAIL_REPUTATION: 'workflows-email-reputation', // owner: #team-workflowsWORKFLOWS_EMAIL_SENDER_ROTATION: 'workflows-email-sender-rotation', // owner: @arthurdedeus #team-workflows- WORKFLOWS_INCIDENT_REPLAY: 'workflows-incident-replay', // owner: #team-workflowsWORKFLOWS_INTERNAL_EVENT_FILTERS: 'workflows-internal-event-filters', // owner: @haven #team-workflowsWORKFLOWS_PUSH_NOTIFICATIONS: 'workflows-push-notifications', // owner: #team-workflowsXAA_AUTHENTICATION: 'xaa-authentication', // owner: @reecejones #team-platform-featuresdiff --git a/products/workflows/frontend/WorkflowsIncidentReplayBanner.tsx b/products/workflows/frontend/WorkflowsIncidentReplayBanner.tsxdeleted file mode 100644index 7c2bf4c30af7..000000000000--- a/products/workflows/frontend/WorkflowsIncidentReplayBanner.tsx+++ /dev/null@@ -1,86 +0,0 @@-import { useActions, useValues } from 'kea'--import { LemonBanner, LemonButton } from '@posthog/lemon-ui'--import { AccessControlAction } from 'lib/components/AccessControlAction'-import { urls } from 'scenes/urls'--import { AccessControlLevel, AccessControlResourceType } from '~/types'--import { workflowsIncidentReplayLogic } from './workflowsIncidentReplayLogic'--// Mirrors the server-side HOG_INVOCATION_RERUN_MAX_COUNT default: one rerun request-// queues at most this many invocations, so larger workflows need a second pass.-const RERUN_MAX_COUNT_PER_REQUEST = 10000--export function WorkflowsIncidentReplayBanner(): JSX.Element | null {- const { showBanner, affectedWorkflows, replayStatusById, currentProjectId } =- useValues(workflowsIncidentReplayLogic)- const { replayWorkflow } = useActions(workflowsIncidentReplayLogic)-- if (!showBanner) {- return null- }-- const hasLargeWorkflow = affectedWorkflows.some((workflow) => workflow.failedCount > RERUN_MAX_COUNT_PER_REQUEST)-- return (- <LemonBanner- type="warning"- // Per project: without the suffix, dismissing in one project hides the recovery- // path in every other project this browser visits.- dismissKey={`workflows-incident-replay-2026-08-17-${currentProjectId}`}- data-attr="workflows-incident-replay-banner"- >- <div className="flex flex-col gap-2">- <div>- Some of your workflow emails failed to send between August 17 and August 18 (UTC) because of an- incident on our side. You can replay the failed sends for each affected workflow below. Replaying- only re-runs what failed during that period.- {hasLargeWorkflow ? (- <>- {' '}- A replay covers up to 10,000 failed sends per run. For workflows with more, replay again- after the first run finishes to send the rest.- </>- ) : null}- </div>- <ul className="flex flex-col gap-1">- {affectedWorkflows.map((workflow) => {- const status = replayStatusById[workflow.id]- return (- <li key={workflow.id} className="flex items-center gap-2">- <AccessControlAction- resourceType={AccessControlResourceType.Workflow}- minAccessLevel={AccessControlLevel.Editor}- userAccessLevel={workflow.userAccessLevel ?? undefined}- >- <LemonButton- type="secondary"- size="xsmall"- data-attr="workflows-incident-replay-button"- loading={status === 'pending'}- disabledReason={- status === 'queued'- ? 'Replay queued. Failed sends are being retried. Refresh the page to replay again once it finishes.'- : undefined- }- onClick={() => replayWorkflow(workflow.id)}- >- {status === 'queued' ? 'Replay queued' : 'Replay failed sends'}- </LemonButton>- </AccessControlAction>- <LemonButton size="xsmall" to={urls.workflow(workflow.id, 'workflow')}>- {workflow.name}- </LemonButton>- <span className="text-secondary">- {workflow.failedCount} failed {workflow.failedCount === 1 ? 'send' : 'sends'}- </span>- </li>- )- })}- </ul>- </div>- </LemonBanner>- )-}diff --git a/products/workflows/frontend/WorkflowsScene.tsx b/products/workflows/frontend/WorkflowsScene.tsxindex eca453228941..9978c78f122d 100644--- a/products/workflows/frontend/WorkflowsScene.tsx+++ b/products/workflows/frontend/WorkflowsScene.tsx@@ -34,7 +34,6 @@ import { NewWorkflowModal } from './Workflows/NewWorkflowModal'import { WorkflowsReputation } from './Workflows/Reputation/WorkflowsReputation'import { WorkflowsTable } from './Workflows/WorkflowsTable'import { workflowsEmailSuspensionLogic } from './workflowsEmailSuspensionLogic'-import { WorkflowsIncidentReplayBanner } from './WorkflowsIncidentReplayBanner'const WORKFLOW_SCENE_TABS = ['workflows', 'library', 'channels', 'opt-outs', 'suppression', 'reputation'] as constexport type WorkflowsSceneTab = (typeof WORKFLOW_SCENE_TABS)[number]@@ -326,7 +325,6 @@ export function WorkflowsScene(props: WorkflowsSceneProps = {}): JSX.Element {support to get sending re-enabled.</LemonBanner>)}- <WorkflowsIncidentReplayBanner /><LemonTabs activeKey={currentTab} tabs={tabs} sceneInset data-attr="workflows-scene-tabs" /><NewWorkflowModal /></SceneContent>diff --git a/products/workflows/frontend/workflowsIncidentReplayLogic.test.ts b/products/workflows/frontend/workflowsIncidentReplayLogic.test.tsdeleted file mode 100644index 4e65a366eb33..000000000000--- a/products/workflows/frontend/workflowsIncidentReplayLogic.test.ts+++ /dev/null@@ -1,69 +0,0 @@-import { expectLogic } from 'kea-test-utils'--import { useMocks } from '~/mocks/jest'-import { initKeaTests } from '~/test/init'--import { workflowsIncidentReplayLogic } from './workflowsIncidentReplayLogic'--const AFFECTED_FLOW_ID = '019d244c-42c9-0000-ec6c-752c8b265c4f'-const DELETED_FLOW_ID = '019d9146-223a-0000-8165-1a3489e88b3d'-const FLAKY_FLOW_ID = '019f3834-8dbd-0000-4b19-073031109b21'--describe('workflowsIncidentReplayLogic', () => {- let logic: ReturnType<typeof workflowsIncidentReplayLogic.build>- let remainingCount: number-- beforeEach(() => {- remainingCount = 12- useMocks({- post: {- '/api/environments/:team_id/query/:query_kind/': () => [- 200,- {- results: [- [224, AFFECTED_FLOW_ID],- [29, FLAKY_FLOW_ID],- [3, DELETED_FLOW_ID],- ],- },- ],- },- get: {- '/api/projects/:team_id/hog_flows/:id/': (req) => {- if (req.params.id === AFFECTED_FLOW_ID) {- return [200, { id: AFFECTED_FLOW_ID, name: 'Order confirmation', user_access_level: 'editor' }]- }- if (req.params.id === FLAKY_FLOW_ID) {- return [500, { detail: 'Internal server error.' }]- }- return [404, { detail: 'Not found.' }]- },- '/api/projects/:team_id/hog_flows/:id/invocation_results_count/': () => [- 200,- { count: remainingCount },- ],- },- })- initKeaTests()- logic = workflowsIncidentReplayLogic()- logic.mount()- })-- it('resolves workflows by id, drops 404s, keeps rows whose retrieve fails transiently', async () => {- await expectLogic(logic, () => logic.actions.loadAffectedWorkflows()).toDispatchActions([- 'loadAffectedWorkflowsSuccess',- ])- expect(logic.values.affectedWorkflows).toEqual([- { id: AFFECTED_FLOW_ID, name: 'Order confirmation', failedCount: 12, userAccessLevel: 'editor' },- { id: FLAKY_FLOW_ID, name: '', failedCount: 12, userAccessLevel: null },- ])- })-- it('drops workflows whose remaining failed count is zero', async () => {- remainingCount = 0- await expectLogic(logic, () => logic.actions.loadAffectedWorkflows()).toDispatchActions([- 'loadAffectedWorkflowsSuccess',- ])- expect(logic.values.affectedWorkflows).toEqual([])- })-})diff --git a/products/workflows/frontend/workflowsIncidentReplayLogic.ts b/products/workflows/frontend/workflowsIncidentReplayLogic.tsdeleted file mode 100644index 518c308cf2f4..000000000000--- a/products/workflows/frontend/workflowsIncidentReplayLogic.ts+++ /dev/null@@ -1,269 +0,0 @@-import { MakeLogicType, actions, connect, kea, listeners, path, reducers, selectors } from 'kea'-import { loaders } from 'kea-loaders'-import { subscriptions } from 'kea-subscriptions'--import { loadAppMetricsTotals } from 'lib/components/AppMetrics/appMetricsLogic'-import { FEATURE_FLAGS } from 'lib/constants'-import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'-import { featureFlagLogic, type FeatureFlagsSet } from 'lib/logic/featureFlagLogic'-import { projectLogic } from 'scenes/projectLogic'--import { AccessControlLevel } from '~/types'--import {- hogFlowsInvocationResultsCountRetrieve,- hogFlowsRerunCreate,- hogFlowsRetrieve,-} from 'products/workflows/frontend/generated/api'-import type { HogFlowApi } from 'products/workflows/frontend/generated/api.schemas'--// The window of the 2026-08-17 email send incident (UTC), padded around the first and last-// observed failures. Both the affected-workflow lookup and the rerun filter use it, so a-// replay only re-enqueues invocations that failed during the incident.-const INCIDENT_WINDOW_START = '2026-08-17T13:00:00.000Z'-const INCIDENT_WINDOW_END = '2026-08-18T22:00:00.000Z'--// Both messages the regression threw start with this, and no other failure mode does, so the-// rerun skips failures unrelated to the incident (e.g. a genuinely broken integration) even-// inside the window. Matches the pre-fix messages in email.service.ts (resolveFromEmailAddress).-const INCIDENT_ERROR_MESSAGE_PREFIX = 'The custom sender address'--export interface AffectedWorkflow {- id: string- name: string- failedCount: number- userAccessLevel: AccessControlLevel | null-}--export type ReplayStatus = 'pending' | 'queued'--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface workflowsIncidentReplayLogicValues {- featureFlags: FeatureFlagsSet // featureFlagLogic- currentProjectId: number | null // projectLogic- affectedWorkflows: AffectedWorkflow[]- affectedWorkflowsLoading: boolean- replayStatusById: Record<string, ReplayStatus>- showBanner: boolean-}--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface workflowsIncidentReplayLogicActions {- loadAffectedWorkflows: () => any- loadAffectedWorkflowsFailure: (- error: string,- errorObject?: any- ) => {- error: string- errorObject?: any- }- loadAffectedWorkflowsSuccess: (- affectedWorkflows: {- failedCount: number- id: string- name: string- userAccessLevel: AccessControlLevel | null- }[],- payload?: any- ) => {- affectedWorkflows: {- failedCount: number- id: string- name: string- userAccessLevel: AccessControlLevel | null- }[]- payload?: any- }- replayWorkflow: (id: string) => {- id: string- }- replayWorkflowFailure: (id: string) => {- id: string- }- replayWorkflowSuccess: (id: string) => {- id: string- }-}--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface workflowsIncidentReplayLogicMeta {- __keaTypeGenInternalSelectorTypes: {- showBanner: (featureFlags: FeatureFlagsSet, affectedWorkflows: AffectedWorkflow[]) => boolean- }-}--export type workflowsIncidentReplayLogicType = MakeLogicType<- workflowsIncidentReplayLogicValues,- workflowsIncidentReplayLogicActions,- Record<string, any>,- workflowsIncidentReplayLogicMeta->--export const workflowsIncidentReplayLogic = kea<workflowsIncidentReplayLogicType>([- path(['products', 'workflows', 'frontend', 'workflowsIncidentReplayLogic']),- connect(() => ({- values: [projectLogic, ['currentProjectId'], featureFlagLogic, ['featureFlags']],- })),- actions({- replayWorkflow: (id: string) => ({ id }),- replayWorkflowSuccess: (id: string) => ({ id }),- replayWorkflowFailure: (id: string) => ({ id }),- }),- loaders(({ values }) => ({- affectedWorkflows: [- [] as AffectedWorkflow[],- {- loadAffectedWorkflows: async () => {- if (!values.currentProjectId) {- return []- }-- const totals = await loadAppMetricsTotals(- {- appSource: 'hog_flow',- metricName: 'email_failed',- breakdownBy: ['app_source_id'],- dateFrom: INCIDENT_WINDOW_START,- dateTo: INCIDENT_WINDOW_END,- limit: 100,- },- 'UTC'- )-- const affected = Object.values(totals)- .map((row) => ({ id: row.breakdowns[0], failedCount: row.total }))- .filter((row) => row.id && row.failedCount > 0)-- if (affected.length === 0) {- return []- }-- // Fetch each affected workflow by ID rather than intersecting with the list- // endpoint: the list caps at a page size, so in projects with more workflows- // than one page the affected ones can fall outside it and silently drop off- // the banner. Only a definitive 403 (no access) or 404 (hard-deleted, can't- // be replayed) drops a row - the same gates the list applied. A transient- // retrieve failure (network, 429, 5xx) keeps the row with fallback fields,- // so a blip never hides the recovery path.- const projectId = String(values.currentProjectId)- const dropped = new Set<string>()- const flows = await Promise.all(- affected.map(async (row) => {- try {- return await hogFlowsRetrieve(projectId, row.id)- } catch (error) {- const status = (error as { status?: number }).status- if (status === 403 || status === 404) {- dropped.add(row.id)- }- return null- }- })- )- const flowsById = new Map(- flows.filter((flow): flow is HogFlowApi => flow !== null).map((flow) => [flow.id, flow])- )- const visible = affected.filter((row) => !dropped.has(row.id))-- if (visible.length === 0) {- return []- }-- // App metrics are historical counters, so a fully replayed workflow would sit in- // the banner forever, and their counts can't be narrowed to the incident's error.- // Count the still-failing invocations that carry the incident message instead -- // the same server-side filter the rerun uses - so the displayed number is what a- // replay would actually target, it shrinks as a replay drains, and the workflow- // drops off at zero. A count that errors falls back to the metric total and keeps- // the row (never hide the recovery path on a transient failure).- //- // No `before`: replay lifecycle rows land in the partition of their own- // scheduled_at (replay time), so capping at the window end would hide them and- // a replayed invocation would read as failed forever. `after` alone bounds the- // partition scan; the failed-status collapse then reflects the true latest state.- const remainingCounts = await Promise.all(- visible.map(async (row) => {- try {- const response = await hogFlowsInvocationResultsCountRetrieve(projectId, row.id, {- status: 'failed',- error_message_contains: INCIDENT_ERROR_MESSAGE_PREFIX,- after: INCIDENT_WINDOW_START,- })- return response.count- } catch {- return row.failedCount- }- })- )-- return visible- .map((row, index) => {- const flow = flowsById.get(row.id)- return {- id: row.id,- name: flow?.name ?? '',- failedCount: remainingCounts[index],- userAccessLevel: (flow?.user_access_level ?? null) as AccessControlLevel | null,- }- })- .filter((row) => row.failedCount > 0)- .sort((a, b) => b.failedCount - a.failedCount)- },- },- ],- })),- reducers({- replayStatusById: [- {} as Record<string, ReplayStatus>,- {- replayWorkflow: (state, { id }) => ({ ...state, [id]: 'pending' }),- replayWorkflowSuccess: (state, { id }) => ({ ...state, [id]: 'queued' }),- replayWorkflowFailure: (state, { id }) => {- const { [id]: _discarded, ...rest } = state- return rest- },- },- ],- }),- selectors({- showBanner: [- (s) => [s.featureFlags, s.affectedWorkflows],- (featureFlags: FeatureFlagsSet, affectedWorkflows: AffectedWorkflow[]): boolean =>- !!featureFlags[FEATURE_FLAGS.WORKFLOWS_INCIDENT_REPLAY] && affectedWorkflows.length > 0,- ],- }),- listeners(({ actions, values }) => ({- replayWorkflow: async ({ id }) => {- if (!values.currentProjectId) {- actions.replayWorkflowFailure(id)- return- }- try {- await hogFlowsRerunCreate(String(values.currentProjectId), id, {- filter: {- window_start: INCIDENT_WINDOW_START,- window_end: INCIDENT_WINDOW_END,- error_message_contains: INCIDENT_ERROR_MESSAGE_PREFIX,- },- })- actions.replayWorkflowSuccess(id)- lemonToast.success('Replay queued. Failed sends will be retried shortly.')- } catch {- actions.replayWorkflowFailure(id)- lemonToast.error("Couldn't queue the replay. Try again, and contact support if it keeps happening.")- }- },- })),- // A subscription instead of afterMount: flags can resolve after the logic mounts, and a- // one-time mount check would then never load. This fires with the value at mount and again- // when the flag flips on, so only flagged (affected) teams pay for the lookup query.- subscriptions(({ actions }) => ({- featureFlags: (featureFlags: FeatureFlagsSet, oldFeatureFlags: FeatureFlagsSet | undefined) => {- const isOn = !!featureFlags[FEATURE_FLAGS.WORKFLOWS_INCIDENT_REPLAY]- const wasOn = !!oldFeatureFlags?.[FEATURE_FLAGS.WORKFLOWS_INCIDENT_REPLAY]- if (isOn && !wasOn) {- actions.loadAffectedWorkflows()- }- },- })),-])