:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(workflows): add create AI task workflow action (#85511)
Harley Alexander175d59b87d08
diff --git a/frontend/src/lib/components/CyclotronJob/customInputRenderers.ts b/frontend/src/lib/components/CyclotronJob/customInputRenderers.tsindex 37412a1b410a..9e85a2cc1e53 100644--- a/frontend/src/lib/components/CyclotronJob/customInputRenderers.ts+++ b/frontend/src/lib/components/CyclotronJob/customInputRenderers.ts@@ -35,4 +35,13 @@ export const CUSTOM_INPUT_RENDERERS: Record<() =>import('products/customer_analytics/frontend/components/AccountRelationshipsInput/CyclotronJobInputAccountRelationships')),+ task_model: lazyWithRetry(+ () => import('products/tasks/frontend/components/TaskModelPicker/CyclotronJobInputTaskModel')+ ),+ task_repository: lazyWithRetry(+ () => import('products/tasks/frontend/components/TaskRepositoryPicker/CyclotronJobInputTaskRepository')+ ),+ task_mcp_installations: lazyWithRetry(+ () => import('products/tasks/frontend/components/TaskConnectorsPicker/CyclotronJobInputTaskConnectors')+ ),}diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex b830c8ecc9f3..a47442442a95 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -558,6 +558,7 @@ export const FEATURE_FLAGS = {WEB_ANALYTICS_TILE_SKELETONS: 'web-analytics-tile-skeletons', // owner: @jordanm-posthog #team-web-analyticsWEB_ANALYTICS_TILE_TOGGLES: 'web-analytics-tile-toggles', // owner: @lricoy #team-web-analyticsWEB_ANALYTICS_TOOLTIP_COMPARISON_LABELS: 'web-analytics-tooltip-comparison-labels', // owner: @lricoy #team-web-analytics+ WORKFLOW_AI_TASK_ACTION: 'workflow-ai-task-action', // owner: @mayteio #team-workflowsWORKFLOWS_EMAIL_REPUTATION: 'workflows-email-reputation', // owner: #team-workflowsWORKFLOWS_EMAIL_SENDER_ROTATION: 'workflows-email-sender-rotation', // owner: @arthurdedeus #team-workflowsWORKFLOWS_INCIDENT_REPLAY: 'workflows-incident-replay', // owner: #team-workflowsdiff --git a/frontend/src/types.ts b/frontend/src/types.tsindex 7ac5d5de86ee..d52ad4bcecb8 100644--- a/frontend/src/types.ts+++ b/frontend/src/types.ts@@ -7243,6 +7243,9 @@ export type CyclotronJobInputSchemaType = {| 'non_failure_status_codes'| 'customer_analytics_account_properties'| 'customer_analytics_account_relationships'+ | 'task_model'+ | 'task_repository'+ | 'task_mcp_installations'key: stringlabel: stringchoices?: { value: string; label: string }[]diff --git a/nodejs/src/cdp/async-functions/create-task.ts b/nodejs/src/cdp/async-functions/create-task.tsnew file mode 100644index 000000000000..f7f8a2d70e7e--- /dev/null+++ b/nodejs/src/cdp/async-functions/create-task.ts@@ -0,0 +1,79 @@+import { DateTime } from 'luxon'++import { CyclotronInvocationQueueParametersFetchSchema } from '~/cdp/schema/cyclotron'+import { HogFlow } from '~/cdp/schema/hogflow'+import { defaultConfig } from '~/common/config/config'++import { registerAsyncFunction } from '../async-function-registry'+import { PosthogJwtAudience } from '../utils/jwt-utils'+import { ScopedServiceJwt } from '../utils/scoped-service-jwt'++// The token rides the staged fetch verbatim through every engine retry (executeFetch re-queues+// the identical request), so its lifetime must cover the whole backoff chain plus queue lag,+// not one attempt. An expired token 401s, which is not retriable, so the step fails permanently.+// The claims scope it to a single team and workflow, which keeps the longer window cheap.+const TOKEN_TTL_SECONDS = 30 * 60++// Constructed on first use rather than at import so the module has no side effects beyond+// registration and tests can override env-derived config before anything reads it.+let tasksJwt: ScopedServiceJwt | undefined+const getTasksJwt = (): ScopedServiceJwt =>+ (tasksJwt ??= new ScopedServiceJwt(PosthogJwtAudience.TASKS_CREATE, defaultConfig.TASKS_CREATE_JWT_SECRET))++registerAsyncFunction('postHogCreateTask', {+ execute: (args, context, result) => {+ const [payload] = args as [Record<string, any> | undefined]++ if (!payload?.prompt || typeof payload.prompt !== 'string') {+ throw new Error("postHogCreateTask call missing 'prompt' property")+ }++ // Both come from the flow-spawned invocation, never from step inputs: the hog_flow_id+ // claim is what the endpoint trusts to resolve the workflow owner, and the action id+ // makes the idempotency key step-scoped (the run id alone is shared by every step in+ // the run, so two task steps in one workflow would dedupe against each other).+ const hogFlow = (context.invocation as { hogFlow?: HogFlow }).hogFlow+ const actionId = context.invocation.state.actionId+ if (!hogFlow?.id || !actionId) {+ throw new Error('postHogCreateTask only runs inside a workflow')+ }++ const jwt = getTasksJwt()+ if (!jwt.enabled) {+ throw new Error('Task creation is not configured in this environment (TASKS_CREATE_JWT_SECRET unset)')+ }+ const token = jwt.mint({ team_id: context.invocation.teamId, hog_flow_id: hogFlow.id }, TOKEN_TTL_SECONDS)++ result.invocation.queueParameters = CyclotronInvocationQueueParametersFetchSchema.parse({+ type: 'fetch',+ url: `${context.siteUrl}/api/projects/${context.invocation.teamId}/workflow_tasks/`,+ method: 'POST',+ headers: {+ 'Content-Type': 'application/json',+ Authorization: `Bearer ${token}`,+ },+ body: JSON.stringify({+ ...payload,+ idempotency_key: `${context.invocation.id}:${actionId}`,+ }),+ })+ },++ mock: (args, logs) => {+ logs.push({+ level: 'info',+ timestamp: DateTime.now(),+ message: `Async function 'postHogCreateTask' was mocked with arguments:`,+ })+ logs.push({+ level: 'info',+ timestamp: DateTime.now(),+ message: `postHogCreateTask(${JSON.stringify(args[0], null, 2)})`,+ })++ return {+ status: 201,+ body: { id: 'mock-task-id', run_id: 'mock-task-run-id' },+ }+ },+})diff --git a/nodejs/src/cdp/async-functions/index.ts b/nodejs/src/cdp/async-functions/index.tsindex c380596bf28d..64daa70ec02c 100644--- a/nodejs/src/cdp/async-functions/index.ts+++ b/nodejs/src/cdp/async-functions/index.ts@@ -1,4 +1,5 @@import './conversations'+import './create-task'import './customer_analytics'import './fetch-handler'import './send-email'diff --git a/nodejs/src/cdp/config.ts b/nodejs/src/cdp/config.tsindex 04fbb857290a..39ae582b5418 100644--- a/nodejs/src/cdp/config.ts+++ b/nodejs/src/cdp/config.ts@@ -175,6 +175,9 @@ export type CdpConfig = ClickhouseConfig & {// newest first (first signs, all verify). Deliberately NOT the fleet-wide INTERNAL_API_SECRET// (see .agents/security.md): empty in prod means the route fails closed until provisioned.WORKFLOWS_RESCHEDULE_JWT_SECRET: string+ // Scoped JWT keys signing the workflow engine's task-create calls to Django, with the same+ // comma-separated rotation and fail-closed-when-empty semantics as the secret above.+ TASKS_CREATE_JWT_SECRET: stringCYCLOTRON_NODE_RESCHEDULE_FLOOR_SECONDS: numberCYCLOTRON_NODE_RESCHEDULE_WAKE_RATE_PER_SECOND: numberCYCLOTRON_NODE_RESCHEDULE_MIN_WINDOW_SECONDS: number@@ -330,6 +333,8 @@ export function getDefaultCdpConfig(): CdpConfig {// mass wake, so wakes are trickled (500k parked @ 200/s ≈ 42 min spread).// Dev/test default must match Django's (posthog/settings/data_stores.py).WORKFLOWS_RESCHEDULE_JWT_SECRET: isTestEnv() || isDevEnv() ? 'local-dev-workflows-reschedule-jwt' : '',+ // Dev/test default must match Django's (posthog/settings/data_stores.py).+ TASKS_CREATE_JWT_SECRET: isTestEnv() || isDevEnv() ? 'local-dev-tasks-create-jwt' : '',CYCLOTRON_NODE_RESCHEDULE_FLOOR_SECONDS: 600,CYCLOTRON_NODE_RESCHEDULE_WAKE_RATE_PER_SECOND: 200,CYCLOTRON_NODE_RESCHEDULE_MIN_WINDOW_SECONDS: 300,diff --git a/nodejs/src/cdp/schema/cyclotron.ts b/nodejs/src/cdp/schema/cyclotron.tsindex e3349d505adb..f5e6cbb37e75 100644--- a/nodejs/src/cdp/schema/cyclotron.ts+++ b/nodejs/src/cdp/schema/cyclotron.ts@@ -29,6 +29,9 @@ export const CyclotronJobInputSchemaTypeSchema = z.object({'push_subscription','customer_analytics_account_properties','customer_analytics_account_relationships',+ 'task_model',+ 'task_repository',+ 'task_mcp_installations',]),key: z.string(),label: z.string(),diff --git a/nodejs/src/cdp/templates/_destinations/posthog_tasks/posthog-create-task.template.test.ts b/nodejs/src/cdp/templates/_destinations/posthog_tasks/posthog-create-task.template.test.tsnew file mode 100644index 000000000000..017843ffa81d--- /dev/null+++ b/nodejs/src/cdp/templates/_destinations/posthog_tasks/posthog-create-task.template.test.ts@@ -0,0 +1,138 @@+import jwt from 'jsonwebtoken'++import { CyclotronInvocationQueueParametersFetchType } from '~/cdp/schema/cyclotron'+import { parseJSON } from '~/common/utils/json-parse'++import { TemplateTester } from '../../test/test-helpers'+import { template } from './posthog-create-task.template'++describe('posthog create task template', () => {+ const tester = new TemplateTester(template)++ const workflowOptions = { hogFlow: { id: '0198c9f1-0000-0000-0000-000000000001' }, actionId: 'action_1' }+ const fullInputs = {+ prompt: 'Investigate the error spike in checkout',+ title: 'Checkout error spike',+ model: { model: 'claude-sonnet-5', reasoning_effort: 'high' },+ repository: 'example-org/example-repo',+ connectors: ['0198c9f1-aaaa-0000-0000-000000000001'],+ posthog_mcp_scopes: 'full',+ max_parallel_tasks: 3,+ }++ beforeEach(async () => {+ await tester.beforeEach()+ })++ const invokeAndGetFetch = async (+ inputs: Record<string, any>+ ): Promise<{+ invocation: Awaited<ReturnType<TemplateTester['invoke']>>['invocation']+ params: CyclotronInvocationQueueParametersFetchType+ }> => {+ const response = await tester.invoke(inputs, undefined, workflowOptions)+ expect(response.error).toBeUndefined()+ expect(response.finished).toBe(false)+ return { invocation: response.invocation, params: response.invocation.queueParameters as any }+ }++ it('stages an authenticated create request with a step-scoped idempotency key', async () => {+ const { invocation, params } = await invokeAndGetFetch(fullInputs)++ expect(params.type).toBe('fetch')+ expect(params.method).toBe('POST')+ expect(params.url).toMatch(/\/api\/projects\/1\/workflow_tasks\/$/)++ const body = parseJSON(params.body!)+ expect(body).toEqual({+ prompt: 'Investigate the error spike in checkout',+ title: 'Checkout error spike',+ model: 'claude-sonnet-5',+ reasoning_effort: 'high',+ repository: 'example-org/example-repo',+ connectors: ['0198c9f1-aaaa-0000-0000-000000000001'],+ posthog_mcp_scopes: 'full',+ max_parallel_tasks: 3,+ idempotency_key: `${invocation.id}:action_1`,+ })++ const token = (params.headers?.['Authorization'] ?? '').replace('Bearer ', '')+ // The literal pins the cross-language contract: Django's TASKS_CREATE_JWT_SECRET dev default+ // (posthog/settings/data_stores.py) must match the nodejs one or local runs 401.+ // nosemgrep: javascript.jsonwebtoken.security.jwt-hardcode.hardcoded-jwt-secret+ const claims = jwt.verify(token, 'local-dev-tasks-create-jwt', {+ audience: 'posthog:tasks:create',+ algorithms: ['HS256'],+ }) as jwt.JwtPayload+ expect(claims.team_id).toBe(1)+ expect(claims.hog_flow_id).toBe(workflowOptions.hogFlow.id)+ })++ it('omits the fields without defaults when they are left empty', async () => {+ const { invocation, params } = await invokeAndGetFetch({ prompt: 'Do the thing' })++ expect(parseJSON(params.body!)).toEqual({+ prompt: 'Do the thing',+ posthog_mcp_scopes: 'read_only',+ max_parallel_tasks: 5,+ idempotency_key: `${invocation.id}:action_1`,+ })+ })++ it('fails without staging a request when the instructions are empty', async () => {+ const response = await tester.invoke({ prompt: '' }, undefined, workflowOptions)+ expect(response.error).toMatch(/Instructions are required/)+ expect(response.invocation.queueParameters).toBeUndefined()+ })++ it('fails when invoked outside a workflow', async () => {+ const response = await tester.invoke(fullInputs)+ expect(response.error).toMatch(/inside a workflow/)+ expect(response.invocation.queueParameters).toBeUndefined()+ })++ it.each([[201], [200]])('returns the created task on a %i response', async (status) => {+ let response = await tester.invoke(fullInputs, undefined, workflowOptions)+ response = await tester.invokeFetchResponse(response.invocation, {+ status,+ body: { id: 'task-1', run_id: 'run-1' },+ })++ expect(response.error).toBeUndefined()+ expect(response.finished).toBe(true)+ expect(response.execResult).toEqual({ id: 'task-1', run_id: 'run-1' })+ })++ it('skips instead of failing when the parallel task limit is hit', async () => {+ let response = await tester.invoke(fullInputs, undefined, workflowOptions)+ response = await tester.invokeFetchResponse(response.invocation, {+ status: 409,+ body: { detail: 'This workflow already has 3 tasks running' },+ })++ expect(response.error).toBeUndefined()+ expect(response.finished).toBe(true)+ expect(response.execResult).toEqual({+ skipped: true,+ reason: 'This workflow already has 3 tasks running',+ })+ expect(response.logs.map((log) => log.message)).toContain(+ 'Task not created: This workflow already has 3 tasks running'+ )+ })++ it.each([+ [400, 'Connector abc is not an active MCP connector'],+ [422, 'The workflow owner can no longer run tasks'],+ ])('surfaces the API error on a %i response', async (status, detail) => {+ let response = await tester.invoke(fullInputs, undefined, workflowOptions)+ response = await tester.invokeFetchResponse(response.invocation, { status, body: { detail } })++ expect(response.error).toEqual(`Failed to create task (${status}): ${detail}`)+ })++ it('declares 409 as a non-failure status so the engine does not fail the step before the code runs', () => {+ const entry = template.inputs_schema.find((input) => input.type === 'non_failure_status_codes')+ expect(entry?.default).toEqual([409])+ })+})diff --git a/nodejs/src/cdp/templates/_destinations/posthog_tasks/posthog-create-task.template.ts b/nodejs/src/cdp/templates/_destinations/posthog_tasks/posthog-create-task.template.tsnew file mode 100644index 000000000000..ae69b069a701--- /dev/null+++ b/nodejs/src/cdp/templates/_destinations/posthog_tasks/posthog-create-task.template.ts@@ -0,0 +1,144 @@+import { HogFunctionTemplate } from '~/cdp/types'++import { hogApiErrorMessageFn } from '../../hog-helpers'++export const template: HogFunctionTemplate = {+ free: true,+ status: 'hidden',+ type: 'destination',+ id: 'template-posthog-create-task',+ name: 'Create AI task',+ description:+ 'Start an AI agent task from a workflow. The agent works in the background and the task shows up in Tasks.',+ icon_url: '/static/posthog-icon.svg',+ category: ['Custom'],+ code_language: 'hog',+ code: `+${hogApiErrorMessageFn}++if (empty(inputs.prompt)) {+ throw Error('Instructions are required')+}++let payload := { 'prompt': inputs.prompt }++if (not empty(inputs.title)) {+ payload.title := inputs.title+}++if (not empty(inputs.model) and not empty(inputs.model.model)) {+ payload.model := inputs.model.model+ if (not empty(inputs.model.reasoning_effort)) {+ payload.reasoning_effort := inputs.model.reasoning_effort+ }+}++if (not empty(inputs.repository)) {+ payload.repository := inputs.repository+}++if (not empty(inputs.connectors)) {+ payload.connectors := inputs.connectors+}++if (not empty(inputs.posthog_mcp_scopes)) {+ payload.posthog_mcp_scopes := inputs.posthog_mcp_scopes+}++if (not empty(inputs.max_parallel_tasks)) {+ payload.max_parallel_tasks := inputs.max_parallel_tasks+}++let response := postHogCreateTask(payload)++if (response.status == 409) {+ print(f'Task not created: {apiErrorMessage(response)}')+ return { 'skipped': true, 'reason': apiErrorMessage(response) }+}++if (response.status >= 400) {+ throw Error(f'Failed to create task ({response.status}): {apiErrorMessage(response)}')+}++return response.body+`,+ inputs_schema: [+ {+ key: 'prompt',+ type: 'string',+ label: 'Instructions',+ secret: false,+ required: true,+ description: 'What the agent should do. Supports variable templating.',+ },+ {+ key: 'title',+ type: 'string',+ label: 'Task title',+ secret: false,+ required: false,+ description: 'Name shown in the task list. Leave empty to name the task from the instructions.',+ },+ {+ key: 'model',+ type: 'task_model',+ label: 'Model',+ secret: false,+ required: false,+ description: 'Model and reasoning effort for the agent. Leave empty to use the default model.',+ },+ {+ key: 'repository',+ type: 'task_repository',+ label: 'Repository',+ secret: false,+ required: false,+ description:+ 'GitHub repository the agent works in, e.g. your-org/your-repo. Leave empty for no repository.',+ },+ {+ key: 'connectors',+ type: 'task_mcp_installations',+ label: 'Connectors',+ secret: false,+ required: false,+ description:+ 'Connectors from the MCP store the agent can use. Team-shared connections and the workflow creator’s own connections are available.',+ },+ {+ key: 'posthog_mcp_scopes',+ type: 'choice',+ label: 'PostHog access',+ secret: false,+ required: false,+ default: 'read_only',+ choices: [+ { label: 'Read only', value: 'read_only' },+ { label: 'Full access', value: 'full' },+ ],+ description: 'What the agent can do in your PostHog project. Read only blocks changes.',+ },+ {+ key: 'max_parallel_tasks',+ type: 'number',+ label: 'Maximum parallel tasks',+ secret: false,+ required: false,+ default: 5,+ description:+ 'New runs are skipped while this many tasks from this workflow are still running. Protects against a burst of trigger events starting too many agents at once.',+ },+ {+ // The engine treats a 4xx as a step failure before the code above runs, unless the+ // status is listed here. 409 is the "task limit reached" reply, which the code turns+ // into a graceful skip.+ key: 'non_failure_status_codes',+ type: 'non_failure_status_codes',+ label: 'Non-failure status codes',+ secret: false,+ required: false,+ hidden: true,+ default: [409],+ },+ ],+}diff --git a/nodejs/src/cdp/templates/index.ts b/nodejs/src/cdp/templates/index.tsindex 28ee0ddcb2f0..96277cb0aaee 100644--- a/nodejs/src/cdp/templates/index.ts+++ b/nodejs/src/cdp/templates/index.ts@@ -31,6 +31,7 @@ import { template as posthogTagAccountTemplate } from './_destinations/posthog_cimport { template as posthogUpdateAccountPropertyTemplate } from './_destinations/posthog_customer_analytics/posthog-update-account-property.template'import { template as posthogUpdateAccountRelationshipsTemplate } from './_destinations/posthog_customer_analytics/posthog-update-account-relationships.template'import { template as posthogUpdateAccountTemplate } from './_destinations/posthog_customer_analytics/posthog-update-account.template'+import { template as posthogCreateTaskTemplate } from './_destinations/posthog_tasks/posthog-create-task.template'import { template as posthogSetHogflowVariableTemplate } from './_destinations/posthog_workflows/posthog-set-variable.template'import { template as pushTemplate } from './_destinations/push/push.template'import { template as redditAdsTemplate } from './_destinations/reddit_ads/reddit.template'@@ -91,6 +92,7 @@ export const HOG_FUNCTION_TEMPLATES_DESTINATIONS: HogFunctionTemplate[] = [posthogSetHogflowVariableTemplate,posthogGetTicketTemplate,posthogUpdateTicketTemplate,+ posthogCreateTaskTemplate,posthogCreateAccountTemplate,posthogGetAccountTemplate,posthogTagAccountTemplate,diff --git a/nodejs/src/cdp/templates/test/test-helpers.ts b/nodejs/src/cdp/templates/test/test-helpers.tsindex bca2ea408375..83658e7b2736 100644--- a/nodejs/src/cdp/templates/test/test-helpers.ts+++ b/nodejs/src/cdp/templates/test/test-helpers.ts@@ -274,7 +274,8 @@ export class TemplateTester {async invoke(_inputs: Record<string, any>,- _globals?: DeepPartialHogFunctionInvocationGlobals+ _globals?: DeepPartialHogFunctionInvocationGlobals,+ _options?: { hogFlow?: { id: string }; actionId?: string }): Promise<CyclotronJobInvocationResult<CyclotronJobInvocationHogFunction>> {if (this.template.mapping_templates) {throw new Error('Mapping templates found. Use invokeMapping instead.')@@ -301,6 +302,14 @@ export class TemplateTester {const globalsWithInputs = await this.hogExecutor.hogExecutor.buildInputsWithGlobals(hogFunction, globals)const invocation = createInvocation(globalsWithInputs, hogFunction)+ // Workflow-only async functions read the flow id and step id off the invocation the way+ // HogFlowFunctionsService sets them; there is no flow in this harness, so inject them.+ if (_options?.hogFlow) {+ ;(invocation as { hogFlow?: { id: string } }).hogFlow = _options.hogFlow+ }+ if (_options?.actionId) {+ invocation.state.actionId = _options.actionId+ }const transformationFunctions = getTransformationFunctions(this.geoIp!)const extraFunctions = invocation.hogFunction.type === 'transformation' ? transformationFunctions : {}diff --git a/nodejs/src/cdp/types.ts b/nodejs/src/cdp/types.tsindex 80e6ab9b4205..31d18aa99871 100644--- a/nodejs/src/cdp/types.ts+++ b/nodejs/src/cdp/types.ts@@ -476,6 +476,9 @@ export type HogFunctionInputSchemaType = {| 'non_failure_status_codes'| 'customer_analytics_account_properties'| 'customer_analytics_account_relationships'+ | 'task_model'+ | 'task_repository'+ | 'task_mcp_installations'key: stringlabel?: stringchoices?: { value: string; label: string }[]diff --git a/nodejs/src/cdp/utils/jwt-utils.ts b/nodejs/src/cdp/utils/jwt-utils.tsindex 97b8ca15925e..6ccdeea6cefa 100644--- a/nodejs/src/cdp/utils/jwt-utils.ts+++ b/nodejs/src/cdp/utils/jwt-utils.ts@@ -6,6 +6,7 @@ export enum PosthogJwtAudience {WORKFLOWS_RESCHEDULE_PARKED = 'posthog:workflows:reschedule_parked',WORKFLOWS_CANCEL_INVOCATIONS = 'posthog:workflows:cancel_invocations',WORKFLOWS_CANCEL_BATCH = 'posthog:workflows:cancel_batch',+ TASKS_CREATE = 'posthog:tasks:create',}export class JWT {diff --git a/nodejs/src/cdp/workflows-e2e.test.ts b/nodejs/src/cdp/workflows-e2e.test.tsindex cae38ef8c4be..05da2a84d8df 100644--- a/nodejs/src/cdp/workflows-e2e.test.ts+++ b/nodejs/src/cdp/workflows-e2e.test.ts@@ -15,6 +15,7 @@ import { mockFetch, mockInternalFetch } from '~/tests/helpers/mocks/request.mockimport { KafkaProducerObserver } from '~/tests/helpers/mocks/producer.spy'+import jsonwebtoken from 'jsonwebtoken'import { DateTime } from 'luxon'import { Pool } from 'pg'import { register } from 'prom-client'@@ -22,6 +23,7 @@ import supertest from 'supertest'import express from 'ultimate-express'import { HogFlow } from '~/cdp/schema/hogflow'+import { template as createTaskTemplate } from '~/cdp/templates/_destinations/posthog_tasks/posthog-create-task.template'import { setupExpressApp } from '~/common/api/router'import {KAFKA_APP_METRICS_2,@@ -2218,6 +2220,117 @@ describe('Workflows E2E (postgres-v2)', () => {})})+ describe('create AI task action', () => {+ let flowId: string++ beforeEach(async () => {+ // The real template, not a fixture copy: this block exists to prove the shipped hog+ // compiles and drives the registered async function inside a running workflow, which+ // is the execution path a template-level test never touches.+ await insertHogFunctionTemplate(hub.postgres, {+ id: createTaskTemplate.id,+ name: createTaskTemplate.name,+ code: createTaskTemplate.code,+ inputs_schema: createTaskTemplate.inputs_schema,+ })++ const flow = await createWorkflowFlow({+ actions: {+ trigger: trigger(),+ function_1: {+ type: 'function',+ config: {+ template_id: createTaskTemplate.id,+ inputs: {+ prompt: { value: 'Investigate the error spike' },+ title: { value: 'Error spike' },+ non_failure_status_codes: { value: [409] },+ },+ },+ },+ exit: exitAction(),+ },+ edges: [+ { from: 'trigger', to: 'function_1', type: 'continue' },+ { from: 'function_1', to: 'exit', type: 'continue' },+ ],+ })+ flowId = flow.id+ globals = createGlobals()+ })++ const runMetricNames = (): string[] =>+ mockProducerObserver+ .getProducedKafkaMessagesForTopic(KAFKA_APP_METRICS_2)+ .filter((m: any) => m.value.app_source === 'hog_flow' && m.value.app_source_id === flowId)+ .map((m: any) => m.value.metric_name)++ it('creates the task through the real registered async function', async () => {+ mockFetch.mockResolvedValue({+ status: 201,+ headers: { 'Content-Type': 'application/json' },+ json: () => Promise.resolve({ id: 'task-1', run_id: 'run-1' }),+ text: () => Promise.resolve(JSON.stringify({ id: 'task-1', run_id: 'run-1' })),+ dump: () => Promise.resolve(),+ } as any)++ await triggerWorkflow(globals)++ await waitForExpect(() => {+ expect(mockFetch).toHaveBeenCalledTimes(1)+ }, 10000)++ const [url, options] = mockFetch.mock.calls[0]+ expect(url).toEqual(`${hub.SITE_URL}/api/projects/${team.id}/workflow_tasks/`)+ expect(options.method).toEqual('POST')++ // Step-scoped dedupe key: run id + action id, so a second task step in the same run+ // would not collide with this one.+ expect(parseJSON(options.body)).toEqual({+ prompt: 'Investigate the error spike',+ title: 'Error spike',+ idempotency_key: expect.stringMatching(/^[0-9a-f-]{36}:function_1$/),+ })++ // The endpoint trusts these claims to resolve the workflow owner, so the token has to+ // verify against the shared dev secret with exactly this audience and flow id.+ const token = (options.headers['Authorization'] as string).replace('Bearer ', '')+ // The literal pins the cross-language contract: Django's TASKS_CREATE_JWT_SECRET dev default+ // (posthog/settings/data_stores.py) must match the nodejs one or local runs 401.+ // nosemgrep: javascript.jsonwebtoken.security.jwt-hardcode.hardcoded-jwt-secret+ const claims = jsonwebtoken.verify(token, 'local-dev-tasks-create-jwt', {+ audience: 'posthog:tasks:create',+ algorithms: ['HS256'],+ }) as jsonwebtoken.JwtPayload+ expect(claims.team_id).toEqual(team.id)+ expect(claims.hog_flow_id).toEqual(flowId)++ await waitForExpect(() => {+ expect(runMetricNames()).toContain('succeeded')+ }, 10000)+ expect(runMetricNames()).not.toContain('failed')+ })++ it('completes the run without a failure when the task limit replies 409', async () => {+ mockFetch.mockResolvedValue({+ status: 409,+ headers: { 'Content-Type': 'application/json' },+ json: () => Promise.resolve({ detail: 'This workflow already has 5 tasks running' }),+ text: () => Promise.resolve(JSON.stringify({ detail: 'This workflow already has 5 tasks running' })),+ dump: () => Promise.resolve(),+ } as any)++ await triggerWorkflow(globals)++ await waitForExpect(() => {+ expect(runMetricNames()).toContain('succeeded')+ }, 10000)+ expect(runMetricNames()).not.toContain('failed')+ // 409 is terminal for the step: one request, no retry burning the engine's budget.+ expect(mockFetch).toHaveBeenCalledTimes(1)+ })+ })+describe('heartbeat during long batches', () => {let janitor: CyclotronV2Janitordiff --git a/posthog/cdp/flag_gated_templates.py b/posthog/cdp/flag_gated_templates.pynew file mode 100644index 000000000000..f21825235671--- /dev/null+++ b/posthog/cdp/flag_gated_templates.py@@ -0,0 +1,50 @@+from typing import TYPE_CHECKING++import structlog+import posthoganalytics++if TYPE_CHECKING:+ from posthog.models import Team++logger = structlog.get_logger(__name__)++# Pre-release templates a team can neither see nor use until it has the named feature flag:+# the authenticated template list drops them, and workflow validation rejects them as+# "Template not found". The flag key is shared with FEATURE_FLAGS in+# frontend/src/lib/constants.tsx. Remove an entry when its feature goes GA.+FLAG_GATED_TEMPLATE_IDS = {+ "template-posthog-create-task": "workflow-ai-task-action",+}+++def gated_template_enabled(flag_key: str, team: "Team") -> bool:+ # A flag-eval blip hides the pre-release template rather than exposing it: fail closed.+ try:+ return bool(+ posthoganalytics.feature_enabled(+ flag_key,+ str(team.uuid),+ groups={"organization": str(team.organization_id), "project": str(team.id)},+ group_properties={+ "organization": {"id": str(team.organization_id)},+ "project": {"id": str(team.id)},+ },+ )+ )+ except Exception:+ logger.warning(+ "cdp.gated_template_flag_check_failed_defaulting_off",+ team_id=team.id,+ flag=flag_key,+ exc_info=True,+ )+ return False+++def hidden_gated_template_ids(team: "Team") -> list[str]:+ """Template ids this team must not see, per the flag map above."""+ return [+ template_id+ for template_id, flag_key in FLAG_GATED_TEMPLATE_IDS.items()+ if not gated_template_enabled(flag_key, team)+ ]diff --git a/posthog/cdp/test/test_validation.py b/posthog/cdp/test/test_validation.pyindex 6719ee6295d7..d224264b3e09 100644--- a/posthog/cdp/test/test_validation.py+++ b/posthog/cdp/test/test_validation.py@@ -3,6 +3,8 @@ import jsonimport pytestfrom posthog.test.base import APIBaseTest, ClickhouseTestMixin, QueryMatchingTest+from django.test import SimpleTestCase+from parameterized import parameterizedfrom rest_framework.exceptions import ValidationError@@ -1139,3 +1141,33 @@ class TestHogFunctionValidation(ClickhouseTestMixin, APIBaseTest, QueryMatchingT)# The original value round-trips so the UI can still render the templated source string.assert validated["tags"]["value"] == value+++class TestTaskInputTypeValidation(SimpleTestCase):+ # The task_* input types are authored programmatically (workflow API, MCP agents), so the+ # serializer is the only guard against a payload shape the tasks endpoint would reject at+ # run time - long after the workflow saved fine.+ @parameterized.expand(+ [+ ("repository_string", "task_repository", "example-org/example-repo", True),+ ("repository_not_string", "task_repository", 123, False),+ ("model_full", "task_model", {"model": "claude-sonnet-5", "reasoning_effort": "high"}, True),+ ("model_without_effort", "task_model", {"model": "claude-sonnet-5"}, True),+ ("model_not_dict", "task_model", "claude-sonnet-5", False),+ ("model_value_not_string", "task_model", {"model": 5}, False),+ ("model_key_absent", "task_model", {"reasoning_effort": "high"}, False),+ ("model_value_empty_string", "task_model", {"model": ""}, False),+ ("installations_string_list", "task_mcp_installations", ["id-1", "id-2"], True),+ ("installations_not_list", "task_mcp_installations", "id-1", False),+ ("installations_not_strings", "task_mcp_installations", [1, 2], False),+ ]+ )+ def test_task_input_value_shapes(self, _name, schema_type, value, expect_valid):+ schema = [{"key": "field", "type": schema_type, "label": "Field", "required": False}]+ inputs = {"field": {"value": value}}++ if expect_valid:+ validate_inputs(schema, inputs)+ else:+ with pytest.raises(ValidationError):+ validate_inputs(schema, inputs)diff --git a/posthog/cdp/validation.py b/posthog/cdp/validation.pyindex d343a4199f80..6746cb352700 100644--- a/posthog/cdp/validation.py+++ b/posthog/cdp/validation.py@@ -457,6 +457,9 @@ class InputsSchemaItemSerializer(serializers.Serializer):"non_failure_status_codes","customer_analytics_account_properties","customer_analytics_account_relationships",+ "task_model",+ "task_repository",+ "task_mcp_installations",])key = serializers.CharField()@@ -547,6 +550,30 @@ class InputsItemSerializer(serializers.Serializer):elif item_type == "integration_multi":if not isinstance(value, list) or not all(isinstance(v, int) and not isinstance(v, bool) for v in value):raise serializers.ValidationError({"input": "Value must be a list of Integration IDs."})+ elif item_type == "task_repository":+ if not isinstance(value, str):+ raise serializers.ValidationError({"input": "Value must be a repository name like your-org/your-repo."})+ elif item_type == "task_model":+ # A non-empty value means a model was chosen (an empty value returned above as "use the+ # default model"), so it must name a usable model. Otherwise the run-time consumer drops+ # the setting and the task silently falls back to the default, which this guard exists to+ # prevent for programmatically authored workflows.+ model = value.get("model") if isinstance(value, dict) else None+ reasoning_effort = value.get("reasoning_effort") if isinstance(value, dict) else None+ if (+ not isinstance(value, dict)+ or not isinstance(model, str)+ or not model+ or (reasoning_effort is not None and not isinstance(reasoning_effort, str))+ ):+ raise serializers.ValidationError(+ {+ "input": "Value must be an object with a non-empty 'model' string and an optional 'reasoning_effort' string."+ }+ )+ elif item_type == "task_mcp_installations":+ if not isinstance(value, list) or not all(isinstance(v, str) for v in value):+ raise serializers.ValidationError({"input": "Value must be a list of MCP connector IDs."})elif item_type == "email" or item_type == "native_email":if not isinstance(value, dict):raise serializers.ValidationError({"input": f"Value must be an email object."})diff --git a/products/cdp/backend/api/hog_function_template.py b/products/cdp/backend/api/hog_function_template.pyindex 4efde0c0a70b..13d8230d82a4 100644--- a/products/cdp/backend/api/hog_function_template.py+++ b/products/cdp/backend/api/hog_function_template.py@@ -10,6 +10,7 @@ from rest_framework.exceptions import NotFoundfrom rest_framework.request import Requestfrom posthog.auth import OAuthAccessTokenAuthentication, PersonalAPIKeyAuthentication, SessionAuthentication+from posthog.cdp.flag_gated_templates import FLAG_GATED_TEMPLATE_IDS, hidden_gated_template_idsfrom posthog.models.team import Teamfrom posthog.models.user import Userfrom posthog.permissions import APIScopePermission@@ -153,6 +154,14 @@ class PublicHogFunctionTemplateViewSet(# from the destinations chooser separately. Only strip them from the anonymous catalog.if self.request.path.startswith("/api/public_hog_function_templates"):queryset = queryset.exclude(status="hidden")+ queryset = queryset.exclude(template_id__in=list(FLAG_GATED_TEMPLATE_IDS))+ else:+ # Flag-gated pre-release templates stay invisible to teams without the flag, so an+ # agent listing templates can't discover a step that workflow validation would then+ # reject as "Template not found".+ gated_ids = hidden_gated_template_ids(self.team)+ if gated_ids:+ queryset = queryset.exclude(template_id__in=gated_ids)return querysetdiff --git a/products/cdp/backend/api/test/test_hog_function_templates.py b/products/cdp/backend/api/test/test_hog_function_templates.pyindex c12b3b6e43c0..7ea284ba6ea4 100644--- a/products/cdp/backend/api/test/test_hog_function_templates.py+++ b/products/cdp/backend/api/test/test_hog_function_templates.py@@ -2,6 +2,7 @@ import osimport jsonfrom posthog.test.base import APIBaseTest, ClickhouseTestMixin, QueryMatchingTest+from unittest.mock import patchfrom parameterized import parameterizedfrom rest_framework import status@@ -328,6 +329,32 @@ class TestHogFunctionTemplates(ClickhouseTestMixin, APIBaseTest, QueryMatchingTeassert response.status_code == status.HTTP_200_OK, response.json()assert "template-hidden" in [template["id"] for template in response.json()["results"]]+ @parameterized.expand([("flag_on", True), ("flag_off", False)])+ def test_flag_gated_template_visibility_follows_the_flag(self, _name, flag_enabled):+ # A flag-gated pre-release template must stay undiscoverable for teams without the flag:+ # an agent that can list it would try to use it and loop on "Template not found". Ordinary+ # hidden templates keep being listed (the workflow editor depends on that, see above).+ HogFunctionTemplate.objects.create(+ template_id="template-posthog-create-task",+ sha="1.0.0",+ name="Create AI task",+ description="A flag-gated template",+ code="return event",+ code_language="hog",+ inputs_schema={},+ type="destination",+ status="hidden",+ category=["Other"],+ free=True,+ )++ with patch("posthog.cdp.flag_gated_templates.gated_template_enabled", return_value=flag_enabled):+ response = self.client.get(f"/api/projects/{self.team.id}/hog_function_templates/")++ assert response.status_code == status.HTTP_200_OK, response.json()+ listed_ids = [template["id"] for template in response.json()["results"]]+ assert ("template-posthog-create-task" in listed_ids) is flag_enabled+def test_hidden_templates_excluded_from_public_catalog(self):HogFunctionTemplate.objects.create(template_id="template-hidden",diff --git a/products/cdp/frontend/generated/api.schemas.ts b/products/cdp/frontend/generated/api.schemas.tsindex 8f8a7cae01b0..190d9055cb4e 100644--- a/products/cdp/frontend/generated/api.schemas.ts+++ b/products/cdp/frontend/generated/api.schemas.ts@@ -281,6 +281,9 @@ export const HogFunctionTypeEnumApi = {* * `non_failure_status_codes` - non_failure_status_codes* * `customer_analytics_account_properties` - customer_analytics_account_properties* * `customer_analytics_account_relationships` - customer_analytics_account_relationships+ * * `task_model` - task_model+ * * `task_repository` - task_repository+ * * `task_mcp_installations` - task_mcp_installations*/export type InputsSchemaItemTypeEnumApi = (typeof InputsSchemaItemTypeEnumApi)[keyof typeof InputsSchemaItemTypeEnumApi]@@ -302,6 +305,9 @@ export const InputsSchemaItemTypeEnumApi = {NonFailureStatusCodes: 'non_failure_status_codes',CustomerAnalyticsAccountProperties: 'customer_analytics_account_properties',CustomerAnalyticsAccountRelationships: 'customer_analytics_account_relationships',+ TaskModel: 'task_model',+ TaskRepository: 'task_repository',+ TaskMcpInstallations: 'task_mcp_installations',} as constexport type InputsSchemaItemApiChoicesItem = { [key: string]: unknown }diff --git a/products/cdp/frontend/generated/api.zod.ts b/products/cdp/frontend/generated/api.zod.tsindex 56b84b08e9ec..b8769d3cf289 100644--- a/products/cdp/frontend/generated/api.zod.ts+++ b/products/cdp/frontend/generated/api.zod.ts@@ -80,9 +80,12 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({'non_failure_status_codes','customer_analytics_account_properties','customer_analytics_account_relationships',+ 'task_model',+ 'task_repository',+ 'task_mcp_installations',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations'),key: zod.string(),label: zod.string().optional(),@@ -180,9 +183,12 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({'non_failure_status_codes','customer_analytics_account_properties','customer_analytics_account_relationships',+ 'task_model',+ 'task_repository',+ 'task_mcp_installations',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations'),key: zod.string(),label: zod.string().optional(),@@ -337,9 +343,12 @@ export const HogFunctionsUpdateBody = /* @__PURE__ */ zod.object({'non_failure_status_codes','customer_analytics_account_properties','customer_analytics_account_relationships',+ 'task_model',+ 'task_repository',+ 'task_mcp_installations',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations'),key: zod.string(),label: zod.string().optional(),@@ -437,9 +446,12 @@ export const HogFunctionsUpdateBody = /* @__PURE__ */ zod.object({'non_failure_status_codes','customer_analytics_account_properties','customer_analytics_account_relationships',+ 'task_model',+ 'task_repository',+ 'task_mcp_installations',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations'),key: zod.string(),label: zod.string().optional(),@@ -594,9 +606,12 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({'non_failure_status_codes','customer_analytics_account_properties','customer_analytics_account_relationships',+ 'task_model',+ 'task_repository',+ 'task_mcp_installations',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations'),key: zod.string(),label: zod.string().optional(),@@ -694,9 +709,12 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({'non_failure_status_codes','customer_analytics_account_properties','customer_analytics_account_relationships',+ 'task_model',+ 'task_repository',+ 'task_mcp_installations',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations'),key: zod.string(),label: zod.string().optional(),@@ -855,9 +873,12 @@ export const HogFunctionsEnableBackfillsCreateBody = /* @__PURE__ */ zod.object('non_failure_status_codes','customer_analytics_account_properties','customer_analytics_account_relationships',+ 'task_model',+ 'task_repository',+ 'task_mcp_installations',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations'),key: zod.string(),label: zod.string().optional(),@@ -955,9 +976,12 @@ export const HogFunctionsEnableBackfillsCreateBody = /* @__PURE__ */ zod.object('non_failure_status_codes','customer_analytics_account_properties','customer_analytics_account_relationships',+ 'task_model',+ 'task_repository',+ 'task_mcp_installations',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations'),key: zod.string(),label: zod.string().optional(),@@ -1188,9 +1212,12 @@ export const HogFunctionsInvocationsCreateBody = /* @__PURE__ */ zod.object({'non_failure_status_codes','customer_analytics_account_properties','customer_analytics_account_relationships',+ 'task_model',+ 'task_repository',+ 'task_mcp_installations',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations'),key: zod.string(),label: zod.string().optional(),@@ -1297,9 +1324,12 @@ export const HogFunctionsInvocationsCreateBody = /* @__PURE__ */ zod.object({'non_failure_status_codes','customer_analytics_account_properties','customer_analytics_account_relationships',+ 'task_model',+ 'task_repository',+ 'task_mcp_installations',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations'),key: zod.string(),label: zod.string().optional(),diff --git a/products/mcp_store/backend/facade/api.py b/products/mcp_store/backend/facade/api.pyindex 1713f3c5a724..0f30613e176d 100644--- a/products/mcp_store/backend/facade/api.py+++ b/products/mcp_store/backend/facade/api.py@@ -235,16 +235,22 @@ def _agent_installation_infos(return infos-def get_active_installations(team_id: int, user_id: int) -> list[ActiveInstallation]:- """Return active, ready-to-use personal MCP installations for a user.+def get_active_installations(team_id: int, user_id: int, *, include_shared: bool = False) -> list[ActiveInstallation]:+ """Return active, ready-to-use MCP installations a user can mount.- Filters out disabled installations and OAuth installations that- need reauthorization or are still pending token exchange.+ Personal installations owned by the user by default; ``include_shared`` adds the+ team's shared-scope installations, mirroring what ``get_installations_for_sandbox``+ resolves for an unmapped run. Filters out disabled installations and OAuth+ installations that need reauthorization or are still pending token exchange."""+ scope_filter = Q(scope="personal", user_id=user_id)+ if include_shared:+ scope_filter |= Q(scope="shared")try:# list() evaluates the lazy queryset here so DB errors hit this handler.installations = list(- MCPServerInstallation.objects.filter(team_id=team_id, user_id=user_id, is_enabled=True, scope="personal")+ MCPServerInstallation.objects.filter(team_id=team_id, is_enabled=True)+ .filter(scope_filter).filter(Q(gateway_server__isnull=True) | Q(gateway_server__is_team_enabled=True)).exclude(gateway_server__member_revocations__user_id=user_id).select_related("template")diff --git a/products/mcp_store/backend/test/test_facade.py b/products/mcp_store/backend/test/test_facade.pyindex b6030a182f3d..40e715e39e83 100644--- a/products/mcp_store/backend/test/test_facade.py+++ b/products/mcp_store/backend/test/test_facade.py@@ -139,6 +139,27 @@ class TestGetActiveInstallations(BaseTest):assert len(results) == 0+ def test_include_shared_adds_team_shared_but_not_teammates_personal(self) -> None:+ other_user = User.objects.create_and_join(self.organization, "[email protected]", "password")+ own_personal = self._create_installation()+ shared = self._create_installation(scope="shared", user=other_user, url="https://mcp.shared.com/mcp")+ self._create_installation(user=other_user, url="https://mcp.theirs.com/mcp")++ results = get_active_installations(self.team.id, self.user.id, include_shared=True)++ assert {result.id for result in results} == {str(own_personal.id), str(shared.id)}++ def test_include_shared_still_applies_readiness_checks(self) -> None:+ self._create_installation(scope="shared", is_enabled=False)+ self._create_installation(+ scope="shared",+ url="https://mcp.pending.com/mcp",+ auth_type="oauth",+ sensitive_configuration={},+ )++ assert get_active_installations(self.team.id, self.user.id, include_shared=True) == []+@parameterized.expand([("enabled_api_key", True, "api_key", {}, True),diff --git a/products/tasks/backend/logic/services/workflow_tasks.py b/products/tasks/backend/logic/services/workflow_tasks.pyindex a15aa7d2679a..bee4c141b4d1 100644--- a/products/tasks/backend/logic/services/workflow_tasks.py+++ b/products/tasks/backend/logic/services/workflow_tasks.py@@ -97,6 +97,11 @@ def create_workflow_task(}},"inactivity_timeout_seconds": WORKFLOW_RUN_IDLE_TIMEOUT_SECONDS,+ # The boot-path override, not pending_user_message: the agent server self-delivers a+ # pending message at boot AND forward_pending_user_message forwards it, and the two+ # deliveries carry no shared idempotency id, so a cold-start background run gets the+ # prompt twice. The override is only read by the boot path, so it delivers once.+ "initial_prompt_override": _render_run_message(prompt),}try:@@ -135,7 +140,6 @@ def create_workflow_task(extra_run_state=extra_run_state,model=model,reasoning_effort=reasoning_effort,- pending_user_message=_render_run_message(prompt),)except IntegrityError:if origin_key is None:@@ -169,7 +173,7 @@ def _find_replayed_task(def _validate_connectors(team_id: int, owner_id: int, mcp_installation_ids: list[str] | None) -> None:if not mcp_installation_ids:return- valid_ids = {installation.id for installation in get_active_installations(team_id, owner_id)}+ valid_ids = {installation.id for installation in get_active_installations(team_id, owner_id, include_shared=True)}invalid = sorted(set(mcp_installation_ids) - valid_ids)if invalid:raise WorkflowTaskConnectorsInvalid(invalid)diff --git a/products/tasks/backend/tests/test_workflow_tasks_api.py b/products/tasks/backend/tests/test_workflow_tasks_api.pyindex b82044ecd261..0b0402e0952d 100644--- a/products/tasks/backend/tests/test_workflow_tasks_api.py+++ b/products/tasks/backend/tests/test_workflow_tasks_api.py@@ -117,9 +117,33 @@ class TestWorkflowTasksAPI(APIBaseTest):assert response.status_code == status.HTTP_201_CREATED, response.json()run = TaskRun.objects.get(id=response.json()["run_id"])- message = run.state["pending_user_message"]+ message = run.state["initial_prompt_override"]assert "look into the alert" in messageassert "data, not instructions" in message+ # The agent server self-delivers the boot prompt, and forward_pending_user_message+ # delivers any pending message on top. Seeding both channels sent the prompt twice,+ # so the run must carry only the boot-path override.+ assert "pending_user_message" not in run.state++ def test_accepts_a_team_shared_connector(self) -> None:+ from products.mcp_store.backend.models import MCPServerInstallation++ other_user = self._create_user("[email protected]")+ shared = MCPServerInstallation.objects.create(+ team=self.team,+ user=other_user,+ display_name="Linear",+ url="https://mcp.linear.app/mcp",+ auth_type="api_key",+ is_enabled=True,+ scope="shared",+ )++ response = self._post({"connectors": [str(shared.id)]})++ assert response.status_code == status.HTTP_201_CREATED, response.json()+ run = TaskRun.objects.get(id=response.json()["run_id"])+ assert run.state["config_snapshot"]["connectors"]["mcp_installation_ids"] == [str(shared.id)]@patch("products.tasks.backend.logic.services.workflow_tasks.get_active_installations")def test_snapshots_validated_connectors_into_the_run(self, get_active_installations) -> None:diff --git a/products/tasks/frontend/components/TaskConnectorsPicker/CyclotronJobInputTaskConnectors.tsx b/products/tasks/frontend/components/TaskConnectorsPicker/CyclotronJobInputTaskConnectors.tsxnew file mode 100644index 000000000000..d7870f6f7436--- /dev/null+++ b/products/tasks/frontend/components/TaskConnectorsPicker/CyclotronJobInputTaskConnectors.tsx@@ -0,0 +1,54 @@+import { useValues } from 'kea'++import { LemonInputSelect, LemonTag } from '@posthog/lemon-ui'++import type { CustomInputRendererProps } from 'lib/components/CyclotronJob/customInputRenderers'++import { taskConnectorsPickerLogic } from './taskConnectorsPickerLogic'++export default function CyclotronJobInputTaskConnectors({ value, onChange }: CustomInputRendererProps): JSX.Element {+ const { installations, installationsLoading } = useValues(taskConnectorsPickerLogic)++ const selectedIds: string[] = Array.isArray(value) ? value : []+ // The run mounts the team's shared connectors and the workflow creator's own personal ones.+ // A teammate's personal installation can't mount (the run only borrows the creator's+ // credentials), so offering it here would pass the picker but fail the run.+ const enabledInstallations = installations.filter(+ (installation) =>+ installation.is_enabled !== false &&+ (installation.scope === 'shared' || (installation.scope === 'personal' && installation.is_owner))+ )++ const options = enabledInstallations.map((installation) => {+ const label = installation.display_name || installation.name+ return {+ key: installation.id,+ label,+ labelComponent: installation.needs_reauth ? (+ <span className="inline-flex items-center gap-1.5">+ {label}+ <LemonTag type="warning">Needs reauthorization</LemonTag>+ </span>+ ) : undefined,+ }+ })+ // Stored ids whose installation has since been removed or disabled still need to render,+ // so the person editing can see and remove them.+ for (const id of selectedIds) {+ if (!options.some((option) => option.key === id)) {+ options.push({ key: id, label: `Unavailable connector (${id})`, labelComponent: undefined })+ }+ }++ return (+ <LemonInputSelect+ mode="multiple"+ value={selectedIds}+ onChange={(ids) => onChange(ids)}+ options={options}+ loading={installationsLoading}+ placeholder="No connectors"+ data-attr="task-connectors-picker"+ />+ )+}diff --git a/products/tasks/frontend/components/TaskConnectorsPicker/taskConnectorsPickerLogic.ts b/products/tasks/frontend/components/TaskConnectorsPicker/taskConnectorsPickerLogic.tsnew file mode 100644index 000000000000..5bd124b5268b--- /dev/null+++ b/products/tasks/frontend/components/TaskConnectorsPicker/taskConnectorsPickerLogic.ts@@ -0,0 +1,59 @@+import { MakeLogicType, afterMount, connect, kea, path } from 'kea'+import { loaders } from 'kea-loaders'++import { projectLogic } from 'scenes/projectLogic'++import { mcpServerInstallationsList } from 'products/mcp_store/frontend/generated/api'+import type { MCPServerInstallationApi } from 'products/mcp_store/frontend/generated/api.schemas'++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface taskConnectorsPickerLogicValues {+ currentProjectId: number | null // projectLogic+ installations: MCPServerInstallationApi[]+ installationsLoading: boolean+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface taskConnectorsPickerLogicActions {+ loadInstallations: () => any+ loadInstallationsFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadInstallationsSuccess: (+ installations: MCPServerInstallationApi[],+ payload?: any+ ) => {+ installations: MCPServerInstallationApi[]+ payload?: any+ }+}++export type taskConnectorsPickerLogicType = MakeLogicType<+ taskConnectorsPickerLogicValues,+ taskConnectorsPickerLogicActions+>++export const taskConnectorsPickerLogic = kea<taskConnectorsPickerLogicType>([+ path(['products', 'tasks', 'frontend', 'components', 'TaskConnectorsPicker', 'taskConnectorsPickerLogic']),+ connect(() => ({+ values: [projectLogic, ['currentProjectId']],+ })),+ loaders(({ values }) => ({+ installations: [+ [] as MCPServerInstallationApi[],+ {+ loadInstallations: async (): Promise<MCPServerInstallationApi[]> => {+ const response = await mcpServerInstallationsList(String(values.currentProjectId))+ return response.results+ },+ },+ ],+ })),+ afterMount(({ actions }) => {+ actions.loadInstallations()+ }),+])diff --git a/products/tasks/frontend/components/TaskModelPicker/CyclotronJobInputTaskModel.tsx b/products/tasks/frontend/components/TaskModelPicker/CyclotronJobInputTaskModel.tsxnew file mode 100644index 000000000000..cf7e6d25eb61--- /dev/null+++ b/products/tasks/frontend/components/TaskModelPicker/CyclotronJobInputTaskModel.tsx@@ -0,0 +1,70 @@+import { useValues } from 'kea'++import { LemonSelect } from '@posthog/lemon-ui'++import type { CustomInputRendererProps } from 'lib/components/CyclotronJob/customInputRenderers'++import { taskModelPickerLogic } from './taskModelPickerLogic'++type TaskModelValue = { model: string; reasoning_effort?: string }++export default function CyclotronJobInputTaskModel({ value, onChange }: CustomInputRendererProps): JSX.Element {+ const { models, modelsLoading } = useValues(taskModelPickerLogic)++ const selected: Partial<TaskModelValue> = value ?? {}+ const selectedChoice = models.find((choice) => choice.model === selected.model)+ const efforts = selectedChoice?.supported_efforts ?? []++ const modelOptions = models.map((choice) => ({ value: choice.model, label: choice.display_name }))+ // A stored model that has since left the catalogue still needs to render as itself, not as blank.+ if (selected.model && !selectedChoice) {+ modelOptions.push({ value: selected.model, label: selected.model })+ }++ return (+ <div className="flex gap-2">+ <LemonSelect+ className="flex-1"+ placeholder={modelsLoading ? 'Loading models...' : 'Default model'}+ allowClear+ disabledReason={+ !modelsLoading && models.length === 0 && !selected.model+ ? 'Model list is unavailable right now. The task will use the default model.'+ : undefined+ }+ value={selected.model ?? null}+ options={modelOptions}+ onChange={(model) => {+ if (!model) {+ onChange(null)+ return+ }+ const choice = models.find((c) => c.model === model)+ const supported = choice?.supported_efforts ?? []+ // Keep the chosen effort across a model switch when the new model supports it;+ // otherwise drop it so the server applies that model's default.+ const effort =+ selected.reasoning_effort && (supported as string[]).includes(selected.reasoning_effort)+ ? selected.reasoning_effort+ : undefined+ onChange(effort ? { model, reasoning_effort: effort } : { model })+ }}+ data-attr="task-model-picker-model"+ />+ {efforts.length > 0 && (+ <LemonSelect+ placeholder="Default effort"+ allowClear+ value={selected.reasoning_effort ?? null}+ options={efforts.map((effort) => ({ value: effort, label: effort }))}+ onChange={(effort) =>+ onChange(+ effort ? { model: selected.model, reasoning_effort: effort } : { model: selected.model }+ )+ }+ data-attr="task-model-picker-effort"+ />+ )}+ </div>+ )+}diff --git a/products/tasks/frontend/components/TaskModelPicker/taskModelPickerLogic.ts b/products/tasks/frontend/components/TaskModelPicker/taskModelPickerLogic.tsnew file mode 100644index 000000000000..f7f0c12f26bf--- /dev/null+++ b/products/tasks/frontend/components/TaskModelPicker/taskModelPickerLogic.ts@@ -0,0 +1,56 @@+import { MakeLogicType, afterMount, connect, kea, path } from 'kea'+import { loaders } from 'kea-loaders'++import { projectLogic } from 'scenes/projectLogic'++import { tasksModelsRetrieve } from 'products/tasks/frontend/generated/api'+import type { ModelChoiceApi } from 'products/tasks/frontend/generated/api.schemas'++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface taskModelPickerLogicValues {+ currentProjectId: number | null // projectLogic+ models: ModelChoiceApi[]+ modelsLoading: boolean+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface taskModelPickerLogicActions {+ loadModels: () => any+ loadModelsFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadModelsSuccess: (+ models: ModelChoiceApi[],+ payload?: any+ ) => {+ models: ModelChoiceApi[]+ payload?: any+ }+}++export type taskModelPickerLogicType = MakeLogicType<taskModelPickerLogicValues, taskModelPickerLogicActions>++export const taskModelPickerLogic = kea<taskModelPickerLogicType>([+ path(['products', 'tasks', 'frontend', 'components', 'TaskModelPicker', 'taskModelPickerLogic']),+ connect(() => ({+ values: [projectLogic, ['currentProjectId']],+ })),+ loaders(({ values }) => ({+ models: [+ [] as ModelChoiceApi[],+ {+ loadModels: async (): Promise<ModelChoiceApi[]> => {+ const response = await tasksModelsRetrieve(String(values.currentProjectId))+ return response.models+ },+ },+ ],+ })),+ afterMount(({ actions }) => {+ actions.loadModels()+ }),+])diff --git a/products/tasks/frontend/components/TaskRepositoryPicker/CyclotronJobInputTaskRepository.tsx b/products/tasks/frontend/components/TaskRepositoryPicker/CyclotronJobInputTaskRepository.tsxnew file mode 100644index 000000000000..92088c307950--- /dev/null+++ b/products/tasks/frontend/components/TaskRepositoryPicker/CyclotronJobInputTaskRepository.tsx@@ -0,0 +1,70 @@+import { useValues } from 'kea'+import { useState } from 'react'++import { IconGithub } from '@posthog/icons'+import { LemonButton, LemonSelect } from '@posthog/lemon-ui'++import api from 'lib/api'+import type { CustomInputRendererProps } from 'lib/components/CyclotronJob/customInputRenderers'+import { GitHubRepositoryCombobox } from 'lib/integrations/GitHubRepositoryCombobox'+import { integrationsLogic } from 'lib/integrations/integrationsLogic'++export default function CyclotronJobInputTaskRepository({ value, onChange }: CustomInputRendererProps): JSX.Element {+ const { getIntegrationsByKind, integrationsLoading } = useValues(integrationsLogic)+ const githubIntegrations = getIntegrationsByKind(['github'])++ // Which GitHub org to browse is view state only: the saved value is the `owner/repo` string,+ // which already names the org, so the choice never needs to persist.+ const [browsedIntegrationId, setBrowsedIntegrationId] = useState<number | null>(null)+ const integrationId = browsedIntegrationId ?? githubIntegrations[0]?.id++ if (integrationsLoading) {+ return (+ <LemonButton size="small" type="secondary" icon={<IconGithub />} disabled>+ GitHub+ </LemonButton>+ )+ }++ if (githubIntegrations.length === 0) {+ return (+ <LemonButton+ size="small"+ type="secondary"+ icon={<IconGithub />}+ // Return to the current workflow editor after authorizing, not the workflows list,+ // so the user keeps their place instead of having to find and reopen the step.+ to={api.integrations.authorizeUrl({+ kind: 'github',+ next: window.location.pathname + window.location.search + window.location.hash,+ })}+ disableClientSideRouting+ >+ Connect GitHub+ </LemonButton>+ )+ }++ return (+ <div className="flex items-center gap-2 flex-wrap">+ {githubIntegrations.length > 1 && (+ <LemonSelect+ size="small"+ value={integrationId}+ options={githubIntegrations.map((integration) => ({+ value: integration.id,+ label: integration.display_name,+ }))}+ onChange={(id) => setBrowsedIntegrationId(id)}+ data-attr="task-repository-picker-integration"+ />+ )}+ <GitHubRepositoryCombobox+ integrationId={integrationId}+ value={typeof value === 'string' ? value : ''}+ onChange={(repository) => onChange(repository ?? null)}+ showNoneOption+ />+ </div>+ )+}diff --git a/products/workflows/backend/api/hog_flow.py b/products/workflows/backend/api/hog_flow.pyindex d6f207928ebb..0d27b13c3608 100644--- a/products/workflows/backend/api/hog_flow.py+++ b/products/workflows/backend/api/hog_flow.py@@ -56,6 +56,7 @@ from posthog.api.shared import UserBasicSerializerfrom posthog.api.utils import log_activity_from_viewsetfrom posthog.auth import InternalAPIAuthenticationfrom posthog.cdp.filters import compile_filters_expr+from posthog.cdp.flag_gated_templates import FLAG_GATED_TEMPLATE_IDS, gated_template_enabledfrom posthog.cdp.validation import (HogFunctionFiltersSerializer,InputsSchemaItemSerializer,@@ -1297,6 +1298,14 @@ class HogFlowActionSerializer(serializers.Serializer):if get_team is not None:_apply_email_template_content(config, get_team(), strict, self.context)template = HogFunctionTemplate.get_template(template_id)+ gating_flag = FLAG_GATED_TEMPLATE_IDS.get(template_id)+ already_stored = data.get("id") in (self.context.get("stored_gated_template_action_ids") or set())+ if template is not None and gating_flag is not None and not already_stored:+ # Outside a request (internal re-saves, direct construction) there is no team to+ # evaluate the flag against, and the flow was already allowed to hold this step.+ get_team = self.context.get("get_team")+ if get_team is not None and not gated_template_enabled(gating_flag, get_team()):+ template = Noneif not template:if strict:raise serializers.ValidationError({"template_id": _describe_unknown_template(data, template_id)})@@ -2044,6 +2053,21 @@ class HogFlowSerializer(HogFlowMinimalSerializer):if isinstance(action, dict) and action.get("id") and action.get("type") == "wait_until_condition"}+ # Action ids already stored with a flag-gated template, so the gate only polices new+ # adoption: a flow that was allowed to hold the step keeps validating after a flag+ # dial-down or eval blip (the gate fails closed), instead of becoming un-editable and+ # failing refresh_hog_flows. Only an active flow's steps count - active means the step+ # passed the gate at activation, whereas a draft can hold the step without ever passing+ # it (lenient web saves skip strict validation), so grandfathering a draft would let an+ # unflagged team activate the step.+ self.context["stored_gated_template_action_ids"] = {+ action["id"]+ for action in ((instance.actions if instance and instance.status == HogFlow.State.ACTIVE else None) or [])+ if isinstance(action, dict)+ and action.get("id")+ and (action.get("config") or {}).get("template_id") in FLAG_GATED_TEMPLATE_IDS+ }+status = data.get("status")if status is None and instance:status = instance.statusdiff --git a/products/workflows/backend/api/test/test_hog_flow.py b/products/workflows/backend/api/test/test_hog_flow.pyindex 6accb83e1ac4..9a225d542815 100644--- a/products/workflows/backend/api/test/test_hog_flow.py+++ b/products/workflows/backend/api/test/test_hog_flow.py@@ -1,6 +1,7 @@import jsonfrom copy import deepcopyfrom datetime import UTC, datetime, timedelta+from io import StringIOfrom typing import Any, Optionalfrom posthog.test.base import APIBaseTest, ClickhouseTestMixin@@ -13,6 +14,7 @@ from django.test import override_settingsfrom parameterized import parameterizedfrom rest_framework import status+from posthog.cdp.flag_gated_templates import gated_template_enabledfrom posthog.cdp.templates.fixtures import template_slackfrom posthog.cdp.templates.hog_function_template import sync_template_to_dbfrom posthog.constants import AvailableFeature@@ -4888,3 +4890,166 @@ class TestHogFlowSecretInputs(APIBaseTest):stored = json.dumps({"actions": flow.actions, "trigger": flow.trigger, "draft": flow.draft})assert "LEGACY-SECRET" not in storedassert "DRAFT-SECRET" not in stored+++def _create_task_template() -> dict:+ template = deepcopy(webhook_template)+ template["id"] = "template-posthog-create-task"+ template["name"] = "Create AI task"+ template["inputs_schema"] = [+ {"key": "prompt", "type": "string", "label": "Instructions", "secret": False, "required": True}+ ]+ return template+++class TestFlagGatedTemplates(APIBaseTest):+ def setUp(self):+ super().setUp()+ sync_template_to_db(_create_task_template())++ def _post_flow_with_create_task_action(self):+ trigger_action = {+ "id": "trigger_node",+ "name": "trigger_1",+ "type": "trigger",+ "config": {+ "type": "event",+ "filters": {"events": [{"id": "$pageview", "name": "$pageview", "type": "events", "order": 0}]},+ },+ }+ action = {+ "id": "action_1",+ "name": "action_1",+ "type": "function",+ "config": {"template_id": "template-posthog-create-task", "inputs": {"prompt": {"value": "Investigate"}}},+ }+ # The MCP client header selects strict validation - the path agents and API callers+ # actually use. Web-client draft saves stay lenient; the gate holds at publish there.+ return self.client.post(+ f"/api/projects/{self.team.id}/hog_flows",+ {"name": "Test Flow", "actions": [trigger_action, action], "edges": []},+ HTTP_X_POSTHOG_CLIENT="mcp",+ )++ def _post_flow_with_create_task_action_as_web(self):+ trigger_action = {+ "id": "trigger_node",+ "name": "trigger_1",+ "type": "trigger",+ "config": {+ "type": "event",+ "filters": {"events": [{"id": "$pageview", "name": "$pageview", "type": "events", "order": 0}]},+ },+ }+ action = {+ "id": "action_1",+ "name": "action_1",+ "type": "function",+ "config": {"template_id": "template-posthog-create-task", "inputs": {"prompt": {"value": "Investigate"}}},+ }+ return self.client.post(+ f"/api/projects/{self.team.id}/hog_flows",+ {"name": "Test Flow", "actions": [trigger_action, action], "edges": []},+ )++ @parameterized.expand(+ [+ ("flag_on", True, status.HTTP_201_CREATED),+ ("flag_off", False, status.HTTP_400_BAD_REQUEST),+ ]+ )+ def test_gated_template_requires_feature_flag(self, _name, flag_enabled, expected_status):+ # The builder hides the AI task step behind a flag, but agents and API callers write+ # workflows through this endpoint directly - without the server-side gate they could+ # attach the step on any team.+ with patch(+ "products.workflows.backend.api.hog_flow.gated_template_enabled", return_value=flag_enabled+ ) as mock_gate:+ response = self._post_flow_with_create_task_action()++ assert response.status_code == expected_status, response.json()+ assert mock_gate.call_args.args[0] == "workflow-ai-task-action"+ if expected_status == status.HTTP_400_BAD_REQUEST:+ assert "Template not found" in response.json()["detail"]++ def test_flag_eval_failure_hides_the_gated_template(self):+ # A flag-service blip must hide the pre-release step, not expose it.+ with patch(+ "posthog.cdp.flag_gated_templates.posthoganalytics.feature_enabled",+ side_effect=Exception("flag service down"),+ ):+ assert gated_template_enabled("workflow-ai-task-action", self.team) is False++ def _create_active_flow_with_gated_step(self) -> str:+ with patch("products.workflows.backend.api.hog_flow.gated_template_enabled", return_value=True):+ response = self._post_flow_with_create_task_action()+ assert response.status_code == status.HTTP_201_CREATED, response.json()+ flow_id = response.json()["id"]+ activate = self.client.patch(+ f"/api/projects/{self.team.id}/hog_flows/{flow_id}",+ {"status": "active"},+ HTTP_X_POSTHOG_CLIENT="mcp",+ )+ assert activate.status_code == status.HTTP_200_OK, activate.json()+ return flow_id++ def test_stored_gated_step_survives_the_flag_turning_off(self):+ # The gate polices new adoption. A workflow that already carries the step must keep+ # saving after a flag dial-down or eval blip, or the flow becomes un-editable and+ # refresh_hog_flows starts failing on it. Resend the stored actions, as any builder+ # save or programmatic full update does.+ flow_id = self._create_active_flow_with_gated_step()++ # No MCP header: MCP callers can't resend the whole actions array (workflows-patch-graph+ # owns that), but an active flow validates strictly for every client, so the gate still runs.+ with patch("products.workflows.backend.api.hog_flow.gated_template_enabled", return_value=False):+ response = self.client.patch(+ f"/api/projects/{self.team.id}/hog_flows/{flow_id}",+ {"name": "Renamed flow", "actions": HogFlow.objects.get(id=flow_id).actions},+ )++ assert response.status_code == status.HTTP_200_OK, response.json()++ def test_refresh_command_survives_the_flag_turning_off(self):+ self._create_active_flow_with_gated_step()++ out = StringIO()+ with patch("products.workflows.backend.api.hog_flow.gated_template_enabled", return_value=False):+ call_command("refresh_hog_flows", "--team-id", str(self.team.id), stdout=out)++ assert "Errors: 0" in out.getvalue(), out.getvalue()++ def test_a_step_smuggled_into_a_draft_cannot_activate(self):+ # Lenient web draft saves skip the gate, so an unflagged user can store the step in a+ # draft. Grandfathering must not treat that as authorization: activation re-checks the+ # flag, or the draft path becomes a gate bypass.+ with patch("products.workflows.backend.api.hog_flow.gated_template_enabled", return_value=False):+ create = self._post_flow_with_create_task_action_as_web()+ assert create.status_code == status.HTTP_201_CREATED, create.json()+ flow_id = create.json()["id"]++ response = self.client.patch(+ f"/api/projects/{self.team.id}/hog_flows/{flow_id}",+ {"status": "active"},+ )++ assert response.status_code == status.HTTP_400_BAD_REQUEST+ assert "Template not found" in str(response.json())++ def test_a_new_gated_step_is_still_rejected_on_a_flow_that_has_one(self):+ flow_id = self._create_active_flow_with_gated_step()++ second_step = {+ "id": "action_2",+ "name": "action_2",+ "type": "function",+ "config": {"template_id": "template-posthog-create-task", "inputs": {"prompt": {"value": "Another"}}},+ }+ with patch("products.workflows.backend.api.hog_flow.gated_template_enabled", return_value=False):+ response = self.client.patch(+ f"/api/projects/{self.team.id}/hog_flows/{flow_id}",+ {"actions": [*HogFlow.objects.get(id=flow_id).actions, second_step]},+ )++ assert response.status_code == status.HTTP_400_BAD_REQUEST+ assert "Template not found" in str(response.json())diff --git a/products/workflows/backend/api/workflow_tasks.py b/products/workflows/backend/api/workflow_tasks.pyindex a9b7849ede1f..399725a081f9 100644--- a/products/workflows/backend/api/workflow_tasks.py+++ b/products/workflows/backend/api/workflow_tasks.py@@ -60,7 +60,7 @@ class WorkflowTaskCreateSerializer(serializers.Serializer):connectors = serializers.ListField(child=serializers.CharField(max_length=64),required=False,- help_text="MCP server installation IDs the run may mount. Must be active installations of the workflow owner.",+ help_text="MCP server installation IDs the run may mount. Must be active team-shared installations or personal ones of the workflow owner.",)posthog_mcp_scopes = serializers.ChoiceField(choices=["read_only", "full"],diff --git a/products/workflows/frontend/Workflows/hogflows/hogFlowEditorLogic.tsx b/products/workflows/frontend/Workflows/hogflows/hogFlowEditorLogic.tsxindex 5efecc103ffc..58bcbb192a7a 100644--- a/products/workflows/frontend/Workflows/hogflows/hogFlowEditorLogic.tsx+++ b/products/workflows/frontend/Workflows/hogflows/hogFlowEditorLogic.tsx@@ -475,6 +475,9 @@ export interface hogFlowEditorLogicActions {| 'posthog_business_hours'| 'posthog_ticket_tags'| 'string'+ | 'task_mcp_installations'+ | 'task_model'+ | 'task_repository'}[]| undefinedname: string@@ -991,6 +994,9 @@ export interface hogFlowEditorLogicActions {| 'posthog_business_hours'| 'posthog_ticket_tags'| 'string'+ | 'task_mcp_installations'+ | 'task_model'+ | 'task_repository'}[]| null| undefined@@ -1281,6 +1287,9 @@ export interface hogFlowEditorLogicActions {| 'posthog_business_hours'| 'posthog_ticket_tags'| 'string'+ | 'task_mcp_installations'+ | 'task_model'+ | 'task_repository'}[]| undefinedname: string@@ -1797,6 +1806,9 @@ export interface hogFlowEditorLogicActions {| 'posthog_business_hours'| 'posthog_ticket_tags'| 'string'+ | 'task_mcp_installations'+ | 'task_model'+ | 'task_repository'}[]| null| undefineddiff --git a/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanelBuild.tsx b/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanelBuild.tsxindex 623750da5b4d..6bb22fbc5be1 100644--- a/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanelBuild.tsx+++ b/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanelBuild.tsx@@ -62,6 +62,20 @@ const PUSH_NOTIFICATION_ACTION_NODE: CreateActionType = {config: { template_id: 'template-native-push', inputs: {} },}+const AI_TASK_ACTION_NODE: CreateActionType = {+ type: 'function',+ name: 'Create AI task',+ description: 'Start an AI agent task with instructions from this workflow.',+ config: {+ template_id: 'template-posthog-create-task',+ // Pinned rather than relying on the template default: the engine only reads+ // action.config.inputs at execution time, and this value is what turns a 409+ // "task limit reached" reply into a graceful skip instead of a failed step.+ inputs: { non_failure_status_codes: { value: [409] } },+ },+ output_variable: { key: 'task', result_path: null, label: 'Task' },+}+const DEFAULT_DELAY = '10m'export const DELAY_NODES_TO_SHOW: CreateActionType[] = [{@@ -314,6 +328,14 @@ export function HogFlowEditorPanelBuild(): JSX.Element {</span></HogFlowEditorToolbarNode>)}+ {featureFlags[FEATURE_FLAGS.WORKFLOW_AI_TASK_ACTION] && (+ <HogFlowEditorToolbarNode key="ai-task" action={AI_TASK_ACTION_NODE}>+ <span className="inline-flex items-center gap-1.5">+ {AI_TASK_ACTION_NODE.name}+ <LemonTag type="completion">Beta</LemonTag>+ </span>+ </HogFlowEditorToolbarNode>+ )}<HogFunctionTemplatesChooser /><span className="flex gap-2 text-sm font-semibold mt-2 items-center">diff --git a/products/workflows/frontend/Workflows/hogflows/steps/stepDelayLogic.ts b/products/workflows/frontend/Workflows/hogflows/steps/stepDelayLogic.tsindex 63b708014cca..cbec9c77c12a 100644--- a/products/workflows/frontend/Workflows/hogflows/steps/stepDelayLogic.ts+++ b/products/workflows/frontend/Workflows/hogflows/steps/stepDelayLogic.ts@@ -203,6 +203,9 @@ export interface stepDelayLogicActions {| 'posthog_business_hours'| 'posthog_ticket_tags'| 'string'+ | 'task_mcp_installations'+ | 'task_model'+ | 'task_repository'}[]| undefinedname: string@@ -480,6 +483,9 @@ export interface stepDelayLogicActions {| 'posthog_business_hours'| 'posthog_ticket_tags'| 'string'+ | 'task_mcp_installations'+ | 'task_model'+ | 'task_repository'}[]| undefinedname: stringdiff --git a/products/workflows/frontend/Workflows/hogflows/steps/stepWaitUntilTimeWindowLogic.ts b/products/workflows/frontend/Workflows/hogflows/steps/stepWaitUntilTimeWindowLogic.tsindex e62d41765d80..cdd59e79822e 100644--- a/products/workflows/frontend/Workflows/hogflows/steps/stepWaitUntilTimeWindowLogic.ts+++ b/products/workflows/frontend/Workflows/hogflows/steps/stepWaitUntilTimeWindowLogic.ts@@ -244,6 +244,9 @@ export interface stepWaitUntilTimeWindowLogicActions {| 'posthog_business_hours'| 'posthog_ticket_tags'| 'string'+ | 'task_mcp_installations'+ | 'task_model'+ | 'task_repository'}[]| undefinedname: string@@ -522,6 +525,9 @@ export interface stepWaitUntilTimeWindowLogicActions {| 'posthog_business_hours'| 'posthog_ticket_tags'| 'string'+ | 'task_mcp_installations'+ | 'task_model'+ | 'task_repository'}[]| undefinedname: stringdiff --git a/products/workflows/frontend/Workflows/hogflows/steps/types.ts b/products/workflows/frontend/Workflows/hogflows/steps/types.tsindex 570e81ae954b..06cd4cb1ce28 100644--- a/products/workflows/frontend/Workflows/hogflows/steps/types.ts+++ b/products/workflows/frontend/Workflows/hogflows/steps/types.ts@@ -93,6 +93,9 @@ export const CyclotronJobInputSchemaTypeSchema = z.object({'non_failure_status_codes','customer_analytics_account_properties','customer_analytics_account_relationships',+ 'task_model',+ 'task_repository',+ 'task_mcp_installations',]),key: z.string(),label: z.string(),diff --git a/products/workflows/frontend/Workflows/workflowLogic.ts b/products/workflows/frontend/Workflows/workflowLogic.tsindex 6e51b31e3bd8..43a02c403010 100644--- a/products/workflows/frontend/Workflows/workflowLogic.ts+++ b/products/workflows/frontend/Workflows/workflowLogic.ts@@ -498,6 +498,9 @@ export interface workflowLogicActions {| 'posthog_business_hours'| 'posthog_ticket_tags'| 'string'+ | 'task_mcp_installations'+ | 'task_model'+ | 'task_repository'}[]| undefinedname: string@@ -1111,6 +1114,9 @@ export interface workflowLogicActions {| 'posthog_business_hours'| 'posthog_ticket_tags'| 'string'+ | 'task_mcp_installations'+ | 'task_model'+ | 'task_repository'}[]| null| undefined@@ -1304,6 +1310,9 @@ export interface workflowLogicActions {| 'posthog_business_hours'| 'posthog_ticket_tags'| 'string'+ | 'task_mcp_installations'+ | 'task_model'+ | 'task_repository'}[]| undefinedname: string@@ -1917,6 +1926,9 @@ export interface workflowLogicActions {| 'posthog_business_hours'| 'posthog_ticket_tags'| 'string'+ | 'task_mcp_installations'+ | 'task_model'+ | 'task_repository'}[]| null| undefined@@ -2081,6 +2093,9 @@ export interface workflowLogicActions {| 'posthog_business_hours'| 'posthog_ticket_tags'| 'string'+ | 'task_mcp_installations'+ | 'task_model'+ | 'task_repository'}[]| undefinedname: string@@ -2433,6 +2448,9 @@ export interface workflowLogicActions {| 'posthog_business_hours'| 'posthog_ticket_tags'| 'string'+ | 'task_mcp_installations'+ | 'task_model'+ | 'task_repository'}[]| undefinedname: stringdiff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex cf4eb450cb99..805f2892f8d4 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -40503,6 +40503,9 @@ export namespace Schemas {* * `non_failure_status_codes` - non_failure_status_codes* * `customer_analytics_account_properties` - customer_analytics_account_properties* * `customer_analytics_account_relationships` - customer_analytics_account_relationships+ * * `task_model` - task_model+ * * `task_repository` - task_repository+ * * `task_mcp_installations` - task_mcp_installations*/export type InputsSchemaItemTypeEnum = typeof InputsSchemaItemTypeEnum[keyof typeof InputsSchemaItemTypeEnum];@@ -40525,6 +40528,9 @@ export namespace Schemas {NonFailureStatusCodes: 'non_failure_status_codes',CustomerAnalyticsAccountProperties: 'customer_analytics_account_properties',CustomerAnalyticsAccountRelationships: 'customer_analytics_account_relationships',+ TaskModel: 'task_model',+ TaskRepository: 'task_repository',+ TaskMcpInstallations: 'task_mcp_installations',} as const;export type InputsSchemaItemChoicesItem = { [key: string]: unknown };diff --git a/services/mcp/src/generated/cdp_functions/api.ts b/services/mcp/src/generated/cdp_functions/api.tsindex ba35af9785b3..379b548f7325 100644--- a/services/mcp/src/generated/cdp_functions/api.ts+++ b/services/mcp/src/generated/cdp_functions/api.ts@@ -105,9 +105,12 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({'non_failure_status_codes','customer_analytics_account_properties','customer_analytics_account_relationships',+ 'task_model',+ 'task_repository',+ 'task_mcp_installations',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations'),key: zod.string(),label: zod.string().optional(),@@ -193,9 +196,12 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({'non_failure_status_codes','customer_analytics_account_properties','customer_analytics_account_relationships',+ 'task_model',+ 'task_repository',+ 'task_mcp_installations',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations'),key: zod.string(),label: zod.string().optional(),@@ -352,9 +358,12 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({'non_failure_status_codes','customer_analytics_account_properties','customer_analytics_account_relationships',+ 'task_model',+ 'task_repository',+ 'task_mcp_installations',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations'),key: zod.string(),label: zod.string().optional(),@@ -440,9 +449,12 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({'non_failure_status_codes','customer_analytics_account_properties','customer_analytics_account_relationships',+ 'task_model',+ 'task_repository',+ 'task_mcp_installations',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations'),key: zod.string(),label: zod.string().optional(),@@ -690,9 +702,12 @@ export const HogFunctionsInvocationsCreateBody = /* @__PURE__ */ zod.object({'non_failure_status_codes','customer_analytics_account_properties','customer_analytics_account_relationships',+ 'task_model',+ 'task_repository',+ 'task_mcp_installations',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations'),key: zod.string(),label: zod.string().optional(),@@ -799,9 +814,12 @@ export const HogFunctionsInvocationsCreateBody = /* @__PURE__ */ zod.object({'non_failure_status_codes','customer_analytics_account_properties','customer_analytics_account_relationships',+ 'task_model',+ 'task_repository',+ 'task_mcp_installations',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations'),key: zod.string(),label: zod.string().optional(),diff --git a/services/mcp/src/generated/error_tracking_alerts/api.ts b/services/mcp/src/generated/error_tracking_alerts/api.tsindex 769dffea43fb..a62c409785e3 100644--- a/services/mcp/src/generated/error_tracking_alerts/api.ts+++ b/services/mcp/src/generated/error_tracking_alerts/api.ts@@ -105,9 +105,12 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({'non_failure_status_codes','customer_analytics_account_properties','customer_analytics_account_relationships',+ 'task_model',+ 'task_repository',+ 'task_mcp_installations',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations'),key: zod.string(),label: zod.string().optional(),@@ -193,9 +196,12 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({'non_failure_status_codes','customer_analytics_account_properties','customer_analytics_account_relationships',+ 'task_model',+ 'task_repository',+ 'task_mcp_installations',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations'),key: zod.string(),label: zod.string().optional(),@@ -343,9 +349,12 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({'non_failure_status_codes','customer_analytics_account_properties','customer_analytics_account_relationships',+ 'task_model',+ 'task_repository',+ 'task_mcp_installations',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations'),key: zod.string(),label: zod.string().optional(),@@ -431,9 +440,12 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({'non_failure_status_codes','customer_analytics_account_properties','customer_analytics_account_relationships',+ 'task_model',+ 'task_repository',+ 'task_mcp_installations',]).describe(- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships'+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations'),key: zod.string(),label: zod.string().optional(),diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-create.jsonindex ba7b0e4e5f8f..1c6feccae2e4 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-create.json@@ -169,7 +169,7 @@]},"type": {- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships",+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations","enum": ["string","number",@@ -187,7 +187,10 @@"posthog_business_hours","non_failure_status_codes","customer_analytics_account_properties",- "customer_analytics_account_relationships"+ "customer_analytics_account_relationships",+ "task_model",+ "task_repository",+ "task_mcp_installations"],"type": "string"}@@ -331,7 +334,7 @@]},"type": {- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships",+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations","enum": ["string","number",@@ -349,7 +352,10 @@"posthog_business_hours","non_failure_status_codes","customer_analytics_account_properties",- "customer_analytics_account_relationships"+ "customer_analytics_account_relationships",+ "task_model",+ "task_repository",+ "task_mcp_installations"],"type": "string"}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-invocations-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-invocations-create.jsonindex c51ed64ad6ba..c9b11236d1a1 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-invocations-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-invocations-create.json@@ -335,7 +335,7 @@]},"type": {- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships",+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations","enum": ["string","number",@@ -353,7 +353,10 @@"posthog_business_hours","non_failure_status_codes","customer_analytics_account_properties",- "customer_analytics_account_relationships"+ "customer_analytics_account_relationships",+ "task_model",+ "task_repository",+ "task_mcp_installations"],"type": "string"}@@ -517,7 +520,7 @@]},"type": {- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships",+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations","enum": ["string","number",@@ -535,7 +538,10 @@"posthog_business_hours","non_failure_status_codes","customer_analytics_account_properties",- "customer_analytics_account_relationships"+ "customer_analytics_account_relationships",+ "task_model",+ "task_repository",+ "task_mcp_installations"],"type": "string"}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-partial-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-partial-update.jsonindex 787e8ae96399..df177f9aed88 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-partial-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-partial-update.json@@ -179,7 +179,7 @@]},"type": {- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships",+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations","enum": ["string","number",@@ -197,7 +197,10 @@"posthog_business_hours","non_failure_status_codes","customer_analytics_account_properties",- "customer_analytics_account_relationships"+ "customer_analytics_account_relationships",+ "task_model",+ "task_repository",+ "task_mcp_installations"],"type": "string"}@@ -341,7 +344,7 @@]},"type": {- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships",+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations","enum": ["string","number",@@ -359,7 +362,10 @@"posthog_business_hours","non_failure_status_codes","customer_analytics_account_properties",- "customer_analytics_account_relationships"+ "customer_analytics_account_relationships",+ "task_model",+ "task_repository",+ "task_mcp_installations"],"type": "string"}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-create.jsonindex ac47dd9e485c..4942bf0c77d8 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-create.json@@ -169,7 +169,7 @@]},"type": {- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships",+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations","enum": ["string","number",@@ -187,7 +187,10 @@"posthog_business_hours","non_failure_status_codes","customer_analytics_account_properties",- "customer_analytics_account_relationships"+ "customer_analytics_account_relationships",+ "task_model",+ "task_repository",+ "task_mcp_installations"],"type": "string"}@@ -331,7 +334,7 @@]},"type": {- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships",+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations","enum": ["string","number",@@ -349,7 +352,10 @@"posthog_business_hours","non_failure_status_codes","customer_analytics_account_properties",- "customer_analytics_account_relationships"+ "customer_analytics_account_relationships",+ "task_model",+ "task_repository",+ "task_mcp_installations"],"type": "string"}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-partial-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-partial-update.jsonindex 30e644bdcafa..df02fbf16f95 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-partial-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-partial-update.json@@ -179,7 +179,7 @@]},"type": {- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships",+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations","enum": ["string","number",@@ -197,7 +197,10 @@"posthog_business_hours","non_failure_status_codes","customer_analytics_account_properties",- "customer_analytics_account_relationships"+ "customer_analytics_account_relationships",+ "task_model",+ "task_repository",+ "task_mcp_installations"],"type": "string"}@@ -341,7 +344,7 @@]},"type": {- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships",+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations","enum": ["string","number",@@ -359,7 +362,10 @@"posthog_business_hours","non_failure_status_codes","customer_analytics_account_properties",- "customer_analytics_account_relationships"+ "customer_analytics_account_relationships",+ "task_model",+ "task_repository",+ "task_mcp_installations"],"type": "string"}