Skip to content

fix(build): wire bundle:browser-mcp into bundle pipeline#24424

Merged
gsquared94 merged 2 commits intogoogle-gemini:mainfrom
gsquared94:fix/bundle-browser-mcp-pipeline
Apr 1, 2026
Merged

fix(build): wire bundle:browser-mcp into bundle pipeline#24424
gsquared94 merged 2 commits intogoogle-gemini:mainfrom
gsquared94:fix/bundle-browser-mcp-pipeline

Conversation

@gsquared94
Copy link
Copy Markdown
Contributor

Summary

The bundle:browser-mcp script (added in #22213) was never wired into the root bundle pipeline, causing chrome-devtools-mcp.mjs to be missing from published npm packages. This results in a MODULE_NOT_FOUND crash when the browser agent launches.

Details

Root cause: The root bundle script runs generate → build devtools → esbuild → copy_bundle_assets, but never invokes npm run bundle:browser-mcp -w @google/gemini-cli-core, which is responsible for building packages/core/dist/bundled/chrome-devtools-mcp.mjs. The copy_bundle_assets.js script then silently skips the copy when the source directory doesn't exist.

Fix:

  1. Added npm run bundle:browser-mcp -w @google/gemini-cli-core to the root bundle script, before esbuild and copy_bundle_assets.
  2. Changed copy_bundle_assets.js to fail loudly (with an actionable error message) when the bundled directory is missing, instead of silently skipping.

Related Issues

How to Validate

  1. Start from a clean state (no pre-existing packages/core/dist/bundled/ or bundle/bundled/):
    rm -rf packages/core/dist/bundled bundle/bundled
  2. Run the bundle pipeline:
    npm run bundle
  3. Verify bundle/bundled/chrome-devtools-mcp.mjs exists:
    ls -la bundle/bundled/chrome-devtools-mcp.mjs
  4. Negative test — verify the guard works: remove the built bundle and run only copy_bundle_assets:
    rm -rf packages/core/dist/bundled
    node scripts/copy_bundle_assets.js  # Should exit with error

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

The bundle:browser-mcp script (which builds packages/core/dist/bundled/
chrome-devtools-mcp.mjs) was never invoked as part of the root bundle
pipeline added in google-gemini#22213. This caused the bundled chrome-devtools-mcp
to be missing from published npm packages, resulting in MODULE_NOT_FOUND
errors at runtime when using the browser agent.

Changes:
- Add bundle:browser-mcp step to root bundle script before esbuild
- Make copy_bundle_assets.js fail loudly when the bundled directory is
  missing instead of silently skipping the copy
@gsquared94 gsquared94 requested review from a team as code owners April 1, 2026 12:54
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a missing dependency in the build pipeline that caused runtime errors due to missing browser agent files. By explicitly including the browser-mcp bundle step and adding strict validation during asset copying, the build process is now more robust and predictable.

Highlights

  • Pipeline Integration: Integrated the bundle:browser-mcp script into the root bundle pipeline to ensure necessary files are generated during the build process.
  • Error Handling: Updated the copy_bundle_assets.js script to fail with an explicit error message if the required bundle directory is missing, preventing silent failures.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the bundle script in package.json to include the browser MCP bundling step for the core package. It also modifies the copy_bundle_assets script to fail explicitly if the chrome-devtools-mcp bundle is not found, providing a helpful error message. I have no feedback to provide.

@gemini-cli gemini-cli bot added priority/p1 Important and should be addressed in the near term. area/core Issues related to User Interface, OS Support, Core Functionality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. labels Apr 1, 2026
@gsquared94 gsquared94 enabled auto-merge April 1, 2026 14:37
The 30-second setTimeout was insufficient for CI environments where
Chrome launch + DevTools MCP connection + model response takes longer.
Replace with poll() that waits up to 120s for the browser agent to
signal completion (success or error).

Related to google-gemini#24382
@gsquared94 gsquared94 force-pushed the fix/bundle-browser-mcp-pipeline branch from 7b74943 to d0455b4 Compare April 1, 2026 14:57
@gsquared94 gsquared94 added this pull request to the merge queue Apr 1, 2026
Merged via the queue into google-gemini:main with commit a3ef87e Apr 1, 2026
27 checks passed
@gsquared94 gsquared94 deleted the fix/bundle-browser-mcp-pipeline branch April 1, 2026 17:23
kalenkevich pushed a commit to kalenkevich/gemini-cli that referenced this pull request Apr 3, 2026
afanty2021 pushed a commit to afanty2021/gemini-cli that referenced this pull request Apr 4, 2026
warrenzhu25 pushed a commit to warrenzhu25/gemini-cli that referenced this pull request Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. priority/p1 Important and should be addressed in the near term.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants