[BUG] (regression) subagent swarm completion in long running tasks causes severe flickering and CPU usage
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?
Note: I am unable to use /feedback for this, since it seems that the Stop event clears the notifications that build up.
The basic issue is that in long running tasks, multiple Agent ${AGENT_XYZ_NAME_DESC} completed. notifications accumulate in the little TUI buffer. If claude is doing something that runs MANY subagents, it will accumulate to the point where the TUI exceeds the vertical height of the screen buffer, and then it flicker-thrashes. I as part of my PR-creation workflow, I run 18 haiku subagents in an iterative loop to catch bugs cheaply, so I can end up with a lot of these notifications building up.
Here's a screenshot from the other day of the behavior in question, though it seems to have gotten much worse in the past few days:
<img width="1440" height="900" alt="Image" src="https://github.com/user-attachments/assets/229800e3-1766-4656-8d8a-9a868b9161f1" />
I'm not sure if it was working properly in 2.1.0, but it wasn't this broken in 2.0.76.
This is DIFFERENT than several of the vague github issues created in recent days that report flickering.
In MY usecase, I run all 18 at once, and then launch a subagent-response-consolidator custom subagent that consumes the results of all 18 review agents and distills them down to something that won't comically exhaust the orchestrating agent's context window (I've seen them dump as much as 600k tokens into the context window at once without careful orchestration and consolidation - that is totally unrecoverable!)...
What Should Happen?
There are multiple potential short and long term fixes and workarounds:
- Don't newline separate each notification, or start outputting them as a long single line once there are more than a few
- Collapse the remaining notifications once more than a few build up (e.g. "and 27 other subagents completed/failed")
- Remove the notifications immediately when the output is consumed by a subagent (this would be difficult now that
TaskOutputandAgentOutputare no longer the ways to do this).
For MY usecase, option #3 would be very difficult for you to get right because of my subagent consolidation pattern.
Error Messages/Logs
Steps to Reproduce
- Run a bazillion background subagents at once as part of some long running task
- Ensure that claude code keeps working after they finish, perhaps launching more iteratively
- Ensure that enough run and finish for the completion-notification messages to exceed the line height of the TUI
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.0.76
Claude Code Version
2.1.4
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗