: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): improve account property change triggers (#83186)
Arthur Moreira de Deusadb741195e19
diff --git a/frontend/src/lib/components/PropertyFilters/PropertyFilters.tsx b/frontend/src/lib/components/PropertyFilters/PropertyFilters.tsxindex bb65b504d360..9c6f6c6c6aed 100644--- a/frontend/src/lib/components/PropertyFilters/PropertyFilters.tsx+++ b/frontend/src/lib/components/PropertyFilters/PropertyFilters.tsx@@ -16,7 +16,7 @@ import { useOnMountEffect } from 'lib/hooks/useOnMountEffect'import { LogicalRowDivider } from 'scenes/cohorts/CohortFilters/CohortCriteriaRowBuilder'import { AnyDataNode, DatabaseSchemaField } from '~/queries/schema/schema-general'-import { AnyPropertyFilter, FilterLogicalOperator } from '~/types'+import { AnyPropertyFilter, FilterLogicalOperator, PropertyDefinition } from '~/types'import { FilterRow } from './components/FilterRow'import { OperatorValueSelectProps } from './components/OperatorValueSelect'@@ -67,6 +67,12 @@ export interface PropertyFiltersProps {*/triggerVariant?: 'button' | 'input'staticValueOptions?: PropertyFilterInternalProps['staticValueOptions']+ /** Override inferred property definitions for contexts where one event key is polymorphic. */+ propertyDefinitionsOverride?: PropertyDefinition[]+ /** Keep the selected key fixed while leaving its operator and value editable. */+ propertyKeyEditable?: boolean+ singleLine?: boolean+ showRemoveButton?: boolean}export function PropertyFilters({@@ -107,6 +113,10 @@ export function PropertyFilters({hogQLGlobals,triggerVariant = 'button',staticValueOptions,+ propertyDefinitionsOverride,+ propertyKeyEditable,+ singleLine,+ showRemoveButton = true,}: PropertyFiltersProps): JSX.Element {const logicProps = { propertyFilters, onChange, pageKey, sendAllKeyUpdates }const { filters, filtersWithNew, filterIds, filterIdsWithNew } = useValues(propertyFilterLogic(logicProps))@@ -146,6 +156,7 @@ export function PropertyFilters({labelClassName={buttonClassName}size={buttonSize}onRemove={remove}+ showRemoveButton={showRemoveButton}orFiltering={orFiltering}editable={editable}filterComponent={(onComplete) => (@@ -179,6 +190,9 @@ export function PropertyFilters({hogQLGlobals={hogQLGlobals}triggerVariant={triggerVariant}staticValueOptions={staticValueOptions}+ propertyDefinitionsOverride={propertyDefinitionsOverride}+ propertyKeyEditable={propertyKeyEditable}+ singleLine={singleLine}/>)}errorMessage={errorMessages && errorMessages[index]}diff --git a/frontend/src/lib/components/PropertyFilters/components/FilterRow.tsx b/frontend/src/lib/components/PropertyFilters/components/FilterRow.tsxindex b4309806d5ff..f3a8887b2340 100644--- a/frontend/src/lib/components/PropertyFilters/components/FilterRow.tsx+++ b/frontend/src/lib/components/PropertyFilters/components/FilterRow.tsx@@ -27,6 +27,7 @@ interface FilterRowProps {labelClassName?: stringopenOnInsert?: booleanonRemove: (index: number) => void+ showRemoveButton?: booleanorFiltering?: booleanerrorMessage?: JSX.Element | nulldisabledReason?: string@@ -47,6 +48,7 @@ export const FilterRow = React.memo(function FilterRow({label,labelClassName = '',onRemove,+ showRemoveButton = true,orFiltering,errorMessage,disabledReason,@@ -79,7 +81,7 @@ export const FilterRow = React.memo(function FilterRow({{disablePopover ? (<>{filterComponent(() => setOpen(false))}- {Object.keys(filters[index]).length > 0 && editable ? (+ {Object.keys(filters[index]).length > 0 && editable && showRemoveButton ? (<LemonButtonicon={orFiltering ? <IconTrash /> : <IconX />}onClick={() => onRemove(index)}diff --git a/frontend/src/lib/components/PropertyFilters/components/OperatorValueSelect.tsx b/frontend/src/lib/components/PropertyFilters/components/OperatorValueSelect.tsxindex f1390de023ad..ff4c7d936901 100644--- a/frontend/src/lib/components/PropertyFilters/components/OperatorValueSelect.tsx+++ b/frontend/src/lib/components/PropertyFilters/components/OperatorValueSelect.tsx@@ -457,6 +457,7 @@ export function OperatorValueSelect({size={size}forceSingleSelect={forceSingleSelect}validationError={validationError}+ propertyTypeOverride={propertyDefinition?.property_type}/>)}</div>diff --git a/frontend/src/lib/components/PropertyFilters/components/PropertyValue.test.tsx b/frontend/src/lib/components/PropertyFilters/components/PropertyValue.test.tsxindex 7c4bcc844ee8..6b7ba48e67b1 100644--- a/frontend/src/lib/components/PropertyFilters/components/PropertyValue.test.tsx+++ b/frontend/src/lib/components/PropertyFilters/components/PropertyValue.test.tsx@@ -192,6 +192,38 @@ describe('PropertyValue', () => {})})+ it('allows text when a polymorphic property overrides a globally inferred numeric type', async () => {+ propertyDefinitionsModel.actions.updatePropertyDefinitions({+ 'event/current_value': {+ id: 'current_value',+ name: 'current_value',+ property_type: PropertyType.Numeric,+ is_numerical: true,+ is_seen_on_filtered_events: false,+ },+ })++ render(+ <Provider>+ <PropertyValue+ propertyKey="current_value"+ type={PropertyFilterType.Event}+ operator={PropertyOperator.Exact}+ onSet={jest.fn()}+ value={[]}+ propertyTypeOverride={PropertyType.String}+ staticValues={[]}+ />+ </Provider>+ )++ const input = screen.getByRole('textbox')+ await userEvent.type(input, 'enterprise')++ expect(input).toHaveValue('enterprise')+ expect(loadPropertyValuesSpy).not.toHaveBeenCalled()+ })+it('keeps numeric-only input for non-regex numeric properties', async () => {propertyDefinitionsModel.actions.updatePropertyDefinitions({'event/userId': {diff --git a/frontend/src/lib/components/PropertyFilters/components/PropertyValue.tsx b/frontend/src/lib/components/PropertyFilters/components/PropertyValue.tsxindex 578a54815872..3fc6efee00c2 100644--- a/frontend/src/lib/components/PropertyFilters/components/PropertyValue.tsx+++ b/frontend/src/lib/components/PropertyFilters/components/PropertyValue.tsx@@ -68,6 +68,8 @@ export interface PropertyValueProps {* (e.g. internal events, which are never ingested into ClickHouse).*/staticValues?: PropValue[] | null+ /** Override the globally inferred type for a polymorphic property key. */+ propertyTypeOverride?: PropertyType}export function PropertyValue({@@ -91,6 +93,7 @@ export function PropertyValue({validationError = null,showInlineValidationErrors = false,staticValues = null,+ propertyTypeOverride,}: PropertyValueProps): JSX.Element {const { formatPropertyValueForDisplay, describeProperty, options } = useValues(propertyDefinitionsModel)const { loadPropertyValues } = useActions(propertyDefinitionsModel)@@ -103,15 +106,13 @@ export function PropertyValue({const propertyDefinitionType = propertyFilterTypeToPropertyDefinitionType(type)const { isRefreshing } = useValues(propertyValueLogic({ propertyKey, type: propertyDefinitionType }))- const isDurationProperty =- propertyKey && describeProperty(propertyKey, propertyDefinitionType) === PropertyType.Duration+ const propertyType = propertyTypeOverride ?? describeProperty(propertyKey, propertyDefinitionType)+ const isDurationProperty = propertyKey && propertyType === PropertyType.Duration// Assignee values come from membersLogic/rolesLogic, not from the property values API- const isAssigneeProperty =- propertyKey && describeProperty(propertyKey, propertyDefinitionType) === PropertyType.Assignee+ const isAssigneeProperty = propertyKey && propertyType === PropertyType.Assignee- const isNumericProperty =- propertyKey && describeProperty(propertyKey, propertyDefinitionType) === PropertyType.Numeric+ const isNumericProperty = propertyKey && propertyType === PropertyType.Numericconst shouldRestrictToNumericInput = isNumericProperty && !isOperatorRegex(operator)const isGroupKeyProperty = propertyKey === '$group_key' && groupTypeIndex != nulldiff --git a/frontend/src/lib/components/PropertyFilters/components/TaxonomicPropertyFilter.scss b/frontend/src/lib/components/PropertyFilters/components/TaxonomicPropertyFilter.scssindex 8a102c86200f..cd28a9ac373d 100644--- a/frontend/src/lib/components/PropertyFilters/components/TaxonomicPropertyFilter.scss+++ b/frontend/src/lib/components/PropertyFilters/components/TaxonomicPropertyFilter.scss@@ -65,4 +65,27 @@min-width: 10rem;}}++ &--single-line {+ flex-wrap: nowrap;++ > :first-child {+ flex: 0 0 auto !important;+ width: auto !important;+ min-width: 0 !important;+ }++ [data-attr='taxonomic-operator'] {+ min-width: 0;+ max-width: 7rem;++ > * {+ max-width: 100%;+ }+ }++ [data-attr='taxonomic-value-select'] {+ min-width: 0;+ }+ }}diff --git a/frontend/src/lib/components/PropertyFilters/components/TaxonomicPropertyFilter.tsx b/frontend/src/lib/components/PropertyFilters/components/TaxonomicPropertyFilter.tsxindex 4300af556e38..bbe5c1305982 100644--- a/frontend/src/lib/components/PropertyFilters/components/TaxonomicPropertyFilter.tsx+++ b/frontend/src/lib/components/PropertyFilters/components/TaxonomicPropertyFilter.tsx@@ -92,6 +92,9 @@ export function TaxonomicPropertyFilter({hogQLGlobals,triggerVariant = 'button',staticValueOptions,+ propertyDefinitionsOverride,+ propertyKeyEditable = true,+ singleLine,}: PropertyFilterInternalProps): JSX.Element {const generatedKey = useId()const pageKey = pageKeyInput || `filter-${generatedKey}`@@ -158,9 +161,10 @@ export function TaxonomicPropertyFilter({// For data warehouse person properties, use columnsJoinedToPersons, otherwise use property definitionsconst propertyDefinitions =- filter?.type === PropertyFilterType.DataWarehousePersonProperty+ propertyDefinitionsOverride ??+ (filter?.type === PropertyFilterType.DataWarehousePersonProperty? columnsJoinedToPersons- : propertyDefinitionsByType(basePropertyType, groupTypeIndex)+ : propertyDefinitionsByType(basePropertyType, groupTypeIndex))// Look up cohort name, if not already provided in filterconst cohortValue =@@ -395,9 +399,13 @@ export function TaxonomicPropertyFilter({)}</div>)}- <div className="TaxonomicPropertyFilter__row-items">+ <div+ className={clsx('TaxonomicPropertyFilter__row-items', {+ 'TaxonomicPropertyFilter__row-items--single-line': singleLine,+ })}+ >{showOperatorValueSelect && placeOperatorValueSelectOnLeft && operatorValueSelect}- {editable ? editablePicker : filterContent}+ {editable && propertyKeyEditable ? editablePicker : filterContent}{showOperatorValueSelect && !placeOperatorValueSelectOnLeft && operatorValueSelect}</div></div>diff --git a/frontend/src/lib/components/PropertyFilters/types.ts b/frontend/src/lib/components/PropertyFilters/types.tsindex 6bdaf7f6a5fa..5c4862d064bc 100644--- a/frontend/src/lib/components/PropertyFilters/types.ts+++ b/frontend/src/lib/components/PropertyFilters/types.ts@@ -12,7 +12,7 @@ import {import { PropValue } from '~/models/propertyDefinitionsModel'import { AnyDataNode, DatabaseSchemaField } from '~/queries/schema/schema-general'-import { AnyPropertyFilter, FilterLogicalOperator, PropertyGroupFilter } from '~/types'+import { AnyPropertyFilter, FilterLogicalOperator, PropertyDefinition, PropertyGroupFilter } from '~/types'export interface PropertyFilterBaseProps {pageKey: string@@ -81,4 +81,10 @@ export interface PropertyFilterInternalProps {* to the default behavior. See `PropertyValueProps.staticValues`.*/staticValueOptions?: (propertyKey: string) => PropValue[] | null+ /** Override the model's inferred definitions, e.g. for a polymorphic event property. */+ propertyDefinitionsOverride?: PropertyDefinition[]+ /** Keep the selected property key fixed while allowing operator/value edits. */+ propertyKeyEditable?: boolean+ /** Keep key, operator, and value controls on one row when the host has enough width. */+ singleLine?: boolean}diff --git a/nodejs/src/cdp/cdp-api.test.ts b/nodejs/src/cdp/cdp-api.test.tsindex 582c40a40624..2b500a7ffeb8 100644--- a/nodejs/src/cdp/cdp-api.test.ts+++ b/nodejs/src/cdp/cdp-api.test.ts@@ -897,6 +897,104 @@ describe('CDP API', () => {})})+ describe('hogflow trigger test invocations', () => {+ const accountPropertyChangedFlowConfiguration = {+ id: 'account-property-changed-flow',+ team_id: 0,+ name: 'Account property changed flow',+ actions: [+ {+ id: 'trigger_node',+ name: 'Trigger',+ type: 'trigger',+ config: {+ type: 'event',+ filters: {+ events: [+ {+ id: '$account_custom_property_changed',+ name: 'Account custom property changed',+ type: 'events',+ order: 0,+ properties: [+ { key: 'property_name', value: 'Plan', operator: 'exact', type: 'event' },+ { key: 'current_value', value: 'enterprise', operator: 'exact', type: 'event' },+ ],+ },+ ],+ properties: [],+ // properties.current_value == 'enterprise' AND properties.property_name == 'Plan'+ bytecode: [+ '_H',+ 1,+ 32,+ 'enterprise',+ 32,+ 'current_value',+ 32,+ 'properties',+ 1,+ 2,+ 11,+ 32,+ 'Plan',+ 32,+ 'property_name',+ 32,+ 'properties',+ 1,+ 2,+ 11,+ 3,+ 2,+ ],+ },+ },+ },+ { id: 'exit_node', name: 'Exit', type: 'exit', config: {} },+ ],+ edges: [{ from: 'trigger_node', to: 'exit_node', type: 'continue' }],+ }++ it.each([+ ['matching', 'enterprise', 'success', 'exit_node'],+ ['non-matching', 'free', 'skipped', null],+ ])(+ 'reports a %s current_value filter result',+ async (_, currentValue, expectedStatus, expectedNextActionId) => {+ const res = await supertest(app)+ .post(`/api/projects/${team.id}/hog_flows/new/invocations`)+ .send({+ globals: {+ ...globals,+ event: {+ ...globals.event!,+ event: '$account_custom_property_changed',+ properties: {+ ...globals.event!.properties,+ property_name: 'Plan',+ current_value: currentValue,+ },+ },+ },+ mock_async_functions: true,+ configuration: { ...accountPropertyChangedFlowConfiguration, team_id: team.id },+ })++ expect(res.status).toEqual(200)+ expect(res.body.status).toEqual(expectedStatus)+ expect(res.body.nextActionId).toEqual(expectedNextActionId)+ if (expectedStatus === 'skipped') {+ expect(res.body.logs).toEqual(+ expect.arrayContaining([+ expect.objectContaining({ message: 'Workflow trigger did not match the event.' }),+ ])+ )+ }+ }+ )+ })+describe('hogflow wait_until_condition test invocations', () => {// Matches events whose name equals `eventName` - same shape the serializer compiles// for an "events to wait for" entry.diff --git a/nodejs/src/cdp/cdp-api.ts b/nodejs/src/cdp/cdp-api.tsindex ea564f5fa992..5c4e0572582a 100644--- a/nodejs/src/cdp/cdp-api.ts+++ b/nodejs/src/cdp/cdp-api.ts@@ -774,9 +774,15 @@ export class CdpApi {const invocation = createHogFlowInvocation(triggerGlobals, compoundConfiguration, filterGlobals)- invocation.state.currentAction = current_action_id+ // Real event ingestion evaluates trigger filters before creating an invocation. A test run has to+ // execute the trigger action itself so callers can verify whether their supplied globals match.+ // Without this explicit position, executeCurrentAction starts after the trigger by design.+ const startingActionId =+ current_action_id ??+ compoundConfiguration.actions?.find((action: HogFlowAction) => action.type === 'trigger')?.id+ invocation.state.currentAction = startingActionId? {- id: current_action_id,+ id: startingActionId,startedAtTimestamp: Date.now(),}: undefined@@ -823,8 +829,8 @@ export class CdpApi {const result = await this.hogFlowExecutor.executeCurrentAction(invocation, { hogExecutorOptions: options })res.json({- nextActionId: result.invocation.state.currentAction?.id,- status: result.error ? 'error' : 'success',+ nextActionId: result.skipped ? null : result.invocation.state.currentAction?.id,+ status: result.error ? 'error' : result.skipped ? 'skipped' : 'success',errors: result.error ? [result.error] : [],logs: [...result.logs, ...logs],variables: result.invocation.state.variables ?? {},diff --git a/nodejs/src/cdp/services/hogflows/actions/action.interface.ts b/nodejs/src/cdp/services/hogflows/actions/action.interface.tsindex de639ca267b6..3080e40031d2 100644--- a/nodejs/src/cdp/services/hogflows/actions/action.interface.ts+++ b/nodejs/src/cdp/services/hogflows/actions/action.interface.ts@@ -9,6 +9,8 @@ export interface ActionHandlerResult {nextAction?: HogFlowActionscheduledAt?: DateTimefinished?: boolean+ /** The action deliberately ended the invocation because its input did not match. */+ skipped?: booleanresult?: unknownerror?: any}diff --git a/nodejs/src/cdp/services/hogflows/actions/trigger.handler.ts b/nodejs/src/cdp/services/hogflows/actions/trigger.handler.tsindex c747e6db3903..7f1433de84b9 100644--- a/nodejs/src/cdp/services/hogflows/actions/trigger.handler.ts+++ b/nodejs/src/cdp/services/hogflows/actions/trigger.handler.ts@@ -1,3 +1,5 @@+import { DateTime } from 'luxon'+import { HogFlowAction } from '~/cdp/schema/hogflow'import { filterFunctionInstrumented } from '~/cdp/utils/hog-function-filtering'@@ -10,6 +12,7 @@ export class TriggerHandler implements ActionHandler {async execute({invocation,action,+ result,}: ActionHandlerOptions<Extract<HogFlowAction, { type: 'trigger' }>>): Promise<ActionHandlerResult> {if (action.config.type !== 'event') {return { nextAction: findContinueAction(invocation) }@@ -26,7 +29,12 @@ export class TriggerHandler implements ActionHandler {}if (!filterResults.match) {- return { finished: true }+ result.logs.push({+ level: 'info',+ timestamp: DateTime.now(),+ message: 'Workflow trigger did not match the event.',+ })+ return { finished: true, skipped: true }}return { nextAction: findContinueAction(invocation) }diff --git a/nodejs/src/cdp/services/hogflows/hogflow-executor.service.ts b/nodejs/src/cdp/services/hogflows/hogflow-executor.service.tsindex bdc875fcb7b9..3d0707bd1a68 100644--- a/nodejs/src/cdp/services/hogflows/hogflow-executor.service.ts+++ b/nodejs/src/cdp/services/hogflows/hogflow-executor.service.ts@@ -530,8 +530,9 @@ export class HogFlowExecutorService {if (handlerResult.finished) {result.finished = true- // Special case for exit - we just track a success metric- this.trackActionMetric(result, currentAction, 'succeeded')+ result.skipped = handlerResult.skipped+ // A non-matching trigger is filtered, while an exit is a successful finish.+ this.trackActionMetric(result, currentAction, handlerResult.skipped ? 'filtered' : 'succeeded')}if (handlerResult.scheduledAt) {diff --git a/nodejs/src/cdp/types.ts b/nodejs/src/cdp/types.tsindex deb056f6098b..b9ec9f261651 100644--- a/nodejs/src/cdp/types.ts+++ b/nodejs/src/cdp/types.ts@@ -310,6 +310,8 @@ export type CyclotronJobInvocation = {export type CyclotronJobInvocationResult<T extends CyclotronJobInvocation = CyclotronJobInvocation> = {invocation: Tfinished: boolean+ /** The invocation deliberately finished without running because its trigger did not match. */+ skipped?: booleanerror?: anylogs: MinimalLogEntry[]metrics: MinimalAppMetric[]diff --git a/products/workflows/frontend/Workflows/hogflows/filters/HogFlowFilters.tsx b/products/workflows/frontend/Workflows/hogflows/filters/HogFlowFilters.tsxindex c004838dd8e4..8b99ad44c8d4 100644--- a/products/workflows/frontend/Workflows/hogflows/filters/HogFlowFilters.tsx+++ b/products/workflows/frontend/Workflows/hogflows/filters/HogFlowFilters.tsx@@ -1,16 +1,17 @@import { useValues } from 'kea'import { PropertyFilters } from 'lib/components/PropertyFilters/PropertyFilters'-import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'+import { AllowedProperties, TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'import { isOperatorSemver } from 'lib/utils/operators'import { ActionFilter } from 'scenes/insights/filters/ActionFilter/ActionFilter'import { MathAvailability } from 'scenes/insights/filters/ActionFilter/ActionFilterRow/ActionFilterRow'import { groupsModel } from '~/models/groupsModel'+import { PropValue } from '~/models/propertyDefinitionsModel'import { defaultDataTableColumns } from '~/queries/nodes/DataTable/utils'import { DatabaseSchemaField, NodeKind } from '~/queries/schema/schema-general'-import { FilterType, PropertyOperator } from '~/types'+import { FilterType, PropertyDefinition, PropertyOperator } from '~/types'import { workflowLogic } from '../../workflowLogic'import { HogFlowAction } from '../types'@@ -53,6 +54,16 @@ export type HogFlowFiltersProps = {// as suggestions and resolve their distinct values.schemaColumns?: DatabaseSchemaField[]dataWarehouseTableName?: string+ taxonomicGroupTypes?: TaxonomicFilterGroupType[]+ propertyAllowList?: AllowedProperties+ propertyDefinitionsOverride?: PropertyDefinition[]+ staticValueOptions?: (propertyKey: string) => PropValue[] | null+ inline?: boolean+ allowNew?: boolean+ propertyKeyEditable?: boolean+ singleLine?: boolean+ showRemoveButton?: boolean+ hasRowOperator?: boolean}/**@@ -124,6 +135,17 @@ export function HogFlowPropertyFilters({excludeGroupProperties,schemaColumns,dataWarehouseTableName,+ taxonomicGroupTypes,+ propertyAllowList,+ propertyDefinitionsOverride,+ staticValueOptions,+ buttonCopy,+ inline,+ allowNew,+ propertyKeyEditable,+ singleLine,+ showRemoveButton,+ hasRowOperator,}: HogFlowFiltersProps): JSX.Element {const sampleGlobals = useSampleGlobals()const { groupsTaxonomicTypes } = useValues(groupsModel)@@ -143,10 +165,18 @@ export function HogFlowPropertyFilters({setFilters({ ...filters, properties: properties ?? [] } as HogFlowAction['filters'])}}pageKey={`HogFlowPropertyFilters.${filtersKey}`}+ buttonText={buttonCopy ?? 'Add filter'}+ disablePopover={inline}+ allowNew={allowNew}+ propertyKeyEditable={propertyKeyEditable}+ singleLine={singleLine}+ showRemoveButton={showRemoveButton}+ hasRowOperator={hasRowOperator}taxonomicGroupTypes={+ taxonomicGroupTypes ??// Warehouse rows are row-scoped — only the synced row's columns make sense to filter on,// so event/feature-flag/person/group properties don't apply here.- isDataWarehouse+ (isDataWarehouse? [TaxonomicFilterGroupType.DataWarehouseProperties, TaxonomicFilterGroupType.HogQLExpression]: [TaxonomicFilterGroupType.WorkflowVariables,@@ -156,7 +186,7 @@ export function HogFlowPropertyFilters({...(excludeGroupProperties ? [] : groupsTaxonomicTypes),TaxonomicFilterGroupType.HogQLExpression,TaxonomicFilterGroupType.EventMetadata,- ]+ ])}taxonomicFilterOptionsFromProp={taxonomicFilterOptionsFromProp}schemaColumns={schemaColumns}@@ -168,6 +198,9 @@ export function HogFlowPropertyFilters({}}hogQLGlobals={sampleGlobals}operatorAllowlist={WORKFLOW_OPERATOR_ALLOWLIST}+ propertyAllowList={propertyAllowList}+ propertyDefinitionsOverride={propertyDefinitionsOverride}+ staticValueOptions={staticValueOptions}/>)}diff --git a/products/workflows/frontend/Workflows/hogflows/registry/triggers/customer_analytics.test.ts b/products/workflows/frontend/Workflows/hogflows/registry/triggers/customer_analytics.test.tsindex a48a55f6d76b..ddb5376871e4 100644--- a/products/workflows/frontend/Workflows/hogflows/registry/triggers/customer_analytics.test.ts+++ b/products/workflows/frontend/Workflows/hogflows/registry/triggers/customer_analytics.test.ts@@ -1,7 +1,12 @@+import { PropertyType } from '~/types'+import {accountCustomPropertyChangedFilters,accountCustomPropertyFrequencyOptions,accountTagAddedFilters,+ customPropertyDisplayTypeToPropertyType,+ getAccountCustomPropertyChangedConditions,+ getAccountCustomPropertyValueFilters,getSelectedPropertyNames,getSelectedTags,} from './customer_analytics'@@ -82,13 +87,91 @@ describe('customer analytics triggers', () => {expect(getSelectedPropertyNames(config)).toEqual(expected)})- it('omits the property filter when no properties are selected', () => {- expect(accountCustomPropertyChangedFilters([]).properties).toEqual([])- expect(accountCustomPropertyChangedFilters(['Plan']).properties).toEqual([- { key: 'property_name', value: ['Plan'], operator: 'exact', type: 'event' },+ it('builds one nested event-filter group per selected property', () => {+ expect(accountCustomPropertyChangedFilters([])).toMatchObject({+ events: [{ id: '$account_custom_property_changed' }],+ properties: [],+ })+ expect(accountCustomPropertyChangedFilters(['Plan'])).toMatchObject({+ events: [+ {+ id: '$account_custom_property_changed',+ properties: [{ key: 'property_name', value: 'Plan', operator: 'exact', type: 'event' }],+ },+ ],+ properties: [],+ })+ })++ it('exposes current value filters separately from the managed property picker filter', () => {+ const currentValueFilter = { key: 'current_value', value: 'enterprise', operator: 'exact', type: 'event' }+ const config: EventTriggerConfig = {+ type: 'event',+ filters: {+ properties: [+ { key: 'property_name', value: ['Plan'], operator: 'exact', type: 'event' },+ currentValueFilter,+ ],+ },+ }++ expect(getAccountCustomPropertyValueFilters(config)).toEqual([currentValueFilter])+ })++ it('upgrades legacy top-level filters without losing the selected property condition', () => {+ const currentValueFilter = { key: 'current_value', value: 'enterprise', operator: 'exact', type: 'event' }+ const filters = accountCustomPropertyChangedFilters(['Plan', 'Seats'], {+ properties: [+ { key: 'property_name', value: ['Plan'], operator: 'exact', type: 'event' },+ currentValueFilter,+ ],+ filter_test_accounts: true,+ })++ expect(filters.properties).toEqual([])+ expect(filters.events).toMatchObject([+ {+ properties: [+ { key: 'property_name', value: 'Plan', operator: 'exact', type: 'event' },+ currentValueFilter,+ ],+ },+ {+ properties: [{ key: 'property_name', value: 'Seats', operator: 'exact', type: 'event' }],+ },+ ])+ expect(filters.filter_test_accounts).toBe(true)+ })++ it('round-trips independently typed OR groups', () => {+ const planFilter = { key: 'current_value', value: 'enterprise', operator: 'exact', type: 'event' }+ const seatsFilter = { key: 'current_value', value: 5, operator: 'gt', type: 'event' }+ const filters = accountCustomPropertyChangedFilters(['Plan', 'Seats'], {}, [+ { propertyName: 'Plan', valueFilters: [planFilter] },+ { propertyName: 'Seats', valueFilters: [seatsFilter] },+ ])+ const config: EventTriggerConfig = { type: 'event', filters }++ expect(getSelectedPropertyNames(config)).toEqual(['Plan', 'Seats'])+ expect(getAccountCustomPropertyChangedConditions(config)).toEqual([+ { propertyName: 'Plan', valueFilters: [planFilter] },+ { propertyName: 'Seats', valueFilters: [seatsFilter] },])})+ it.each([+ ['text', PropertyType.String],+ ['select', PropertyType.String],+ ['number', PropertyType.Numeric],+ ['currency', PropertyType.Numeric],+ ['percent', PropertyType.Numeric],+ ['boolean', PropertyType.Boolean],+ ['date', PropertyType.DateTime],+ ['datetime', PropertyType.DateTime],+ ] as const)('maps the %s custom property display type to %s operators', (displayType, expected) => {+ expect(customPropertyDisplayTypeToPropertyType(displayType)).toBe(expected)+ })+// The hash templates are evaluated as Hog against the trigger event at runtime — a typo'd// property reference resolves to null for every event and masks all accounts as one.it('frequency hashes key on the account and property from the trigger event', () => {diff --git a/products/workflows/frontend/Workflows/hogflows/registry/triggers/customer_analytics.tsx b/products/workflows/frontend/Workflows/hogflows/registry/triggers/customer_analytics.tsxindex a319332ad5da..b1caca9eb51e 100644--- a/products/workflows/frontend/Workflows/hogflows/registry/triggers/customer_analytics.tsx+++ b/products/workflows/frontend/Workflows/hogflows/registry/triggers/customer_analytics.tsx@@ -1,14 +1,18 @@import { useActions, useValues } from 'kea'-import { IconBolt, IconPencil } from '@posthog/icons'-import { LemonBanner, LemonInputSelect } from '@posthog/lemon-ui'+import { IconBolt, IconPencil, IconPlusSmall, IconX } from '@posthog/icons'+import { LemonButton, LemonInputSelect } from '@posthog/lemon-ui'import { CodeSnippet } from 'lib/components/CodeSnippet'+import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'import { FEATURE_FLAGS } from 'lib/constants'import { LemonField } from 'lib/lemon-ui/LemonField'import { tagsModel } from '~/models/tagsModel'+import { PropertyDefinition, PropertyDefinitionType, PropertyType } from '~/types'+import type { CustomPropertyDefinitionApi } from 'products/customer_analytics/frontend/generated/api.schemas'+import { HogFlowPropertyFilters } from 'products/workflows/frontend/Workflows/hogflows/filters/HogFlowFilters'import { accountCustomPropertyDefinitionsLogic } from 'products/workflows/frontend/Workflows/hogflows/registry/triggers/accountCustomPropertyDefinitionsLogic'import {type EventTriggerConfig,@@ -105,24 +109,147 @@ export const accountCustomPropertyFrequencyOptions: TriggerFrequencyOption[] = [},]-export function getSelectedPropertyNames(config: EventTriggerConfig): string[] {- const nameProperty = (config.filters?.properties ?? []).find((property: any) => property?.key === 'property_name')- if (!nameProperty) {- return []- }- const values = Array.isArray(nameProperty.value) ? nameProperty.value : [nameProperty.value]+export type AccountCustomPropertyChangedCondition = {+ propertyName: string+ valueFilters: any[]+}++function propertyValues(property: any): string[] {+ const values = Array.isArray(property?.value) ? property.value : [property?.value]return values.filter((name: unknown): name is string => typeof name === 'string')}-export function accountCustomPropertyChangedFilters(names: string[]): EventTriggerConfig['filters'] {+function topLevelPropertyNames(config: EventTriggerConfig): string[] {+ const property = (config.filters?.properties ?? []).find((candidate: any) => candidate?.key === 'property_name')+ return propertyValues(property)+}++/**+ * Each event filter is one OR branch. Its nested properties stay ANDed, giving us:+ * (property_name = Plan AND current_value = enterprise) OR+ * (property_name = Seats AND current_value > 5).+ *+ * Older/MCP configs use top-level properties. Distribute those filters across the selected+ * property names so the first UI edit upgrades the config without changing its meaning.+ */+export function getAccountCustomPropertyChangedConditions(+ config: EventTriggerConfig+): AccountCustomPropertyChangedCondition[] {+ const topLevelValueFilters = (config.filters?.properties ?? []).filter(+ (property: any) => property?.key !== 'property_name'+ )+ const groupedConditions = (config.filters?.events ?? []).flatMap((event: any) => {+ if (event?.id !== ACCOUNT_CUSTOM_PROPERTY_CHANGED_EVENT) {+ return []+ }+ const properties = event.properties ?? []+ const nameProperty = properties.find((property: any) => property?.key === 'property_name')+ return propertyValues(nameProperty).map((propertyName) => ({+ propertyName,+ valueFilters: [+ ...properties.filter((property: any) => property?.key !== 'property_name'),+ ...topLevelValueFilters,+ ],+ }))+ })++ if (groupedConditions.length > 0) {+ return groupedConditions.filter(+ (condition, index) =>+ groupedConditions.findIndex((candidate) => candidate.propertyName === condition.propertyName) === index+ )+ }++ return topLevelPropertyNames(config).map((propertyName) => ({+ propertyName,+ valueFilters: topLevelValueFilters,+ }))+}++export function getSelectedPropertyNames(config: EventTriggerConfig): string[] {+ const groupedNames = getAccountCustomPropertyChangedConditions(config).map((condition) => condition.propertyName)+ return groupedNames.length > 0 ? groupedNames : topLevelPropertyNames(config)+}++export function getAccountCustomPropertyValueFilters(config: EventTriggerConfig): any[] {+ return getAccountCustomPropertyChangedConditions(config).flatMap((condition) => condition.valueFilters)+}++const accountCustomPropertyChangedEvent = (properties: any[] = []): any => ({+ id: ACCOUNT_CUSTOM_PROPERTY_CHANGED_EVENT,+ type: 'events',+ name: 'Account custom property changed',+ ...(properties.length > 0 ? { properties } : {}),+})++export function accountCustomPropertyChangedFilters(+ names: string[],+ existingFilters: EventTriggerConfig['filters'] = {},+ conditions: AccountCustomPropertyChangedCondition[] = getAccountCustomPropertyChangedConditions({+ type: 'event',+ filters: existingFilters,+ })+): EventTriggerConfig['filters'] {+ const conditionsByName = new Map(conditions.map((condition) => [condition.propertyName, condition]))+ const selectedConditions = names.map(+ (propertyName): AccountCustomPropertyChangedCondition =>+ conditionsByName.get(propertyName) ?? { propertyName, valueFilters: [] }+ )+return {- events: [- { id: ACCOUNT_CUSTOM_PROPERTY_CHANGED_EVENT, type: 'events', name: 'Account custom property changed' },- ],- properties: names.length > 0 ? [{ key: 'property_name', value: names, operator: 'exact', type: 'event' }] : [],+ ...existingFilters,+ events:+ selectedConditions.length > 0+ ? selectedConditions.map((condition) =>+ accountCustomPropertyChangedEvent([+ {+ key: 'property_name',+ value: condition.propertyName,+ operator: 'exact',+ type: 'event',+ },+ ...condition.valueFilters,+ ])+ )+ : [accountCustomPropertyChangedEvent()],+ // Conditions are nested under each event filter. Keeping them top-level would AND them+ // with every OR branch and recreate the ambiguity this trigger-specific editor avoids.+ properties:+ selectedConditions.length > 0+ ? []+ : (existingFilters.properties ?? []).filter((property: any) => property?.key !== 'property_name'),+ }+}++export function customPropertyDisplayTypeToPropertyType(+ displayType: CustomPropertyDefinitionApi['display_type'] | undefined+): PropertyType {+ switch (displayType) {+ case 'number':+ case 'currency':+ case 'percent':+ return PropertyType.Numeric+ case 'boolean':+ return PropertyType.Boolean+ case 'date':+ case 'datetime':+ return PropertyType.DateTime+ default:+ return PropertyType.String}}+function currentValuePropertyDefinition(definition: CustomPropertyDefinitionApi | undefined): PropertyDefinition[] {+ return [+ {+ id: `account-custom-property-current-value-${definition?.id ?? 'unknown'}`,+ name: 'current_value',+ type: PropertyDefinitionType.Event,+ property_type: customPropertyDisplayTypeToPropertyType(definition?.display_type),+ },+ ]+}+const TRIGGER_EVENT_TEMPLATES = ['{event.properties.property_name}','{event.properties.previous_value}',@@ -133,37 +260,164 @@ const TRIGGER_EVENT_TEMPLATES = [function StepTriggerConfigurationAccountCustomPropertyChanged({ node }: { node: any }): JSX.Element {const { setWorkflowActionConfig } = useActions(workflowLogic)- const { accountPropertyNames, definitionsLoading } = useValues(accountCustomPropertyDefinitionsLogic)+ const { accountPropertyNames, definitions, definitionsLoading } = useValues(accountCustomPropertyDefinitionsLogic)const config = node.data.config as EventTriggerConfigconst selectedNames = getSelectedPropertyNames(config)+ const conditions = getAccountCustomPropertyChangedConditions(config)++ const updateTriggerConfig = (names: string[], nextConditions: AccountCustomPropertyChangedCondition[]): void => {+ setWorkflowActionConfig(node.data.id, {+ type: 'event',+ filters: accountCustomPropertyChangedFilters(names, config.filters, nextConditions),+ })+ }++ const selectProperties = (names: string[]): void => {+ const conditionsByName = new Map(conditions.map((condition) => [condition.propertyName, condition]))+ updateTriggerConfig(+ names,+ names.map((propertyName) => conditionsByName.get(propertyName) ?? { propertyName, valueFilters: [] })+ )+ }return (<div className="flex flex-col gap-2 w-full"><p className="mb-0 text-sm text-muted-alt">This trigger runs when an account custom property value changes. Leave empty to run for any property.</p>- <LemonField.Pure label="Properties">+ <LemonField.Pure+ label="Properties"+ info="Select a property to add a current value condition. With no selection, this trigger runs for any changed property."+ ><LemonInputSelectmode="multiple"value={selectedNames}loading={definitionsLoading}placeholder="Any property"options={accountPropertyNames.map((name: string) => ({ key: name, label: name }))}- onChange={(value) =>- setWorkflowActionConfig(node.data.id, {- type: 'event',- filters: accountCustomPropertyChangedFilters(value),- })- }+ onChange={selectProperties}data-attr="account-custom-property-changed-trigger-properties"/></LemonField.Pure>- {selectedNames.length !== 1 && (- <LemonBanner type="info">- The workflow starts once per changed property. If two matching properties change at the same time,- two separate runs start.- </LemonBanner>- )}+ {conditions.length > 0 ? (+ <LemonField.Pure+ label="Current value conditions"+ info="Conditions inside a property group are ANDed. Property groups are ORed."+ >+ <div className="flex flex-col gap-2">+ {conditions.map((condition, index) => {+ const definition = definitions.find(+ (candidate) =>+ candidate.name === condition.propertyName &&+ (candidate.target_type ?? 'account') === 'account'+ )+ const selectOptions =+ definition?.display_type === 'select'+ ? (definition.options ?? []).map((option) => ({ name: option.label }))+ : []++ return (+ <div key={condition.propertyName}>+ {index > 0 && (+ <div className="flex items-center gap-2 my-2 text-xs font-semibold text-muted uppercase">+ <div className="flex-1 border-t" />+ or+ <div className="flex-1 border-t" />+ </div>+ )}+ <div className="relative rounded border bg-surface-primary p-3 flex flex-col gap-2">+ <div className="text-sm pr-8">+ When <strong>{condition.propertyName}</strong> changes+ </div>+ {condition.valueFilters.length > 0 && (+ <LemonButton+ icon={<IconX />}+ type="tertiary"+ size="xsmall"+ noPadding+ className="absolute top-3 right-3"+ tooltip="Remove value filter"+ onClick={() =>+ updateTriggerConfig(+ selectedNames,+ conditions.map((candidate) =>+ candidate.propertyName === condition.propertyName+ ? { ...candidate, valueFilters: [] }+ : candidate+ )+ )+ }+ />+ )}+ {condition.valueFilters.length === 0 ? (+ <LemonButton+ type="secondary"+ size="small"+ icon={<IconPlusSmall />}+ onClick={() =>+ updateTriggerConfig(+ selectedNames,+ conditions.map((candidate) =>+ candidate.propertyName === condition.propertyName+ ? {+ ...candidate,+ valueFilters: [+ {+ key: 'current_value',+ value: null,+ operator: 'exact',+ type: 'event',+ },+ ],+ }+ : candidate+ )+ )+ }+ data-attr={`account-custom-property-add-value-filter-${condition.propertyName}`}+ >+ Add value filter+ </LemonButton>+ ) : (+ <HogFlowPropertyFilters+ filtersKey={`account-custom-property-changed-trigger-${node.data.id}-${condition.propertyName}`}+ filters={{ properties: condition.valueFilters }}+ setFilters={(filters) =>+ updateTriggerConfig(+ selectedNames,+ conditions.map((candidate) =>+ candidate.propertyName === condition.propertyName+ ? {+ ...candidate,+ valueFilters: filters?.properties ?? [],+ }+ : candidate+ )+ )+ }+ taxonomicGroupTypes={[TaxonomicFilterGroupType.EventProperties]}+ propertyAllowList={{+ [TaxonomicFilterGroupType.EventProperties]: ['current_value'],+ }}+ propertyDefinitionsOverride={currentValuePropertyDefinition(definition)}+ staticValueOptions={(propertyKey) =>+ propertyKey === 'current_value' ? selectOptions : null+ }+ inline+ allowNew={false}+ propertyKeyEditable={false}+ singleLine+ showRemoveButton={false}+ hasRowOperator={false}+ />+ )}+ </div>+ </div>+ )+ })}+ </div>+ </LemonField.Pure>+ ) : null}<LemonField.Pure label="Available in steps" help="Reference the change from any step, filter, or condition"><div className="flex flex-col gap-1">{TRIGGER_EVENT_TEMPLATES.map((template) => (diff --git a/products/workflows/frontend/generated/agentContext.ts b/products/workflows/frontend/generated/agentContext.tsindex 4e49fc7a477c..79b56ec4a48b 100644--- a/products/workflows/frontend/generated/agentContext.ts+++ b/products/workflows/frontend/generated/agentContext.ts@@ -21,7 +21,7 @@ export const WORKFLOWS_MCP_TOOLS: McpToolSummary[] = [{name: 'workflows-create',description:- "Create a workflow. It is created as a draft and does NOT run until enabled: test it with workflows-test-run first, then enable (workflows-enable) only with the user's explicit approval — from then on it runs on real people, and further content edits stage as a draft you must publish (workflows-publish) to take effect. Provide 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, conditional_branch, wait_until_condition, ...) connected by edges. A webhook or manual trigger also needs config.template_id set to the literal 'template-source-webhook', and a tracking_pixel trigger needs 'template-source-webhook-pixel'; without it the create is rejected with 'Template not found' against the trigger node. Read the building-workflows skill for node shapes before composing: a node that mismatches the per-type schema saves but breaks the visual editor. Two traps that save but break: (1) a conditional_branch condition needs a 'filters' wrapper — {filters:{properties:[...]}}, not {properties:[...]} on the condition; omitting it passes save but the editor flags it and the branch won't evaluate your condition. (2) Never hand-author bytecode anywhere; send properties/hash and the server compiles it. A 'batch' trigger broadcasts to an audience (config.filters.properties: person-property conditions and/or cohort references), one run per matching person, and does NOT fire on enable: dispatch with workflows-run-batch or attach a schedule with workflows-schedule-create. Behavioral targeting ('did event X at least N times over the last M days') is unsupported; reject it and explain why.",+ "Create a workflow. It is created as a draft and does NOT run until enabled: test it with workflows-test-run first, then enable (workflows-enable) only with the user's explicit approval — from then on it runs on real people, and further content edits stage as a draft you must publish (workflows-publish) to take effect. Provide 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, conditional_branch, wait_until_condition, ...) connected by edges. A webhook or manual trigger also needs config.template_id set to the literal 'template-source-webhook', and a tracking_pixel trigger needs 'template-source-webhook-pixel'; without it the create is rejected with 'Template not found' against the trigger node. Read the building-workflows skill for node shapes before composing: a node that mismatches the per-type schema saves but breaks the visual editor. Two traps that save but break: (1) a conditional_branch condition needs a 'filters' wrapper — {filters:{properties:[...]}}, not {properties:[...]} on the condition; omitting it passes save but the editor flags it and the branch won't evaluate your condition. (2) Never hand-author bytecode anywhere; send properties/hash and the server compiles it. For '$account_custom_property_changed', current_value is polymorphic. To target multiple property types, repeat that event in filters.events: nested properties in each event entry are ANDed, while event entries are ORed. For example, one entry can pair property_name=Plan with current_value=enterprise and another can pair property_name=Seats with current_value greater than 5; do not put one shared current_value condition in top-level properties. A 'batch' trigger broadcasts to an audience (config.filters.properties: person-property conditions and/or cohort references), one run per matching person, and does NOT fire on enable: dispatch with workflows-run-batch or attach a schedule with workflows-schedule-create. Behavioral targeting ('did event X at least N times over the last M days') is unsupported; reject it and explain why.",},{name: 'workflows-discard-draft',@@ -101,7 +101,7 @@ export const WORKFLOWS_MCP_TOOLS: McpToolSummary[] = [{name: 'workflows-test-run',description:- "Test-invoke a workflow one node at a time; it does NOT traverse the full graph in one call. The result includes nextActionId. To verify a path end to end, chain calls: start at the trigger (omit current_action_id), then pass the returned nextActionId as current_action_id on the next call, and repeat. To test a specific branch, set current_action_id to that node. Skip delay nodes by jumping to the action after them, since delays are not simulated. Pass test data via globals (typically {event, person, groups}). Async actions (HTTP/email/SMS/push) are mocked by default; set mock_async_functions=false to fire real side effects. Returns the step's execution trace. Set use_draft=true to test a workflow's staged draft instead of its live config — always do this before workflows-publish. use_draft requires a staged draft to exist (workflows-get shows it in 'draft'); on a workflow with nothing staged, omit it.",+ "Test-invoke a workflow one node at a time; it does NOT traverse the full graph in one call. The result includes nextActionId. To verify a path end to end, chain calls: start at the trigger (omit current_action_id), then pass the returned nextActionId as current_action_id on the next call, and repeat. To test a specific branch, set current_action_id to that node. Skip delay nodes by jumping to the action after them, since delays are not simulated. Pass test data via globals (typically {event, person, groups}). Async actions (HTTP/email/SMS/push) are mocked by default; set mock_async_functions=false to fire real side effects. The trigger step evaluates its filters against globals and returns status=skipped when they do not match. Returns the step's execution trace. Set use_draft=true to test a workflow's staged draft instead of its live config — always do this before workflows-publish. use_draft requires a staged draft to exist (workflows-get shows it in 'draft'); on a workflow with nothing staged, omit it.",},{name: 'workflows-update',diff --git a/products/workflows/mcp/tools.yaml b/products/workflows/mcp/tools.yamlindex d887980ea758..08bd52dbebdf 100644--- a/products/workflows/mcp/tools.yaml+++ b/products/workflows/mcp/tools.yaml@@ -142,9 +142,13 @@ tools:editor. Two traps that save but break: (1) a conditional_branch condition needs a 'filters' wrapper —{filters:{properties:[...]}}, not {properties:[...]} on the condition; omitting it passes save but theeditor flags it and the branch won't evaluate your condition. (2) Never hand-author bytecode anywhere; send- properties/hash and the server compiles it. A 'batch' trigger broadcasts to an audience- (config.filters.properties: person-property conditions and/or cohort references), one run per matching- person, and does NOT fire on enable: dispatch with workflows-run-batch or attach a schedule with+ properties/hash and the server compiles it. For '$account_custom_property_changed', current_value is+ polymorphic. To target multiple property types, repeat that event in filters.events: nested properties in+ each event entry are ANDed, while event entries are ORed. For example, one entry can pair property_name=Plan+ with current_value=enterprise and another can pair property_name=Seats with current_value greater than 5; do+ not put one shared current_value condition in top-level properties. A 'batch' trigger broadcasts to an+ audience (config.filters.properties: person-property conditions and/or cohort references), one run per+ matching person, and does NOT fire on enable: dispatch with workflows-run-batch or attach a schedule withworkflows-schedule-create. Behavioral targeting ('did event X at least N times over the last M days') isunsupported; reject it and explain why.ui_app: workflow@@ -426,7 +430,8 @@ tools:To test a specific branch, set current_action_id to that node. Skip delay nodes by jumping to the actionafter them, since delays are not simulated. Pass test data via globals (typically {event, person, groups}).Async actions (HTTP/email/SMS/push) are mocked by default; set mock_async_functions=false to fire real side- effects. Returns the step's execution trace. Set use_draft=true to test a workflow's staged draft instead of+ effects. The trigger step evaluates its filters against globals and returns status=skipped when they do not+ match. Returns the step's execution trace. Set use_draft=true to test a workflow's staged draft instead ofits live config — always do this before workflows-publish. use_draft requires a staged draft to exist(workflows-get shows it in 'draft'); on a workflow with nothing staged, omit it.exclude_params:diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex fc40d3b46fca..2e64c74db54e 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -11097,7 +11097,7 @@"feature_flag": "engineering-analytics"},"workflows-create": {- "description": "Create a workflow. It is created as a draft and does NOT run until enabled: test it with workflows-test-run first, then enable (workflows-enable) only with the user's explicit approval — from then on it runs on real people, and further content edits stage as a draft you must publish (workflows-publish) to take effect. Provide 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, conditional_branch, wait_until_condition, ...) connected by edges. A webhook or manual trigger also needs config.template_id set to the literal 'template-source-webhook', and a tracking_pixel trigger needs 'template-source-webhook-pixel'; without it the create is rejected with 'Template not found' against the trigger node. Read the building-workflows skill for node shapes before composing: a node that mismatches the per-type schema saves but breaks the visual editor. Two traps that save but break: (1) a conditional_branch condition needs a 'filters' wrapper — {filters:{properties:[...]}}, not {properties:[...]} on the condition; omitting it passes save but the editor flags it and the branch won't evaluate your condition. (2) Never hand-author bytecode anywhere; send properties/hash and the server compiles it. A 'batch' trigger broadcasts to an audience (config.filters.properties: person-property conditions and/or cohort references), one run per matching person, and does NOT fire on enable: dispatch with workflows-run-batch or attach a schedule with workflows-schedule-create. Behavioral targeting ('did event X at least N times over the last M days') is unsupported; reject it and explain why.",+ "description": "Create a workflow. It is created as a draft and does NOT run until enabled: test it with workflows-test-run first, then enable (workflows-enable) only with the user's explicit approval — from then on it runs on real people, and further content edits stage as a draft you must publish (workflows-publish) to take effect. Provide 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, conditional_branch, wait_until_condition, ...) connected by edges. A webhook or manual trigger also needs config.template_id set to the literal 'template-source-webhook', and a tracking_pixel trigger needs 'template-source-webhook-pixel'; without it the create is rejected with 'Template not found' against the trigger node. Read the building-workflows skill for node shapes before composing: a node that mismatches the per-type schema saves but breaks the visual editor. Two traps that save but break: (1) a conditional_branch condition needs a 'filters' wrapper — {filters:{properties:[...]}}, not {properties:[...]} on the condition; omitting it passes save but the editor flags it and the branch won't evaluate your condition. (2) Never hand-author bytecode anywhere; send properties/hash and the server compiles it. For '$account_custom_property_changed', current_value is polymorphic. To target multiple property types, repeat that event in filters.events: nested properties in each event entry are ANDed, while event entries are ORed. For example, one entry can pair property_name=Plan with current_value=enterprise and another can pair property_name=Seats with current_value greater than 5; do not put one shared current_value condition in top-level properties. A 'batch' trigger broadcasts to an audience (config.filters.properties: person-property conditions and/or cohort references), one run per matching person, and does NOT fire on enable: dispatch with workflows-run-batch or attach a schedule with workflows-schedule-create. Behavioral targeting ('did event X at least N times over the last M days') is unsupported; reject it and explain why.","category": "Workflows","feature": "workflows","summary": "Create workflow",@@ -11391,7 +11391,7 @@}},"workflows-test-run": {- "description": "Test-invoke a workflow one node at a time; it does NOT traverse the full graph in one call. The result includes nextActionId. To verify a path end to end, chain calls: start at the trigger (omit current_action_id), then pass the returned nextActionId as current_action_id on the next call, and repeat. To test a specific branch, set current_action_id to that node. Skip delay nodes by jumping to the action after them, since delays are not simulated. Pass test data via globals (typically {event, person, groups}). Async actions (HTTP/email/SMS/push) are mocked by default; set mock_async_functions=false to fire real side effects. Returns the step's execution trace. Set use_draft=true to test a workflow's staged draft instead of its live config — always do this before workflows-publish. use_draft requires a staged draft to exist (workflows-get shows it in 'draft'); on a workflow with nothing staged, omit it.",+ "description": "Test-invoke a workflow one node at a time; it does NOT traverse the full graph in one call. The result includes nextActionId. To verify a path end to end, chain calls: start at the trigger (omit current_action_id), then pass the returned nextActionId as current_action_id on the next call, and repeat. To test a specific branch, set current_action_id to that node. Skip delay nodes by jumping to the action after them, since delays are not simulated. Pass test data via globals (typically {event, person, groups}). Async actions (HTTP/email/SMS/push) are mocked by default; set mock_async_functions=false to fire real side effects. The trigger step evaluates its filters against globals and returns status=skipped when they do not match. Returns the step's execution trace. Set use_draft=true to test a workflow's staged draft instead of its live config — always do this before workflows-publish. use_draft requires a staged draft to exist (workflows-get shows it in 'draft'); on a workflow with nothing staged, omit it.","category": "Workflows","feature": "workflows","summary": "Test-run workflow",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex c2c5467189be..6c7801f5f58a 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -11739,7 +11739,7 @@}},"workflows-create": {- "description": "Create a workflow. It is created as a draft and does NOT run until enabled: test it with workflows-test-run first, then enable (workflows-enable) only with the user's explicit approval — from then on it runs on real people, and further content edits stage as a draft you must publish (workflows-publish) to take effect. Provide 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, conditional_branch, wait_until_condition, ...) connected by edges. A webhook or manual trigger also needs config.template_id set to the literal 'template-source-webhook', and a tracking_pixel trigger needs 'template-source-webhook-pixel'; without it the create is rejected with 'Template not found' against the trigger node. Read the building-workflows skill for node shapes before composing: a node that mismatches the per-type schema saves but breaks the visual editor. Two traps that save but break: (1) a conditional_branch condition needs a 'filters' wrapper — {filters:{properties:[...]}}, not {properties:[...]} on the condition; omitting it passes save but the editor flags it and the branch won't evaluate your condition. (2) Never hand-author bytecode anywhere; send properties/hash and the server compiles it. A 'batch' trigger broadcasts to an audience (config.filters.properties: person-property conditions and/or cohort references), one run per matching person, and does NOT fire on enable: dispatch with workflows-run-batch or attach a schedule with workflows-schedule-create. Behavioral targeting ('did event X at least N times over the last M days') is unsupported; reject it and explain why.",+ "description": "Create a workflow. It is created as a draft and does NOT run until enabled: test it with workflows-test-run first, then enable (workflows-enable) only with the user's explicit approval — from then on it runs on real people, and further content edits stage as a draft you must publish (workflows-publish) to take effect. Provide 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, conditional_branch, wait_until_condition, ...) connected by edges. A webhook or manual trigger also needs config.template_id set to the literal 'template-source-webhook', and a tracking_pixel trigger needs 'template-source-webhook-pixel'; without it the create is rejected with 'Template not found' against the trigger node. Read the building-workflows skill for node shapes before composing: a node that mismatches the per-type schema saves but breaks the visual editor. Two traps that save but break: (1) a conditional_branch condition needs a 'filters' wrapper — {filters:{properties:[...]}}, not {properties:[...]} on the condition; omitting it passes save but the editor flags it and the branch won't evaluate your condition. (2) Never hand-author bytecode anywhere; send properties/hash and the server compiles it. For '$account_custom_property_changed', current_value is polymorphic. To target multiple property types, repeat that event in filters.events: nested properties in each event entry are ANDed, while event entries are ORed. For example, one entry can pair property_name=Plan with current_value=enterprise and another can pair property_name=Seats with current_value greater than 5; do not put one shared current_value condition in top-level properties. A 'batch' trigger broadcasts to an audience (config.filters.properties: person-property conditions and/or cohort references), one run per matching person, and does NOT fire on enable: dispatch with workflows-run-batch or attach a schedule with workflows-schedule-create. Behavioral targeting ('did event X at least N times over the last M days') is unsupported; reject it and explain why.","category": "Workflows","feature": "workflows","summary": "Create workflow",@@ -12075,7 +12075,7 @@}},"workflows-test-run": {- "description": "Test-invoke a workflow one node at a time; it does NOT traverse the full graph in one call. The result includes nextActionId. To verify a path end to end, chain calls: start at the trigger (omit current_action_id), then pass the returned nextActionId as current_action_id on the next call, and repeat. To test a specific branch, set current_action_id to that node. Skip delay nodes by jumping to the action after them, since delays are not simulated. Pass test data via globals (typically {event, person, groups}). Async actions (HTTP/email/SMS/push) are mocked by default; set mock_async_functions=false to fire real side effects. Returns the step's execution trace. Set use_draft=true to test a workflow's staged draft instead of its live config — always do this before workflows-publish. use_draft requires a staged draft to exist (workflows-get shows it in 'draft'); on a workflow with nothing staged, omit it.",+ "description": "Test-invoke a workflow one node at a time; it does NOT traverse the full graph in one call. The result includes nextActionId. To verify a path end to end, chain calls: start at the trigger (omit current_action_id), then pass the returned nextActionId as current_action_id on the next call, and repeat. To test a specific branch, set current_action_id to that node. Skip delay nodes by jumping to the action after them, since delays are not simulated. Pass test data via globals (typically {event, person, groups}). Async actions (HTTP/email/SMS/push) are mocked by default; set mock_async_functions=false to fire real side effects. The trigger step evaluates its filters against globals and returns status=skipped when they do not match. Returns the step's execution trace. Set use_draft=true to test a workflow's staged draft instead of its live config — always do this before workflows-publish. use_draft requires a staged draft to exist (workflows-get shows it in 'draft'); on a workflow with nothing staged, omit it.","category": "Workflows","feature": "workflows","summary": "Test-run workflow",