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
<!-- 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, orBackport to v1(if the PR is an urgent fix that needs to be backported)