Repository navigation
fix(browser): isolate embedded pages by conversation - #3526
Merged
Merged
Conversation
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
When conversation A opened the embedded browser after the user switched to B, its page appeared in B. Switching conversations also destroyed the native page and could break A's subsequent reads.
Bind native targets, open events, canvas snapshots, and browser tool selection to the owning conversation. The Desktop host creates pages hidden; panels reattach the same document and only control presentation. Background sessions keep running, foreign target IDs are rejected, and session deletion releases only its own pages. Serialize presentation calls across remounts and preserve native navigation behavior before a panel mounts. Replacement navigation waits for the native load lifecycle before tool evaluation, so delayed responses cannot return the old document. Target discovery and automation attachment also exclude concurrent registration/cleanup races.
Also fix WebDriver serialization of article results: a numeric
lengthproperty must remain an object field rather than turning the whole result into an array.Type and Areas
Type: bug fix / regression coverage.
Areas: Desktop/Tauri, Rust browser tool adapter, WebDriver, Web UI session canvas, Product Operation Registry.
Motivation / Impact
Users can work in B while A opens, reads, or navigates its browser. Returning to A retains the original page, input state, and background execution. Optional ownership fields preserve legacy payload deserialization and round trips. Current-URL reads remain on the controller in Peer Device Mode.
Verification
Passed locally:
cargo build --locked -p openbitfun-desktopcargo check --locked -p openbitfun-webdrivercargo test --locked -p openbitfun-desktop --lib api::browser_api::testscargo test --locked -p openbitfun-product-domains --no-default-features --lib remote_surfacecargo test --locked -p openbitfun-core --no-default-features --features agent-runtime,tools-browser-web,tools-computer-use,git --lib control_hub_tool::cargo test --locked -p openbitfun-core --no-default-features --features agent-runtime,tools-browser-web,tools-computer-use,git --lib browser_control::pnpm run check:webandpnpm run build:webpnpm run check:core-boundaries,pnpm run check:repo-hygiene, andgit diff --check.OPENBITFUN_E2E_BACKGROUND_ONLY=1 node tests/e2e/scripts/run-browser-session-isolation.mjs: actual Agent calls and native pages verify A opening/reading/clicking while B stays selected, a delayed replacement returning the new document on the same native target, simultaneous A/B reads, repeated switches retaining document/input/timer state with exactly two WebViews, and owner-specific deletion. Only loopback model responses and page content are fixtures.Reviewer Notes
AI-assisted. Testing level: lightly tested across platforms, with focused automated tests and native macOS background coverage. The local Mac was locked, so full foreground native visibility was not exercised; the runner's default mode requires an unlocked desktop and asserts it. Visibility ordering is covered by frontend tests. Windows/Linux native behavior and live SSH, mobile/IM, peer-device, and detached-dispatch scenarios were not exercised. Remote-workspace rejection and peer routing were checked by contract tests.
Checklist