Skip to content

fix: skip frozen page targets when page enumeration times out#1231

Closed
barretlee wants to merge 1 commit intoChromeDevTools:mainfrom
barretlee:fix-skip-frozen-pages-1230
Closed

fix: skip frozen page targets when page enumeration times out#1231
barretlee wants to merge 1 commit intoChromeDevTools:mainfrom
barretlee:fix-skip-frozen-pages-1230

Conversation

@barretlee
Copy link
Copy Markdown

Summary

This PR makes page enumeration resilient to frozen/discarded background tabs.

When browser.pages() fails because Puppeteer times out while initializing a page session (for example on Network.enable), MCP now falls back to enumerating page targets one by one and skips only the targets that hit the same recoverable timeout.

Motivation

Closes #1230.

In a long-lived Chrome profile, some background tabs can become frozen or discarded by Chrome memory-saving behavior. Before this change, a single bad target could make page enumeration fail for the entire MCP session.

Changes

  • Keep the normal browser.pages() path for healthy browsers
  • Fall back to per-target enumeration when page initialization fails with recoverable page-session timeouts
  • Skip only the failing targets and keep healthy pages available
  • Add a regression test covering the fallback path

Verification

  • npm run typecheck
  • npm test -- tests/McpContext.test.ts
  • Manual repro against a real Chrome session with frozen background tabs:
    • raw CDP Network.enable still timed out for affected targets
    • patched McpContext.from() succeeded and skipped the frozen targets

@google-cla
Copy link
Copy Markdown

google-cla Bot commented Mar 24, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@barretlee barretlee changed the title Skip frozen page targets when page enumeration times out fix: skip frozen page targets when page enumeration times out Mar 24, 2026
@barretlee barretlee force-pushed the fix-skip-frozen-pages-1230 branch from 9e31b48 to e573157 Compare March 24, 2026 02:28
@barretlee barretlee closed this Mar 24, 2026
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.

Frozen/discarded background tabs can make page enumeration fail with Network.enable timeout

1 participant