Skip to content

web: agent-browser Chrome fleets leak and can spin at 100% CPU for days — add idle lifecycle/reaper #1109

Description

@thymikee

Found 2026-07-05 on a dev machine: two orphaned agent-browser Chrome fleets (27 processes) from web-automation sessions 8.7 and 11.9 days old; one renderer had been pinned at ~100% CPU for 6 days (~144 CPU-hours). The parent daemons were long gone — nothing ever reaps the browsers.

The iOS runner already solved this class of problem: retained runners idle-stop after a period of inactivity, and leases expire. The web provider (src/platforms/web/, agent-browser integration under ~/.agent-device/tools/agent-browser/) has no equivalent: once a session leaks (daemon killed, machine slept, crash), its Chrome tree lives forever.

Wanted, in order of value:

  1. Idle self-termination: the agent-browser side (or a daemon-side watchdog while the daemon lives) shuts the browser down after N minutes without a command (mirror the iOS runner idle-stop policy and its configuration shape).
  2. Orphan detection at startup: when the web provider launches, detect prior agent-device-owned browser processes whose owning daemon/state-dir is gone and kill them (ownership marker: launch args/env tag or a pidfile in the state dir — pick one that survives crashes; do not kill user-owned Chrome).
  3. A diagnostic in doctor counting live agent-device-owned browser processes.

Constraints: ownership detection must be conservative — never kill a browser we cannot prove agent-device launched. Follow the repo error-system conventions for any new failure surfaces. Tests: unit-test the ownership/idle decision logic pure (no real browsers in unit tests — see docs/agents/testing.md speed rules).

Acceptance: a killed daemon leaves zero agent-browser processes behind within the idle window; a fresh session on a machine with leaked fleets cleans them up; unit tests for the decision logic; full gate green.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions