[BUG] Multiple duplicate warmup agents spawning causes idle token consumption
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 noticed Claude Code is spawning 3 parallel warmup agents every few minutes instead of one. In ~/.claude/logs/, I can see simultaneous requests with "content":"Warmup" and "isSidechain":true but different agentId values (e.g., a78337d, a51e86b) all under the same sessionId and identical timestamps. Each warmup consumes ~20-26k cache creation tokens, so 3x warmups means ~60-70k tokens burned every few minutes during idle time. Only one Claude process is running (ps aux | grep claude confirms single instance). This appears to be causing the idle token drain bug that others have reported. Expected behavior would be a single warmup agent, not three parallel duplicates.
What Should Happen?
A single warmup agent should fire periodically to keep the prompt cache hot. Multiple parallel warmups with identical context serve no purpose since they're all creating the same cache - only one cache creation is needed, and subsequent requests should read from it. The warmup logic should either spawn one agent, or if multiple agent types need warming, they should be deduplicated or staggered rather than firing simultaneously.
Error Messages/Logs
{"parentUuid":null,"isSidechain":true,"agentId":"a78337d","message":{"content":"Warmup"},"timestamp":"2026-01-11T08:01:06.211Z"}
{"agentId":"a78337d","usage":{"cache_creation_input_tokens":26277}}
{"parentUuid":null,"isSidechain":true,"agentId":"a51e86b","message":{"content":"Warmup"},"timestamp":"2026-01-11T08:01:06.214Z"}
{"agentId":"a51e86b","usage":{"cache_creation_input_tokens":19534}}
Three agents with different IDs (a78337d, a51e86b, plus a third) all spawning within 3ms of each other, each creating separate caches totaling ~45k+ tokens in a single warmup cycle.
Steps to Reproduce
- Start Claude Code in any project directory (claude)
- Leave the session idle for a few minutes without sending any messages
- Monitor ~/.claude/logs/ for entries containing "content":"Warmup"
- Observe multiple warmup requests firing simultaneously with different agentId values but identical sessionId and near-identical timestamps
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
v2.1.3
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 9 comments on GitHub. Read the full discussion on GitHub ↗