claude-code - 💡(How to fix) Fix [bug] agent-browser skill: Chrome headless processes orphaned after session ends (97% CPU, 10GB RAM leak) [3 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#50783Fetched 2026-04-20 12:13:08
View on GitHub
Comments
3
Participants
3
Timeline
10
Reactions
0
Author
Timeline (top)
labeled ×5commented ×3mentioned ×1subscribed ×1

Error Message

Error Messages/Logs

Root Cause

Root cause: ~/.claude/plugins/cache/agent-browser/ has no Stop hook registered. Claude Code exposes the Stop event exactly for this purpose but agent-browser doesn't use it.

Fix Action

Fix / Workaround

Workaround (manually added to ~/.claude/settings.json):

"hooks": {      
  "Stop": [{
    "hooks": [{
      "type": "command",
      "command": "pkill -f 'agent-browser-chrome' 2>/dev/null || true"
    }]                                                                                                                                                                                      
  }]
}

Workaround manually added to ~/.claude/settings.json:
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

The agent-browser skill launches Chrome headless instances via Playwright but does NOT kill them when the Claude Code session ends. Processes remain orphaned indefinitely consuming CPU
and RAM.

Measured impact on 16GB MacBook:

  • CPU: 97.3% for ~32 minutes (single renderer process)
  • RAM: 10 GB consumed (of 16 GB total)
  • 6+ orphaned chrome-headless-shell instances
  • Severe laptop overheating

What Should Happen?

When the Claude Code session ends, all Chrome headless processes launched by agent-browser should be terminated automatically. The skill should register a Stop hook to clean up its own processes.

Error Messages/Logs

Steps to Reproduce

Steps to Reproduce

  1. Use the agent-browser skill to automate any browser task
  2. End the Claude Code session (normal exit, /clear, or crash)
  3. Run: ps aux | grep chrome-headless-shell
  4. Observe orphaned chrome-headless-shell processes still running with high CPU/RAM usage

Root cause: ~/.claude/plugins/cache/agent-browser/ has no Stop hook registered. Claude Code exposes the Stop event exactly for this purpose but agent-browser doesn't use it.

Workaround (manually added to ~/.claude/settings.json):

"hooks": {      
  "Stop": [{
    "hooks": [{
      "type": "command",
      "command": "pkill -f 'agent-browser-chrome' 2>/dev/null || true"
    }]                                                                                                                                                                                      
  }]
}                

### Claude Model

Sonnet (default)

### Is this a regression?

No, this never worked

### Last Working Version

_No response_

### Claude Code Version

2.1.114 (Claude Code) 

### Platform

Anthropic API

### Operating System

macOS

### Terminal/Shell

Terminal.app (macOS)

### Additional Information

The fix is straightforward: agent-browser skill should register its own Stop hook to run:
pkill -f 'agent-browser-chrome' 2>/dev/null || true                                                                                                                                         
 
This makes cleanup automatic for all users without requiring manual configuration.                                                                                                          
                




1. Use the agent-browser skill to automate any browser task                                                                                                                                 
2. End the Claude Code session (normal exit, /clear, or crash)
3. Run: ps aux | grep chrome-headless-shell                                                                                                                                                 
4. Observe orphaned chrome-headless-shell processes still running with high CPU/RAM                                                                                                         
                                                                                                                                                                                            
Root cause: ~/.claude/plugins/cache/agent-browser/ has no Stop hook registered.                                                                                                             
Claude Code exposes the Stop event exactly for this purpose but agent-browser does not use it.                                                                                              
                                                                                                                                                                                            
Workaround manually added to ~/.claude/settings.json:
                                                                                                                                                                                            
  "hooks": {    
    "Stop": [{
      "hooks": [{                                                                                                                                                                           
        "type": "command",
        "command": "pkill -f agent-browser-chrome"                                                                                                                                          
      }]        
    }]
  }

extent analysis

TL;DR

The agent-browser skill should register a Stop hook to automatically terminate Chrome headless processes when the Claude Code session ends.

Guidance

  • The root cause is the lack of a Stop hook registration in the agent-browser skill, which prevents it from cleaning up its own processes.
  • To verify the issue, follow the steps to reproduce and check for orphaned chrome-headless-shell processes using ps aux | grep chrome-headless-shell.
  • A potential fix is to register a Stop hook in the agent-browser skill to run the command pkill -f 'agent-browser-chrome' 2>/dev/null || true.
  • To mitigate the issue, a manual workaround can be added to ~/.claude/settings.json with a Stop hook that runs the above command.

Example

"hooks": {    
  "Stop": [{
    "hooks": [{                                                                                                                                                                           
      "type": "command",
      "command": "pkill -f agent-browser-chrome"                                                                                                                                          
    }]        
  }]
}

Notes

The provided workaround requires manual configuration, and a more permanent solution would involve modifying the agent-browser skill to register its own Stop hook.

Recommendation

Apply the workaround by adding the Stop hook to ~/.claude/settings.json, as this provides an immediate solution to the issue. A more permanent fix would require modifying the agent-browser skill, which may require additional development and testing.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING