Concurrent coding agents were contending for one Chrome profile. I built
a TypeScript CLI and session library that gives each worker its own browser,
waits for readiness, and cleans up the session when work ends.
My role
CLI, session lifecycle, integration tests
Stack
TypeScript, Playwright, Chrome DevTools Protocol
Use
Private tooling for concurrent browser verification
The workflow
A worker requests a browser, navigates to a page, reads its title, and
captures a screenshot. Each worker has a distinct port and temporary
profile, so another worker’s navigation cannot replace its page.
My code manages allocation, readiness, attachment, and teardown.
Playwright drives the page through Chrome DevTools Protocol. The agent
or calling script chooses the task and interprets the result.
One worker, one browser
Separate state for each task, with an explicit end to its lifetime.
ReserveAllocate a port and profile under a lock
LaunchStart Chrome and wait for readiness
AttachConnect Playwright over CDP
WorkNavigate, inspect, capture
ReleaseStop owned processes and remove temporary state
Failure and recovery
Concurrent startup
Port reservation and its placeholder record are written inside the
allocation lock. Readiness polling happens outside it, so one slow
browser does not hold up every other startup. The default readiness
limit is 15 seconds; a timeout removes the browser and its temporary state.
A task throws
The session wrapper releases the browser in a finally block. A live
integration test deliberately throws inside a task, checks that the error
reaches the caller, and verifies that no live instance or orphan remains.
The screenshot demo also allows one retry of its initial navigation.
Chrome outlives its connection
Disconnecting a CDP client can leave Chrome running. Release finds the
processes associated with that session’s profile, stops them, and verifies
they are gone. A diagnostic command reports abandoned profiles and processes
within the tool’s own storage area.
Recorded results
September 29, 2026 UTC · Linux CI · Headless Chrome
4
isolated browsers in the navigation and screenshot demo
8.003 s
total demo time, including startup and release
4 of 4
live browser lifecycle tests passed
0
orphaned browser processes after the run
What the check covers
Four workers visited different public pages and saved screenshots. The
integration checks covered navigation and release, distinct concurrent
ports, bulk cleanup in an isolated test environment, and cleanup after a
thrown task. The same revision passed 93 unit tests across 12 suites.
This is one recorded run, with network-dependent timing and no separately
measured sequential baseline. It verifies browser lifecycle behavior;
it does not measure an LLM’s success rate on arbitrary computer tasks or
exercise the macOS-specific launch path.