fix(extension): skip user windows in tab-group discovery#1762
Open
Benjamin-eecs wants to merge 1 commit into
Open
fix(extension): skip user windows in tab-group discovery#1762Benjamin-eecs wants to merge 1 commit into
Benjamin-eecs wants to merge 1 commit into
Conversation
baef6ff to
e9c8833
Compare
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a guard so that a tab group labelled as an owned container is skipped during discovery if its window contains user http(s) tabs outside the group, preventing the extension from hijacking a user's main window when a group has been dragged/merged into it.
Changes:
- Skip owned-container discovery candidates whose window has user http(s) tabs outside the group.
- Add a test verifying that such residual groups are not reused and a new window is created instead.
- Mirror the source change in the compiled
dist/background.jsbundle.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| extension/src/background.ts | Adds the residual-window detection in toOwnedContainerDiscoveryCandidate. |
| extension/src/background.test.ts | Adds a test for the new skip behavior. |
| extension/dist/background.js | Compiled output reflecting the source change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ener#1760) Chrome can move our "OpenCLI Adapter" tab group into the user's main window via drag or window merge. After the original automation window closes the residual group survives in the user's window, and the next service-worker discovery cycle adopts that window as the automation container, letting `resolveTab` reuse the user's real http(s) tabs as automation targets. `toOwnedContainerDiscoveryCandidate` now skips any candidate window whose tabs include http(s) pages outside the matched group, since extension-created adapter tabs are always inside the group. Fixes jackwener#1760
e9c8833 to
cd4399b
Compare
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.
Description
discoverOwnedContainerFromTabGroupqueries Chrome for any tab group titled "OpenCLI Adapter" across all windows and adopts the first match as the automation container. When Chrome moves our tab group into the user's main window (via tab drag or "Merge all windows"), the residual group survives there after the original automation window closes. The next service-worker discovery cycle then adopts the user's window, andfindReusableOwnedContainerTabhappily returns the user's real http(s) tab as a reusable automation target.resolveTabproceeds to overwrite that tab.Adapter tabs created by the extension are always added to our group via
ensureOwnedContainerTabGroup, so any http(s) tab in the candidate window that is outside our group must be a user tab. Use that as the residue signal intoOwnedContainerDiscoveryCandidate: when present, return null soselectOwnedContainerDiscoveryCandidatedoes not adopt the window and a fresh automation window is created instead.Related issue: fixes #1760.
Type of Change
Checklist
Screenshots / Output
Unit test
skips a residual OpenCLI Adapter group when its window holds user http tabs outside the groupcovers the regression: a window with a userhttps://tab outside the matched group and an "OpenCLI Adapter" group inside it now triggers a fresh automation window viachrome.windows.createand the user's tab url is preserved.Live test on Chrome for Testing 149 with the patched extension loaded: a probe driven from the service-worker debug WS prepared the residue state (user window with one
https://example.com/users-real-tabtab outside the group and oneabout:blanktab inside an "OpenCLI Adapter" group) and the patched discovery returnedadopted: nullwhile the pre-patch logic would have selected the user's window. Full extension suite: 75/75 pass.