Skip to content

Conversation

@yehorkardash
Copy link
Contributor

Summary

This PR makes Chat model requirement more granular, requiring it only when LLM checks are present

2025-11-24.14-48-01.mp4

Had to add versioning, so that old classification guardrails that use only non-LLM checks don't look like that
image

Related Linear tickets, Github issues, and Community forum posts

https://linear.app/n8n/issue/NODE-3984/guardrails-node-only-show-model-connector-if-the-selected-action-is

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

@bundlemon
Copy link

bundlemon bot commented Nov 24, 2025

BundleMon

Unchanged files (2)
Status Path Size Limits
WASM Dependencies
tree-sitter-bash.wasm
181.26KB -
WASM Dependencies
tree-sitter.wasm
74.47KB -

No change in files bundle size

Groups updated (2)
Status Path Size Limits
**/*.js
11.38MB (+94.56KB +0.82%) -
**/*.css
231.53KB (+10.76KB +4.87%) -

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@codecov
Copy link

codecov bot commented Nov 24, 2025

@n8n-assistant n8n-assistant bot added the n8n team Authored by the n8n team label Nov 24, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 7 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="packages/@n8n/nodes-langchain/nodes/Guardrails/Guardrails.node.ts">

<violation number="1" location="packages/@n8n/nodes-langchain/nodes/Guardrails/Guardrails.node.ts:15">
`model` availability is determined only from item 0 guardrails, so later items that enable LLM checks fail with `Chat Model is required`. Iterate all items (or evaluate per item) when deciding to load the chat model.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

const items = this.getInputData();
const operation = this.getNodeParameter('operation', 0) as 'classify' | 'sanitize';
const model = operation === 'classify' ? await getChatModel.call(this) : null;
const model = hasLLMGuardrails(this.getNodeParameter('guardrails', 0) as GuardrailsOptions)
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Nov 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

model availability is determined only from item 0 guardrails, so later items that enable LLM checks fail with Chat Model is required. Iterate all items (or evaluate per item) when deciding to load the chat model.

Prompt for AI agents
Address the following comment on packages/@n8n/nodes-langchain/nodes/Guardrails/Guardrails.node.ts at line 15:

<comment>`model` availability is determined only from item 0 guardrails, so later items that enable LLM checks fail with `Chat Model is required`. Iterate all items (or evaluate per item) when deciding to load the chat model.</comment>

<file context>
@@ -10,7 +12,9 @@ export class Guardrails implements INodeType {
 		const items = this.getInputData();
 		const operation = this.getNodeParameter(&#39;operation&#39;, 0) as &#39;classify&#39; | &#39;sanitize&#39;;
-		const model = operation === &#39;classify&#39; ? await getChatModel.call(this) : null;
+		const model = hasLLMGuardrails(this.getNodeParameter(&#39;guardrails&#39;, 0) as GuardrailsOptions)
+			? await getChatModel.call(this)
+			: null;
</file context>
Fix with Cubic

@blacksmith-sh

This comment has been minimized.

@currents-bot
Copy link

currents-bot bot commented Nov 24, 2025

E2E Tests: n8n tests passed after 10m 23.8s

🟢 588 · 🔴 0 · ⚪️ 12 · 🟣 3

View Run Details

Run Details

  • Project: n8n

  • Groups: 2

  • Framework: Playwright

  • Run Status: Passed

  • Commit: 0530fcd

  • Spec files: 96

  • Overall tests: 600

  • Duration: 10m 23.8s

  • Parallelization: 9

Groups

GroupId Results Spec Files Progress
ui 🟢 539 · 🔴 0 · ⚪️ 12 · 🟣 3 90 / 90
ui:isolated 🟢 49 · 🔴 0 · ⚪️ 0 6 / 6


This message was posted automatically by currents.dev | Integration Settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

n8n team Authored by the n8n team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants