[BUG] Claude can present the plan to the user before backgrounded subagents finish executing
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?
I ran into an issue where Claude (Opus 5) spun up a backgrounded design subagent while in plan mode, but then ended up presenting the plan to me without waiting for the result of the subagent. I always implement plans from a clear context, which would presumably have discarded the subagent's work. The only reason I caught on to this is because I had a correction to make to Claude's plan myself, and while it was thinking about that it got a notification that the subagent finished.
What Should Happen?
Claude should wait for all subagents to finish before presenting the plan to the user.
Error Messages/Logs
Steps to Reproduce
This is agent behavior which is inherently nondeterministic in its nature, but since the correct layer to fix this is the harness, it should be fairly easy to hook Claude Code up to an API that returns deterministic responses reproducing the undesirable behavior and verify that the harness blocks the action.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.212
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
_No response_