Merged
Size
S
Change Breakdown
Bug Fix90%
Testing10%
#28175fix(core): Save cancellation status on cancelled background sub-agent snapshots (no-changelog)

Cancelled sub-agent status now persists on reload

Background task cancellations now survive page reloads. Previously, sub-agents marked as cancelled existed only in memory — users refreshing the page would see stale snapshots where tasks still appeared active.

When a background sub-agent was cancelled, the agent tree was updated in memory to reflect the error status — but this change was never written to the database. Refreshing the page triggered a reload from storage, revealing a ghost: a sub-agent that had been cancelled moments ago, now showing as active again.

Cancelling a background task is a deliberate user action. The system now writes the updated agent tree to the instance_ai_run_snapshots table immediately after cancellation, ensuring the cancelled status persists across sessions. This closes a loop where the in-memory state and the persisted state finally agree, eliminating the confusing feedback of a task that appears both cancelled and running.

The fix lives in the n8n CLI package's instance AI module.

View Original GitHub Description

Summary

When a background subagent is cancelled, the updated agent tree (with the child marked as 'error') is now persisted to the instance_ai_run_snapshots DB table - previously it was only updated in memory, so page reloads loaded a stale snapshot where the child was still 'active'

Related Linear tickets, Github issues, and Community forum posts

https://www.notion.so/n8n/aef5b6e0c94f82159cc58164aa417607?v=7965b6e0c94f823c918f88516500cb86&p=3365b6e0c94f804ba6bdfb41b8b74e96&pm=s

<!-- 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