Skip to content

fix: dashboard live view recovers when a tab closes itself - #1634

Draft
kevingatera wants to merge 1 commit into
vercel-labs:mainfrom
kevingatera:fix/stream-self-closed-tab-resync
Draft

fix: dashboard live view recovers when a tab closes itself#1634
kevingatera wants to merge 1 commit into
vercel-labs:mainfrom
kevingatera:fix/stream-self-closed-tab-resync

Conversation

@kevingatera

Copy link
Copy Markdown
Contributor

Bug

Reported in #1633. When a tab closes without going through a daemon command (window.close, a crash, or an external CDP client), the dashboard's live view never noticed on its own. The screencast kept targeting the dead CDP session, so the dashboard kept showing the closed tab's last frame and a stale tab bar until some later tab command happened to re-sync things.

The only path that observes these closes is the lazy per-command CDP event drain. It removed the destroyed target from the tracked pages but never told the stream server, so nothing re-broadcast the tab list or re-pointed the screencast.

Fix

  • When the drain removes a destroyed target that was a tracked page, the daemon now also broadcasts the updated tab list, re-syncs the stream server's CDP session id to the active tab, and notifies stream clients. That triggers the existing screencast restart, so frames resume from the remaining tab without any further command.
  • BrowserManager::remove_page_by_target_id now returns whether a tracked page was actually removed, so untracked target deaths (workers, service workers) do not cause spurious broadcasts.

Verification

  • New ignored e2e e2e_stream_self_closed_tab_resyncs_stream closes a tab over raw CDP (bypassing execute_command, so no post-command sync can mask the event-driven path) and asserts the dashboard receives a tab list without the closed tab and that frames resume from the remaining tab. Passes on this branch, fails without the fix.
  • Suite: cargo fmt clean, cargo clippy --all-targets clean (only the two pre-existing warnings), cargo test --bin agent-browser daemon 23/23, cargo test --bin agent-browser stream 77/77, all e2e_stream ignored tests 4/4.

Fixes #1633.

A tab closed by window.close, a crash, or external CDP was only noticed
by the lazy per-command drain, so the screencast kept aiming at the dead
session and the dashboard showed the closed tab until the next command.
The periodic drain now broadcasts the tab list and re-syncs the stream
CDP session whenever a tracked page is removed.
@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

@kevingatera is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

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.

Dashboard live view: a tab that closes itself stays visible until another tab action runs

1 participant