[BUG] Subagent Work Is Lost on WorkTree Cleanup with No-Commit

Resolved 💬 3 comments Opened Apr 24, 2026 by Tyfoods Closed Apr 28, 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?

The parent agent lost the work that subagents did because
worktrees are automatically cleaned up and it 'forgot' to tell the
subagents to commit their work so that it didn't get auto-cleaned up.
When it happens, this is a devastating waste of compute, time and
money for everyone involved.

What Should Happen?

Use a background process that starts after a sub-agent completes, which waits N rounds before notifying the agent that they need to save the wireframe changes immediately unless they'd like them to be destroyed, so that this never happens again. Let them know it'll be destroyed in another M rounds, and of course, if they do nothing, go ahead and destroy it.

Error Messages/Logs

Steps to Reproduce

Ask the parent agent to run subagents on a task and see how often you end up losing the results to this bug. Doesn't happen every time, obviously, but once is enough. Major waste.

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.119

Platform

Other

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

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