anthropics / anthropics/claude-code

[BUG] Claude can present the plan to the user before backgrounded subagents finish executing

Open
#81,254 0 comments 0 reactions 0 assignees View on GitHub
area:agents bug
Dominant language
Python
Stars
145k
Forks
23.1k
PR merge metrics
PR metrics pending

Description

### Preflight Checklist

- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) 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

```shell

```

### 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_

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names no files, tests, or entry points. Start by tracing the harness path that presents a plan while backgrounded subagents are running, then reproduce it with deterministic API responses; done means plan presentation is blocked until every subagent has finished.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.