Skip to content

feat(editor): Integrate Assistant mentions with composer (no-changelog) - #39314

Draft
MiloradFilipovic wants to merge 3 commits into
vis-22-build-mention-providers-and-workflow-artifact-indexfrom
vis-23-integrate-mentions-with-the-ai-assistant-composer
Draft

MiloradFilipovic wants to merge 3 commits into
vis-22-build-mention-providers-and-workflow-artifact-indexfrom
vis-23-integrate-mentions-with-the-ai-assistant-composer

Conversation

@MiloradFilipovic

@MiloradFilipovic MiloradFilipovic commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR integrates AI Assistant mentions with the composer and artifact lifecycle.

  • Add typed @ and composer-button entry points.
  • Insert selected names as quoted text.
  • Build workflow, node, and canvas-group attachments.
  • Add removable workflow context chips.
  • Keep unsent workflow artifacts alive with thread-scoped transient references.
  • Transfer transient references to optimistic messages after successful sends.
  • Restore mention context after failed sends.
  • Rebuild parent workflow artifacts from sent node and group context.
  • Keep attachment and node-set limits aligned with shared schemas.

This is the fourth PR in the AI Assistant mentions stack. It depends on #39294.

The integration remains disabled by default. VIS-25 wires the rollout flag and completes release verification.

No screenshots are included because the rollout gate is not wired in this PR.

How to test

  1. Run the focused editor tests from packages/frontend/editor-ui:
pnpm test src/features/ai/assistant-at-mentions/AssistantAtMentionPicker.test.ts src/features/ai/assistant-at-mentions/composables/useAssistantAtMentions.test.ts src/features/ai/assistant-at-mentions/utils/buildMentionAttachment.test.ts src/features/ai/instanceAi/utils/buildNodesAttachment.test.ts src/features/ai/instanceAi/components/__tests__/InstanceAiInput.attachments.test.ts src/features/ai/instanceAi/components/__tests__/InstanceAiConversation.test.ts src/features/ai/instanceAi/__tests__/useResourceRegistry.test.ts src/features/ai/instanceAi/__tests__/useCanvasPreview.test.ts src/features/ai/instanceAi/__tests__/instanceAi.threadRuntime.test.ts
  1. Run pnpm typecheck and pnpm lint from packages/frontend/editor-ui.
  2. Run the schema tests from packages/@n8n/api-types:
pnpm test src/schemas/__tests__/instance-ai.schema.test.ts
  1. Run pnpm typecheck and pnpm lint from packages/@n8n/api-types.
  2. Run pnpm lint from packages/frontend/@n8n/i18n.

Related Linear tickets, Github issues, and Community forum posts

https://linear.app/n8n/issue/VIS-23

Stack base: #39294

Review / Merge checklist

  • I have seen this code, I have run this code, and I take responsibility for this code.
  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with Backport to Beta, Backport to Stable, or Backport to v1 (if the PR is an urgent fix that needs to be backported)

🤖 PR Summary generated by AI

This PR connects mention selection to composer text, structured context, and workflow artifact state.

@MiloradFilipovic
MiloradFilipovic added this pull request to stack #39284 September 22, 2026 15:06
@n8n-assistant

n8n-assistant Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

PR review overview

Based on ownership of the 29 changed files in this PR:

Ownership Files owned Share Source code Test files Misc
@n8n-io/ai 25 86% +1,023 / -24 +700 / -5 +0 / -0
@n8n-io/catalysts 3 10% +13 / -2 +14 / -0 +0 / -0
@n8n-io/frontend 1 3% +7 / -0 +0 / -0 +0 / -0
Total 29 100% +1,043 / -26 +714 / -5 +0 / -0

❗ Source code additions (1,043) exceed the 1,000-line limit.

@codecov

codecov Bot commented Sep 22, 2026

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 46.85kB (0.08%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
editor-ui-esm 57.91MB 46.85kB (0.08%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: editor-ui-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/worker-*.js 3.3MB 3.32MB 17912.45% ⚠️
assets/worker-*.js -3.3MB 18.44kB -99.44%
assets/src-*.js 49 bytes 1.54MB 0.0%
assets/src-*.js 479 bytes 841.23kB 0.06%
assets/AgentBuilderView-*.js 1.8kB 1.02MB 0.18%
assets/InstanceAiEmptyView-*.js 629 bytes 373.18kB 0.17%
assets/InstanceAiThreadView-*.js 296 bytes 317.95kB 0.09%
assets/router-*.js -4.83kB 168.18kB -2.79%
assets/emscripten-*.browser-DMyKHjXQ.js (New) 135.87kB 135.87kB 100.0% 🚀
assets/WorkflowBuilderUnavailableNotice-*.js 40.52kB 114.74kB 54.6% ⚠️
assets/instanceAi.store-*.js 1.83kB 112.17kB 1.66%
assets/emscripten-*.browser-C7pnW7Dn.js (New) 76.96kB 76.96kB 100.0% 🚀
assets/constants-*.js 700 bytes 42.87kB 1.66%
assets/emscripten-*.browser-DGdtCKWC.js (New) 15.69kB 15.69kB 100.0% 🚀
assets/emscripten-*.browser-Do4Nae8C.js (New) 12.97kB 12.97kB 100.0% 🚀
assets/constants-*.css 96 bytes 6.94kB 1.4%
assets/recentWorkflows.store-*.js (New) 5.28kB 5.28kB 100.0% 🚀
assets/emscripten-*.browser-DiNyVILz.js (Deleted) -135.87kB 0 bytes -100.0% 🗑️
assets/emscripten-*.browser-y4xLZIOM.js (Deleted) -76.96kB 0 bytes -100.0% 🗑️
assets/emscripten-*.browser-DErnMln5.js (Deleted) -15.69kB 0 bytes -100.0% 🗑️
assets/emscripten-*.browser-Cw-qXdjq.js (Deleted) -12.97kB 0 bytes -100.0% 🗑️

Files in assets/AgentBuilderView-*.js:

  • ./src/features/ai/instanceAi/components/InstanceAiConversation.vue → Total Size: 382 bytes

Files in assets/InstanceAiEmptyView-*.js:

  • ./src/features/ai/instanceAi/InstanceAiEmptyView.vue → Total Size: 355 bytes

Files in assets/InstanceAiThreadView-*.js:

  • ./src/features/ai/instanceAi/InstanceAiThreadView.vue → Total Size: 359 bytes

  • ./src/features/ai/instanceAi/useCanvasPreview.ts → Total Size: 11.45kB

Files in assets/WorkflowBuilderUnavailableNotice-*.js:

  • ./src/features/ai/assistant-at-mentions/composables/useAssistantMentionAttachments.ts → Total Size: 5.83kB

  • ./src/features/ai/instanceAi/components/InstanceAiInput.vue → Total Size: 354 bytes

  • ./src/features/ai/assistant-at-mentions/AssistantAtMentionPicker.vue → Total Size: 199 bytes

  • ./src/features/ai/assistant-at-mentions/composables/useAssistantAtMentions.ts → Total Size: 3.36kB

  • ./src/features/ai/assistant-at-mentions/utils/buildMentionAttachment.ts → Total Size: 1.14kB

Files in assets/instanceAi.store-*.js:

  • ./src/features/ai/instanceAi/useResourceRegistry.ts → Total Size: 15.22kB

  • ./src/features/ai/instanceAi/utils/buildNodesAttachment.ts → Total Size: 5.08kB

  • ./src/features/ai/instanceAi/instanceAi.threadRuntime.ts → Total Size: 43.55kB

Files in assets/constants-*.js:

  • ./src/features/ai/instanceAi/components/AttachmentPreview.vue → Total Size: 358 bytes

@codecov

codecov Bot commented Sep 22, 2026

Copy link
Copy Markdown

❌ 4 Tests Failed:

Tests completed Failed Passed Skipped
88149 4 88145 49
View the top 3 failed test(s) by shortest run time
src/features/ai/instanceAi/__tests__/InstanceAiInput.test.ts > InstanceAiInput > inserts a prompt suggestion and submits it only when send is clicked
Stack Traces | 0.0754s run time
AssertionError: expected [ …(6) ] to deeply equal [ …(5) ]

- Expected
+ Received

@@ -7,6 +7,7 @@
      "prefillId": "build-agent",
      "prefillType": "v1_opener",
      "promptModified": false,
    },
    1790092272485.7153,
+   [Function accept],
  ]

 ❯ .../instanceAi/__tests__/InstanceAiInput.test.ts:515:33
src/features/ai/instanceAi/__tests__/InstanceAiInput.test.ts > InstanceAiInput > submits plan feedback on Enter without any prior click
Stack Traces | 0.175s run time
AssertionError: expected [ [ 'Drop the third workflow', …(5) ] ] to deeply equal [ [ 'Drop the third workflow', …(4) ] ]

- Expected
+ Received

@@ -5,7 +5,8 @@
      [Function anonymous],
      {
        "kind": "user_typed",
      },
      1790092275741.4177,
+     [Function anonymous],
    ],
  ]

 ❯ .../instanceAi/__tests__/InstanceAiInput.test.ts:1053:28
src/features/ai/instanceAi/__tests__/InstanceAiInput.test.ts > InstanceAiInput > stays live for plan feedback while the run is suspended
Stack Traces | 0.237s run time
AssertionError: expected [ [ …(6) ] ] to deeply equal [ [ …(5) ] ]

- Expected
+ Received

@@ -5,7 +5,8 @@
      [Function anonymous],
      {
        "kind": "user_typed",
      },
      1790092275506.9338,
+     [Function anonymous],
    ],
  ]

 ❯ .../instanceAi/__tests__/InstanceAiInput.test.ts:1011:28
src/features/ai/instanceAi/__tests__/InstanceAiInput.test.ts > InstanceAiInput > submits typed text and attachments from the send button
Stack Traces | 0.511s run time
AssertionError: expected [ [ …(6) ] ] to deeply equal [ [ …(5) ] ]

- Expected
+ Received

@@ -12,7 +12,8 @@
      [Function anonymous],
      {
        "kind": "user_typed",
      },
      1790092274615.803,
+     [Function accept],
    ],
  ]

 ❯ .../instanceAi/__tests__/InstanceAiInput.test.ts:809:28

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

cubic-dev-ai[bot]

This comment was marked as outdated.

@n8n-assistant n8n-assistant Bot added the n8n team Authored by the n8n team label Sep 22, 2026
@github-actions

github-actions Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

! PR exceeds size limit (1,043 lines added)

This PR adds 1,043 lines, exceeding the 1,000-line limit (test files excluded).

Large PRs are harder to review and increase the risk of bugs going unnoticed. Please consider:

  • Breaking this into smaller, logically separate PRs
  • Moving unrelated changes to a follow-up PR

If the size is genuinely justified (e.g. generated code, large migrations, test fixtures), a maintainer can override by commenting /size-limit-override and then pushing a new commit or re-running this check.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 3 files (changes from recent commits).

Confidence score: 5/5

  • The test fixtures and assertions in packages/frontend/editor-ui/src/features/ai/assistant-at-mentions/composables/useAssistantMentionAttachments.test.ts never exercise a true truncated value, so a regression that drops selection.truncated could go undetected; add a fixture and assertion with truncated: true.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/frontend/editor-ui/src/features/ai/assistant-at-mentions/composables/useAssistantMentionAttachments.test.ts">

<violation number="1" location="packages/frontend/editor-ui/src/features/ai/assistant-at-mentions/composables/useAssistantMentionAttachments.test.ts:83">
P3: The `truncated` flag is never actually pinned: every fixture declares `truncated: false` and every assertion hardcodes `truncated: false`, so `select()` could drop `selection.truncated` and this suite would still pass. The PR's truncation feature (oversized group selections) is only exercised in buildMentionAttachment.test.ts, not through the composable. Add a fixture with `truncated: true` (e.g., the workflow or node selection) and assert `{ status: 'added', truncated: true }` to verify propagation from `useAssistantMentionAttachments.ts:160` (`return { status: 'added', truncated: selection.truncated };`).</violation>
</file>

Shadow auto-approve: would not auto-approve because issues were found.

Fix all with cubic | Re-trigger cubic

it('adds a structured attachment and one transient reference per mention', () => {
const { mentions, resources, onReferenceAdded, scope } = setup();

expect(mentions.select(workflowSelection())).toEqual({ status: 'added', truncated: false });

@cubic-dev-ai cubic-dev-ai Bot Sep 22, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P3: The truncated flag is never actually pinned: every fixture declares truncated: false and every assertion hardcodes truncated: false, so select() could drop selection.truncated and this suite would still pass. The PR's truncation feature (oversized group selections) is only exercised in buildMentionAttachment.test.ts, not through the composable. Add a fixture with truncated: true (e.g., the workflow or node selection) and assert { status: 'added', truncated: true } to verify propagation from useAssistantMentionAttachments.ts:160 (return { status: 'added', truncated: selection.truncated };).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/frontend/editor-ui/src/features/ai/assistant-at-mentions/composables/useAssistantMentionAttachments.test.ts, line 83:

<comment>The `truncated` flag is never actually pinned: every fixture declares `truncated: false` and every assertion hardcodes `truncated: false`, so `select()` could drop `selection.truncated` and this suite would still pass. The PR's truncation feature (oversized group selections) is only exercised in buildMentionAttachment.test.ts, not through the composable. Add a fixture with `truncated: true` (e.g., the workflow or node selection) and assert `{ status: 'added', truncated: true }` to verify propagation from `useAssistantMentionAttachments.ts:160` (`return { status: 'added', truncated: selection.truncated };`).</comment>

<file context>
@@ -0,0 +1,142 @@
+	it('adds a structured attachment and one transient reference per mention', () => {
+		const { mentions, resources, onReferenceAdded, scope } = setup();
+
+		expect(mentions.select(workflowSelection())).toEqual({ status: 'added', truncated: false });
+		expect(mentions.select(workflowSelection())).toEqual({
+			status: 'duplicate',
</file context>
Fix with cubic

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

0 issues found across 1 file (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Shadow auto-approve: would not auto-approve. Auto-approval blocked by 11 unresolved issues from previous reviews.

Re-trigger cubic

This branch has not been deployed

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

Labels

cla-signed n8n team Authored by the n8n team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant