Repository navigation
test: guard lazy browser bundle loading and tighten idle memory budgets - #3574
Merged
Merged
Conversation
Lightning00Blade
force-pushed
the
test/guard-lazy-browser-startup
branch
from
November 23, 2026 12:36
97b50b9 to
3c23dd1
Compare
Lightning00Blade
self-requested a review
November 23, 2026 12:39
Lightning00Blade
force-pushed
the
test/guard-lazy-browser-startup
branch
3 times, most recently
from
November 23, 2026 14:33
6ca4056 to
d315659
Compare
yulunz
force-pushed
the
test/guard-lazy-browser-startup
branch
from
November 24, 2026 19:53
d315659 to
40b986d
Compare
Add an e2e loader-hook test verifying that third_party/browser.js is not loaded during MCP server startup or tools/list and loads on the first tool call, lower the idle private-memory budgets in footprint_mcp.ts from 112/110 MiB to 40/38 MiB (~11% above CI Node 22 LTS medians), and sync AGENTS.md with the completed lazy-startup rules. Refs #3427
yulunz
force-pushed
the
test/guard-lazy-browser-startup
branch
from
November 25, 2026 13:30
40b986d to
df17264
Compare
Lightning00Blade
approved these changes
Nov 26, 2026
1 task
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.
Refs #3427
Lazy loading: server startup part f (final part of 3a–3f), stacked on #3573. Guards the lazy startup boundary end-to-end, tightens the idle private-memory budgets so any regression that eagerly loads
third_party/browser.jsfails CI, and syncsAGENTS.md.What changed
tests/e2e/lazy-startup.test.ts,tests/BUILD.gn):bin/chrome-devtools-mcp.js --usage-statistics=false --browserUrl=http://127.0.0.1:1with anode:moduleregister()loader hook passed via--import.initializeandtools/list, assertsthird_party/index.jswas recorded by the hook andthird_party/browser.jswas not loaded, then invokeslist_pages(failing fast against127.0.0.1:1without launching Chrome) and assertsthird_party/browser.jswas loaded.file://URLs withfileURLToPath+fs.realpathSyncfor cross-platform paths across Linux, macOS, and Windows, and waits for server exit beforeusing tempDir = createTempDir(...)cleans up.src/index.ts.scripts/profile/footprint_mcp.ts):defaultfrom112 MiBto40 MiBandno-usage-statisticsfrom110 MiBto38 MiB, updating the baseline comment.test-memory-leaks.yml, Node 22 LTS), medians are35.92 MiB(default) and34.17 MiB(no-usage-statistics), so both budgets sit ~11% above CI medians (locally on Linux x64 with Nodev24.12.0LTS, medians are46.02 MiBand43.49 MiB) and less than half the ~93 MiB footprint whenthird_party/browser.jsloads eagerly.AGENTS.md):Third-party bundlesand theDesignchecklist to state thatthird_party/browser.jsis not loaded at server startup and list all paths covered by the ESLint@typescript-eslint/no-restricted-importsrules (src/index.ts,src/BrowserManager.ts,src/processors/HeapSnapshotManager.ts,src/ToolHandler.ts,src/bin/,src/daemon/,src/tools/,src/config/, andsrc/telemetry/forbrowser.js, plus./McpContext.jsinsrc/index.ts).Test plan
npm run test tests/e2e/lazy-startup.test.ts(and verified failure before perf: create McpContext on the first tool call #3568).npm run profile:footprinton Ubuntu x64 Node 22 LTS CI (and local 5-launch verification on Nodev24.12.0LTS).npm run formatand fullnpm run test.