Background Agents Survive macOS Sleep/Wake and Brew Upgrades in v2.1.142
Claude Code v2.1.142 fixes two critical reliability issues that disrupted background agents on macOS: the daemon now detects system clock jumps caused by sleep/wake cycles instead of treating elapsed suspended time as idle time, preventing sessions from disappearing mid-task. A second fix ensures the daemon exits cleanly after a binary upgrade (e.g. via brew upgrade), so dispatched agents no longer crash-loop on a deleted binary path. Together, these fixes significantly improve the reliability of long-running background agents on macOS.
Sources & Mentions
5 external resources covering this update
Background Agents on macOS Are Now Significantly More Reliable
Claude Code v2.1.142 ships two targeted fixes for a class of problems that had made running unattended background agents on macOS frustrating: session drops triggered by laptop sleep and crashes caused by brew upgrade. Both issues affected users running long-horizon tasks in the background β exactly the workflows that the Claude Code Agent View and /bg command are designed to support.
Fix 1: Sessions No Longer Disappear After macOS Sleep/Wake
Previously, when a Mac went to sleep while a background agent was running, the daemon measured the sleep duration as elapsed idle time. If the sleep was long enough, the agent would be treated as timed out and removed β even if the underlying task was still valid.
The fix is precise: the daemon now detects clock jumps (a reliable signal of a sleep/wake cycle) and correctly skips over the suspended period when computing idle time. Background sessions that were actively working when the laptop closed now resume normally after wake.
Fix 2: Brew Upgrades No Longer Crash Running Agents
When brew upgrade updated the Claude Code binary, the previous daemon process continued running but pointed at a deleted executable path. Any new agent dispatches would attempt to spawn using that path and immediately crash-loop. Users experienced a confusing series of failed agent launches until they manually restarted the daemon.
In v2.1.142, the daemon detects that its binary has been replaced and exits cleanly after an upgrade. This allows the upgraded daemon to start fresh with the correct binary path on the next invocation, resolving the crash-loop without manual intervention.
Why These Fixes Matter
The combination of sleep/wake resilience and clean daemon upgrades removes two of the most common interruptions for macOS users running overnight or long-duration background agents. Teams using Claude Code for PR babysitting, extended refactoring tasks, or multi-step research workflows on laptops should see noticeably fewer unexplained session terminations.