fix: prevent CDP connect hang on browsers with discarded/frozen tabs#1080
Open
ChunHao-dev wants to merge 1 commit intovercel-labs:mainfrom
Open
fix: prevent CDP connect hang on browsers with discarded/frozen tabs#1080ChunHao-dev wants to merge 1 commit intovercel-labs:mainfrom
ChunHao-dev wants to merge 1 commit intovercel-labs:mainfrom
Conversation
… on discarded tabs When connecting via --cdp to a browser with discarded/frozen tabs (Chrome Memory Saver), Page.enable hangs indefinitely because discarded tabs have no renderer process to respond. Add a 3-second timeout to the initial enable_domains call. If the first tab fails to respond (likely discarded), fall back to creating a new about:blank tab. Fixes vercel-labs#1036
Contributor
|
@ChunHao-dev 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.
Summary
Fix CDP connect hanging indefinitely on browsers with discarded/frozen tabs (Chrome Memory Saver).
Fixes #1036
Changes
enable_domains()call during initial CDP connection indiscover_and_attach_targets()about:blanktabtab list(attached but not enabled); they get enabled lazily ontab switchTest plan
cargo fmt --check✅cargo clippy✅cargo test— 565 passed, 0 failed ✅chrome://discards→ Urgent Discard multiple tabs →agent-browser --cdp 9222 get titleDesign decision
Fallback to a new tab after the first timeout rather than trying all tabs because:
Target.getTargetsorder is not sorted by activity — there's no way to know which tab is more likely to be active, so trying them sequentially doesn't improve the oddsA future improvement could use the
/json/listHTTP endpoint (which returns tabs sorted by most recently active) to pick a better first candidate.