← 返回 Skills 市场
guoqunabc

Browser Zombie Cleaner

作者 Madoka · GitHub ↗ · v1.0.0
cross-platform ✓ 安全检测通过
262
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install browser-zombie-cleaner
功能描述
Detect and clean up zombie browser processes left by OpenClaw's browser tool. When the OpenClaw Gateway restarts, Playwright-launched browser processes get o...
使用说明 (SKILL.md)

Browser Zombie Cleaner

Detect and clean up orphaned browser processes left behind when OpenClaw Gateway restarts.

The Problem

OpenClaw's browser tool uses Playwright to launch Chrome/Chromium/Firefox. When the Gateway restarts (update, crash, manual restart), these browser child processes become orphans — their parent PID changes to 1 (init/systemd). They keep running, consuming memory, and accumulate over days.

Safety Design

This tool is safe by default:

  1. Detect-only mode is the default — no processes are killed without --kill
  2. Triple verification before killing: OpenClaw user-data-dir pattern + orphaned PPID + minimum age
  3. Only current user's processes — never touches other users
  4. Only OpenClaw browsers — identified by ~/.openclaw/browser/ in the command line
  5. Graceful shutdown — SIGTERM first, SIGKILL only after grace period
  6. Audit log — every action is logged to /tmp/openclaw/zombie-browser-cleanup.log
  7. No root required — runs as regular user

Usage

Detect only (safe, default)

bash \x3Cskill_dir>/scripts/cleanup-zombie-browsers.sh

Output example:

Found 8 OpenClaw browser processes, 5 are zombies (1200MB total)
  ZOMBIE: PID=66301 PPID=1 age=3d 2h mem=388MB
  ZOMBIE: PID=152356 PPID=1 age=2d 4h mem=168MB
  ...
Run with --kill to terminate these zombie processes

Detect and clean

bash \x3Cskill_dir>/scripts/cleanup-zombie-browsers.sh --kill

Options

Option Default Description
--kill off Actually terminate zombie processes
--min-age N 3600 (1h) Only target processes older than N seconds
--grace N 10 Seconds between SIGTERM and SIGKILL
--json off Output as JSON (for programmatic use)
--log PATH /tmp/openclaw/zombie-browser-cleanup.log Log file location
--pattern STR .openclaw/browser/ Pattern to identify OpenClaw browsers

Integration with Health Checks

Add to your health check script or heartbeat:

# Detect and report (no kill)
bash /path/to/cleanup-zombie-browsers.sh

# Auto-clean with safety margin (processes must be >2 hours old)
bash /path/to/cleanup-zombie-browsers.sh --kill --min-age 7200

How It Identifies Zombies

A process is classified as a zombie browser if ALL of these are true:

  1. Browser process — executable name matches chrome/chromium/brave/msedge/firefox
  2. OpenClaw origin — command line contains .openclaw/browser/ (the user-data-dir used by OpenClaw)
  3. Orphaned — PPID is 1 (init) or systemd, meaning the parent Gateway process is gone
  4. Old enough — process age exceeds --min-age threshold (prevents killing browsers that are actively initializing)

If ANY condition is not met, the process is skipped.

Platform Support

Platform Status Notes
Linux Full Uses /proc filesystem for precise detection
macOS Full Uses ps with etime parsing
Windows Not yet Planned (PowerShell-based)

Supported Browsers

All Playwright-supported browsers with OpenClaw user-data-dir:

  • Google Chrome / Chromium
  • Brave Browser
  • Microsoft Edge
  • Firefox

Exit Codes

Code Meaning
0 No zombies found, or zombies cleaned (--kill mode)
1 Zombies detected but not killed (detect mode)
安全使用建议
This skill appears to do what it says, but follow safe steps before using its kill functionality: (1) run the default detect-only mode and review the output to confirm detected PIDs are indeed orphaned OpenClaw browser processes; (2) inspect the log file (default /tmp/openclaw/zombie-browser-cleanup.log) and consider setting --log to a secure path so command lines (which may contain sensitive args) aren't left in a world-readable temp file; (3) tune --pattern and --min-age to your environment to avoid false positives; (4) avoid running as root — the script is designed to run as the regular user; (5) on macOS test the parsing thoroughly because ps output parsing can be brittle. If you need extra assurance, run with --json and validate programmatically before enabling automatic --kill runs.
功能分析
Type: OpenClaw Skill Name: browser-zombie-cleaner Version: 1.0.0 The skill is a utility designed to identify and terminate orphaned browser processes (zombies) left behind by OpenClaw's browser tool. The script (cleanup-zombie-browsers.sh) implements multiple safety checks, including verifying the process owner, checking for a specific command-line pattern (~/.openclaw/browser/), ensuring the process is orphaned (PPID=1), and enforcing a minimum process age. It defaults to a non-destructive detection mode and uses graceful termination (SIGTERM followed by SIGKILL) when the --kill flag is explicitly provided.
能力评估
Purpose & Capability
Name/description match the implementation: the script scans processes (via /proc and ps), filters by current user and a user-data-dir pattern (.openclaw/browser/) and optionally kills matched orphans. It does not ask for cloud credentials, global system access, or unrelated binaries.
Instruction Scope
The SKILL.md and script stay within the declared purpose. The script reads /proc and invokes normal system utilities, and only kills when --kill is passed. Two cautionary notes: (1) it inspects full command lines, which can include sensitive arguments — these are written to the log by default; (2) platform-specific parsing (macOS ps parsing) can be brittle and could misclassify processes in edge cases. The presence of a configurable pattern and min-age mitigates accidental kills but requires the operator to verify settings.
Install Mechanism
Instruction-only skill with a bundled shell script; no install spec, no external downloads, and no packages are installed. Lowest-risk distribution model.
Credentials
No credentials or privileged environment variables are required. The script supports an optional OPENCLAW_ZOMBIE_LOG env var and allows custom pattern/log path via CLI; these are reasonable and proportionate for the task.
Persistence & Privilege
always is false and the skill does not request permanent/forced inclusion or modify other skills or system-wide settings. It runs as the invoking user and explicitly avoids touching other users' processes.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install browser-zombie-cleaner
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /browser-zombie-cleaner 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of browser-zombie-cleaner. - Detects orphaned browser processes left by OpenClaw's browser tool after Gateway restarts. - Default safe mode: only detects and reports zombie browsers; uses triple verification before termination. - Option to terminate zombie processes with --kill, supporting grace periods and logging all actions. - Filters processes by user, age, and OpenClaw browser signature to prevent accidental terminations. - Supports Linux and macOS; logs actions to /tmp/openclaw/zombie-browser-cleanup.log for auditability.
元数据
Slug browser-zombie-cleaner
版本 1.0.0
许可证
累计安装 1
当前安装数 0
历史版本数 1
常见问题

Browser Zombie Cleaner 是什么?

Detect and clean up zombie browser processes left by OpenClaw's browser tool. When the OpenClaw Gateway restarts, Playwright-launched browser processes get o... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 262 次。

如何安装 Browser Zombie Cleaner?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install browser-zombie-cleaner」即可一键安装,无需额外配置。

Browser Zombie Cleaner 是免费的吗?

是的,Browser Zombie Cleaner 完全免费(开源免费),可自由下载、安装和使用。

Browser Zombie Cleaner 支持哪些平台?

Browser Zombie Cleaner 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Browser Zombie Cleaner?

由 Madoka(@guoqunabc)开发并维护,当前版本 v1.0.0。

💬 留言讨论