Skip to content

web: graceful daemon shutdown has no web-session close step — Chrome fleet survives until the idle window #1868

Description

@thymikee

teardownSessionResources (src/daemon/session-teardown.ts:124-149) finalizes recording, app-log, audio, and perf captures on daemon shutdown, but has no step for an open web session — unlike session close, which does dispatch a platform close (src/daemon/handlers/session-close.ts:395).

SIGTERM of a daemon holding an open web session therefore leaves the full agent-browser Chrome fleet (~15 processes) alive until agent-browser's own idle timer fires — DEFAULT_AGENT_BROWSER_IDLE_TIMEOUT_MS = 5 * 60_000 (src/platforms/web/agent-browser-lifecycle.ts:19).

A fresh daemon on the same state dir does not reap it either: cleanupManagedAgentBrowserOrphans runs only at daemon/provider startup and skips fleets with recent-browser-activity (agent-browser-lifecycle.ts:124-127).

Not a regression — this is within #1109's accepted "within the idle window" behaviour — but it is the only capture-like resource with no shutdown step, and it blocks wiring #1859's daemon leak oracle to a web lane.

Wanted: a best-effort web close step in teardownSessionResources, mirroring the recording step added in #1325, plus a lane that asserts zero owned processes immediately after shutdown.

Found while building the B1 daemon leak oracle (#1781 wave 3, PR #1859); code paths independently verified in review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions