Skip to content

Conversation

@dariacodes
Copy link
Contributor

@dariacodes dariacodes commented Oct 26, 2025

Summary

This PR decouples the active version from the current version of the workflow:

  • Add a foreign (nullable) key activeVersionId to the workflow entity
    • It does not currently replace the active flag, but we will tackle this as tech debt later.
  • Automatic executions now always run the populated active version of the workflow. Manual executions still use the data that is sent.
  • Update public API endpoints with keeping the current behavior
    • Update activeVersion with the current version when updating and activating workflows
    • Return activeVersion for GET endpoints (it'll be the same as the current version until user starts using V2 endpoints)
    • Remove excludePinnedData from activate endpoint (it was unused and using "GET" type was semantically incorrect)
  • Update the logic to always first add a record to workflow history and only then update the workflow entity, so that activeVersion is set once along with the workflow entity update

Active Version Usage

These are now using the active workflow version:

  1. Workflow Activation [active-workflow-manager.ts - add]
    • When activating workflows, the system now uses activeVersion nodes and connections instead of current version.
  2. Webhook Cleanup [active-workflow-manager.ts - clearWebhooks]
    • When deactivating workflows and removing webhooks, the system now uses activeVersion to properly identify and clean up the correct webhooks.
  3. Activation Error Handling [active-workflow-manager.ts - activateWorkflow]
    • When workflow activation fails and throws an error workflow needs to execute, it now uses activeVersion instead of current version.
  4. Production Webhook Execution [live-webhooks.ts - executeWebhook]
    • Production webhooks now use activeVersion instead of current version.

What I tested and how

  • For public endpoints, I created workflows with an HTTP Request node that sends a payload to activate or update another workflow.
  • For internal endpoints, I manually saved inactive and active workflows and checked which version was executed.
  • I verified that the current behavior remains unchanged and that the active version from the DB is automatically executed, while for manual executions, the current version is executed. Execution data table had the right data.

Related Linear tickets, Github issues, and Community forum posts

https://linear.app/n8n/issue/ADO-4277/feature-be-decouple-current-workflow-version-from-active-version

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)

@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels Oct 26, 2025
@dariacodes dariacodes marked this pull request as ready for review October 26, 2025 18:40
@dariacodes dariacodes requested a review from a team as a code owner October 26, 2025 18:40
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.

No issues found across 15 files

@dariacodes dariacodes force-pushed the ado-4277-refactor branch 3 times, most recently from 48ac94d to bbc3af0 Compare October 26, 2025 20:31
@currents-bot
Copy link

currents-bot bot commented Oct 26, 2025

E2E Tests: n8n tests timed out after 30m

🟢 83 · 🔴 0 · ⚪️ 2 · 🟣 1

View Run Details

Run Details

  • Project: n8n

  • Groups: 2

  • Framework: Playwright

  • Run Status: Timed out

  • Commit: ba03d02

  • Spec files: 95

  • Overall tests: 595

  • Duration: 30m

  • Parallelization: 1

Groups

GroupId Results Spec Files Progress
ui 🟢 83 · 🔴 0 · ⚪️ 2 · 🟣 1 8 / 88
ui:isolated 🟢 0 · 🔴 0 · ⚪️ 0 0 / 7


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

@dariacodes dariacodes requested a review from tomi October 27, 2025 07:49
@blacksmith-sh

This comment has been minimized.

@dariacodes dariacodes marked this pull request as draft October 29, 2025 12:27
@dariacodes dariacodes requested a review from tomi November 18, 2025 19:38
@blacksmith-sh

This comment has been minimized.

@dariacodes dariacodes requested a review from tomi November 20, 2025 14:06
tomi
tomi previously approved these changes Nov 20, 2025
Copy link
Collaborator

@tomi tomi left a comment

Choose a reason for hiding this comment

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

Just one nit comment. Feel free to merge without addressing

tomi
tomi previously approved these changes Nov 20, 2025
@blacksmith-sh

This comment has been minimized.

@dariacodes dariacodes merged commit ac91020 into master Nov 20, 2025
41 of 43 checks passed
@dariacodes dariacodes deleted the ado-4277-refactor branch November 20, 2025 15:47
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants