fix(extension): cleanup empty owned tab groups#1653
Conversation
|
Thanks for digging into this @jun0315 — closing this PR after a deeper design review. The change works as written (and the test additions are solid), but the direction conflicts with how OpenCLI's owned tab groups are designed to work: The empty OpenCLI uses these named groups as persistent automation container markers. When a tab is removed, the group is intentionally left behind as a stable anchor for the next session. The existing reuse path (PR #1541's So users see exactly one empty OpenCLI group between sessions, never accumulation. Auto-ungrouping the last tab would actively break that reuse path — Chrome would then create a fresh group with a new ID each session. If you'd like to take another swing at issue #1627, the right direction would be to verify whether there's a scenario where reuse doesn't trigger (e.g. cross-window edge case, race during teardown), and fix that path — rather than removing the group anchor. Happy to look at a fresh PR going that direction. Related design: PR #1541 (cross-window owned-container discovery), PR #1566 (regression test for groupId tiebreaker). |
Description
Fixes #1627.
When an owned OpenCLI tab is removed, Chrome can leave behind an empty named tab group such as
OpenCLI Adapter/OpenCLI Browser. This is visible after ephemeral adapter sessions clean up their temporary tabs.This PR adds a small owned-tab removal helper that checks whether the tab being removed is the last tab in an
OpenCLI-managed tab group. If so, it calls
chrome.tabs.ungroup(tabId)beforechrome.tabs.remove(tabId),preventing Chrome from leaving an empty group behind.
The default grouping behavior is unchanged. OpenCLI still groups owned browser/adapter tabs as before; this only
cleans up the final tab before removal.
Related issue: #1627
Type of Change
Checklist
Documentation (if adding/modifying an adapter)
docs/adapters/(if new adapter)docs/adapters/index.mdtable (if new adapter)docs/.vitepress/config.mts(if new adapter)README.md/README.zh-CN.mdwhen command discoverability changedCliErrorsubclasses instead of rawErrorScreenshots / Output