feat: multi-instance browser isolation for concurrent Claude Code sessions#113
Open
ca1sar wants to merge 1 commit intoepiral:mainfrom
Open
feat: multi-instance browser isolation for concurrent Claude Code sessions#113ca1sar wants to merge 1 commit intoepiral:mainfrom
ca1sar wants to merge 1 commit intoepiral:mainfrom
Conversation
…sions Each Claude Code window is now automatically assigned its own Chrome browser instance on a dedicated CDP port, eliminating conflicts when running multiple sessions simultaneously. Key changes: - Add session-manager.ts: detects Claude Code session ID from process tree, maintains session-to-port bindings in ~/.bb-browser/instances/ - New instances inherit login state from template user-data directory - Atomic port allocation via O_EXCL file locks prevents race conditions - Stale sessions are automatically cleaned up when their CC process exits - Supports BB_BROWSER_PORT and BB_BROWSER_SESSION_ID env var overrides - Fully backward compatible: no-session invocations use legacy single-instance path Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
bb-browsercommands simultaneously, they all share a single Chrome instance, causing tab/navigation conflicts~/.bb-browser/browser/user-data/directoryDesign
New
session-manager.tsmodule (self-contained, single integration point indiscoverCdpPort):--session-idO_EXCLfile locks prevent race conditions~/.bb-browser/instances/session-map.jsonwith file-lock-protected read-modify-write~/.bb-browser/browser/user-data/template, with--disable-cookie-encryptionso cookies survive cross-profile copyBB_BROWSER_PORT(explicit port) andBB_BROWSER_SESSION_ID(explicit session identity)Files changed
packages/cli/src/session-manager.tspackages/cli/src/cdp-discovery.tsdiscoverSessionPort()before legacy pathTest plan
bb-browser open urlworks as beforebb-browser snapshotreturns different pagesBB_BROWSER_PORT=19830 bb-browser open url: launches on specified port🤖 Generated with Claude Code