Findings
Finding: abandoned cookie login sessions leak chromium + tmpdir
Date: 2026-05-30
Status: Resolved (reaper shipped — see plan 2026-05-30-mcp-initiated-connect).
Area: packages/server/src/auth/cookie.ts
What#
startCookieSession spawns a headless chromium process and a temp userDataDir
(mkdtempSync), and registers the session in the in-memory sessions Map. The
process + tmpdir are only ever freed by closeCookieSession (SIGKILL + rm).
There is no TTL and no idle reaper. If a user gets a CDP login URL but never finishes login (closes the tab, walks away), the session sits in the Map with:
- a live headless chromium process, and
- a temp
userDataDiron disk,
until closeCookieSession is explicitly called or the server restarts.
Why it matters#
- Correctness is safe: with no cookies captured,
hasValidCookiesstays false, soexecute_toolkeeps returningNOT_CONNECTED(guard atmcp/meta-tools.ts:62) andcreateContextthrowsNOT_CONNECTEDbefore any HTTP call (plugins/context.ts:104-107). Double-gated. - But each abandoned login is a resource leak: one orphaned chromium process and one temp dir per abandonment. Over time this exhausts memory / file handles / disk on the server host.
Resolution#
Closed by the MCP-initiated-connect design
(docs/internal/superpowers/specs/2026-05-30-mcp-initiated-connect-design.md, §4): every
cookie session gets an expiresAt (default 10 min) and a setInterval reaper
calls closeCookieSession on expiry, plus an immediate reap on
wait_for_connection timeout.