Skip to content

Daemon has no lifetime bound: sessions opened by agents each leak a headless Chrome #460

Description

playwright-cli open spawns cliDaemon.js detached and unref'd, and the daemon holds its browser until something sends close. When the caller is an agent (Claude Code, Codex) that opens a named session, finishes its task, and exits, nothing ever sends it. Each leaked session then keeps a Chrome renderer running at full rate, since the browser is launched with --disable-background-timer-throttling.

Measured on one machine over a day of agent use: 18 daemons (the oldest 21 h), 127 Chrome processes, ~25 GB RSS and ~6 cores busy. The next day there were 29 more.

Suggestion

Give the daemon a lifetime it can check itself, in one of these shapes:

  • open --owner-pid <pid> (or read a well-known env var such as CLAUDE_PID): the daemon polls the pid and exits when it is gone.
  • open --idle-timeout <duration>: exit after that long without a command over the socket.

Either could default on for agent clients — the CLI already detects CLAUDECODE / COPILOT_CLI — since an agent is exactly the caller that will not come back to close.

Version: @playwright/cli 0.1.19, playwright-core 1.63.0-alpha-2026-08-31, macOS 26.

This was written by Claude Code on behalf of max-sixty

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions