Multi-partition support: isolated browser sessions for parallel agents - #20
Open
ugbodagadave wants to merge 1 commit into
Open
Multi-partition support: isolated browser sessions for parallel agents#20ugbodagadave wants to merge 1 commit into
ugbodagadave wants to merge 1 commit into
Conversation
Problem: every agent sharing one MCP session (coordinator + subagents) drives the same tab group through the default port, so concurrent agents steal and close each other's tabs. A partition is an extra WebSocket listener in the same port range. The extension scans the whole range every 2s and connects to every listener, so each partition automatically becomes its own Chrome tab group with its own active tab. No extension changes needed. - browser_partition_new/list/close; every other tool accepts an optional partition number (omitted = default partition, behavior unchanged). - The default-port path (lazy binding, connection pinning, error taxonomy) is untouched. Partitions hold a scarce port only while open; closing one (or its last tab closing) releases the port immediately. - tools.js: partition prop on all tab-touching tools; server-local tools (about, feedback, partition_*) excluded by design. - Tests: mcp-server/test-partitions.py (21 checks, live Chrome E2E); suite guards updated (SERVER_LOKALE, methodMap tolerance derived from it, README table + count, combobox param exclusion). - Live 5-agent concurrency test: five partitions, five distinct pages held open simultaneously, each saw only its own tab, all cleaned up.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When several agents share one MCP session (a coordinator plus subagents), every browser tool call targets the same server port, hence the same Chrome tab group and the same active tab. Concurrent agents steal and close each other's tabs: screenshots of the wrong page, fills landing in the wrong form, tabs closed mid-task.
What this adds
Runtime browser partitions. A partition is an extra WebSocket listener in the same port range (
BROWSER_MCP_BASE_PORT–BROWSER_MCP_MAX_PORTaware). The extension already scans the whole range every 2 s and connects to every listener it finds, so each partition automatically becomes its own Chrome tab group with its own active tab. No extension changes needed.New tools:
browser_partition_new— opens a partition, waits for the extension to adopt it, returns its numberbrowser_partition_list— default port plus extras, with connection statebrowser_partition_close— releases an extra partition's port immediately (the default is protected)Every other tool accepts an optional
partitionnumber; omitting it targets the default partition — fully backward compatible, existing clients notice nothing. Server-local tools (browser_about,browser_provide_feedback, thepartition_*tools themselves) take nopartitionby design: they never touch a tab group.Compatibility with lazy ports: the default-port path (lazy binding, connection pinning, error taxonomy) is untouched. A partition holds a scarce port only while it is open; closing it — or its last tab closing (
terminate) — releases the port immediately.Testing
mcp-server/test-partitions.py: 21-check E2E over stdio against live Chrome (tool exposure, extension adoption, cross-partition isolation in both directions, default-path coexistence, unknown-partition error path, close semantics, default-partition protection) — all pass.WISHLIST paastaar...,bind-fejl...) fail identically on pristinemain. Suite guards that encode the tool inventory were updated for the 3 new tools (SERVER_LOKALE, methodMap tolerance now derived from it, README table + count, combobox param-forwarding exclusion for the server-routedpartitionparam).