Merged
Size
S
Change Breakdown
Bug Fix70%
Maintenance30%
#28250fix(core): Run snapshot pruning correctly and adjust logs (no-changelog)

Snapshot pruning fixed and logs improved

A refactoring break caused snapshot pruning to stop running entirely. The initialization has been fixed so pruning starts correctly, with better logging to track when snapshots are cleaned up.

Snapshot pruning in n8n had stopped working. A prior refactor accidentally broke the initialization — the code imported the service file but never actually started the pruning timer, leaving old workflow snapshots to accumulate indefinitely.

The fix ensures the pruning service is properly initialized at startup. Critically, the service now checks whether it is running on the leader instance before beginning — a guard that prevents redundant pruning across multi-main deployments. Logging has been improved to distinguish between finding no snapshots to prune and successfully removing stale data, with interval and retention settings now included in debug output.

This restores automatic cleanup of old workflow snapshots in the CLI package.

View Original GitHub Description

Summary

Through refactoring we had broken our workflow snapshots pruning mechanism, and it wasn't started anymore. I now made it work similar to executions pruning, and adjusted how it gets logged.

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