fix: dashboard live view recovers when a tab closes itself - #1634
Draft
kevingatera wants to merge 1 commit into
Draft
fix: dashboard live view recovers when a tab closes itself#1634kevingatera wants to merge 1 commit into
kevingatera wants to merge 1 commit into
Conversation
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.
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. |
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.
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
BrowserManager::remove_page_by_target_idnow returns whether a tracked page was actually removed, so untracked target deaths (workers, service workers) do not cause spurious broadcasts.Verification
e2e_stream_self_closed_tab_resyncs_streamcloses 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.cargo fmtclean,cargo clippy --all-targetsclean (only the two pre-existing warnings),cargo test --bin agent-browser daemon23/23,cargo test --bin agent-browser stream77/77, alle2e_streamignored tests 4/4.Fixes #1633.