[BUG] Returning from agent view cancels & respawns in-flight subagents (work re-run, double token spend, misleading "already done" reports)

Open 💬 3 comments Opened Jul 10, 2026 by hi-fox

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Summary

Entering the agents view (or attaching/detaching a session) while a workflow's
subagents are mid-run, then returning to the main session, cancels the running
generation and respawns every agent slot. The respawned generation finds the
already-modified working tree and mislabels it as pre-existing uncommitted
changes, reporting work as already done rather than as its own.
Recurs on 2.1.206 — i.e. after the changelog entry "subagent work being lost on
return to claude agents" (~v2.1.203) — so incomplete fix or regression.

Impact

  • Three of four scopes paid for twice in tokens.
  • Misleading "already done" reports mask whether output is freshly correct or a

rationalisation of prior work — a data-integrity hazard on tasks not
verifiable by hand. (This task was verified file-by-file; build + 3 suites
green, so no lasting damage here.)

Likely mechanism (hypothesis, not proven)

The "state at conversation start" snapshot (git status + injected context)
appears re-captured at the respawn seam, so gen 2 was fed the post-gen-1 tree
and told the changes pre-date the session. Live greps at 18:52 still showed the
original state, contradicting the snapshot — evidence something re-captured late.

This relates to a few ongoing issues around the subagent window, but it is unique as far as I have seen, although the root cause could be the same.

What Should Happen?

The view should return to the conversation window with any and all active subagents uninterrupted.

Error Messages/Logs

Steps to Reproduce

Steps to reproduce

  1. In a session, launch a workflow that fans out subagents making file edits.
  2. While it runs, enter agent view (or attach then detach a session).
  3. Return to the main view.
  4. Original subagents are cancelled; a new generation spawns; the new

generation reports the work as already-existing rather than its own.

Evidence (from transcripts + journal)

  • Gen 1 (spawned 19:18:40) did all real edits — app 19, tests 10, ui 5,

docs 7 (41 total), working 19:18:40–19:21:58.

  • Return to main view ~19:22:04 cancelled gen 1 and respawned all four slots.
  • Gen 2 (19:22:04) edits — app 0, tests 0, ui 0, docs 4 (only finishing

gen-1's unreached docs tail).

  • Gen-2 agents rationalised the already-edited tree as "pre-existing changes".

This also happens for ANY type of subagent, not just workflows.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.206

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

Notes

Incident transcripts + journal are on my machine across two session folders
(available on request); the edit-count split above is the key evidence.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗