[bug] agent-browser skill: Chrome headless processes orphaned after session ends (97% CPU, 10GB RAM leak)

Resolved 💬 5 comments Opened Apr 19, 2026 by Rf-hnl Closed May 28, 2026

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?

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):
```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"
}]
}]
}

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗