Skip to content

fix(browser): isolate embedded pages by conversation - #3526

Merged
bobleer merged 3 commits into
GCWing:mainfrom
bobleer:bob/session-browser-isolation
Oct 22, 2026
Merged

bobleer merged 3 commits into
GCWing:mainfrom
bobleer:bob/session-browser-isolation

Conversation

@bobleer

@bobleer bobleer commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

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 length property 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-desktop
  • cargo check --locked -p openbitfun-webdriver
  • cargo test --locked -p openbitfun-desktop --lib api::browser_api::tests
  • cargo test --locked -p openbitfun-product-domains --no-default-features --lib remote_surface
  • cargo 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:web and pnpm run build:web
  • Focused Web UI tests for browser lifetime/presentation, session events and storage, pane layout, and peer routing.
  • pnpm run check:core-boundaries, pnpm run check:repo-hygiene, and git 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

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

@bobleer
bobleer merged commit f6e0238 into GCWing:main Oct 22, 2026
13 checks passed
@bobleer
bobleer deleted the bob/session-browser-isolation branch October 27, 2026 02:18
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