Skip to content

fix(editor): Fix AI Node Logs View to Filter Duplicate Executions #15049

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

OlegIvaniv
Copy link
Contributor

Summary

This PR fixes an issue in the AI logs view where executions of a sub-node connected to multiple root nodes would appear in each parent node's logs, creating duplicate entries. Now, executions are correctly filtered to appear only in the logs of the parent node that triggered them.

Changes

Backend

  • Added tracking of parent nodes during execution by passing parent node reference through the execution context
  • Modified SupplyDataContext to track and store the parent node that triggered each execution
  • Added source information to task data with parent node references

Frontend

  • Added filtering logic in getTreeNodeDataRec and getTreeNodeDataV2 to only show executions triggered by the current node
  • Enhanced the interface to support the new source tracking field
  • Added special handling for nodes without source information or with empty source arrays
  • Added comprehensive tests for various edge cases including:
    • Nodes connected to multiple parents
    • Deeply nested node hierarchies
    • Nodes without source information
    • Complex branching trees
CleanShot.2025-05-02.at.09.23.27.mp4

Related Linear tickets, Github issues, and Community forum posts

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)

@OlegIvaniv OlegIvaniv requested a review from autologie May 2, 2025 07:24
Copy link

@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.

mrge reviewed 5 files and found no issues. Review this PR in mrge.io.

@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels May 2, 2025
Copy link

codecov bot commented May 2, 2025

Codecov Report

Attention: Patch coverage is 92.85714% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ontend/editor-ui/src/components/RunDataAi/utils.ts 94.87% 1 Missing and 1 partial ⚠️
...gine/node-execution-context/supply-data-context.ts 66.66% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link

cypress bot commented May 2, 2025

n8n    Run #10638

Run Properties:  status check failed Failed #10638  •  git commit 86807978c1: 🌳 move-repositories-third-batch 🖥️ browsers:node18.12.0-chrome107 🤖 ivov 🗃️ ...
Project n8n
Branch Review master
Run status status check failed Failed #10638
Run duration 30m 10s
Commit git commit 86807978c1: 🌳 move-repositories-third-batch 🖥️ browsers:node18.12.0-chrome107 🤖 ivov 🗃️ ...
Committer oleg
View all properties for this run ↗︎

Test results
Tests that failed  Failures 5
Tests that were flaky  Flaky 2
Tests that did not run due to a developer annotating a test with .skip  Pending 4
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 148
View all changes introduced in this branch ↗︎

Tests for review

Failed  39-projects.cy.ts • 5 failed tests

View Output Video

Test Artifacts
Projects > when starting from scratch > should create sub-workflow and credential in the sub-workflow in the same project Test Replay Screenshots Video
Projects > when starting from scratch > should be able to create a workflow when in the workflow editor Test Replay Screenshots Video
Projects > when moving resources between projects > should create a workflow and a credential in the Home project Test Replay Screenshots Video
Projects > when moving resources between projects > should move the workflow to expected projects Test Replay Screenshots Video
Projects > when moving resources between projects > should move the credential to expected projects Test Replay Screenshots Video
Failed  30-langchain.cy.ts • 0 failed tests

View Output

Test Artifacts
Failed  7-workflow-actions.cy.ts • 0 failed tests

View Output

Test Artifacts
Failed  2-credentials.cy.ts • 0 failed tests

View Output

Test Artifacts
Failed  16-webhook-node.cy.ts • 0 failed tests

View Output

Test Artifacts

The first 5 failed specs are shown, see all 62 specs in Cypress Cloud.

Flakiness  17-sharing.cy.ts • 1 flaky test

View Output Video

Test Artifacts
Sharing > credentials should work between team and personal projects Test Replay Screenshots Video
Flakiness  4-node-creator.cy.ts • 1 flaky test

View Output Video

Test Artifacts
Node Creator > should add node directly for sub-connection as tool Test Replay Screenshots Video

Copy link
Contributor

@autologie autologie left a comment

Choose a reason for hiding this comment

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

Thank you for porting implementations/tests to the V2 function! I tested both versions locally and worked well. Left question comments about some details.

Copy link
Contributor

github-actions bot commented May 7, 2025

✅ All Cypress E2E specs passed

@OlegIvaniv OlegIvaniv merged commit 8680797 into master May 7, 2025
47 checks passed
@OlegIvaniv OlegIvaniv deleted the ai-766-ai-agent-log-shows-all-agents-and-not-just-the-selected-one branch May 7, 2025 06:56
@github-actions github-actions bot mentioned this pull request May 12, 2025
@janober
Copy link
Member

janober commented May 12, 2025

Got released with [email protected]

ozcangungor pushed a commit to ozcangungor/n8n that referenced this pull request May 25, 2025
etobella pushed a commit to etobella/n8n that referenced this pull request May 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team Released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants