feat: make pageId routing always-on and fix waitForEventsAfterAction page isolation#1244
Closed
bcfmtolgahan wants to merge 2 commits intoChromeDevTools:mainfrom
Closed
feat: make pageId routing always-on and fix waitForEventsAfterAction page isolation#1244bcfmtolgahan wants to merge 2 commits intoChromeDevTools:mainfrom
bcfmtolgahan wants to merge 2 commits intoChromeDevTools:mainfrom
Conversation
…page isolation Remove the experimental-page-id-routing gate so pageId is always exposed on page-scoped tools. This prevents race conditions in multi-agent workflows where concurrent select_page calls can cause tools to operate on the wrong page. Key changes: - Remove experimentalPageIdRouting gate from schema injection and page resolution in index.ts - Add explicit page parameter to waitForEventsAfterAction so it uses the correct page's emulation settings instead of the global selected page - Update all page-scoped tool handlers (input, pages, script) to pass the explicit page to waitForEventsAfterAction - Unify evaluate_script's pageId handling with the standard pattern - Deprecate --experimental-page-id-routing CLI flag (now always enabled) - Add E2E tests for pageId routing, race condition simulation, and per-page emulation isolation
OrKoN
requested changes
Mar 31, 2026
Collaborator
OrKoN
left a comment
There was a problem hiding this comment.
Thanks for the PR! Let's split the enablement of the pageId routing by default to a separate PR. Let's also move waitForEventsAfterAction to the McpPage class
Contributor
Author
|
Thank you! Sure, splitting into two focused PRs as requested — one for removing the experimental flag, one for moving waitForEventsAfterAction to McpPage. |
Collaborator
|
have you also created a PR for the waitForEventsAfterAction fix? |
github-merge-queue bot
pushed a commit
that referenced
this pull request
Apr 1, 2026
Splits out from #1244 per review feedback. 'waitForEventsAfterAction' previously lived in 'McpContext' and always used the selected page's CPU/network throttling settings. With pageId routing, a tool can target a different page than the selected one, meaning wrong throttling multipliers were applied. Moving the method to 'McpPage' fixes this: each tool now calls 'page.waitForEventsAfterAction(...)' and gets the correct page's emulation settings. 'getNetworkMultiplierFromString' is extracted to 'WaitForHelper.ts' to avoid a circular import (McpContext → McpPage already exists). Unblocks #1777.
wolfib
pushed a commit
that referenced
this pull request
Apr 1, 2026
Splits out from #1244 per review feedback. 'waitForEventsAfterAction' previously lived in 'McpContext' and always used the selected page's CPU/network throttling settings. With pageId routing, a tool can target a different page than the selected one, meaning wrong throttling multipliers were applied. Moving the method to 'McpPage' fixes this: each tool now calls 'page.waitForEventsAfterAction(...)' and gets the correct page's emulation settings. 'getNetworkMultiplierFromString' is extracted to 'WaitForHelper.ts' to avoid a circular import (McpContext → McpPage already exists). Unblocks #1777.
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
--experimental-page-id-routinggate sopageIdis always exposed on page-scoped tools, preventing race conditions in multi-agent workflows where concurrentselect_pagecalls cause tools to operate on the wrong pagewaitForEventsAfterActionto accept an explicitpageparameter so it uses the correct page's emulation settings (CPU throttling, network conditions) instead of the global selected pageinput,pages,script) to pass the explicit page towaitForEventsAfterActionChanges
src/index.ts: RemoveexperimentalPageIdRoutinggate from schema injection and page resolutionsrc/McpContext.ts: Add optionalpageparameter towaitForEventsAfterActionsrc/tools/ToolDefinition.ts: UpdateContextinterface andpageIddescriptionsrc/tools/input.ts: Pass{page: request.page}to all 8waitForEventsAfterActioncall sitessrc/tools/pages.ts: Pass explicit page innavigatePageandnewPage; updateselect_pagedescription for multi-agent guidancesrc/tools/script.ts: Remove duplicateexperimentalPageIdRoutinggate, always includepageIdSchema, pass page toperformEvaluationsrc/bin/chrome-devtools-mcp-cli-options.ts: Deprecate--experimental-page-id-routingflagdocs/tool-reference.md,src/bin/cliDefinitions.ts: Regenerated vianpm run genTest plan