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

Status Open
Reported on v2.1.206
Maintainer reply None cached
Activity 3 comments · opened Jul 10, 2026

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 ↗

3 Comments

github-actions[bot] · 1 month ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/73756
  2. https://github.com/anthropics/claude-code/issues/70373
  3. https://github.com/anthropics/claude-code/issues/73958

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

hi-fox · 1 month ago

Related to #73756 - merge into this issue as the description is more detailed

kcarriedo · 1 month ago

The "gen 2 rationalizes gen 1's output as pre-existing" failure mode is the most dangerous part of this. Not because of the re-run cost (painful but recoverable) but because the agent's own report makes it look like the work succeeded independently when it didn't. If you're not diff-checking every file by hand you could ship gen 2's "already done" report as a clean run.

The reproduce path you found (enter agent view mid-run -> return) is a real workflow for anyone monitoring a long fan-out. Checking in on agents is the whole point of the view. It shouldn't be a destructive action.

The thumbs-down on the duplicate flag is right -- the issues listed (#73756, #70373, #73958) don't describe the exact combination of re-run + misleading snapshot. If this gets merged into one of those, make sure the "misleading already-done rationalization" case is called out explicitly in the issue body because it's the part that makes this a data-integrity problem, not just a token-waste problem.

Version 2.1.206 with the partial fix from ~v2.1.203 still regressing confirms this isn't a one-off. The subagent state snapshot timing is fundamentally racy at the view-return seam.