Skip to content

Multi-partition support: isolated browser sessions for parallel agents - #20

Open
ugbodagadave wants to merge 1 commit into
Agent360dk:mainfrom
ugbodagadave:feature/browser-partitions
Open

Multi-partition support: isolated browser sessions for parallel agents#20
ugbodagadave wants to merge 1 commit into
Agent360dk:mainfrom
ugbodagadave:feature/browser-partitions

Conversation

@ugbodagadave

Copy link
Copy Markdown

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_PORTBROWSER_MCP_MAX_PORT aware). 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 number
  • browser_partition_list — default port plus extras, with connection state
  • browser_partition_close — releases an extra partition's port immediately (the default is protected)

Every other tool accepts an optional partition number; omitting it targets the default partition — fully backward compatible, existing clients notice nothing. Server-local tools (browser_about, browser_provide_feedback, the partition_* tools themselves) take no partition by 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.
  • 5-agent concurrency test: five agents, five partitions, five distinct pages held open simultaneously; each partition saw only its own tab; all cleaned up afterwards.
  • Existing suite: no new failures. The only failing tests (WISHLIST paastaar..., bind-fejl...) fail identically on pristine main. 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-routed partition param).

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant