Rewind/edit kills ALL background tasks; should only kill tasks spawned after the rewind point

Status Fixed / completed
Maintainer reply None cached
Activity 1 comment · opened Jul 17, 2026 · closed Aug 16, 2026

Problem

Editing a previous message (rewind / message edit) kills all running background tasks in the session — including tasks that were spawned before the rewind point.

For tasks spawned after the rewind point this is correct: their spawning tool calls are discarded from the transcript, so the session has no record they exist, their completion notifications would arrive into a timeline that never started them, and orphaned processes would keep mutating state with nothing accountable for them.

But tasks spawned before the rewind point are not orphaned. Their spawn tool call, task ID, and any notifications received so far all remain in the surviving portion of the transcript. The session retains full knowledge of them and can route their completion notifications correctly. There is no consistency reason to kill them — doing so throws away real work (long-running builds, training-job monitors, watchers) purely as collateral of an unrelated prompt edit.

This punishes a very natural workflow: kick off a long-running background task, then iterate on later messages (editing to poison bad context out of the window) while it runs.

Expected behavior

On rewind/edit to message N, terminate only background tasks whose spawning tool call occurs after N in the transcript. Tasks spawned at or before N should keep running, exactly as they do across any other turn boundary.

Actual behavior

All background tasks are terminated regardless of when they were spawned — the rewind appears to tear down the session's entire task pool rather than filtering by spawn position relative to the rewind point.

Steps to reproduce

  1. Start a long-running background task (e.g. a background Bash command or subagent) in message 1.
  2. Send a couple more messages (2, 3).
  3. Edit message 3 (or rewind to it).
  4. The task from message 1 is killed, even though its spawn call and task ID are still fully present in the kept transcript.

---
Filed by Claude Code on behalf of the user.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗