Skip to content

feat: avoid opening duplicate tabs in CDP browser on update - #6242

Merged
atomantic merged 1 commit into
mainfrom
cos/task-mtn6xq1w/agent-2dad6cd1
Sep 4, 2026
Merged

feat: avoid opening duplicate tabs in CDP browser on update#6242
atomantic merged 1 commit into
mainfrom
cos/task-mtn6xq1w/agent-2dad6cd1

Conversation

@atomantic

Copy link
Copy Markdown
Owner

Summary

When running update.sh or update.ps1, PortOS invokes scripts/open-ui-in-browser.js to auto-open the dashboard in the PortOS-managed CDP browser. Previously, it always navigated a fresh tab, creating duplicate tabs whenever updates were executed repeatedly with PortOS already open.

This change:

  • Queries open CDP pages and checks for an existing PortOS tab before opening a new tab.
  • Matches existing tabs against the target URL, loopback origins (ports 5555, 5553, 5554), Tailscale hostnames (*.ts.net), or PortOS page titles on PortOS ports.
  • Skips launching if a tab is already open, logging that PortOS is already open.
  • Only launches a new pinned tab if no PortOS tab exists in CDP.
  • Retries connection during cold starts so tabs in an existing or restoring browser session are recognized once CDP is reachable.

Test plan

  • Added unit tests in scripts/open-ui-in-browser.test.js verifying isPortOsPage, findExistingPortOsTab, and openPortOsUi.
  • Verified skipping launch when a tab is already open and launching when no PortOS tab is present.
  • Verified retrying during cold launch and detecting restored tabs.
  • Verified server and client unit tests pass.

@atomantic
atomantic merged commit d6e27e0 into main Sep 4, 2026
7 checks passed
@atomantic
atomantic deleted the cos/task-mtn6xq1w/agent-2dad6cd1 branch September 4, 2026 17:08
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