[Bug] --bg-pty-host causes high CPU usage on resumed sessions
Bug Description
--bg-pty-host pegs a CPU core at ~100% on resumed sessions
A resumed Claude Code session's background pty host process spins at ~99.6% CPU indefinitely. Single core, sustained, no input. macOS Activity Monitor flags the parent terminal app as "using significant energy" — the actual culprit is the claude --bg-pty-host child.
Environment Info
- macOS (Darwin 25.5.0)
- Claude Code 2.1.177 / 2.1.179 (multiple versions running in parallel resumed sessions)
- Terminal: cmux 0.64.16 (Ghostty-based), with autoResumeAgentSessions: true
- Multiple resumed agent surfaces in one workspace
- Platform: darwin
- Terminal: ghostty
- Feedback ID: 51040a32-45b3-49fa-82a7-7bdef1775789
Observed
PID %CPU %MEM COMMAND
30644 99.6 0.0 claude --bg-pty-host /tmp/cc-daemon-501/d09eba95/pty/86f3bce8.sock 190 58 \
-- claude --session-id 86f3bce8-c97e-4381-a21d-5a21df3031dc \
--fork-session --resume …86f3bce8-…jsonl
The pty host (PID 30644) is pinned at 99.6% CPU. The actual session process it hosts (PID 30725) sits at 0.3% — so the loop is in the host, not the session work. Other Claude sessions on the same machine behave normally (0.0–6.5% CPU).
Steps to reproduce (best guess — needs your repro)
- Have several resumed agent sessions auto-restored on terminal launch.
- Leave them sitting; eventually one bg-pty-host process enters a busy loop and stays there.
I can't pin down the exact trigger from one observation, but the socket path naming (d09eba95 daemon, 86f3bce8 session) plus the --fork-session --resume flags point at session-resume / fork interaction.
Impact
- Sustained ~1 core of wasted CPU
- Battery drain on laptops
- macOS energy warnings on the host terminal app (it gets blamed for a child process it doesn't control)
Mitigation today
kill <pid> on the runaway bg-pty-host. It doesn't take the session with it cleanly, so the surface needs closing too.
Aside
Even with the most capable models like Mythos in the loop, this one keeps slipping past — Boris @bcherny seems to enjoy his loops. Let him have them, but maybe with a watchdog.
Errors
[]This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗