Description
When hermes-agent launches agent-browser (headless Chrome) for a task, the Chrome child processes are not properly
cleaned up after the task completes. This leaves zombie Chrome processes running indefinitely, each consuming ~100%
CPU.
Environment
- hermes-agent version: commit 24f139e (v0.11.0)
- agent-browser version: 0.26.0
- OS: macOS (Darwin 25.2.0, arm64)
- Chrome version: 147.0.7727.102
Steps to Reproduce
- Run hermes gateway with an agent task that uses browser tool
- After the task completes, check running Chrome processes
- The headless Chrome processes remain running with high CPU usage
Observed Behavior
7 Chrome processes were left running for 3+ days after the original task completed, consuming a combined ~580% CPU:
┌─────────────────┬──────┬─────────────────┐
│ Process │ CPU% │ Total CPU Time │
├─────────────────┼──────┼─────────────────┤
│ GPU Helper │ ~99% │ 1663 min (~27h) │
├─────────────────┼──────┼─────────────────┤
│ Renderer (main) │ ~99% │ 5205 min (~86h) │
├─────────────────┼──────┼─────────────────┤
│ Renderer x3 │ ~97% │ ~1600 min each │
├─────────────────┼──────┼─────────────────┤
│ Network Helper │ ~95% │ 1616 min │
├─────────────────┼──────┼─────────────────┤
│ Storage Helper │ ~97% │ 1608 min │
└─────────────────┴──────┴─────────────────┘
Parent process was: agent-browser-darwin-arm64 (PID 92242), using user-data-dir:
/var/folders/gz/.../agent-browser-chrome-d5463250-...
The --headless=new --enable-unsafe-swiftshader Chrome instance was never terminated.
Expected Behavior
agent-browser should kill all spawned Chrome processes when the browser session ends or the parent process exits.
Suggested Fix
- Add a process cleanup handler (e.g., atexit, signal handler) in agent-browser to ensure Chrome processes are
terminated
- Consider using process.kill(-pid) to kill the entire process group
- Alternatively, track spawned Chrome PIDs and clean them up on session close
Description
When hermes-agent launches agent-browser (headless Chrome) for a task, the Chrome child processes are not properly
cleaned up after the task completes. This leaves zombie Chrome processes running indefinitely, each consuming ~100%
CPU.
Environment
Steps to Reproduce
Observed Behavior
7 Chrome processes were left running for 3+ days after the original task completed, consuming a combined ~580% CPU:
┌─────────────────┬──────┬─────────────────┐
│ Process │ CPU% │ Total CPU Time │
├─────────────────┼──────┼─────────────────┤
│ GPU Helper │ ~99% │ 1663 min (~27h) │
├─────────────────┼──────┼─────────────────┤
│ Renderer (main) │ ~99% │ 5205 min (~86h) │
├─────────────────┼──────┼─────────────────┤
│ Renderer x3 │ ~97% │ ~1600 min each │
├─────────────────┼──────┼─────────────────┤
│ Network Helper │ ~95% │ 1616 min │
├─────────────────┼──────┼─────────────────┤
│ Storage Helper │ ~97% │ 1608 min │
└─────────────────┴──────┴─────────────────┘
Parent process was: agent-browser-darwin-arm64 (PID 92242), using user-data-dir:
/var/folders/gz/.../agent-browser-chrome-d5463250-...
The --headless=new --enable-unsafe-swiftshader Chrome instance was never terminated.
Expected Behavior
agent-browser should kill all spawned Chrome processes when the browser session ends or the parent process exits.
Suggested Fix
terminated