: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
feat(workflows): show why a workflow paused and let customers resume it (#95168)
Meikel Ratz6deaf3b75c71
diff --git a/docs/internal/workflows-email-auto-pause.md b/docs/internal/workflows-email-auto-pause.mdnew file mode 100644index 000000000000..7371a88afbc5--- /dev/null+++ b/docs/internal/workflows-email-auto-pause.md@@ -0,0 +1,57 @@+# Workflow email auto-pause++One workflow with a rotten list or a spammy message can poison the shared SES account every customer sends through.+An hourly detector pauses that workflow's email when its spam complaint or hard bounce rate crosses a threshold, and warns the project's admins one band earlier.+Only the workflow's email stops: its other steps keep running, and every other workflow keeps sending.+This complements the [email sending tiers](workflows-email-sending-tiers.md): the detector handles the acute per-workflow case in hours, the tiers handle chronic per-team trust in days.++## Where the pieces live++- Pause state: `email_sending_paused_at`, `email_sending_paused_reason`, `email_sending_paused_by` ("auto" or "staff"), `email_sending_resumed_at`, and `email_sending_warned_at` on `HogFlow`.+- Detection: an hourly Celery task (minute 35, LONG_RUNNING queue) in `products/workflows/backend/services/workflow_email_health.py`.+- Enforcement: the email worker skips sends for a paused workflow at the send choke point (`executeSendEmail` in `nodejs/src/cdp/services/messaging/email.service.ts`), reacting to a pause within seconds via config reload.+- Staff controls: pause and resume bulk actions on `/admin/workflows/hogflow/`, recorded in the object's admin history.+- Customer surface: a banner on the workflow page with the reason, and a resume button for automatic pauses. Staff pauses point to support instead.++## Thresholds++Rates are judged over whole clock hours only, because the metrics table collapses rows per hour.+The current partial hour is excluded, which adds up to an hour of detection lag on top of the hourly cadence.++| Signal | Window | Warn at | Pause at | Needs sends | Needs events |+| --------------- | ------ | ------- | -------- | ----------- | ------------ |+| Spam complaints | 1h | 0.5% | 1% | 200 | 5 |+| Spam complaints | 24h | 0.15% | 0.3% | 1,000 | 10 |+| Hard bounces | 1h | 5% | 10% | 200 | 20 |+| Hard bounces | 24h | 2.5% | 5% | 1,000 | 50 |++Any one row firing is enough; both volume gates must pass before the rate counts.+Every number is a `WORKFLOW_EMAIL_AUTO_PAUSE_*` or `WORKFLOW_EMAIL_WARN_*` setting in `posthog/settings/ses.py` with an env override.+Warnings repeat at most once per `WORKFLOW_EMAIL_WARN_COOLDOWN_DAYS` (default 7) per workflow.+Batch job metrics count toward their parent workflow, and discovery gates sum at the team level so a breach split across many small batch jobs still surfaces.++## Who pauses, who resumes++- The detector pauses with `paused_by="auto"`. The customer resumes from the workflow page; project admins get an email naming the reason.+- Staff pause from Django admin with `paused_by="staff"`. Only staff can resume those: the customer's resume endpoint refuses with a contact-support message, the banner shows no button, and the email says to contact support.+- Resuming stamps `email_sending_resumed_at`, and every detector window then starts at the first full hour after it. A workflow that keeps misbehaving re-trips within a couple of hours on fresh feedback only; resuming without fixing anything cannot outrun the detector.++## Rollout++`WORKFLOW_EMAIL_AUTO_PAUSE_ENABLED` (default off) gates every automatic write; warnings and pauses arm together.+Staff admin actions write regardless of the flag, which is the intended dogfood path before enabling.++1. Deploy dark. The detector logs `would_pause_workflow_email_sending` and `would_warn_workflow_email_sending` (with workflow name, rates, and volume) and counts `workflow_email_auto_pause_total` / `workflow_email_warning_total` with `mode="dry_run"`.+2. Read the would-pause list for a week or two and tune thresholds per region if needed.+3. Validate the machinery with one staff pause on an internal workflow: worker skip, admin email, banner, resume.+4. Set `WORKFLOW_EMAIL_AUTO_PAUSE_ENABLED=true` per region via `posthog/charts`.+5. To back out, unset the flag; existing pauses stay until resumed.++Optionally add the pause metric name to `WORKFLOWS_EMAIL_TIER_AUTO_PAUSE_METRIC_NAMES` afterwards, so an auto-paused workflow also demotes its team's tier at the next daily run.++## Known limits++- Gmail runs no feedback loop, so Gmail complaints never appear in these rates; true complaint rates are higher than measured.+- The detector reads at most 24 hours back. Chronic slow deterioration is the tier system's job.+- A workflow below every volume gate is never auto-paused, whatever its rates; the team's tier caps bound its blast radius, and staff can pause it by hand.+- Skipped sends log at error level in the run and record an `email_paused` metric; the run itself continues past the email step, so downstream steps still execute.diff --git a/frontend/src/scenes/cohorts/CohortEdit.tsx b/frontend/src/scenes/cohorts/CohortEdit.tsxindex 21547a8ba53e..031afdd56360 100644--- a/frontend/src/scenes/cohorts/CohortEdit.tsx+++ b/frontend/src/scenes/cohorts/CohortEdit.tsx@@ -2,7 +2,16 @@ import { BindLogic, BuiltLogic, Logic, LogicWrapper, useActions, useValues } froimport { Form } from 'kea-forms'import { router } from 'kea-router'-import { IconClock, IconCopy, IconInfo, IconRefresh, IconTrash, IconUpload, IconWarning } from '@posthog/icons'+import {+ IconClock,+ IconCopy,+ IconInfo,+ IconRefresh,+ IconSend,+ IconTrash,+ IconUpload,+ IconWarning,+} from '@posthog/icons'import { LemonBanner, LemonDialog, LemonDivider, LemonFileInput, LemonTabs, Link, Tooltip } from '@posthog/lemon-ui'import { ActivityLog } from 'lib/components/ActivityLog/ActivityLog'@@ -48,7 +57,7 @@ import { AddPersonToCohortModal } from './AddPersonToCohortModal'import { addPersonToCohortModalLogic } from './addPersonToCohortModalLogic'import { cohortCountWarningLogic } from './cohortCountWarningLogic'import { CohortSceneMenuBar } from './CohortSceneMenuBar'-import { createCohortDataNodeLogicKey } from './cohortUtils'+import { createCohortDataNodeLogicKey, urlForCohortWorkflow } from './cohortUtils'import { PersonSelectList } from './PersonSelectList'import { PersonDisplayNameType, RemovePersonFromCohortButton } from './RemovePersonFromCohortButton'@@ -242,6 +251,18 @@ export function CohortEdit({ id, attachTo }: CohortEditProps): JSX.Element {<ScenePanelDivider /><ScenePanelActionsSection>+ <ButtonPrimitive+ onClick={() => router.actions.push(urlForCohortWorkflow(cohort))}+ disabledReasons={{+ 'Save the cohort first': isNewCohort,+ }}+ data-attr={`${RESOURCE_TYPE}-message-with-workflow`}+ tooltip="Start a workflow that emails everyone in this cohort"+ menuItem+ >+ <IconSend /> Message this cohort+ </ButtonPrimitive>+<SceneAddToNotebookDropdownMenudataAttrKey={RESOURCE_TYPE}disabledReasons={{diff --git a/frontend/src/scenes/cohorts/CohortSceneMenuBar.tsx b/frontend/src/scenes/cohorts/CohortSceneMenuBar.tsxindex 8b431577cbe8..4da48a966f06 100644--- a/frontend/src/scenes/cohorts/CohortSceneMenuBar.tsx+++ b/frontend/src/scenes/cohorts/CohortSceneMenuBar.tsx@@ -1,7 +1,7 @@import { useActions, useValues } from 'kea'import { router } from 'kea-router'-import { IconClock, IconCopy, IconRefresh, IconTrash } from '@posthog/icons'+import { IconClock, IconCopy, IconRefresh, IconSend, IconTrash } from '@posthog/icons'import { LemonDialog } from '@posthog/lemon-ui'import { SceneMenuBarAddToNotebook } from 'lib/components/Scenes/SceneMenuBarAddToNotebook'@@ -9,6 +9,7 @@ import { SceneMenuBarFileItems } from 'lib/components/Scenes/SceneMenuBarFileIteimport { FEATURE_FLAGS } from 'lib/constants'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { cohortEditLogic } from 'scenes/cohorts/cohortEditLogic'+import { urlForCohortWorkflow } from 'scenes/cohorts/cohortUtils'import { NotebookNodeType } from 'scenes/notebooks/types'import { interProjectCopyLogic } from 'scenes/resource-transfer/interProjectCopyLogic'import { urls } from 'scenes/urls'@@ -53,6 +54,13 @@ function CohortSceneMenuBarInner({ id }: { id?: CohortType['id'] }): JSX.Element{!isNewCohort && cohortIdNumber !== undefined && (<><SceneMenuBarSubMenu label="Create">+ <SceneMenuBarItem+ onClick={() => router.actions.push(urlForCohortWorkflow(cohort))}+ data-attr={`${RESOURCE_TYPE}-menubar-message-with-workflow`}+ >+ <IconSend />+ Message this cohort+ </SceneMenuBarItem><SceneMenuBarAddToNotebookdataAttrKey={RESOURCE_TYPE}notebookSelectButtonProps={{diff --git a/frontend/src/scenes/cohorts/cohortUtils.tsx b/frontend/src/scenes/cohorts/cohortUtils.tsxindex 6b99ab3f9bcc..3f64a98b8a52 100644--- a/frontend/src/scenes/cohorts/cohortUtils.tsx+++ b/frontend/src/scenes/cohorts/cohortUtils.tsx@@ -37,6 +37,8 @@ import {TimeUnitType,} from '~/types'+import { urlForNewWorkflowWithTrigger } from 'products/workflows/frontend/Workflows/workflowTriggerPrefill'+/*** Single source of truth for whether a HaveProperty/NotHaveProperty criterion targets a* top-level persons-table column (PersonMetadata) or the JSON properties blob (Person).@@ -682,6 +684,23 @@ export function createCohortDataNodeLogicKey(cohortId: number | 'new'): string {return `cohort_${cohortId}_persons`}+export function urlForCohortWorkflow(cohort: CohortType): string {+ return urlForNewWorkflowWithTrigger({+ type: 'batch',+ filters: {+ properties: [+ {+ key: 'id',+ type: PropertyFilterType.Cohort,+ value: cohort.id as number,+ operator: PropertyOperator.In,+ cohort_name: cohort.name,+ },+ ],+ },+ })+}+export const COHORT_MATCHING_DAYS = {'1': 'day','7': 'week',diff --git a/posthog/settings/ses.py b/posthog/settings/ses.pyindex 0959e351c96f..6cd9beaff4c7 100644--- a/posthog/settings/ses.py+++ b/posthog/settings/ses.py@@ -96,6 +96,13 @@ WORKFLOW_EMAIL_WARN_COMPLAINT_RATE_24H: float = get_from_env(WORKFLOW_EMAIL_WARN_BOUNCE_RATE_1H: float = get_from_env("WORKFLOW_EMAIL_WARN_BOUNCE_RATE_1H", 0.05, type_cast=float)WORKFLOW_EMAIL_WARN_BOUNCE_RATE_24H: float = get_from_env("WORKFLOW_EMAIL_WARN_BOUNCE_RATE_24H", 0.025, type_cast=float)+# A pause that lands within this window of the previous resume is staff-resumable only. Without+# it, polling the resume endpoint keeps a spammy workflow sending for a fresh evaluation window+# after every pause.+WORKFLOW_EMAIL_AUTO_PAUSE_REPEAT_WINDOW_DAYS: int = get_from_env(+ "WORKFLOW_EMAIL_AUTO_PAUSE_REPEAT_WINDOW_DAYS", 7, type_cast=int+)+# How long one warning covers a workflow. Without this bound the hourly detector would repeat the# same email every run while the workflow sits inside the warning band.WORKFLOW_EMAIL_WARN_COOLDOWN_DAYS: int = get_from_env("WORKFLOW_EMAIL_WARN_COOLDOWN_DAYS", 7, type_cast=int)diff --git a/posthog/tasks/email.py b/posthog/tasks/email.pyindex e1a2c02b3c73..7cb84fc8f5df 100644--- a/posthog/tasks/email.py+++ b/posthog/tasks/email.py@@ -813,7 +813,13 @@ def send_email_sending_suspended(team_id: int, reason: str, suspended_at: str) -@shared_task(**EMAIL_TASK_KWARGS)@with_team_scope()def send_workflow_email_sending_paused(- team_id: int, hog_flow_id: str, hog_flow_name: str, reason: str, paused_at: str, resumable: bool = True+ team_id: int,+ hog_flow_id: str,+ hog_flow_name: str,+ reason: str,+ paused_at: str,+ resumable: bool = True,+ staff_pause: bool = False,) -> None:"""Tell a project's admins that one workflow's email sending was paused automatically because its@@ -838,6 +844,7 @@ def send_workflow_email_sending_paused("hog_flow_name": workflow_label,"reason": reason,"resumable": resumable,+ "staff_pause": staff_pause,"workflow_path": f"/project/{team.id}/workflows/{hog_flow_id}/workflow",},)diff --git a/posthog/templates/email/workflow_email_sending_paused.html b/posthog/templates/email/workflow_email_sending_paused.htmlindex 9b29005af8d6..1dd390012263 100644--- a/posthog/templates/email/workflow_email_sending_paused.html+++ b/posthog/templates/email/workflow_email_sending_paused.html@@ -19,10 +19,14 @@<p>Sending pauses again automatically if the problem continues, so there is no need to wait on support before resuming.</p>- {% else %}+ {% elif staff_pause %}<p>PostHog staff paused this workflow's email sending, so only we can resume it. Contact support once you have cleaned up the audience.</p>+ {% else %}+ <p>+ This workflow's email was paused again soon after it was resumed, so only we can resume it now. Contact support once you have cleaned up the audience.+ </p>{% endif %}<div class="mb mt text-center"><a class="button" href="{% absolute_uri workflow_path %}">Open workflow</a>diff --git a/products/workflows/backend/api/hog_flow.py b/products/workflows/backend/api/hog_flow.pyindex b90e7af91771..b8f9a95c74b2 100644--- a/products/workflows/backend/api/hog_flow.py+++ b/products/workflows/backend/api/hog_flow.py@@ -171,11 +171,20 @@ from products.workflows.backend.services.batch_audience import (get_batch_audience_count,get_batch_audience_person_ids,)+from products.workflows.backend.services.email_sending_attribution import (+ EMAIL_HEALTH_METRIC_NAMES,+ fold_email_totals_by_flow,+)from products.workflows.backend.services.timing_reschedule import (get_all_timing_action_ids,get_timing_reschedule_action_ids,)from products.workflows.backend.services.wait_clock_conditions import find_clock_function+from products.workflows.backend.services.workflow_email_health import (+ StaffPausedError,+ pause_requires_staff,+ resume_workflow_email_sending,+)from products.workflows.backend.tasks.hog_flows import reschedule_hog_flow_timingfrom products.workflows.backend.utils.batch_trigger_limit import get_hogflow_batch_trigger_limitfrom products.workflows.backend.utils.email_sending_tiers import max_email_sending_tier, resolve_team_email_sending_tier@@ -2410,6 +2419,22 @@ class WorkflowEmailSendingRatesSerializer(EmailSendingRatesSerializer):hog_flow_name = serializers.CharField(read_only=True, allow_blank=True, help_text="Display name of the workflow; empty for unnamed workflows.")+ email_sending_paused = serializers.BooleanField(+ read_only=True,+ help_text=(+ "True when PostHog paused this workflow's email automatically because its complaint or "+ "hard bounce rate crossed a threshold. Independent of the AWS tenant verdict and of the "+ "project-wide suspension."+ ),+ )+ email_sending_paused_at = serializers.DateTimeField(+ read_only=True, allow_null=True, help_text="When the pause started; null when not paused."+ )+ email_sending_paused_reason = serializers.CharField(+ read_only=True,+ allow_blank=True,+ help_text="Plain-language reason for the pause, naming the signal and the window. Empty when not paused.",+ )class AwsTenantFindingSerializer(serializers.Serializer):@@ -2649,6 +2674,34 @@ class EmailSendingSuspensionStatusSerializer(serializers.Serializer):)+class WorkflowEmailPauseStatusSerializer(serializers.Serializer):+ """Whether PostHog paused this one workflow's email sending, and why."""++ email_sending_paused = serializers.BooleanField(+ read_only=True,+ help_text=(+ "True while this workflow's email is paused because its spam complaint or hard bounce rate "+ "crossed a threshold. Other workflows in the project keep sending."+ ),+ )+ email_sending_paused_at = serializers.DateTimeField(+ read_only=True, allow_null=True, help_text="When the pause started; null when not paused."+ )+ email_sending_paused_reason = serializers.CharField(+ read_only=True,+ allow_blank=True,+ help_text="Plain-language reason for the pause, naming the signal and the window. Empty when not paused.",+ )+ email_sending_resumed_at = serializers.DateTimeField(+ read_only=True,+ allow_null=True,+ help_text=(+ "When sending was last resumed. Detector windows start after this, so resuming does not "+ "immediately re-trip on older feedback. Null if never paused."+ ),+ )++class HogFlowMinimalSerializer(UserAccessControlSerializerMixin, serializers.ModelSerializer):created_by = UserBasicSerializer(read_only=True)@@ -2843,6 +2896,52 @@ class HogFlowSerializer(HogFlowMinimalSerializer):"continue at its surviving successor instead of exiting. Null when no live deletions have occurred."),)+ email_sending_paused_at = serializers.DateTimeField(+ read_only=True,+ allow_null=True,+ help_text=(+ "When PostHog paused this workflow's email automatically because its spam complaint or hard "+ "bounce rate crossed a threshold. Null when sending is not paused. Read-only: only the "+ "resume_email_sending endpoint clears a pause, so a normal update or publish can't lift it."+ ),+ )+ email_sending_paused_reason = serializers.CharField(+ read_only=True,+ allow_blank=True,+ help_text="Plain-language reason for the pause, naming the signal and the window. Empty when not paused.",+ )+ email_sending_paused_by = serializers.CharField(+ read_only=True,+ allow_blank=True,+ help_text=(+ 'Who paused it: "auto" for the deliverability detector, "staff" for PostHog staff. A staff '+ "pause can only be resumed by staff, so the resume endpoint refuses it. Empty when not paused."+ ),+ )+ email_sending_pause_requires_support = serializers.SerializerMethodField(+ help_text=(+ "True when only PostHog staff can lift the current pause: staff placed it, or it landed "+ "shortly after a resume, so another self-serve resume is not offered. False when not "+ "paused or when the resume endpoint would accept the caller."+ ),+ )++ @extend_schema_field(serializers.BooleanField())+ def get_email_sending_pause_requires_support(self, hog_flow: HogFlow) -> bool:+ return pause_requires_staff(+ paused_at=hog_flow.email_sending_paused_at,+ paused_by=hog_flow.email_sending_paused_by,+ resumed_at=hog_flow.email_sending_resumed_at,+ )++ email_sending_resumed_at = serializers.DateTimeField(+ read_only=True,+ allow_null=True,+ help_text=(+ "When sending was last resumed. Every detector window starts after this, so resuming does not "+ "immediately re-trip on the feedback that caused the pause. Null if never paused."+ ),+ )def _stages_draft(self) -> bool:# stage_draft rides the raw request body rather than being a serializer field, mirroring@@ -2960,6 +3059,11 @@ class HogFlowSerializer(HogFlowMinimalSerializer):"draft","draft_updated_at","action_redirects",+ "email_sending_paused_at",+ "email_sending_paused_reason",+ "email_sending_paused_by",+ "email_sending_pause_requires_support",+ "email_sending_resumed_at",]read_only_fields = ["id",@@ -2975,6 +3079,13 @@ class HogFlowSerializer(HogFlowMinimalSerializer):"draft", # Written by draft routing (see perform_update / graph), never directly"draft_updated_at","action_redirects", # Computed from graph diffs at save time (see _refresh_action_redirects)+ # Set by the deliverability detector; only resume_email_sending clears a pause, so a+ # workflow update, publish or draft promotion can't be used to lift one.+ "email_sending_paused_at",+ "email_sending_paused_reason",+ "email_sending_paused_by",+ "email_sending_pause_requires_support",+ "email_sending_resumed_at",]def validate(self, data):@@ -3717,6 +3828,7 @@ class HogFlowViewSet("publish","discard_draft","restore_revision",+ "resume_email_sending",]queryset = HogFlow.objects.all()pagination_class = HogFlowPagination@@ -5178,7 +5290,7 @@ class HogFlowViewSet(team_id=self.team_id,app_source="hog_flow",after=after,- name=["email_sent", "email_bounced_hard", "email_blocked"],+ name=EMAIL_HEALTH_METRIC_NAMES,)cache.set(totals_cache_key, totals_by_source, 60)@@ -5193,43 +5305,15 @@ class HogFlowViewSet(else None)- # Attribute sources to workflows: metrics are recorded under the workflow id for- # event-triggered runs and under the batch job id for batch runs — resolve both and fold- # batch-job counts into the parent workflow. Sources matching neither (deleted workflows,- # non-UUID ids) still count toward the team aggregate above.- source_ids = [source_id for source_id in totals_by_source if _looks_like_uuid(source_id)]+ # Sources matching neither a workflow nor a batch job (deleted workflows, non-UUID ids)+ # still count toward the team aggregate above. Unnamed flows come back as "" to keep+ # hog_flow_name a plain string in the generated types.team_queryset = self.get_queryset()- # Only names are needed and HogFlow rows are wide (full step graphs in edges/actions/draft),- # so don't hydrate model instances for an uncapped id list. Unnamed flows serialize as "" to- # keep hog_flow_name a plain string in the generated types.- names_by_flow_id = {- str(flow_id): name or ""- for flow_id, name in team_queryset.filter(id__in=source_ids).values_list("id", "name")- }- unmatched_ids = [source_id for source_id in source_ids if source_id not in names_by_flow_id]- batch_job_to_flow = {- str(batch_job_id): str(flow_id)- for batch_job_id, flow_id in HogFlowBatchJob.objects.filter(- team_id=self.team_id, id__in=unmatched_ids- ).values_list("id", "hog_flow_id")- }- missing_flow_ids = set(batch_job_to_flow.values()) - set(names_by_flow_id)- names_by_flow_id.update(- {- str(flow_id): name or ""- for flow_id, name in team_queryset.filter(id__in=missing_flow_ids).values_list("id", "name")- }+ folded_totals = fold_email_totals_by_flow(+ team_id=self.team_id, totals_by_source=totals_by_source, flows=team_queryset)-- counts_by_flow: dict[str, dict[str, int]] = {}- for source_id, counts in totals_by_source.items():- flow_id = source_id if source_id in names_by_flow_id else batch_job_to_flow.get(source_id)- if flow_id is None or flow_id not in names_by_flow_id:- continue- folded = counts_by_flow.setdefault(flow_id, {"sent": 0, "bounced": 0, "complained": 0})- folded["sent"] += counts.get("email_sent", 0)- folded["bounced"] += counts.get("email_bounced_hard", 0)- folded["complained"] += counts.get("email_blocked", 0)+ counts_by_flow = folded_totals.counts_by_flow+ names_by_flow_id = folded_totals.names_by_flow_id# Mirror metrics_global: only surface workflows the caller can see, so reputation doesn't# leak names/volumes of access-controlled workflows the list endpoint hides.@@ -5246,11 +5330,11 @@ class HogFlowViewSet({"hog_flow_id": flow_id,"hog_flow_name": names_by_flow_id[flow_id],- **_email_sending_rates(counts["sent"], counts["bounced"], counts["complained"]),+ **_email_sending_rates(counts.sent, counts.bounced_hard, counts.complained),}for flow_id, counts in counts_by_flow.items()if flow_id in accessible_ids- and counts["sent"] > 0+ and counts.sent > 0and (not search or search in names_by_flow_id[flow_id].lower())]# Complaint rate breaks ties first: it's the more dangerous SES signal, with thresholds@@ -5258,6 +5342,22 @@ class HogFlowViewSet(workflow_rows.sort(key=lambda row: (-row["complaint_rate"], -row["bounce_rate"], -row["emails_sent"]))workflow_rows = workflow_rows[: self.WORKFLOW_REPUTATION_LIMIT]+ # Whether we paused each row's sending ourselves. Without it this tab reports only AWS's+ # verdict, so a workflow we paused for complaints can read as healthy here, which is the+ # wrong thing to show while someone is working out why their email stopped. Read after the+ # cap so it stays one small lookup.+ pause_state = {+ str(flow_id): (paused_at, reason)+ for flow_id, paused_at, reason in team_queryset.filter(+ id__in=[row["hog_flow_id"] for row in workflow_rows]+ ).values_list("id", "email_sending_paused_at", "email_sending_paused_reason")+ }+ for row in workflow_rows:+ paused_at, reason = pause_state.get(row["hog_flow_id"], (None, ""))+ row["email_sending_paused"] = paused_at is not None+ row["email_sending_paused_at"] = paused_at+ row["email_sending_paused_reason"] = reason if paused_at is not None else ""+# Shown to every project member regardless of per-object grants: a suspension stops# everyone's email, so hiding it would just leave silent send failures unexplained.suspension = (@@ -5336,6 +5436,44 @@ class HogFlowViewSet().data)+ @extend_schema(+ operation_id="hog_flows_resume_email_sending",+ request=None,+ responses={200: WorkflowEmailPauseStatusSerializer},+ )+ @action(detail=True, methods=["POST"], pagination_class=None, filter_backends=[], url_path="resume_email_sending")+ def resume_email_sending(self, request: Request, **kwargs) -> Response:+ """+ Resume email sending for a workflow PostHog paused automatically.++ Self-serve on purpose. Resuming re-arms the detector rather than exempting the workflow, so+ a workflow that is still generating complaints or hard bounces pauses again within minutes,+ while a customer who has cleaned up their audience does not have to wait on support.+ """+ hog_flow = self.get_object()+ before_update = HogFlow.objects.get(id=hog_flow.id)+ try:+ resumed = resume_workflow_email_sending(hog_flow)+ except StaffPausedError:+ raise exceptions.PermissionDenied(+ "This pause can only be lifted by PostHog. Contact support to get sending re-enabled."+ )+ if not resumed:+ raise exceptions.ValidationError({"detail": "Email sending is not paused for this workflow."})+ log_activity_from_viewset(+ self, hog_flow, activity="email_sending_resumed", name=hog_flow.name, previous=before_update+ )+ return Response(+ WorkflowEmailPauseStatusSerializer(+ {+ "email_sending_paused": False,+ "email_sending_paused_at": None,+ "email_sending_paused_reason": "",+ "email_sending_resumed_at": hog_flow.email_sending_resumed_at,+ }+ ).data+ )+@extend_schema(methods=["GET"], responses=HogFlowBatchJobSerializer(many=True))@extend_schema(methods=["POST"], request=HogFlowBatchJobSerializer, responses=HogFlowBatchJobSerializer)# GET returns a bare list (no pagination) and ignores the viewset's HogFlow filterset; disable both so thediff --git a/products/workflows/backend/api/test/test_email_reputation.py b/products/workflows/backend/api/test/test_email_reputation.pyindex 9c0bbaf5fbec..c1b6f4f37fa2 100644--- a/products/workflows/backend/api/test/test_email_reputation.py+++ b/products/workflows/backend/api/test/test_email_reputation.py@@ -254,6 +254,28 @@ class TestEmailReputationAPI(APIBaseTest):assert data["workflows"] == []assert data["reputation"]["emails_sent"] == 200+ def test_reputation_endpoint_flags_workflows_we_paused_ourselves(self):+ # The rest of this tab reports the provider's verdict, so a workflow PostHog paused reads+ # as healthy here without this flag.+ paused = self._create_flow("Paused blast")+ clean = self._create_flow("Healthy drip")+ paused.email_sending_paused_at = timezone.now()+ paused.email_sending_paused_reason = "Spam complaints reached 2%."+ paused.save(update_fields=["email_sending_paused_at", "email_sending_paused_reason"])++ data = self._get_reputation(+ {+ str(paused.id): {"email_sent": 1000, "email_blocked": 20},+ str(clean.id): {"email_sent": 1000},+ }+ )++ rows = {row["hog_flow_name"]: row for row in data["workflows"]}+ assert rows["Paused blast"]["email_sending_paused"] is True+ assert rows["Paused blast"]["email_sending_paused_reason"] == "Spam complaints reached 2%."+ assert rows["Healthy drip"]["email_sending_paused"] is False+ assert rows["Healthy drip"]["email_sending_paused_reason"] == ""+def test_reputation_endpoint_reports_email_sending_suspension(self):suspended_at = timezone.now().replace(microsecond=0)TeamWorkflowsConfig.objects.update_or_create(diff --git a/products/workflows/backend/api/test/test_workflow_email_pause.py b/products/workflows/backend/api/test/test_workflow_email_pause.pynew file mode 100644index 000000000000..e8e71a985823--- /dev/null+++ b/products/workflows/backend/api/test/test_workflow_email_pause.py@@ -0,0 +1,102 @@+from datetime import timedelta++from posthog.test.base import APIBaseTest++from django.utils import timezone++from rest_framework import status++from posthog.models.activity_logging.activity_log import ActivityLog++from products.workflows.backend.models import HogFlow++TRIGGER_ACTION = {+ "id": "trigger_node",+ "name": "trigger_1",+ "type": "trigger",+ "config": {+ "type": "event",+ "filters": {"events": [{"id": "$pageview", "name": "$pageview", "type": "events", "order": 0}]},+ },+}+EXIT_ACTION = {"id": "exit_node", "name": "exit_1", "type": "exit", "config": {}}+++class TestWorkflowEmailPauseAPI(APIBaseTest):+ def setUp(self):+ super().setUp()+ self.flow = HogFlow.objects.create(+ team=self.team,+ name="Newsletter",+ status="active",+ trigger={"type": "event"},+ edges=[{"from": "trigger_node", "to": "exit_node", "type": "continue"}],+ actions=[TRIGGER_ACTION, EXIT_ACTION],+ )++ def _pause(self, reason: str = "Spam complaints reached 2% of the 400 emails sent in the last hour.") -> None:+ self.flow.email_sending_paused_at = timezone.now() - timedelta(hours=1)+ self.flow.email_sending_paused_reason = reason+ self.flow.save(update_fields=["email_sending_paused_at", "email_sending_paused_reason"])++ def test_resume_clears_the_pause_and_stamps_the_resume_time(self):+ self._pause()++ response = self.client.post(+ f"/api/projects/{self.team.id}/hog_flows/{self.flow.id}/resume_email_sending",+ )++ assert response.status_code == status.HTTP_200_OK, response.json()+ body = response.json()+ assert body["email_sending_paused"] is False+ assert body["email_sending_paused_at"] is None+ assert body["email_sending_paused_reason"] == ""+ assert body["email_sending_resumed_at"] is not None+ self.flow.refresh_from_db()+ assert self.flow.email_sending_paused_at is None+ assert self.flow.email_sending_paused_reason == ""+ assert self.flow.email_sending_resumed_at is not None+ assert ActivityLog.objects.filter(+ scope="HogFlow", item_id=str(self.flow.id), activity="email_sending_resumed"+ ).exists()++ def test_resume_rejects_a_workflow_that_is_not_paused(self):+ response = self.client.post(+ f"/api/projects/{self.team.id}/hog_flows/{self.flow.id}/resume_email_sending",+ )++ assert response.status_code == status.HTTP_400_BAD_REQUEST+ self.flow.refresh_from_db()+ assert self.flow.email_sending_resumed_at is None++ def test_a_normal_update_cannot_clear_a_pause(self):+ # The resume endpoint is the only way out of a pause. A plain PATCH that sets the fields+ # back to null would otherwise be a free bypass of the whole feature.+ self._pause(reason="Spam complaints reached 2%.")++ response = self.client.patch(+ f"/api/projects/{self.team.id}/hog_flows/{self.flow.id}",+ {+ "name": "Newsletter renamed",+ "email_sending_paused_at": None,+ "email_sending_paused_reason": "",+ "email_sending_resumed_at": timezone.now().isoformat(),+ },+ )++ assert response.status_code == status.HTTP_200_OK, response.json()+ self.flow.refresh_from_db()+ assert self.flow.name == "Newsletter renamed"+ assert self.flow.email_sending_paused_at is not None+ assert self.flow.email_sending_paused_reason == "Spam complaints reached 2%."+ assert self.flow.email_sending_resumed_at is None++ def test_retrieve_exposes_the_pause_state(self):+ self._pause(reason="Spam complaints reached 2%.")++ response = self.client.get(f"/api/projects/{self.team.id}/hog_flows/{self.flow.id}")++ assert response.status_code == status.HTTP_200_OK+ body = response.json()+ assert body["email_sending_paused_at"] is not None+ assert body["email_sending_paused_reason"] == "Spam complaints reached 2%."diff --git a/products/workflows/backend/services/workflow_email_health.py b/products/workflows/backend/services/workflow_email_health.pyindex 7ea9759b8f05..e47c7223bea2 100644--- a/products/workflows/backend/services/workflow_email_health.py+++ b/products/workflows/backend/services/workflow_email_health.py@@ -36,7 +36,24 @@ PAUSED_BY_STAFF: Final[str] = "staff"class StaffPausedError(Exception):- """A customer tried to resume a pause staff placed. Only staff may clear it."""+ """A customer tried to resume a pause only staff may clear."""+++def pause_requires_staff(*, paused_at: datetime | None, paused_by: str, resumed_at: datetime | None) -> bool:+ """Whether only staff can clear this pause.++ Staff pauses always. Automatic pauses too when they landed within the repeat window of the+ previous resume: the workflow already got its self-serve second chance and re-tripped, so+ polling the resume endpoint cannot keep a spammy workflow sending indefinitely.+ """+ if paused_at is None:+ return False+ if paused_by == PAUSED_BY_STAFF:+ return True+ if resumed_at is None:+ return False+ window = timedelta(days=settings.WORKFLOW_EMAIL_AUTO_PAUSE_REPEAT_WINDOW_DAYS)+ return paused_at - resumed_at <= windowSignal = Literal["complaint", "bounce"]@@ -397,11 +414,14 @@ def pause_workflow_email_sending(flow = (HogFlow.objects.select_for_update().filter(id=hog_flow_id, team_id=team_id)- .only("id", "team_id", "email_sending_paused_at")+ .only("id", "team_id", "email_sending_paused_at", "email_sending_resumed_at").first())if flow is None or flow.email_sending_paused_at is not None:return False+ # A pause landing inside the repeat window of the previous resume is staff-resumable only,+ # and its email must not point the customer at a resume button that will refuse them.+ staff_only = pause_requires_staff(paused_at=now, paused_by=paused_by, resumed_at=flow.email_sending_resumed_at)# A queryset update rather than save: the post_save signal publishes the worker reload# immediately, and inside this transaction that is before the pause commits, so a worker# could reload, read the still-unpaused row, and cache it for minutes. The explicit publish@@ -426,7 +446,8 @@ def pause_workflow_email_sending(hog_flow_name=hog_flow_name,reason=reason,paused_at=now.isoformat(),- resumable=paused_by != PAUSED_BY_STAFF,+ resumable=not staff_only,+ staff_pause=paused_by == PAUSED_BY_STAFF,))return True@@ -582,12 +603,16 @@ def resume_workflow_email_sending(flow: HogFlow, *, actor: str = "customer", nowlocked = (HogFlow.objects.select_for_update().filter(id=flow.id, team_id=flow.team_id)- .only("id", "team_id", "email_sending_paused_at", "email_sending_paused_by")+ .only("id", "team_id", "email_sending_paused_at", "email_sending_paused_by", "email_sending_resumed_at").first())if locked is None or locked.email_sending_paused_at is None:return False- if actor != PAUSED_BY_STAFF and locked.email_sending_paused_by == PAUSED_BY_STAFF:+ if actor != PAUSED_BY_STAFF and pause_requires_staff(+ paused_at=locked.email_sending_paused_at,+ paused_by=locked.email_sending_paused_by,+ resumed_at=locked.email_sending_resumed_at,+ ):raise StaffPausedError("Only PostHog staff can resume this pause.")# Queryset update for the same reason as the pause writer: the reload must publish only# once the resume is committed.diff --git a/products/workflows/backend/test/test_workflow_email_health.py b/products/workflows/backend/test/test_workflow_email_health.pyindex c6b244097766..19130f3a7ae8 100644--- a/products/workflows/backend/test/test_workflow_email_health.py+++ b/products/workflows/backend/test/test_workflow_email_health.py@@ -402,6 +402,33 @@ class TestWorkflowEmailHealthDetector(ClickhouseTestMixin, BaseTest):self.flow.refresh_from_db()assert self.flow.email_sending_paused_at is None+ def test_a_repeat_pause_is_not_customer_resumable(self):+ # Resume-polling must not keep a spammy workflow sending: a pause landing inside the repeat+ # window of the previous resume needs staff. An old resume outside the window changes nothing.+ self.flow.email_sending_resumed_at = self.now - timedelta(days=1)+ self.flow.save(update_fields=["email_sending_resumed_at"])+ self._seed(sent=400, complaints=8)+ self._sweep()+ self.flow.refresh_from_db()+ assert self.flow.email_sending_paused_by == "auto"++ try:+ resume_workflow_email_sending(self.flow)+ raise AssertionError("a repeat pause must not be customer-resumable")+ except StaffPausedError:+ pass+ assert resume_workflow_email_sending(self.flow, actor=PAUSED_BY_STAFF) is True++ def test_a_pause_long_after_the_last_resume_stays_customer_resumable(self):+ self.flow.email_sending_resumed_at = self.now - timedelta(days=30)+ self.flow.save(update_fields=["email_sending_resumed_at"])+ self._seed(sent=400, complaints=8)+ self._sweep()+ self.flow.refresh_from_db()+ assert self.flow.email_sending_paused_at is not None++ assert resume_workflow_email_sending(self.flow) is True+def test_resume_is_a_no_op_when_not_paused(self):assert resume_workflow_email_sending(self.flow) is Falseself.flow.refresh_from_db()diff --git a/products/workflows/frontend/Workflows/Reputation/WorkflowsReputation.tsx b/products/workflows/frontend/Workflows/Reputation/WorkflowsReputation.tsxindex ec8e89e310fe..39850a38ed61 100644--- a/products/workflows/frontend/Workflows/Reputation/WorkflowsReputation.tsx+++ b/products/workflows/frontend/Workflows/Reputation/WorkflowsReputation.tsx@@ -517,9 +517,22 @@ export function WorkflowsReputation(): JSX.Element {title: 'Workflow',key: 'workflow',render: (_, snapshot: WorkflowEmailSendingRatesApi) => (- <Link to={urls.workflow(snapshot.hog_flow_id, 'workflow')} className="font-semibold">- {snapshot.hog_flow_name || snapshot.hog_flow_id}- </Link>+ <span className="inline-flex items-center gap-2">+ <Link to={urls.workflow(snapshot.hog_flow_id, 'workflow')} className="font-semibold">+ {snapshot.hog_flow_name || snapshot.hog_flow_id}+ </Link>+ {/* Without this, a workflow we paused ourselves reads as healthy here,+ because the rest of this tab reports the provider's verdict only. */}+ {snapshot.email_sending_paused && (+ <Tooltip+ title={`${snapshot.email_sending_paused_reason} Open the workflow to resume sending.`}+ >+ <LemonTag type="danger" size="small">+ Paused+ </LemonTag>+ </Tooltip>+ )}+ </span>),},{diff --git a/products/workflows/frontend/Workflows/WorkflowEmailPauseBanner.tsx b/products/workflows/frontend/Workflows/WorkflowEmailPauseBanner.tsxnew file mode 100644index 000000000000..202a38d55793--- /dev/null+++ b/products/workflows/frontend/Workflows/WorkflowEmailPauseBanner.tsx@@ -0,0 +1,67 @@+import { useActions, useValues } from 'kea'++import { LemonBanner } from '@posthog/lemon-ui'++import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'++import { AccessControlLevel, AccessControlResourceType } from '~/types'++import { workflowLogic } from './workflowLogic'++export function WorkflowEmailPauseBanner(): JSX.Element | null {+ const {+ emailSendingPaused,+ emailSendingPausedReason,+ emailSendingPausedByStaff,+ emailSendingPauseRequiresSupport,+ resumeEmailSendingPending,+ hasUnsavedChanges,+ workflowUserAccessLevel,+ } = useValues(workflowLogic)+ const { resumeEmailSending } = useActions(workflowLogic)++ // The resume endpoint needs editor access, so a viewer gets a disabled button with the reason+ // instead of a confirm dialog that can only end in an error.+ const accessDisabledReason = getAccessControlDisabledReason(+ AccessControlResourceType.Workflow,+ AccessControlLevel.Editor,+ workflowUserAccessLevel ?? undefined+ )++ if (!emailSendingPaused) {+ return null+ }++ if (emailSendingPauseRequiresSupport) {+ return (+ <LemonBanner type="error" data-attr="workflow-email-paused-banner">+ {emailSendingPausedByStaff+ ? 'PostHog staff paused email sending for this workflow to protect delivery for everyone.'+ : 'Email sending for this workflow was paused again soon after it was resumed.'}{' '}+ Its other steps still run. {emailSendingPausedReason} Remove old or bought addresses from the audience,+ then contact support to get sending re-enabled.+ </LemonBanner>+ )+ }++ return (+ <LemonBanner+ type="error"+ data-attr="workflow-email-paused-banner"+ action={{+ children: 'Resume sending',+ onClick: resumeEmailSending,+ // LemonButton disables itself while loading, so this is also the double-submit guard.+ loading: resumeEmailSendingPending,+ // Resuming reloads the workflow from the server, which resets the editor and would+ // drop whatever the form still holds.+ disabledReason: accessDisabledReason ?? (hasUnsavedChanges ? 'Save your changes first' : undefined),+ 'data-attr': 'workflow-email-paused-resume',+ }}+ >+ Email sending is paused for this workflow. Its other steps still run, and the rest of your workflows keep+ sending. {emailSendingPausedReason} Remove old or bought addresses from the audience and stop sending to+ people who never open anything, then resume sending.+ </LemonBanner>+ )+}diff --git a/products/workflows/frontend/Workflows/WorkflowScene.tsx b/products/workflows/frontend/Workflows/WorkflowScene.tsxindex 4a098545efc5..d7f8ae5f5782 100644--- a/products/workflows/frontend/Workflows/WorkflowScene.tsx+++ b/products/workflows/frontend/Workflows/WorkflowScene.tsx@@ -28,12 +28,14 @@ import {isEditingEmailAction,} from './workflowAgentContext'import { WorkflowAssets } from './WorkflowAssets'+import { WorkflowEmailPauseBanner } from './WorkflowEmailPauseBanner'import { WorkflowInvocations } from './WorkflowInvocations'import { workflowLogic } from './workflowLogic'import { WorkflowMetrics } from './WorkflowMetrics'import { WorkflowRevisions } from './WorkflowRevisions'import { WorkflowSceneHeader } from './WorkflowSceneHeader'import { WorkflowSceneLogicProps, WorkflowTab, workflowSceneLogic } from './workflowSceneLogic'+import { TRIGGER_PREFILL_PARAM } from './workflowTriggerPrefill'export const scene: SceneExport<WorkflowSceneLogicProps> = {component: WorkflowScene,@@ -55,10 +57,11 @@ export function WorkflowScene(props: WorkflowSceneLogicProps): JSX.Element {const { searchParams } = useValues(router)const templateId = searchParams.templateId as string | undefinedconst editTemplateId = searchParams.editTemplateId as string | undefined+ const triggerPrefill = searchParams[TRIGGER_PREFILL_PARAM] as string | undefinedconst batchJobsLogic = batchWorkflowJobsLogic({ id: workflowSceneProps.id })- const logic = workflowLogic({ id: props.id, templateId, editTemplateId })+ const logic = workflowLogic({ id: props.id, templateId, editTemplateId, triggerPrefill })// The save/auto-save indicators moved into the WorkflowStatusBar; the scene only needs the// workflow itself (for the agent context) and the load state.const { workflow, workflowLoading, originalWorkflow, hogFunctionTemplatesById } = useValues(logic)@@ -164,8 +167,9 @@ export function WorkflowScene(props: WorkflowSceneLogicProps): JSX.Element {return (<SceneContent className="h-full flex flex-col grow" data-attr="workflow-scene">- <BindLogic logic={workflowLogic} props={{ id: props.id, templateId, editTemplateId }}>+ <BindLogic logic={workflowLogic} props={{ id: props.id, templateId, editTemplateId, triggerPrefill }}><WorkflowSceneHeader {...props} />+ <WorkflowEmailPauseBanner />{/* Only show Logs and Metrics tabs if the workflow has already been created */}{!props.id || props.id === 'new' ? (<Workflow {...props} />diff --git a/products/workflows/frontend/Workflows/hogflows/types.ts b/products/workflows/frontend/Workflows/hogflows/types.tsindex 0160ca7eeff6..869c0bb717d5 100644--- a/products/workflows/frontend/Workflows/hogflows/types.ts+++ b/products/workflows/frontend/Workflows/hogflows/types.ts@@ -95,6 +95,15 @@ export interface HogFlow extends z.infer<typeof HogFlowSchema> {// content fields; null when nothing is staged. Read-only server state.draft?: Partial<HogFlow> | nulldraft_updated_at?: string | null+ // Set when PostHog paused this workflow's email because its spam complaint or hard bounce rate+ // crossed a threshold. Read-only server state: only the resume endpoint clears it.+ email_sending_paused_at?: string | null+ email_sending_paused_reason?: string+ // "auto" (detector) or "staff"; a staff pause has no customer resume. Empty when not paused.+ email_sending_paused_by?: string+ // True when only PostHog can lift the pause: staff placed it, or it re-tripped soon after a resume.+ email_sending_pause_requires_support?: boolean+ email_sending_resumed_at?: string | null}export interface HogFlowEdge extends z.infer<typeof HogFlowEdgeSchema> {}diff --git a/products/workflows/frontend/Workflows/misc/workflowActivityDescriber.tsx b/products/workflows/frontend/Workflows/misc/workflowActivityDescriber.tsxindex 868e34f99bd2..3267a98a0090 100644--- a/products/workflows/frontend/Workflows/misc/workflowActivityDescriber.tsx+++ b/products/workflows/frontend/Workflows/misc/workflowActivityDescriber.tsx@@ -128,6 +128,17 @@ export function workflowActivityDescriber(logItem: ActivityLogItem, asNotificati}}+ if (logItem.activity == 'email_sending_resumed') {+ return {+ description: (+ <>+ <ActivityLogUserName logItem={logItem} /> resumed email sending for the {objectNoun}:{' '}+ {nameOrLinkToWorkflow(logItem?.item_id, logItem?.detail.name)}+ </>+ ),+ }+ }+if (logItem.activity == 'updated' || logItem.activity == 'published') {const verb = logItem.activity == 'published' ? 'published' : 'updated'const changes: JSX.Element[] = []diff --git a/products/workflows/frontend/Workflows/workflowLogic.ts b/products/workflows/frontend/Workflows/workflowLogic.tsindex f095ed33033c..c2fb3ab2874d 100644--- a/products/workflows/frontend/Workflows/workflowLogic.ts+++ b/products/workflows/frontend/Workflows/workflowLogic.ts@@ -25,6 +25,7 @@ import { userLogic } from 'scenes/userLogic'import { AccessControlLevel, HogFunctionTemplateType } from '~/types'import { resourceEditedLogic } from 'products/notifications/frontend/resourceEditedLogic'+import { hogFlowsResumeEmailSending } from 'products/workflows/frontend/generated/api'import type { ResourceEditedEvent, UserBasicType, UserType } from '../../../../frontend/src/types'import { getRegisteredTriggerTypes } from './hogflows/registry/triggers/triggerTypeRegistry'@@ -53,11 +54,13 @@ import { openPublishConfirmDialog } from './PublishImpactDialog'import { prepareWorkflowDuplicate } from './workflowDuplication'import { workflowSceneLogic } from './workflowSceneLogic'import { workflowsLogic } from './workflowsLogic'+import { parseWorkflowTriggerPrefill } from './workflowTriggerPrefill'export interface WorkflowLogicProps {id?: stringtemplateId?: stringeditTemplateId?: string+ triggerPrefill?: string}export const TRIGGER_NODE_ID = 'trigger_node'@@ -214,6 +217,10 @@ export interface workflowLogicValues {discardDisabledReason: string | undefineddraftActionPending: 'discard' | 'publish' | nulledgesByActionId: Record<string, HogFlowEdge[]>+ emailSendingPauseRequiresSupport: boolean+ emailSendingPaused: boolean+ emailSendingPausedByStaff: boolean+ emailSendingPausedReason: stringexternallyEdited: booleanhasStagedDraft: booleanhasUnsavedChanges: boolean@@ -239,6 +246,7 @@ export interface workflowLogicValues {| false| nullpublishDisabledReason: string | undefined+ resumeEmailSendingPending: booleansaveAttemptedActionIds: string[] | nullsaveBaseUpdatedAt: string | nullscheduleConfigSources: {@@ -288,6 +296,9 @@ export interface workflowLogicActions {confirmPublishDraft: (confirmToken: string) => {confirmToken: string}+ confirmResumeEmailSending: () => {+ value: true+ }discardChanges: () => {value: true}@@ -2355,6 +2366,9 @@ export interface workflowLogicActions {resetWorkflow: (values?: HogFlow) => {values?: HogFlow}+ resumeEmailSending: () => {+ value: true+ }saveWorkflow: (updates: HogFlow) => HogFlowsaveWorkflowFailure: (error: string,@@ -2385,6 +2399,9 @@ export interface workflowLogicActions {setExternallyEdited: (externallyEdited: boolean) => {externallyEdited: boolean}+ setResumeEmailSendingPending: (pending: boolean) => {+ pending: boolean+ }setSaveBaseUpdatedAt: (updatedAt: string | null) => {updatedAt: string | null}@@ -2977,6 +2994,10 @@ export interface workflowLogicMeta {hogFunctionTemplatesById: Record<string, HogFunctionTemplateType>) => HogFlowhasStagedDraft: (originalWorkflow: HogFlow | null) => boolean+ emailSendingPaused: (originalWorkflow: HogFlow | null) => boolean+ emailSendingPausedReason: (originalWorkflow: HogFlow | null) => string+ emailSendingPausedByStaff: (originalWorkflow: HogFlow | null) => boolean+ emailSendingPauseRequiresSupport: (originalWorkflow: HogFlow | null) => booleanshowDraftActions: (originalWorkflow: HogFlow | null) => booleanpublishDisabledReason: (hasStagedDraft: boolean,@@ -3002,7 +3023,8 @@ export const workflowLogic = kea<workflowLogicType>([path((key) => ['products', 'workflows', 'frontend', 'Workflows', 'workflowLogic', key]),props({ id: 'new' } as WorkflowLogicProps),key(- (props) => `workflow-${props.id || 'new'}-${props.templateId || 'default'}-${props.editTemplateId || 'default'}`+ (props) =>+ `workflow-${props.id || 'new'}-${props.templateId || 'default'}-${props.editTemplateId || 'default'}-${props.triggerPrefill || 'default'}`),connect(() => ({values: [userLogic, ['user'], projectLogic, ['currentProjectId']],@@ -3056,6 +3078,9 @@ export const workflowLogic = kea<workflowLogicType>([setDraftActionPending: (pending: 'publish' | 'discard' | null) => ({ pending }),setDeferredResourceEdited: (event: ResourceEditedEvent | null) => ({ event }),replayDeferredResourceEdited: true,+ resumeEmailSending: true,+ confirmResumeEmailSending: true,+ setResumeEmailSendingPending: (pending: boolean) => ({ pending }),}),loaders(({ props, values, actions, cache }) => ({originalWorkflow: [@@ -3088,6 +3113,16 @@ export const workflowLogic = kea<workflowLogicType>([return newWorkflow}+ const triggerConfig = parseWorkflowTriggerPrefill(props.triggerPrefill)+ if (triggerConfig) {+ const prefilled: HogFlow = {+ ...NEW_WORKFLOW,+ actions: NEW_WORKFLOW.actions.map((action) =>+ action.type === 'trigger' ? { ...action, config: triggerConfig } : action+ ),+ }+ return prefilled+ }return { ...NEW_WORKFLOW }}@@ -3432,6 +3467,12 @@ export const workflowLogic = kea<workflowLogicType>([setDraftActionPending: (_, { pending }) => pending,},],+ resumeEmailSendingPending: [+ false,+ {+ setResumeEmailSendingPending: (_, { pending }) => pending,+ },+ ],// A resource_edited event parked while our own save/reload was in flight. Replayed once the// flight settles, so a genuine external edit landing in that window is reconciled instead of// dropped. Latest event wins: the comparison is against timestamps, so older ones are moot.@@ -3756,6 +3797,28 @@ export const workflowLogic = kea<workflowLogicType>([(originalWorkflow: HogFlow | null): boolean => !!originalWorkflow?.draft,],+ // Read off the saved row, never the editor form: a pause is server state and the form is+ // whatever the author has typed since.+ emailSendingPaused: [+ (s) => [s.originalWorkflow],+ (originalWorkflow: HogFlow | null): boolean => !!originalWorkflow?.email_sending_paused_at,+ ],+ emailSendingPausedReason: [+ (s) => [s.originalWorkflow],+ (originalWorkflow: HogFlow | null): string => originalWorkflow?.email_sending_paused_reason ?? '',+ ],+ // "staff" means only PostHog staff can lift the pause, so the banner hides the resume button.+ emailSendingPausedByStaff: [+ (s) => [s.originalWorkflow],+ (originalWorkflow: HogFlow | null): boolean => originalWorkflow?.email_sending_paused_by === 'staff',+ ],+ // Covers staff pauses and repeat pauses (re-tripped soon after a resume): no resume button.+ emailSendingPauseRequiresSupport: [+ (s) => [s.originalWorkflow],+ (originalWorkflow: HogFlow | null): boolean =>+ originalWorkflow?.email_sending_pause_requires_support === true,+ ],+// A staged draft outlives the edits made after it, so the draft actions stay mounted while// the form is dirty. Gating them on a clean form made them appear and disappear on every// auto-save cycle.@@ -3928,6 +3991,42 @@ export const workflowLogic = kea<workflowLogicType>([actions.setDraftActionPending(null)}},+ resumeEmailSending: () => {+ if (!props.id || props.id === 'new' || values.resumeEmailSendingPending) {+ return+ }+ LemonDialog.open({+ title: 'Resume email sending?',+ description:+ 'Send again from this workflow. If it keeps drawing spam complaints or hitting addresses that do not exist, sending pauses again on its own within a couple of hours.',+ primaryButton: {+ children: 'Resume sending',+ onClick: () => actions.confirmResumeEmailSending(),+ },+ secondaryButton: {+ children: 'Cancel',+ },+ })+ },+ confirmResumeEmailSending: async () => {+ // Also guards the dialog's close-animation window, where a fast double-click on the+ // confirm button dispatches twice.+ if (!props.id || props.id === 'new' || values.resumeEmailSendingPending) {+ return+ }+ actions.setResumeEmailSendingPending(true)+ try {+ await hogFlowsResumeEmailSending(String(values.currentProjectId), props.id)+ lemonToast.success('Email sending resumed')+ } catch {+ lemonToast.error('Could not resume email sending. Please try again.')+ } finally {+ actions.setResumeEmailSendingPending(false)+ // Reload either way: on success to clear the banner, on failure because another+ // editor may have resumed it already.+ actions.loadWorkflow()+ }+ },discardDraft: () => {if (!props.id || props.id === 'new' || values.draftActionPending) {returndiff --git a/products/workflows/frontend/Workflows/workflowMetricsSummaryLogic.ts b/products/workflows/frontend/Workflows/workflowMetricsSummaryLogic.tsindex 4f8f7be4f916..6f2c2e950b12 100644--- a/products/workflows/frontend/Workflows/workflowMetricsSummaryLogic.ts+++ b/products/workflows/frontend/Workflows/workflowMetricsSummaryLogic.ts@@ -118,6 +118,7 @@ export type EmailMetric =| 'email_blocked'| 'email_untracked'| 'email_suspended'+ | 'email_paused'export type PushMetric = 'push_sent' | 'push_skipped' | 'push_failed' | 'push_opened'@@ -184,6 +185,7 @@ export const METRIC_COLORS: Record<string, string> = {'Marked as spam': getColorVar('data-color-9'),Untracked: getColorVar('data-color-10'),Suspended: getColorVar('data-color-11'),+ Paused: getColorVar('data-color-12'),Skipped: getColorVar('data-color-2'),// Workflow run + batch-job metricsSuccess: getColorVar('success'),@@ -307,6 +309,13 @@ export const WORKFLOW_EMAIL_METRICS: Record<color: METRIC_COLORS['Suspended'],metricNames: ['email_suspended'],},+ email_paused: {+ name: 'Paused',+ description:+ "Total number of emails that were not sent because this workflow's email is paused. Sending pauses automatically when a workflow's spam complaint or hard bounce rate gets high enough to hurt delivery. Clean up the audience, then resume sending from this workflow's page.",+ color: METRIC_COLORS['Paused'],+ metricNames: ['email_paused'],+ },}// Push has no delivery-receipt channel like email's SES webhook (FCM/APNs respond synchronously), so@@ -361,6 +370,9 @@ export const EMAIL_METRIC_INVOCATION_FILTERS: Partial<email_blocked: { search: 'Complaint', levels: ['WARN', 'ERROR'] },// Suspension skips log "Skipping send: email sending is suspended …" at WARN (EmailService).email_suspended: { search: 'Skipping send', levels: ['WARN'] },+ // A per-workflow pause logs "Skipping send: … paused …" at ERROR (EmailService). The search+ // term stays generic because the staff and automatic pauses word the line differently.+ email_paused: { search: 'Skipping send', levels: ['ERROR'] },}// Build the router search params that point the Invocations tab at the runs behind the given email@@ -399,6 +411,7 @@ const EMAIL_METRICS: EmailMetric[] = ['email_blocked','email_untracked','email_suspended',+ 'email_paused',]const PUSH_METRICS: PushMetric[] = ['push_sent', 'push_skipped', 'push_failed', 'push_opened']diff --git a/products/workflows/frontend/Workflows/workflowTriggerPrefill.test.ts b/products/workflows/frontend/Workflows/workflowTriggerPrefill.test.tsnew file mode 100644index 000000000000..b385ca41acd2--- /dev/null+++ b/products/workflows/frontend/Workflows/workflowTriggerPrefill.test.ts@@ -0,0 +1,29 @@+import {+ TRIGGER_PREFILL_PARAM,+ type WorkflowTriggerConfig,+ parseWorkflowTriggerPrefill,+ urlForNewWorkflowWithTrigger,+} from './workflowTriggerPrefill'++describe('workflowTriggerPrefill', () => {+ it('round-trips a trigger config through the URL', () => {+ const config: WorkflowTriggerConfig = {+ type: 'batch',+ filters: { properties: [{ key: 'id', type: 'cohort', value: 7, operator: 'in' }] },+ }++ const url = urlForNewWorkflowWithTrigger(config)+ const raw = new URLSearchParams(url.split('?')[1]).get(TRIGGER_PREFILL_PARAM)++ expect(parseWorkflowTriggerPrefill(raw ?? undefined)).toEqual(config)+ })++ it.each([+ ['nothing', undefined],+ ['a non-JSON string', 'not-json'],+ ['an unknown trigger type', '{"type":"nonsense"}'],+ ['a batch trigger missing its filters', '{"type":"batch"}'],+ ])('returns null for %s', (_label, raw) => {+ expect(parseWorkflowTriggerPrefill(raw)).toBeNull()+ })+})diff --git a/products/workflows/frontend/Workflows/workflowTriggerPrefill.ts b/products/workflows/frontend/Workflows/workflowTriggerPrefill.tsnew file mode 100644index 000000000000..a3bba23e55c4--- /dev/null+++ b/products/workflows/frontend/Workflows/workflowTriggerPrefill.ts@@ -0,0 +1,26 @@+import { combineUrl } from 'kea-router'++import { urls } from 'scenes/urls'++import { HogFlowTriggerSchema } from './hogflows/steps/types'+import type { HogFlowAction } from './hogflows/types'++export type WorkflowTriggerConfig = Extract<HogFlowAction, { type: 'trigger' }>['config']++export const TRIGGER_PREFILL_PARAM = 'trigger'++export function urlForNewWorkflowWithTrigger(config: WorkflowTriggerConfig): string {+ return combineUrl(urls.workflowNew(), { [TRIGGER_PREFILL_PARAM]: JSON.stringify(config) }).url+}++export function parseWorkflowTriggerPrefill(raw: string | undefined): WorkflowTriggerConfig | null {+ if (!raw) {+ return null+ }+ try {+ const result = HogFlowTriggerSchema.safeParse(JSON.parse(raw))+ return result.success ? (result.data as WorkflowTriggerConfig) : null+ } catch {+ return null+ }+}diff --git a/products/workflows/frontend/generated/api.schemas.ts b/products/workflows/frontend/generated/api.schemas.tsindex 4a110afd032a..f82bcdbf5484 100644--- a/products/workflows/frontend/generated/api.schemas.ts+++ b/products/workflows/frontend/generated/api.schemas.ts@@ -633,6 +633,22 @@ export interface HogFlowApi {* @nullable*/readonly action_redirects: HogFlowApiActionRedirects+ /**+ * When PostHog paused this workflow's email automatically because its spam complaint or hard bounce rate crossed a threshold. Null when sending is not paused. Read-only: only the resume_email_sending endpoint clears a pause, so a normal update or publish can't lift it.+ * @nullable+ */+ readonly email_sending_paused_at: string | null+ /** Plain-language reason for the pause, naming the signal and the window. Empty when not paused. */+ readonly email_sending_paused_reason: string+ /** Who paused it: "auto" for the deliverability detector, "staff" for PostHog staff. A staff pause can only be resumed by staff, so the resume endpoint refuses it. Empty when not paused. */+ readonly email_sending_paused_by: string+ /** True when only PostHog staff can lift the current pause: staff placed it, or it landed shortly after a resume, so another self-serve resume is not offered. False when not paused or when the resume endpoint would accept the caller. */+ readonly email_sending_pause_requires_support: boolean+ /**+ * When sending was last resumed. Every detector window starts after this, so resuming does not immediately re-trip on the feedback that caused the pause. Null if never paused.+ * @nullable+ */+ readonly email_sending_resumed_at: string | null}/**@@ -715,6 +731,22 @@ export interface HogFlowUpdateApi {* @nullable*/readonly action_redirects: HogFlowUpdateApiActionRedirects+ /**+ * When PostHog paused this workflow's email automatically because its spam complaint or hard bounce rate crossed a threshold. Null when sending is not paused. Read-only: only the resume_email_sending endpoint clears a pause, so a normal update or publish can't lift it.+ * @nullable+ */+ readonly email_sending_paused_at: string | null+ /** Plain-language reason for the pause, naming the signal and the window. Empty when not paused. */+ readonly email_sending_paused_reason: string+ /** Who paused it: "auto" for the deliverability detector, "staff" for PostHog staff. A staff pause can only be resumed by staff, so the resume endpoint refuses it. Empty when not paused. */+ readonly email_sending_paused_by: string+ /** True when only PostHog staff can lift the current pause: staff placed it, or it landed shortly after a resume, so another self-serve resume is not offered. False when not paused or when the resume endpoint would accept the caller. */+ readonly email_sending_pause_requires_support: boolean+ /**+ * When sending was last resumed. Every detector window starts after this, so resuming does not immediately re-trip on the feedback that caused the pause. Null if never paused.+ * @nullable+ */+ readonly email_sending_resumed_at: string | null}/**@@ -797,6 +829,22 @@ export interface PatchedHogFlowUpdateApi {* @nullable*/readonly action_redirects?: PatchedHogFlowUpdateApiActionRedirects+ /**+ * When PostHog paused this workflow's email automatically because its spam complaint or hard bounce rate crossed a threshold. Null when sending is not paused. Read-only: only the resume_email_sending endpoint clears a pause, so a normal update or publish can't lift it.+ * @nullable+ */+ readonly email_sending_paused_at?: string | null+ /** Plain-language reason for the pause, naming the signal and the window. Empty when not paused. */+ readonly email_sending_paused_reason?: string+ /** Who paused it: "auto" for the deliverability detector, "staff" for PostHog staff. A staff pause can only be resumed by staff, so the resume endpoint refuses it. Empty when not paused. */+ readonly email_sending_paused_by?: string+ /** True when only PostHog staff can lift the current pause: staff placed it, or it landed shortly after a resume, so another self-serve resume is not offered. False when not paused or when the resume endpoint would accept the caller. */+ readonly email_sending_pause_requires_support?: boolean+ /**+ * When sending was last resumed. Every detector window starts after this, so resuming does not immediately re-trip on the feedback that caused the pause. Null if never paused.+ * @nullable+ */+ readonly email_sending_resumed_at?: string | null}/**@@ -1273,6 +1321,26 @@ export interface HogInvocationRerunResponseApi {skipped_count: number}+/**+ * Whether PostHog paused this one workflow's email sending, and why.+ */+export interface WorkflowEmailPauseStatusApi {+ /** True while this workflow's email is paused because its spam complaint or hard bounce rate crossed a threshold. Other workflows in the project keep sending. */+ readonly email_sending_paused: boolean+ /**+ * When the pause started; null when not paused.+ * @nullable+ */+ readonly email_sending_paused_at: string | null+ /** Plain-language reason for the pause, naming the signal and the window. Empty when not paused. */+ readonly email_sending_paused_reason: string+ /**+ * When sending was last resumed. Detector windows start after this, so resuming does not immediately re-trip on older feedback. Null if never paused.+ * @nullable+ */+ readonly email_sending_resumed_at: string | null+}+export interface HogFlowRevisionBasicApi {/** Workflow version this snapshot was published as. */readonly version: number@@ -1516,6 +1584,15 @@ export interface WorkflowEmailSendingRatesApi {readonly hog_flow_id: string/** Display name of the workflow; empty for unnamed workflows. */readonly hog_flow_name: string+ /** True when PostHog paused this workflow's email automatically because its complaint or hard bounce rate crossed a threshold. Independent of the AWS tenant verdict and of the project-wide suspension. */+ readonly email_sending_paused: boolean+ /**+ * When the pause started; null when not paused.+ * @nullable+ */+ readonly email_sending_paused_at: string | null+ /** Plain-language reason for the pause, naming the signal and the window. Empty when not paused. */+ readonly email_sending_paused_reason: string}/**diff --git a/products/workflows/frontend/generated/api.ts b/products/workflows/frontend/generated/api.tsindex 66199da0e9ef..5b47b1fcb725 100644--- a/products/workflows/frontend/generated/api.ts+++ b/products/workflows/frontend/generated/api.ts@@ -57,6 +57,7 @@ import type {PatchedHogFlowTemplateApi,PatchedHogFlowUpdateApi,TeamEmailReputationResponseApi,+ WorkflowEmailPauseStatusApi,WorkflowStatsRowApi,} from './api.schemas'@@ -784,6 +785,28 @@ export const hogFlowsRerunCreate = async (})}+export const getHogFlowsResumeEmailSendingUrl = (projectId: string, id: string) => {+ return `/api/projects/${projectId}/hog_flows/${id}/resume_email_sending/`+}++/**+ * Resume email sending for a workflow PostHog paused automatically.+ *+ * Self-serve on purpose. Resuming re-arms the detector rather than exempting the workflow, so+ * a workflow that is still generating complaints or hard bounces pauses again within minutes,+ * while a customer who has cleaned up their audience does not have to wait on support.+ */+export const hogFlowsResumeEmailSending = async (+ projectId: string,+ id: string,+ options?: RequestInit+): Promise<WorkflowEmailPauseStatusApi> => {+ return apiMutator<WorkflowEmailPauseStatusApi>(getHogFlowsResumeEmailSendingUrl(projectId, id), {+ ...options,+ method: 'POST',+ })+}+export const getHogFlowsRevisionsListUrl = (projectId: string, id: string, params?: HogFlowsRevisionsListParams) => {const normalizedParams = new URLSearchParams()diff --git a/products/workflows/frontend/generated/api.zod.ts b/products/workflows/frontend/generated/api.zod.tsindex e9696f9cea65..78b30b451169 100644--- a/products/workflows/frontend/generated/api.zod.ts+++ b/products/workflows/frontend/generated/api.zod.ts@@ -2279,6 +2279,33 @@ export const HogFlowsInvocationsCreateBody = /* @__PURE__ */ zod.object({.describe('Skip-forward map for deleted steps: {deleted_action_id: next surviving action_id}. Maintained automatically when a live graph edit deletes actions, so in-flight runs parked on a deleted step continue at its surviving successor instead of exiting. Null when no live deletions have occurred.'),+ email_sending_paused_at: zod.iso+ .datetime({ offset: true })+ .nullable()+ .describe(+ "When PostHog paused this workflow's email automatically because its spam complaint or hard bounce rate crossed a threshold. Null when sending is not paused. Read-only: only the resume_email_sending endpoint clears a pause, so a normal update or publish can't lift it."+ ),+ email_sending_paused_reason: zod+ .string()+ .describe(+ 'Plain-language reason for the pause, naming the signal and the window. Empty when not paused.'+ ),+ email_sending_paused_by: zod+ .string()+ .describe(+ 'Who paused it: \"auto\" for the deliverability detector, \"staff\" for PostHog staff. A staff pause can only be resumed by staff, so the resume endpoint refuses it. Empty when not paused.'+ ),+ email_sending_pause_requires_support: zod+ .boolean()+ .describe(+ 'True when only PostHog staff can lift the current pause: staff placed it, or it landed shortly after a resume, so another self-serve resume is not offered. False when not paused or when the resume endpoint would accept the caller.'+ ),+ email_sending_resumed_at: zod.iso+ .datetime({ offset: true })+ .nullable()+ .describe(+ 'When sending was last resumed. Every detector window starts after this, so resuming does not immediately re-trip on the feedback that caused the pause. Null if never paused.'+ ),}).describe('Mixin for serializers to add user access control fields').optional()diff --git a/products/workflows/mcp/tools.yaml b/products/workflows/mcp/tools.yamlindex d5fc0f002898..2550a7ec4aba 100644--- a/products/workflows/mcp/tools.yaml+++ b/products/workflows/mcp/tools.yaml@@ -87,6 +87,9 @@ tools:hog-flows-rerun-create:operation: hog_flows_rerun_createenabled: false+ hog-flows-resume-email-sending:+ operation: hog_flows_resume_email_sending+ enabled: falsehog-flows-revisions-list:operation: hog_flows_revisions_listenabled: falsediff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 583743311813..4cfc7f8e82f0 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -44091,6 +44091,22 @@ export namespace Schemas {* @nullable*/readonly action_redirects: HogFlowActionRedirects;+ /**+ * When PostHog paused this workflow's email automatically because its spam complaint or hard bounce rate crossed a threshold. Null when sending is not paused. Read-only: only the resume_email_sending endpoint clears a pause, so a normal update or publish can't lift it.+ * @nullable+ */+ readonly email_sending_paused_at: string | null;+ /** Plain-language reason for the pause, naming the signal and the window. Empty when not paused. */+ readonly email_sending_paused_reason: string;+ /** Who paused it: "auto" for the deliverability detector, "staff" for PostHog staff. A staff pause can only be resumed by staff, so the resume endpoint refuses it. Empty when not paused. */+ readonly email_sending_paused_by: string;+ /** True when only PostHog staff can lift the current pause: staff placed it, or it landed shortly after a resume, so another self-serve resume is not offered. False when not paused or when the resume endpoint would accept the caller. */+ readonly email_sending_pause_requires_support: boolean;+ /**+ * When sending was last resumed. Every detector window starts after this, so resuming does not immediately re-trip on the feedback that caused the pause. Null if never paused.+ * @nullable+ */+ readonly email_sending_resumed_at: string | null;}/**@@ -44541,6 +44557,22 @@ export namespace Schemas {* @nullable*/readonly action_redirects: HogFlowUpdateActionRedirects;+ /**+ * When PostHog paused this workflow's email automatically because its spam complaint or hard bounce rate crossed a threshold. Null when sending is not paused. Read-only: only the resume_email_sending endpoint clears a pause, so a normal update or publish can't lift it.+ * @nullable+ */+ readonly email_sending_paused_at: string | null;+ /** Plain-language reason for the pause, naming the signal and the window. Empty when not paused. */+ readonly email_sending_paused_reason: string;+ /** Who paused it: "auto" for the deliverability detector, "staff" for PostHog staff. A staff pause can only be resumed by staff, so the resume endpoint refuses it. Empty when not paused. */+ readonly email_sending_paused_by: string;+ /** True when only PostHog staff can lift the current pause: staff placed it, or it landed shortly after a resume, so another self-serve resume is not offered. False when not paused or when the resume endpoint would accept the caller. */+ readonly email_sending_pause_requires_support: boolean;+ /**+ * When sending was last resumed. Every detector window starts after this, so resuming does not immediately re-trip on the feedback that caused the pause. Null if never paused.+ * @nullable+ */+ readonly email_sending_resumed_at: string | null;}/**@@ -66271,6 +66303,22 @@ export namespace Schemas {* @nullable*/readonly action_redirects?: PatchedHogFlowUpdateActionRedirects;+ /**+ * When PostHog paused this workflow's email automatically because its spam complaint or hard bounce rate crossed a threshold. Null when sending is not paused. Read-only: only the resume_email_sending endpoint clears a pause, so a normal update or publish can't lift it.+ * @nullable+ */+ readonly email_sending_paused_at?: string | null;+ /** Plain-language reason for the pause, naming the signal and the window. Empty when not paused. */+ readonly email_sending_paused_reason?: string;+ /** Who paused it: "auto" for the deliverability detector, "staff" for PostHog staff. A staff pause can only be resumed by staff, so the resume endpoint refuses it. Empty when not paused. */+ readonly email_sending_paused_by?: string;+ /** True when only PostHog staff can lift the current pause: staff placed it, or it landed shortly after a resume, so another self-serve resume is not offered. False when not paused or when the resume endpoint would accept the caller. */+ readonly email_sending_pause_requires_support?: boolean;+ /**+ * When sending was last resumed. Every detector window starts after this, so resuming does not immediately re-trip on the feedback that caused the pause. Null if never paused.+ * @nullable+ */+ readonly email_sending_resumed_at?: string | null;}/**@@ -89204,6 +89252,15 @@ export namespace Schemas {readonly hog_flow_id: string;/** Display name of the workflow; empty for unnamed workflows. */readonly hog_flow_name: string;+ /** True when PostHog paused this workflow's email automatically because its complaint or hard bounce rate crossed a threshold. Independent of the AWS tenant verdict and of the project-wide suspension. */+ readonly email_sending_paused: boolean;+ /**+ * When the pause started; null when not paused.+ * @nullable+ */+ readonly email_sending_paused_at: string | null;+ /** Plain-language reason for the pause, naming the signal and the window. Empty when not paused. */+ readonly email_sending_paused_reason: string;}export interface TeamEmailReputationResponse {@@ -91227,6 +91284,26 @@ export namespace Schemas {PullRequest: 'pull_request',} as const;+ /**+ * Whether PostHog paused this one workflow's email sending, and why.+ */+ export interface WorkflowEmailPauseStatus {+ /** True while this workflow's email is paused because its spam complaint or hard bounce rate crossed a threshold. Other workflows in the project keep sending. */+ readonly email_sending_paused: boolean;+ /**+ * When the pause started; null when not paused.+ * @nullable+ */+ readonly email_sending_paused_at: string | null;+ /** Plain-language reason for the pause, naming the signal and the window. Empty when not paused. */+ readonly email_sending_paused_reason: string;+ /**+ * When sending was last resumed. Detector windows start after this, so resuming does not immediately re-trip on older feedback. Null if never paused.+ * @nullable+ */+ readonly email_sending_resumed_at: string | null;+ }+export interface WorkflowHealthBucket {/** Bucket start, aligned to the item's granularity (top of hour, midnight, or Monday). */bucket_start: string;