From c3190fcfec22f0b4cb3ab9e117adb509844b9307 Mon Sep 17 00:00:00 2001 From: Michael Drury Date: Wed, 10 Dec 2025 12:15:44 +0000 Subject: [PATCH] fix(ai-builder): Updating stream recursion limit and removing tool node static parameter validation (#23023) --- packages/@n8n/ai-workflow-builder.ee/src/constants.ts | 3 +++ .../src/validation/checks/tools.ts | 11 ----------- .../ai-workflow-builder.ee/src/validation/types.ts | 1 + .../src/workflow-builder-agent.ts | 6 +++++- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/packages/@n8n/ai-workflow-builder.ee/src/constants.ts b/packages/@n8n/ai-workflow-builder.ee/src/constants.ts index 8ed6eab0a97..1a45f25d49a 100644 --- a/packages/@n8n/ai-workflow-builder.ee/src/constants.ts +++ b/packages/@n8n/ai-workflow-builder.ee/src/constants.ts @@ -51,3 +51,6 @@ export const MAX_NODE_EXAMPLE_CHARS = 5000 * AVG_CHARS_PER_TOKEN_ANTHROPIC; export const MAX_BUILDER_ITERATIONS = 30; export const MAX_CONFIGURATOR_ITERATIONS = 30; export const MAX_DISCOVERY_ITERATIONS = 50; +export const MAX_MULTI_AGENT_STREAM_ITERATIONS = + MAX_BUILDER_ITERATIONS + MAX_CONFIGURATOR_ITERATIONS + MAX_DISCOVERY_ITERATIONS; +export const MAX_SINGLE_AGENT_STREAM_ITERATIONS = 50; diff --git a/packages/@n8n/ai-workflow-builder.ee/src/validation/checks/tools.ts b/packages/@n8n/ai-workflow-builder.ee/src/validation/checks/tools.ts index c76e7d3c36b..144ab6c39b2 100644 --- a/packages/@n8n/ai-workflow-builder.ee/src/validation/checks/tools.ts +++ b/packages/@n8n/ai-workflow-builder.ee/src/validation/checks/tools.ts @@ -3,7 +3,6 @@ import type { INodeTypeDescription } from 'n8n-workflow'; import type { SimpleWorkflow } from '@/types'; import type { SingleEvaluatorResult } from '../types'; -import { nodeParametersContainExpression } from '../utils/expressions'; import { isTool } from '../utils/is-tool'; const toolsWithoutParameters = [ @@ -39,16 +38,6 @@ export function validateTools( description: `Tool node "${node.name}" has no parameters set.`, pointsDeducted: 20, }); - continue; - } - - if (!nodeParametersContainExpression(node.parameters)) { - violations.push({ - name: 'tool-node-static-parameters', - type: 'major', - description: `Tool node "${node.name}" has no expressions in its parameters. This likely means it is not using dynamic input.`, - pointsDeducted: 20, - }); } } } diff --git a/packages/@n8n/ai-workflow-builder.ee/src/validation/types.ts b/packages/@n8n/ai-workflow-builder.ee/src/validation/types.ts index 14fd015ff8e..7fb9c9b6816 100644 --- a/packages/@n8n/ai-workflow-builder.ee/src/validation/types.ts +++ b/packages/@n8n/ai-workflow-builder.ee/src/validation/types.ts @@ -6,6 +6,7 @@ export type ProgrammaticViolationType = 'critical' | 'major' | 'minor'; export const PROGRAMMATIC_VIOLATION_NAMES = [ 'tool-node-has-no-parameters', + // this validation has been removed for now as it was throwing a lot of false positives 'tool-node-static-parameters', 'agent-static-prompt', 'agent-no-system-prompt', diff --git a/packages/@n8n/ai-workflow-builder.ee/src/workflow-builder-agent.ts b/packages/@n8n/ai-workflow-builder.ee/src/workflow-builder-agent.ts index e1557a0ca72..e8d751e185f 100644 --- a/packages/@n8n/ai-workflow-builder.ee/src/workflow-builder-agent.ts +++ b/packages/@n8n/ai-workflow-builder.ee/src/workflow-builder-agent.ts @@ -18,6 +18,8 @@ import { DEFAULT_AUTO_COMPACT_THRESHOLD_TOKENS, MAX_AI_BUILDER_PROMPT_LENGTH, MAX_INPUT_TOKENS, + MAX_MULTI_AGENT_STREAM_ITERATIONS, + MAX_SINGLE_AGENT_STREAM_ITERATIONS, } from '@/constants'; import { createMainAgentPrompt } from '@/prompts/legacy-agent.prompt'; import { trimWorkflowJSON } from '@/utils/trim-workflow-context'; @@ -515,7 +517,9 @@ export class WorkflowBuilderAgent { const streamConfig = { ...threadConfig, streamMode: ['updates', 'custom'] as const, - recursionLimit: 50, + recursionLimit: payload.featureFlags?.multiAgent + ? MAX_MULTI_AGENT_STREAM_ITERATIONS + : MAX_SINGLE_AGENT_STREAM_ITERATIONS, signal: abortSignal, callbacks: this.tracer ? [this.tracer] : undefined, metadata: this.runMetadata,