fix(desktop): keep agent browsing out of the app window and on-screen - #2159
Merged
Conversation
Two built-in browser gaps after the CDP-plugin migration: #2000 - will-navigate never fires for CDP Page.navigate, so agent automation that picked the wrong CDP target (the app window is the first page target when no browser tab exists) replaced the entire workspace UI with the website, with no way back. A did-start-navigation guard on the main window now cancels disallowed external loads and reroutes the URL into a built-in browser tab. #2015 - only the active tab's WebContentsView is attached; agent CDP navigation of a background tab 'succeeded' while the visible tab stayed on about:blank. Tab navigations now auto-select the navigated tab so it becomes visible. data: loads (internal CDP target-marker pages) no longer surface the panel. Fixes #2000, fixes #2015
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
Fixes #2000 and #2015 — the remaining built-in-browser gaps at HEAD after the Puppeteer→CDP migration (#1707/#1861) and the post-0.14.0 fixes (#2020/#2022/#2079).
Root causes & changes (
apps/desktop/electron/main.mjs)#2000 — browser takes over the whole app window, no way back
The
will-navigateguard added in #2079 routes blocked main-window navigations into a browser tab — butwill-navigatenever fires for CDPPage.navigate, which behaves likeloadURL. The agent'sopencode-chrome-devtoolsplugin defaults to the first page target whentarget_idis omitted, and when no browser tab exists yet that target is the OpenWork main window itself. Result: the workspace UI replaced wholesale by the website, with no close control (and no app menu on Windows).→ Added a
did-start-navigationguard on the main window that cancels disallowed external main-frame loads (webContents.stop()) and reroutes the URL into a built-in browser tab via the existingrouteBlockedMainWindowNavigation.#2015 — browser shows about:blank while navigation "succeeds"
Only the active tab's
WebContentsViewis attached to the window; background tabs stay alive but detached. Agent CDP navigation of a background tab returns full success (snapshots/screenshots work offscreen) while the visible active tab sits onabout:blank.→ Tab
did-start-navigationnow auto-selects the navigated tab so it becomes visible.data:loads (the internal CDP target-marker pages) no longer trigger the panel.Tests run
pnpm --filter @openwork/desktop typecheck:electron— pass.pnpm --filter @openwork/desktop check:electron— pass (bridge covers 50 renderer methods).node --check apps/desktop/electron/main.mjs— pass.browser_navigatewithouttarget_id(or prompt a browse task) → the app window must NOT be replaced; the site must open in the side-panel browser.