Skip to content

fix(multi-panel): preserve live chat sessions when switching open modes - #115

Merged
Manho merged 2 commits into
mainfrom
fix/preserve-chat-on-mode-switch
Nov 19, 2026
Merged

Manho merged 2 commits into
mainfrom
fix/preserve-chat-on-mode-switch

Conversation

@Manho

@Manho Manho commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • Move the existing Multi-Panel tab in-place between normal browser windows and standalone popup windows so switching between Tab Mode and Popup Mode no longer reloads the page or resets active provider iframe / custom API chats.
    • Tab → Popup: adopts the current tab into a popup window via chrome.windows.create({ tabId, type: 'popup', ... }).
    • Popup → Tab: moves the tab back to the preferred (or last-focused / available) matching-profile normal window via chrome.tabs.move, activating and focusing it (unminimizing if minimized), or adopts it into a new normal window when no compatible normal window is open.
  • Harden edge cases and races:
    • Retry transient Chrome tab-strip-busy errors (Tabs cannot be edited right now) with short backoff and keep the live page open (showing a toast) instead of recreating and closing the tab if retries exhaust.
    • Only fall back to legacy recreate when reparenting APIs are unsupported, using a URL-scoped openModeHandoff token key with failure cleanup.
    • Reconcile external chrome.tabs.onAttached moves (e.g., Chrome's native "Show as tab") even if they arrive during a pending mode switch, and update the toggle button without waiting on chrome.storage.sync.get.
  • Requires no new manifest permissions.

Test Plan

  • Added unit and integration regression tests in tests/open-mode-switcher.test.js (22/22 passed).
  • Full Vitest suite passed (npx vitest run, 93 files / 1285 tests).
  • Added real Chromium Playwright E2E tests in tests/e2e/open-mode-switch.e2e.test.js (2/2 passed) verifying live iframe chat preservation across Tab ↔ Popup transitions and zero-normal-window recovery.

@Manho
Manho merged commit 5b95c7e into main Nov 19, 2026
2 checks passed
@Manho
Manho deleted the fix/preserve-chat-on-mode-switch branch November 19, 2026 03:14
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