Merged
Size
M
Change Breakdown
Refactor65%
Security25%
Maintenance10%
#27940refactor(core): Instance AI tweaks (no-changelog)

Instance AI gets structured logging and security fixes

Console statements replaced with structured logging, path traversal protection added, and the experimental module now warns administrators on startup.

The Instance AI module is getting a suite of internal improvements. Console.log, console.warn, and console.error calls scattered across the codebase are being replaced with a structured Logger interface that feeds into n8n's logging system — providing consistent, queryable output with proper scopes.

Path resolution in the node-definition-resolver has been hardened. Manual path validation is being replaced with safeJoinPath from @n8n/backend-common, which throws on traversal attempts instead of silently allowing them.

The Anthropic SDK is now dynamically imported, enabling better tree-shaking. The AI assistant client creation logic has been consolidated to reuse the existing aiService client instead of duplicating initialization. A startup warning banner now appears when the instance-ai module loads, flagging it as experimental and undocumented.

These changes live in the @n8n/instance-ai package and related CLI modules, part of ongoing work to clean up the module's foundations.

View Original GitHub Description

Summary

Collection of minor refactoring changes combined into one PR to save some time:

https://github.com/n8n-io/n8n/pull/27835 use logger instead of console https://github.com/n8n-io/n8n/pull/27860 removing some dev time dead code https://github.com/n8n-io/n8n/pull/27862 dynamic anthropic import https://github.com/n8n-io/n8n/pull/27878 use the existing path traversal preventing join https://github.com/n8n-io/n8n/pull/27900 use the same ai assistant client for daytona proxy https://github.com/n8n-io/n8n/pull/27904 warning on startup if instance AI is enabled

Related Linear tickets, Github issues, and Community forum posts

<!-- Include links to **Linear ticket** or Github issue or Community forum post. Important in order to close *automatically* and provide context to reviewers. https://linear.app/n8n/issue/ --> <!-- Use "closes #<issue-number>", "fixes #<issue-number>", or "resolves #<issue-number>" to automatically close issues when the PR is merged. -->

Review / Merge checklist

  • PR title and summary are descriptive. (conventions) <!-- **Remember, the title automatically goes into the changelog. Use `(no-changelog)` otherwise.** -->
  • Docs updated or follow-up ticket created.
  • Tests included. <!-- A bug is not considered fixed, unless a test is added to prevent it from happening again. A feature is not complete without tests. -->
  • 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)
© 2026 · via Gitpulse