Skip to content

fix(core): Filter stale credentials from setup wizard requests#28478

Open
aalises wants to merge 1 commit intomasterfrom
aalises-fix-setup-credentials
Open

fix(core): Filter stale credentials from setup wizard requests#28478
aalises wants to merge 1 commit intomasterfrom
aalises-fix-setup-credentials

Conversation

@aalises
Copy link
Copy Markdown
Contributor

@aalises aalises commented Apr 14, 2026

Summary

The setup wizard was asking users to configure credentials for nodes that don't need them (e.g., an HTTP Request node calling a public API with authentication: 'none').

Root cause: Stale node.credentials entries, left over from earlier builder revisions, were being surfaced unconditionally in two places:

  1. getNodeCredentialTypes() in the adapter had a "Step 4" that added all existing credentials without checking if they're still needed
  2. The fallback in buildSetupRequests() checked node.credentials first, bypassing the displayOptions-filtered path

Fix:

  • Removed the unconditional existing-credentials step from the adapter: Steps 1-3 (displayOptions filtering, credential issues, dynamic resolution) already cover all legitimate detection paths
  • Removed the unfiltered node.credentials fallback in buildSetupRequests(): now only the displayOptions-filtered path from the node description is used

Related Linear ticket

https://linear.app/n8n/issue/AI-2366

  • I have seen this code, I have run this code, and I take responsibility for this code.

The setup wizard was asking users to configure credentials for nodes
that don't need them (e.g. HTTP Request with authentication set to
'none'). Stale node.credentials entries from earlier builder revisions
were being surfaced unconditionally.
@aalises aalises marked this pull request as ready for review April 14, 2026 13:38
@aalises aalises requested a review from Cadiac April 14, 2026 13:40
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 14, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...modules/instance-ai/instance-ai.adapter.service.ts 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
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.

No issues found across 3 files

Architecture diagram
sequenceDiagram
    participant UI as Setup Wizard
    participant Svc as SetupWorkflowService
    participant Adapter as InstanceAiAdapterService
    participant Desc as Node Description
    participant Creds as CredentialService

    Note over UI,Creds: Identifying required credentials for a node

    UI->>Svc: buildSetupRequests(node)
    
    Svc->>Adapter: getNodeCredentialTypes(node)
    Adapter->>Desc: Get node description
    
    Note over Adapter: Step 1-3: Resolve via displayOptions,<br/>issues, and dynamic resolution
    
    rect rgb(240, 240, 240)
        Note over Adapter: CHANGED: Step 4 (unconditional addition<br/>of existingCredentials) REMOVED
        Adapter-->>Svc: Array of validated credential types
    end

    alt if credentialTypes is empty
        Note over Svc: NEW: Fallback logic no longer<br/>checks node.credentials (stale data)
        Svc->>Desc: Get static credentials from description
        loop for each static credential
            Svc->>Svc: NEW: Filter using matchesDisplayOptions(parameters)
        end
        Svc-->>Svc: Filtered list of required types
    end

    loop for each identified credentialType
        Svc->>Creds: list({ type: credentialType })
        Creds-->>Svc: Found credentials
    end

    Svc-->>UI: Setup requests (filtered for current context)
Loading

@github-actions
Copy link
Copy Markdown
Contributor

Performance Comparison

Comparing currentlatest master14-day baseline

Idle baseline with Instance AI module loaded

Metric Current Latest Master Baseline (avg) vs Master vs Baseline Status
instance-ai-heap-used-baseline 187.62 MB 186.52 MB 186.34 MB (σ 0.24) +0.6% +0.7% 🔴
instance-ai-rss-baseline 342.11 MB 388.20 MB 372.63 MB (σ 22.95) -11.9% -8.2% ⚠️

docker-stats

Metric Current Latest Master Baseline (avg) vs Master vs Baseline Status
docker-image-size-runners 393.00 MB 393.00 MB 391.63 MB (σ 11.06) +0.0% +0.3%
docker-image-size-n8n 1269.76 MB 1269.76 MB 1269.76 MB (σ 0.00) +0.0% +0.0%

Memory consumption baseline with starter plan resources

Metric Current Latest Master Baseline (avg) vs Master vs Baseline Status
memory-rss-baseline 221.42 MB 287.98 MB 284.98 MB (σ 42.51) -23.1% -22.3% ⚠️
memory-heap-used-baseline 114.77 MB 114.05 MB 113.86 MB (σ 0.84) +0.6% +0.8% ⚠️
How to read this table
  • Current: This PR's value (or latest master if PR perf tests haven't run)
  • Latest Master: Most recent nightly master measurement
  • Baseline: Rolling 14-day average from master
  • vs Master: PR impact (current vs latest master)
  • vs Baseline: Drift from baseline (current vs rolling avg)
  • Status: ✅ within 1σ | ⚠️ 1-2σ | 🔴 >2σ regression

@aalises aalises requested a review from scdekov April 14, 2026 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant