0
Fork 0
mirror of https://github.com/mastra-ai/mastra.git synced 2026-11-17 08:44:46 +00:00

fix(browser): retire replaced browsers and kill them when close hangs

A tool call that captured the old browser before /browser replaced it could
reach ensureReady() mid-close, wait, and relaunch a Chrome nothing tracked,
which kept holding the profile. And a close that failed or hung past 5s still
counted as done, leaving the old Chrome alive.

MastraBrowser gains retire(), which closes for good so later ensureReady() or
launch() calls throw, and killProcesses(), which SIGKILLs the browser's
process groups. Mastra Code retires browsers it replaces or shuts down, and
kills them if the retire rejects or takes longer than 5s.

Co-Authored-By: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com>
This commit is contained in:
mastra-platform[bot] 2026-10-28 19:41:16 +00:00
commit 0204188bbf
7 changed files with 175 additions and 42 deletions