: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): harden against behavioural-cohort/frequency targeting via MCP (#62368)
Harley Alexander39a29d3bbd5c
diff --git a/products/workflows/backend/api/hog_flow.py b/products/workflows/backend/api/hog_flow.pyindex 0befc8ff53cd..670b94e2224d 100644--- a/products/workflows/backend/api/hog_flow.py+++ b/products/workflows/backend/api/hog_flow.py@@ -69,6 +69,19 @@ logger = structlog.get_logger(__name__)DELAY_DURATION_REGEX = re.compile(r"^\d*\.?\d+[dhm]$")+def _should_validate_strictly(context: dict, is_draft: Optional[bool]) -> bool:+ # Non-draft saves always validate fully. Drafts stay lenient for the web UI builder (which saves+ # incomplete graphs mid-edit) and for internal re-saves (e.g. the refresh management command), which+ # only re-persist already-accepted data. Programmatic authoring clients (MCP, posthog-code, raw API)+ # validate drafts fully too, so an unsupported config is rejected at create rather than silently stored+ # and surfacing only at enable. The viewset sets event_source; absent it (internal/no request), drafts+ # stay lenient.+ if not is_draft:+ return True+ source = context.get("event_source")+ return source is not None and source != EventSource.WEB++def _event_config_has_event_or_action(event_config: dict) -> bool:# An "events to wait for" / conversion entry that targets neither events nor actions compiles to# always-true bytecode and would fire on every incoming event. Action-based entries (events empty,@@ -188,15 +201,6 @@ class HogFlowActionSerializer(serializers.Serializer):self.initial_data = datareturn super().to_internal_value(data)- def _should_enforce_audience_guard(self, is_draft) -> bool:- # Non-draft saves always validate. Drafts stay lenient only for the web UI builder (users save- # incomplete graphs while building); programmatic callers (MCP, posthog-code, API) send complete- # graphs, so enforce even on their drafts and fail fast at create time.- if not is_draft:- return True- request = self.context.get("request")- return request is None or get_event_source(request) != EventSource.WEB-def _reject_behavioral_cohorts_in_audience(self, properties) -> None:# Batch/schedule audiences resolve offline by precalculated membership and can't evaluate event# behavior the way it's intended; the UI hides behavioral cohorts from the audience picker. Mirror@@ -230,6 +234,10 @@ class HogFlowActionSerializer(serializers.Serializer):def validate(self, data):is_draft = self.context.get("is_draft")+ # Drafts from the web builder stay lenient (incomplete graphs save fine); programmatic callers+ # (MCP/API) get full validation even on drafts so a broken or unsupported config fails at create+ # time rather than being silently stored and surfacing only at enable.+ strict = _should_validate_strictly(self.context, is_draft)trigger_is_function = Falseif data.get("type") == "trigger":@@ -242,7 +250,7 @@ class HogFlowActionSerializer(serializers.Serializer):filters["filter_test_accounts"] = data["config"].pop("filter_test_accounts")if filters:serializer = HogFunctionFiltersSerializer(data=filters, context=self.context)- if is_draft:+ if not strict:if serializer.is_valid():data["config"]["filters"] = serializer.validated_dataelse:@@ -250,7 +258,7 @@ class HogFlowActionSerializer(serializers.Serializer):data["config"]["filters"] = serializer.validated_dataelif data.get("config", {}).get("type") == "batch":filters = data.get("config", {}).get("filters", {})- if not is_draft:+ if strict:if not filters:raise serializers.ValidationError({"filters": "Filters are required for batch triggers."})if not isinstance(filters, dict):@@ -258,11 +266,10 @@ class HogFlowActionSerializer(serializers.Serializer):properties = filters.get("properties", None)if properties is not None and not isinstance(properties, list):raise serializers.ValidationError({"filters": {"properties": "Properties must be an array."}})- if self._should_enforce_audience_guard(is_draft) and isinstance(filters, dict):+ if strict and isinstance(filters, dict):# The audience targets who a person is (properties / cohort membership), not what they did.# Event/action filters are silently dropped by the person-based blast radius (resolving to- # "everyone"), so reject them outright — same rejection as a behavioral cohort below, and- # enforced together so MCP/API drafts can't slip an event-behavior audience through.+ # "everyone"), so reject them outright — same rejection as a behavioral cohort below.if filters.get("events") or filters.get("actions"):raise serializers.ValidationError({@@ -277,19 +284,19 @@ class HogFlowActionSerializer(serializers.Serializer):elif data.get("config", {}).get("type") == "schedule":# The schedule definition lives on a separate HogFlowSchedule row, but a schedule trigger# resolves the same offline audience as batch — guard its cohort refs the same way.- if self._should_enforce_audience_guard(is_draft):+ if strict:filters = data.get("config", {}).get("filters", {})if isinstance(filters, dict):self._reject_behavioral_cohorts_in_audience(filters.get("properties"))else:- if not is_draft:+ if strict:raise serializers.ValidationError({"config": "Invalid trigger type"})if "function" in data.get("type", "") or trigger_is_function:template_id = data.get("config", {}).get("template_id", "")template = HogFunctionTemplate.get_template(template_id)if not template:- if not is_draft:+ if strict:raise serializers.ValidationError({"template_id": "Template not found"})else:input_schema = template.inputs_schema@@ -303,7 +310,7 @@ class HogFlowActionSerializer(serializers.Serializer):context={"function_type": template.type},)- if is_draft:+ if not strict:if function_config_serializer.is_valid():data["config"]["inputs"] = function_config_serializer.validated_data["inputs"]else:@@ -314,7 +321,7 @@ class HogFlowActionSerializer(serializers.Serializer):single_condition = data.get("config", {}).get("condition", None)if conditions and single_condition:- if not is_draft:+ if strict:raise serializers.ValidationError({"config": "Cannot specify both 'conditions' and 'condition' fields"})if single_condition:conditions = [single_condition]@@ -324,11 +331,11 @@ class HogFlowActionSerializer(serializers.Serializer):filters = condition.get("filters")if filters is not None:if "events" in filters:- if not is_draft:+ if strict:raise serializers.ValidationError("Event filters are not allowed in conditionals")else:serializer = HogFunctionFiltersSerializer(data=filters, context=self.context)- if is_draft:+ if not strict:if serializer.is_valid():condition["filters"] = serializer.validated_dataelse:@@ -348,7 +355,7 @@ class HogFlowActionSerializer(serializers.Serializer):filters = event_config.get("filters")if filters is not None:serializer = HogFunctionFiltersSerializer(data=filters, context=self.context)- if is_draft:+ if not strict:if serializer.is_valid():event_config["filters"] = serializer.validated_dataelse:@@ -358,7 +365,7 @@ class HogFlowActionSerializer(serializers.Serializer):if data.get("type") == "delay":delay_duration = data.get("config", {}).get("delay_duration")if not isinstance(delay_duration, str) or not DELAY_DURATION_REGEX.match(delay_duration):- if not is_draft:+ if strict:raise serializers.ValidationError({"config": (@@ -400,12 +407,17 @@ class HogFlowMaskingSerializer(serializers.Serializer):min_value=60,max_value=60 * 60 * 24 * 365 * 3,allow_null=True,- help_text="Hash TTL in seconds (60 to ~94M / 3y).",+ help_text="Seconds (60 to ~94M / 3y) to suppress repeat firings of the same hash.",)threshold = serializers.IntegerField(- required=False, allow_null=True, help_text="Min matching events before triggering (k-anonymity)."+ required=False,+ allow_null=True,+ help_text="Fire once per N matches of the same hash within ttl — a sampler: N=3 fires on the 1st, 4th, 7th… match. Omit to fire on the first match, then suppress repeats within ttl.",+ )+ hash = serializers.CharField(+ required=True,+ help_text="HogQL template defining the dedup/grouping key, e.g. '{person.id}' (once per person) within ttl.",)- hash = serializers.CharField(required=True, help_text="HogQL template, e.g. '{person.properties.email}'.")bytecode = serializers.JSONField(required=False, allow_null=True, help_text="Auto-compiled from hash. Do not set.")def validate(self, attrs):@@ -525,8 +537,12 @@ class HogFlowSerializer(HogFlowMinimalSerializer):required=False,allow_null=True,help_text=(- "Optional dedup: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. "- "Server compiles bytecode from hash. Omit to disable."+ "Optional dedup/throttle on an already-matched trigger: {hash: <HogQL template>, "+ "ttl: <seconds, 60-94608000>, threshold?: <int>}. Without threshold: fire once per hash, then "+ "suppress repeats within ttl (hash '{person.id}' = once per person per ttl). With threshold N: fire "+ "once per N matches of the same hash — a sampler, the 1st then every Nth. Throttles an "+ "already-qualifying trigger; it doesn't decide who enters. Server compiles bytecode from hash; "+ "omit to disable."),)conversion = serializers.JSONField(@@ -642,6 +658,11 @@ class HogFlowSerializer(HogFlowMinimalSerializer):)data["billable_action_types"] = billable_action_types+ # Web-builder drafts stay lenient; programmatic (MCP/API) callers get full validation even on+ # drafts — same posture as HogFlowActionSerializer, so a conversion filter that can't compile+ # (e.g. a cohort reference) fails at create rather than being silently stored.+ strict = _should_validate_strictly(self.context, self.context.get("is_draft"))+conversion = data.get("conversion")if conversion is not None:filters = conversion.get("filters")@@ -657,7 +678,7 @@ class HogFlowSerializer(HogFlowMinimalSerializer):filters = []if filters:serializer = HogFunctionFiltersSerializer(data={"properties": filters}, context=self.context)- if self.context.get("is_draft"):+ if not strict:if serializer.is_valid():compiled_filters = serializer.validated_datadata["conversion"]["filters"] = compiled_filters.get("properties", [])@@ -680,7 +701,7 @@ class HogFlowSerializer(HogFlowMinimalSerializer):event_filters = event_config.get("filters")if event_filters is not None:event_serializer = HogFunctionFiltersSerializer(data=event_filters, context=self.context)- if self.context.get("is_draft"):+ if not strict:if event_serializer.is_valid():event_config["filters"] = event_serializer.validated_dataelif isinstance(event_filters, dict):@@ -799,6 +820,15 @@ class HogFlowViewSet(TeamAndOrgViewSetMixin, LogEntryMixin, AppMetricsMixin, viedef get_serializer_class(self) -> type[BaseSerializer]:return HogFlowMinimalSerializer if self.action == "list" else HogFlowSerializer+ def get_serializer_context(self) -> dict:+ # Drives draft strictness in the serializers: web-builder drafts stay lenient, programmatic+ # (MCP/API) drafts validate fully. Set here so the decision is tied to the request entry point,+ # not inferred deep in the serializer (which would also catch internal re-saves like the refresh+ # command). See _should_validate_strictly.+ context = super().get_serializer_context()+ context["event_source"] = get_event_source(self.request)+ return context+def safely_get_queryset(self, queryset: QuerySet) -> QuerySet:if self.action == "list":queryset = queryset.order_by("-updated_at")diff --git a/products/workflows/backend/api/test/test_hog_flow.py b/products/workflows/backend/api/test/test_hog_flow.pyindex 77b2c60c2e01..3983230e4a1f 100644--- a/products/workflows/backend/api/test/test_hog_flow.py+++ b/products/workflows/backend/api/test/test_hog_flow.py@@ -9,6 +9,7 @@ from rest_framework import statusfrom posthog.cdp.templates.hog_function_template import sync_template_to_dbfrom posthog.cdp.templates.slack.template_slack import template as template_slack+from posthog.event_usage import EventSourcefrom posthog.models import Organization, Team, Userfrom posthog.models.personal_api_key import PersonalAPIKeyfrom posthog.models.utils import generate_random_token_personal, hash_key_value@@ -17,6 +18,7 @@ from posthog.test.fixtures import create_app_metric2from products.actions.backend.models.action import Actionfrom products.cdp.backend.api.test.test_hog_function_templates import MOCK_NODE_TEMPLATESfrom products.cohorts.backend.models.cohort import Cohort+from products.workflows.backend.api.hog_flow import _should_validate_strictlyfrom products.workflows.backend.models.hog_flow.hog_flow import HogFlowwebhook_template = MOCK_NODE_TEMPLATES[0]@@ -1317,6 +1319,52 @@ class TestHogFlowAPI(APIBaseTest):response = self._post_batch_with_cohort(cohort.pk, status="draft")assert response.status_code == 201, response.json()+ def _post_event_trigger_with_cohort(self, cohort_id: int, *, status: str = "draft", **extra):+ trigger_action = {+ "id": "trigger_node",+ "name": "trigger_1",+ "type": "trigger",+ "config": {+ "type": "event",+ "filters": {+ "events": [{"id": "$pageview", "name": "$pageview", "type": "events", "order": 0}],+ "properties": [{"key": "id", "type": "cohort", "value": cohort_id, "operator": "in"}],+ },+ },+ }+ hog_flow = {"name": "Test Event Flow", "status": status, "actions": [trigger_action]}+ return self.client.post(f"/api/projects/{self.team.id}/hog_flows", hog_flow, **extra)++ def test_hog_flow_event_trigger_cohort_filter_rejected_for_mcp_draft(self):+ # Cohorts can't be evaluated in real-time event filters. Generalized strict validation rejects this+ # at create for programmatic callers, instead of silently storing a filter that won't compile and+ # only surfacing the failure at enable (which reads to the caller as a successful create).+ cohort = self._make_cohort(behavioral=True)+ response = self._post_event_trigger_with_cohort(cohort.pk, HTTP_X_POSTHOG_CLIENT="mcp")+ assert response.status_code == 400, response.json()+ assert "cohort" in str(response.json()).lower()++ def test_hog_flow_event_trigger_cohort_filter_allowed_for_web_draft(self):+ # Web builder drafts stay lenient so incomplete graphs can be saved mid-edit.+ cohort = self._make_cohort(behavioral=True)+ response = self._post_event_trigger_with_cohort(cohort.pk)+ assert response.status_code == 201, response.json()++ @parameterized.expand(+ [+ # (name, is_draft, event_source, expected_strict)+ ("active_no_source", False, None, True),+ ("active_web", False, EventSource.WEB, True),+ ("draft_no_source", True, None, False), # internal re-saves (e.g. refresh command) stay lenient+ ("draft_web", True, EventSource.WEB, False),+ ("draft_mcp", True, EventSource.MCP, True),+ ("draft_api", True, EventSource.API, True),+ ]+ )+ def test_should_validate_strictly(self, _name, is_draft, event_source, expected_strict):+ context = {} if event_source is None else {"event_source": event_source}+ assert _should_validate_strictly(context, is_draft) is expected_strict+def test_hog_flow_user_blast_radius_requires_filters(self):with patch("products.workflows.backend.api.hog_flow.get_user_blast_radius") as mock_get_user_blast_radius:response = self.client.post(f"/api/projects/{self.team.id}/hog_flows/user_blast_radius", {})diff --git a/products/workflows/frontend/generated/api.schemas.ts b/products/workflows/frontend/generated/api.schemas.tsindex 5dc036d3db79..b4c46e5fe80a 100644--- a/products/workflows/frontend/generated/api.schemas.ts+++ b/products/workflows/frontend/generated/api.schemas.ts@@ -22,18 +22,18 @@ export const HogFlowTemplateScopeEnumApi = {export interface HogFlowMaskingApi {/**- * Hash TTL in seconds (60 to ~94M / 3y).+ * Seconds (60 to ~94M / 3y) to suppress repeat firings of the same hash.* @minimum 60* @maximum 94608000* @nullable*/ttl?: number | null/**- * Min matching events before triggering (k-anonymity).+ * Fire once per N matches of the same hash within ttl — a sampler: N=3 fires on the 1st, 4th, 7th… match. Omit to fire on the first match, then suppress repeats within ttl.* @nullable*/threshold?: number | null- /** HogQL template, e.g. '{person.properties.email}'. */+ /** HogQL template defining the dedup/grouping key, e.g. '{person.id}' (once per person) within ttl. */hash: string/** Auto-compiled from hash. Do not set. */bytecode?: unknown@@ -445,7 +445,7 @@ export interface HogFlowApi {readonly created_by: UserBasicApireadonly updated_at: stringreadonly trigger: unknown- /** Optional dedup: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Server compiles bytecode from hash. Omit to disable. */+ /** Optional dedup/throttle on an already-matched trigger: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Without threshold: fire once per hash, then suppress repeats within ttl (hash '{person.id}' = once per person per ttl). With threshold N: fire once per N matches of the same hash — a sampler, the 1st then every Nth. Throttles an already-qualifying trigger; it doesn't decide who enters. Server compiles bytecode from hash; omit to disable. */trigger_masking?: HogFlowMaskingApi | null/** Conversion goal: {filters: [<cond>, ...], window_minutes}. <cond>: {key, value, operator, type: event|person|group}. Empty filters = any event in window. Required for exit_on_conversion / exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side. */conversion?: unknown@@ -495,7 +495,7 @@ export interface PatchedHogFlowApi {readonly created_by?: UserBasicApireadonly updated_at?: stringreadonly trigger?: unknown- /** Optional dedup: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Server compiles bytecode from hash. Omit to disable. */+ /** Optional dedup/throttle on an already-matched trigger: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Without threshold: fire once per hash, then suppress repeats within ttl (hash '{person.id}' = once per person per ttl). With threshold N: fire once per N matches of the same hash — a sampler, the 1st then every Nth. Throttles an already-qualifying trigger; it doesn't decide who enters. Server compiles bytecode from hash; omit to disable. */trigger_masking?: HogFlowMaskingApi | null/** Conversion goal: {filters: [<cond>, ...], window_minutes}. <cond>: {key, value, operator, type: event|person|group}. Empty filters = any event in window. Required for exit_on_conversion / exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side. */conversion?: unknowndiff --git a/products/workflows/frontend/generated/api.zod.ts b/products/workflows/frontend/generated/api.zod.tsindex 10ab9fd350c6..8ae7dde01cd4 100644--- a/products/workflows/frontend/generated/api.zod.ts+++ b/products/workflows/frontend/generated/api.zod.ts@@ -42,9 +42,18 @@ export const HogFlowTemplatesCreateBody = /* @__PURE__ */ zod.min(hogFlowTemplatesCreateBodyTriggerMaskingOneTtlMin).max(hogFlowTemplatesCreateBodyTriggerMaskingOneTtlMax).nullish()- .describe('Hash TTL in seconds (60 to ~94M \/ 3y).'),- threshold: zod.number().nullish().describe('Min matching events before triggering (k-anonymity).'),- hash: zod.string().describe("HogQL template, e.g. '{person.properties.email}'."),+ .describe('Seconds (60 to ~94M \/ 3y) to suppress repeat firings of the same hash.'),+ threshold: zod+ .number()+ .nullish()+ .describe(+ 'Fire once per N matches of the same hash within ttl — a sampler: N=3 fires on the 1st, 4th, 7th… match. Omit to fire on the first match, then suppress repeats within ttl.'+ ),+ hash: zod+ .string()+ .describe(+ "HogQL template defining the dedup\/grouping key, e.g. '{person.id}' (once per person) within ttl."+ ),bytecode: zod.unknown().optional().describe('Auto-compiled from hash. Do not set.'),}),zod.null(),@@ -156,9 +165,18 @@ export const HogFlowTemplatesUpdateBody = /* @__PURE__ */ zod.min(hogFlowTemplatesUpdateBodyTriggerMaskingOneTtlMin).max(hogFlowTemplatesUpdateBodyTriggerMaskingOneTtlMax).nullish()- .describe('Hash TTL in seconds (60 to ~94M \/ 3y).'),- threshold: zod.number().nullish().describe('Min matching events before triggering (k-anonymity).'),- hash: zod.string().describe("HogQL template, e.g. '{person.properties.email}'."),+ .describe('Seconds (60 to ~94M \/ 3y) to suppress repeat firings of the same hash.'),+ threshold: zod+ .number()+ .nullish()+ .describe(+ 'Fire once per N matches of the same hash within ttl — a sampler: N=3 fires on the 1st, 4th, 7th… match. Omit to fire on the first match, then suppress repeats within ttl.'+ ),+ hash: zod+ .string()+ .describe(+ "HogQL template defining the dedup\/grouping key, e.g. '{person.id}' (once per person) within ttl."+ ),bytecode: zod.unknown().optional().describe('Auto-compiled from hash. Do not set.'),}),zod.null(),@@ -271,9 +289,18 @@ export const HogFlowTemplatesPartialUpdateBody = /* @__PURE__ */ zod.min(hogFlowTemplatesPartialUpdateBodyTriggerMaskingOneTtlMin).max(hogFlowTemplatesPartialUpdateBodyTriggerMaskingOneTtlMax).nullish()- .describe('Hash TTL in seconds (60 to ~94M \/ 3y).'),- threshold: zod.number().nullish().describe('Min matching events before triggering (k-anonymity).'),- hash: zod.string().describe("HogQL template, e.g. '{person.properties.email}'."),+ .describe('Seconds (60 to ~94M \/ 3y) to suppress repeat firings of the same hash.'),+ threshold: zod+ .number()+ .nullish()+ .describe(+ 'Fire once per N matches of the same hash within ttl — a sampler: N=3 fires on the 1st, 4th, 7th… match. Omit to fire on the first match, then suppress repeats within ttl.'+ ),+ hash: zod+ .string()+ .describe(+ "HogQL template defining the dedup\/grouping key, e.g. '{person.id}' (once per person) within ttl."+ ),bytecode: zod.unknown().optional().describe('Auto-compiled from hash. Do not set.'),}),zod.null(),@@ -386,16 +413,25 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod.object({.min(hogFlowsCreateBodyTriggerMaskingOneTtlMin).max(hogFlowsCreateBodyTriggerMaskingOneTtlMax).nullish()- .describe('Hash TTL in seconds (60 to ~94M \/ 3y).'),- threshold: zod.number().nullish().describe('Min matching events before triggering (k-anonymity).'),- hash: zod.string().describe("HogQL template, e.g. '{person.properties.email}'."),+ .describe('Seconds (60 to ~94M \/ 3y) to suppress repeat firings of the same hash.'),+ threshold: zod+ .number()+ .nullish()+ .describe(+ 'Fire once per N matches of the same hash within ttl — a sampler: N=3 fires on the 1st, 4th, 7th… match. Omit to fire on the first match, then suppress repeats within ttl.'+ ),+ hash: zod+ .string()+ .describe(+ "HogQL template defining the dedup\/grouping key, e.g. '{person.id}' (once per person) within ttl."+ ),bytecode: zod.unknown().optional().describe('Auto-compiled from hash. Do not set.'),}),zod.null(),]).optional().describe(- 'Optional dedup: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Server compiles bytecode from hash. Omit to disable.'+ "Optional dedup\/throttle on an already-matched trigger: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Without threshold: fire once per hash, then suppress repeats within ttl (hash '{person.id}' = once per person per ttl). With threshold N: fire once per N matches of the same hash — a sampler, the 1st then every Nth. Throttles an already-qualifying trigger; it doesn't decide who enters. Server compiles bytecode from hash; omit to disable."),conversion: zod.unknown()@@ -542,16 +578,25 @@ export const HogFlowsUpdateBody = /* @__PURE__ */ zod.object({.min(hogFlowsUpdateBodyTriggerMaskingOneTtlMin).max(hogFlowsUpdateBodyTriggerMaskingOneTtlMax).nullish()- .describe('Hash TTL in seconds (60 to ~94M \/ 3y).'),- threshold: zod.number().nullish().describe('Min matching events before triggering (k-anonymity).'),- hash: zod.string().describe("HogQL template, e.g. '{person.properties.email}'."),+ .describe('Seconds (60 to ~94M \/ 3y) to suppress repeat firings of the same hash.'),+ threshold: zod+ .number()+ .nullish()+ .describe(+ 'Fire once per N matches of the same hash within ttl — a sampler: N=3 fires on the 1st, 4th, 7th… match. Omit to fire on the first match, then suppress repeats within ttl.'+ ),+ hash: zod+ .string()+ .describe(+ "HogQL template defining the dedup\/grouping key, e.g. '{person.id}' (once per person) within ttl."+ ),bytecode: zod.unknown().optional().describe('Auto-compiled from hash. Do not set.'),}),zod.null(),]).optional().describe(- 'Optional dedup: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Server compiles bytecode from hash. Omit to disable.'+ "Optional dedup\/throttle on an already-matched trigger: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Without threshold: fire once per hash, then suppress repeats within ttl (hash '{person.id}' = once per person per ttl). With threshold N: fire once per N matches of the same hash — a sampler, the 1st then every Nth. Throttles an already-qualifying trigger; it doesn't decide who enters. Server compiles bytecode from hash; omit to disable."),conversion: zod.unknown()@@ -698,16 +743,25 @@ export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zod.object({.min(hogFlowsPartialUpdateBodyTriggerMaskingOneTtlMin).max(hogFlowsPartialUpdateBodyTriggerMaskingOneTtlMax).nullish()- .describe('Hash TTL in seconds (60 to ~94M \/ 3y).'),- threshold: zod.number().nullish().describe('Min matching events before triggering (k-anonymity).'),- hash: zod.string().describe("HogQL template, e.g. '{person.properties.email}'."),+ .describe('Seconds (60 to ~94M \/ 3y) to suppress repeat firings of the same hash.'),+ threshold: zod+ .number()+ .nullish()+ .describe(+ 'Fire once per N matches of the same hash within ttl — a sampler: N=3 fires on the 1st, 4th, 7th… match. Omit to fire on the first match, then suppress repeats within ttl.'+ ),+ hash: zod+ .string()+ .describe(+ "HogQL template defining the dedup\/grouping key, e.g. '{person.id}' (once per person) within ttl."+ ),bytecode: zod.unknown().optional().describe('Auto-compiled from hash. Do not set.'),}),zod.null(),]).optional().describe(- 'Optional dedup: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Server compiles bytecode from hash. Omit to disable.'+ "Optional dedup\/throttle on an already-matched trigger: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Without threshold: fire once per hash, then suppress repeats within ttl (hash '{person.id}' = once per person per ttl). With threshold N: fire once per N matches of the same hash — a sampler, the 1st then every Nth. Throttles an already-qualifying trigger; it doesn't decide who enters. Server compiles bytecode from hash; omit to disable."),conversion: zod.unknown()@@ -938,19 +992,25 @@ export const HogFlowsInvocationsCreateBody = /* @__PURE__ */ zod.object({.min(hogFlowsInvocationsCreateBodyConfigurationOneTriggerMaskingOneTtlMin).max(hogFlowsInvocationsCreateBodyConfigurationOneTriggerMaskingOneTtlMax).nullish()- .describe('Hash TTL in seconds (60 to ~94M \/ 3y).'),+ .describe('Seconds (60 to ~94M \/ 3y) to suppress repeat firings of the same hash.'),threshold: zod.number().nullish()- .describe('Min matching events before triggering (k-anonymity).'),- hash: zod.string().describe("HogQL template, e.g. '{person.properties.email}'."),+ .describe(+ 'Fire once per N matches of the same hash within ttl — a sampler: N=3 fires on the 1st, 4th, 7th… match. Omit to fire on the first match, then suppress repeats within ttl.'+ ),+ hash: zod+ .string()+ .describe(+ "HogQL template defining the dedup\/grouping key, e.g. '{person.id}' (once per person) within ttl."+ ),bytecode: zod.unknown().optional().describe('Auto-compiled from hash. Do not set.'),}),zod.null(),]).optional().describe(- 'Optional dedup: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Server compiles bytecode from hash. Omit to disable.'+ "Optional dedup\/throttle on an already-matched trigger: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Without threshold: fire once per hash, then suppress repeats within ttl (hash '{person.id}' = once per person per ttl). With threshold N: fire once per N matches of the same hash — a sampler, the 1st then every Nth. Throttles an already-qualifying trigger; it doesn't decide who enters. Server compiles bytecode from hash; omit to disable."),conversion: zod.unknown()@@ -1197,16 +1257,25 @@ export const HogFlowsBulkDeleteCreateBody = /* @__PURE__ */ zod.object({.min(hogFlowsBulkDeleteCreateBodyTriggerMaskingOneTtlMin).max(hogFlowsBulkDeleteCreateBodyTriggerMaskingOneTtlMax).nullish()- .describe('Hash TTL in seconds (60 to ~94M \/ 3y).'),- threshold: zod.number().nullish().describe('Min matching events before triggering (k-anonymity).'),- hash: zod.string().describe("HogQL template, e.g. '{person.properties.email}'."),+ .describe('Seconds (60 to ~94M \/ 3y) to suppress repeat firings of the same hash.'),+ threshold: zod+ .number()+ .nullish()+ .describe(+ 'Fire once per N matches of the same hash within ttl — a sampler: N=3 fires on the 1st, 4th, 7th… match. Omit to fire on the first match, then suppress repeats within ttl.'+ ),+ hash: zod+ .string()+ .describe(+ "HogQL template defining the dedup\/grouping key, e.g. '{person.id}' (once per person) within ttl."+ ),bytecode: zod.unknown().optional().describe('Auto-compiled from hash. Do not set.'),}),zod.null(),]).optional().describe(- 'Optional dedup: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Server compiles bytecode from hash. Omit to disable.'+ "Optional dedup\/throttle on an already-matched trigger: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Without threshold: fire once per hash, then suppress repeats within ttl (hash '{person.id}' = once per person per ttl). With threshold N: fire once per N matches of the same hash — a sampler, the 1st then every Nth. Throttles an already-qualifying trigger; it doesn't decide who enters. Server compiles bytecode from hash; omit to disable."),conversion: zod.unknown()diff --git a/products/workflows/mcp/tools.yaml b/products/workflows/mcp/tools.yamlindex c1a8d60d202f..9cb26da8e8a8 100644--- a/products/workflows/mcp/tools.yaml+++ b/products/workflows/mcp/tools.yaml@@ -101,9 +101,12 @@ tools:config.filters.properties: person-property conditions ({type:'person',key,value,operator}) and/or cohortreferences ({type:'cohort',key:'id',value:<id>,operator:'in'}). Prefer inline person-property conditions ora dynamic (filter-based) cohort via cohorts-create — these re-evaluate as people qualify; a static cohort is- a frozen list, use only when given an explicit set. Behavioral (event-based) cohorts are rejected — for 'did- event X', use an 'event' trigger instead. A batch workflow fires only once enabled and a recurring schedule- is attached (workflows-schedule-create).+ a frozen list, use only when given an explicit set. An event trigger fires on every occurrence matching the+ event and the trigger's filters; throttle repeat firings with trigger_masking (dedup/sampling — not+ behavioral filtering). Behavioral cohorts/targeting ('did event X at least N times over the last M days')+ are unsupported — if the user requests one, reject it and explain why. A batch workflow doesn't fire on+ enable alone: dispatch it with workflows-run-batch (one-off) or attach a recurring schedule with+ workflows-schedule-create.ui_app: workflowworkflows-get:operation: hog_flows_retrieve@@ -263,7 +266,10 @@ tools:already-scheduled runs); create a new draft for changes instead. Status changes go through workflows-enable/ workflows-archive. A batch audience is config.filters.properties — person-property conditions and/orcohort references. Prefer person properties or a dynamic (filter-based) cohort, which re-evaluate, over a- static frozen-list cohort; behavioral (event-based) cohorts are rejected.+ static frozen-list cohort. An event trigger fires on every occurrence matching the event and the trigger's+ filters; throttle repeat firings with trigger_masking (dedup/sampling — not behavioral filtering).+ Behavioral cohorts/targeting ('did event X at least N times over the last M days') are unsupported — if the+ user requests one, reject it and explain why.exclude_params:- statusui_app: workflowdiff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex cb27f90765d9..4fe63b6cff65 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -6513,7 +6513,7 @@}},"workflows-create": {- "description": "Create a workflow. Needs an actions array with exactly one type='trigger' (config.type: event|webhook|manual|batch|tracking_pixel) plus action nodes — function/function_email/function_sms/function_push, delay (e.g. '30m'), conditional_branch, wait_until_condition — connected by edges. Created as a draft; activate with workflows-enable. 'batch' = broadcast to an audience, one run per matching person (emails/messages). The audience is config.filters.properties: person-property conditions ({type:'person',key,value,operator}) and/or cohort references ({type:'cohort',key:'id',value:<id>,operator:'in'}). Prefer inline person-property conditions or a dynamic (filter-based) cohort via cohorts-create — these re-evaluate as people qualify; a static cohort is a frozen list, use only when given an explicit set. Behavioral (event-based) cohorts are rejected — for 'did event X', use an 'event' trigger instead. A batch workflow fires only once enabled and a recurring schedule is attached (workflows-schedule-create).",+ "description": "Create a workflow. Needs an actions array with exactly one type='trigger' (config.type: event|webhook|manual|batch|tracking_pixel) plus action nodes — function/function_email/function_sms/function_push, delay (e.g. '30m'), conditional_branch, wait_until_condition — connected by edges. Created as a draft; activate with workflows-enable. 'batch' = broadcast to an audience, one run per matching person (emails/messages). The audience is config.filters.properties: person-property conditions ({type:'person',key,value,operator}) and/or cohort references ({type:'cohort',key:'id',value:<id>,operator:'in'}). Prefer inline person-property conditions or a dynamic (filter-based) cohort via cohorts-create — these re-evaluate as people qualify; a static cohort is a frozen list, use only when given an explicit set. An event trigger fires on every occurrence matching the event and the trigger's filters; throttle repeat firings with trigger_masking (dedup/sampling — not behavioral filtering). Behavioral cohorts/targeting ('did event X at least N times over the last M days') are unsupported — if the user requests one, reject it and explain why. A batch workflow doesn't fire on enable alone: dispatch it with workflows-run-batch (one-off) or attach a recurring schedule with workflows-schedule-create.","category": "Workflows","feature": "workflows","summary": "Create workflow",@@ -6653,7 +6653,7 @@}},"workflows-update": {- "description": "Update a workflow by ID. Draft only — active workflows are read-only via MCP for now (editing risks breaking already-scheduled runs); create a new draft for changes instead. Status changes go through workflows-enable / workflows-archive. A batch audience is config.filters.properties — person-property conditions and/or cohort references. Prefer person properties or a dynamic (filter-based) cohort, which re-evaluate, over a static frozen-list cohort; behavioral (event-based) cohorts are rejected.",+ "description": "Update a workflow by ID. Draft only — active workflows are read-only via MCP for now (editing risks breaking already-scheduled runs); create a new draft for changes instead. Status changes go through workflows-enable / workflows-archive. A batch audience is config.filters.properties — person-property conditions and/or cohort references. Prefer person properties or a dynamic (filter-based) cohort, which re-evaluate, over a static frozen-list cohort. An event trigger fires on every occurrence matching the event and the trigger's filters; throttle repeat firings with trigger_masking (dedup/sampling — not behavioral filtering). Behavioral cohorts/targeting ('did event X at least N times over the last M days') are unsupported — if the user requests one, reject it and explain why.","category": "Workflows","feature": "workflows","summary": "Update workflow",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex 08e064a8b11a..7ca5f6953e90 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -6910,7 +6910,7 @@}},"workflows-create": {- "description": "Create a workflow. Needs an actions array with exactly one type='trigger' (config.type: event|webhook|manual|batch|tracking_pixel) plus action nodes — function/function_email/function_sms/function_push, delay (e.g. '30m'), conditional_branch, wait_until_condition — connected by edges. Created as a draft; activate with workflows-enable. 'batch' = broadcast to an audience, one run per matching person (emails/messages). The audience is config.filters.properties: person-property conditions ({type:'person',key,value,operator}) and/or cohort references ({type:'cohort',key:'id',value:<id>,operator:'in'}). Prefer inline person-property conditions or a dynamic (filter-based) cohort via cohorts-create — these re-evaluate as people qualify; a static cohort is a frozen list, use only when given an explicit set. Behavioral (event-based) cohorts are rejected — for 'did event X', use an 'event' trigger instead. A batch workflow fires only once enabled and a recurring schedule is attached (workflows-schedule-create).",+ "description": "Create a workflow. Needs an actions array with exactly one type='trigger' (config.type: event|webhook|manual|batch|tracking_pixel) plus action nodes — function/function_email/function_sms/function_push, delay (e.g. '30m'), conditional_branch, wait_until_condition — connected by edges. Created as a draft; activate with workflows-enable. 'batch' = broadcast to an audience, one run per matching person (emails/messages). The audience is config.filters.properties: person-property conditions ({type:'person',key,value,operator}) and/or cohort references ({type:'cohort',key:'id',value:<id>,operator:'in'}). Prefer inline person-property conditions or a dynamic (filter-based) cohort via cohorts-create — these re-evaluate as people qualify; a static cohort is a frozen list, use only when given an explicit set. An event trigger fires on every occurrence matching the event and the trigger's filters; throttle repeat firings with trigger_masking (dedup/sampling — not behavioral filtering). Behavioral cohorts/targeting ('did event X at least N times over the last M days') are unsupported — if the user requests one, reject it and explain why. A batch workflow doesn't fire on enable alone: dispatch it with workflows-run-batch (one-off) or attach a recurring schedule with workflows-schedule-create.","category": "Workflows","feature": "workflows","summary": "Create workflow",@@ -7092,7 +7092,7 @@}},"workflows-update": {- "description": "Update a workflow by ID. Draft only — active workflows are read-only via MCP for now (editing risks breaking already-scheduled runs); create a new draft for changes instead. Status changes go through workflows-enable / workflows-archive. A batch audience is config.filters.properties — person-property conditions and/or cohort references. Prefer person properties or a dynamic (filter-based) cohort, which re-evaluate, over a static frozen-list cohort; behavioral (event-based) cohorts are rejected.",+ "description": "Update a workflow by ID. Draft only — active workflows are read-only via MCP for now (editing risks breaking already-scheduled runs); create a new draft for changes instead. Status changes go through workflows-enable / workflows-archive. A batch audience is config.filters.properties — person-property conditions and/or cohort references. Prefer person properties or a dynamic (filter-based) cohort, which re-evaluate, over a static frozen-list cohort. An event trigger fires on every occurrence matching the event and the trigger's filters; throttle repeat firings with trigger_masking (dedup/sampling — not behavioral filtering). Behavioral cohorts/targeting ('did event X at least N times over the last M days') are unsupported — if the user requests one, reject it and explain why.","category": "Workflows","feature": "workflows","summary": "Update workflow",diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 2b819170c191..3b7d709a4879 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -19670,18 +19670,18 @@ export namespace Schemas {export interface HogFlowMasking {/**- * Hash TTL in seconds (60 to ~94M / 3y).+ * Seconds (60 to ~94M / 3y) to suppress repeat firings of the same hash.* @minimum 60* @maximum 94608000* @nullable*/ttl?: number | null;/**- * Min matching events before triggering (k-anonymity).+ * Fire once per N matches of the same hash within ttl — a sampler: N=3 fires on the 1st, 4th, 7th… match. Omit to fire on the first match, then suppress repeats within ttl.* @nullable*/threshold?: number | null;- /** HogQL template, e.g. '{person.properties.email}'. */+ /** HogQL template defining the dedup/grouping key, e.g. '{person.id}' (once per person) within ttl. */hash: string;/** Auto-compiled from hash. Do not set. */bytecode?: unknown;@@ -19860,7 +19860,7 @@ export namespace Schemas {readonly created_by: UserBasic;readonly updated_at: string;readonly trigger: unknown;- /** Optional dedup: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Server compiles bytecode from hash. Omit to disable. */+ /** Optional dedup/throttle on an already-matched trigger: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Without threshold: fire once per hash, then suppress repeats within ttl (hash '{person.id}' = once per person per ttl). With threshold N: fire once per N matches of the same hash — a sampler, the 1st then every Nth. Throttles an already-qualifying trigger; it doesn't decide who enters. Server compiles bytecode from hash; omit to disable. */trigger_masking?: HogFlowMasking | null;/** Conversion goal: {filters: [<cond>, ...], window_minutes}. <cond>: {key, value, operator, type: event|person|group}. Empty filters = any event in window. Required for exit_on_conversion / exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side. */conversion?: unknown;@@ -30473,7 +30473,7 @@ export namespace Schemas {readonly created_by?: UserBasic;readonly updated_at?: string;readonly trigger?: unknown;- /** Optional dedup: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Server compiles bytecode from hash. Omit to disable. */+ /** Optional dedup/throttle on an already-matched trigger: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Without threshold: fire once per hash, then suppress repeats within ttl (hash '{person.id}' = once per person per ttl). With threshold N: fire once per N matches of the same hash — a sampler, the 1st then every Nth. Throttles an already-qualifying trigger; it doesn't decide who enters. Server compiles bytecode from hash; omit to disable. */trigger_masking?: HogFlowMasking | null;/** Conversion goal: {filters: [<cond>, ...], window_minutes}. <cond>: {key, value, operator, type: event|person|group}. Empty filters = any event in window. Required for exit_on_conversion / exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side. */conversion?: unknown;diff --git a/services/mcp/src/generated/workflows/api.ts b/services/mcp/src/generated/workflows/api.tsindex a565c10b4443..0e71f970633f 100644--- a/services/mcp/src/generated/workflows/api.ts+++ b/services/mcp/src/generated/workflows/api.ts@@ -67,16 +67,25 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod.object({.min(hogFlowsCreateBodyTriggerMaskingOneTtlMin).max(hogFlowsCreateBodyTriggerMaskingOneTtlMax).nullish()- .describe('Hash TTL in seconds (60 to ~94M / 3y).'),- threshold: zod.number().nullish().describe('Min matching events before triggering (k-anonymity).'),- hash: zod.string().describe("HogQL template, e.g. '{person.properties.email}'."),+ .describe('Seconds (60 to ~94M / 3y) to suppress repeat firings of the same hash.'),+ threshold: zod+ .number()+ .nullish()+ .describe(+ 'Fire once per N matches of the same hash within ttl — a sampler: N=3 fires on the 1st, 4th, 7th… match. Omit to fire on the first match, then suppress repeats within ttl.'+ ),+ hash: zod+ .string()+ .describe(+ "HogQL template defining the dedup/grouping key, e.g. '{person.id}' (once per person) within ttl."+ ),bytecode: zod.unknown().optional().describe('Auto-compiled from hash. Do not set.'),}),zod.null(),]).optional().describe(- 'Optional dedup: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Server compiles bytecode from hash. Omit to disable.'+ "Optional dedup/throttle on an already-matched trigger: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Without threshold: fire once per hash, then suppress repeats within ttl (hash '{person.id}' = once per person per ttl). With threshold N: fire once per N matches of the same hash — a sampler, the 1st then every Nth. Throttles an already-qualifying trigger; it doesn't decide who enters. Server compiles bytecode from hash; omit to disable."),conversion: zod.unknown()@@ -233,16 +242,25 @@ export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zod.object({.min(hogFlowsPartialUpdateBodyTriggerMaskingOneTtlMin).max(hogFlowsPartialUpdateBodyTriggerMaskingOneTtlMax).nullish()- .describe('Hash TTL in seconds (60 to ~94M / 3y).'),- threshold: zod.number().nullish().describe('Min matching events before triggering (k-anonymity).'),- hash: zod.string().describe("HogQL template, e.g. '{person.properties.email}'."),+ .describe('Seconds (60 to ~94M / 3y) to suppress repeat firings of the same hash.'),+ threshold: zod+ .number()+ .nullish()+ .describe(+ 'Fire once per N matches of the same hash within ttl — a sampler: N=3 fires on the 1st, 4th, 7th… match. Omit to fire on the first match, then suppress repeats within ttl.'+ ),+ hash: zod+ .string()+ .describe(+ "HogQL template defining the dedup/grouping key, e.g. '{person.id}' (once per person) within ttl."+ ),bytecode: zod.unknown().optional().describe('Auto-compiled from hash. Do not set.'),}),zod.null(),]).optional().describe(- 'Optional dedup: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Server compiles bytecode from hash. Omit to disable.'+ "Optional dedup/throttle on an already-matched trigger: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Without threshold: fire once per hash, then suppress repeats within ttl (hash '{person.id}' = once per person per ttl). With threshold N: fire once per N matches of the same hash — a sampler, the 1st then every Nth. Throttles an already-qualifying trigger; it doesn't decide who enters. Server compiles bytecode from hash; omit to disable."),conversion: zod.unknown()diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.jsonindex 84fd0bc856c2..8771d5cd2316 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.json@@ -194,7 +194,7 @@"description": "Auto-compiled from hash. Do not set."},"hash": {- "description": "HogQL template, e.g. '{person.properties.email}'.",+ "description": "HogQL template defining the dedup/grouping key, e.g. '{person.id}' (once per person) within ttl.","type": "string"},"threshold": {@@ -206,7 +206,7 @@"type": "null"}],- "description": "Min matching events before triggering (k-anonymity)."+ "description": "Fire once per N matches of the same hash within ttl — a sampler: N=3 fires on the 1st, 4th, 7th… match. Omit to fire on the first match, then suppress repeats within ttl."},"ttl": {"anyOf": [@@ -219,7 +219,7 @@"type": "null"}],- "description": "Hash TTL in seconds (60 to ~94M / 3y)."+ "description": "Seconds (60 to ~94M / 3y) to suppress repeat firings of the same hash."}},"required": ["hash"],@@ -229,7 +229,7 @@"type": "null"}],- "description": "Optional dedup: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Server compiles bytecode from hash. Omit to disable."+ "description": "Optional dedup/throttle on an already-matched trigger: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Without threshold: fire once per hash, then suppress repeats within ttl (hash '{person.id}' = once per person per ttl). With threshold N: fire once per N matches of the same hash — a sampler, the 1st then every Nth. Throttles an already-qualifying trigger; it doesn't decide who enters. Server compiles bytecode from hash; omit to disable."},"variables": {"description": "Workflow vars (key, type, default). Total <5KB.",diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-update.jsonindex d52574e422e3..67efa66f5a7c 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-update.json@@ -192,7 +192,7 @@"description": "Auto-compiled from hash. Do not set."},"hash": {- "description": "HogQL template, e.g. '{person.properties.email}'.",+ "description": "HogQL template defining the dedup/grouping key, e.g. '{person.id}' (once per person) within ttl.","type": "string"},"threshold": {@@ -204,7 +204,7 @@"type": "null"}],- "description": "Min matching events before triggering (k-anonymity)."+ "description": "Fire once per N matches of the same hash within ttl — a sampler: N=3 fires on the 1st, 4th, 7th… match. Omit to fire on the first match, then suppress repeats within ttl."},"ttl": {"anyOf": [@@ -217,7 +217,7 @@"type": "null"}],- "description": "Hash TTL in seconds (60 to ~94M / 3y)."+ "description": "Seconds (60 to ~94M / 3y) to suppress repeat firings of the same hash."}},"required": ["hash"],@@ -227,7 +227,7 @@"type": "null"}],- "description": "Optional dedup: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Server compiles bytecode from hash. Omit to disable."+ "description": "Optional dedup/throttle on an already-matched trigger: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Without threshold: fire once per hash, then suppress repeats within ttl (hash '{person.id}' = once per person per ttl). With threshold N: fire once per N matches of the same hash — a sampler, the 1st then every Nth. Throttles an already-qualifying trigger; it doesn't decide who enters. Server compiles bytecode from hash; omit to disable."},"variables": {"description": "Workflow vars (key, type, default). Total <5KB.",