Skip to content

feat: add ChromeDriver proxy for WebDriver and BiDi protocol support#164

Merged
rgarcia merged 11 commits intomainfrom
tanmay/kernel-915-validation-gate
Mar 9, 2026
Merged

feat: add ChromeDriver proxy for WebDriver and BiDi protocol support#164
rgarcia merged 11 commits intomainfrom
tanmay/kernel-915-validation-gate

Conversation

@tnsardesai
Copy link
Contributor

@tnsardesai tnsardesai commented Feb 25, 2026

Install ChromeDriver matching the Chromium version in both headful and headless images, managed via supervisord on internal port 9225. A new ChromeDriver proxy (exposed on port 9224) intercepts session creation to inject goog:chromeOptions.debuggerAddress so ChromeDriver attaches to the already-running browser (at port 9222), rewrites webSocketUrl in responses to route BiDi traffic back through the proxy, and transparently proxies all other HTTP and WebSocket traffic.

Extracts the shared WebSocket bidirectional pump logic from devtoolsproxy into a reusable wsproxy package with a MessageTransform hook, used by both the existing DevTools proxy and the new ChromeDriver proxy. Expands CDP discovery endpoint proxying to include /json/list and makes proxy ports configurable via environment variables.

Includes comprehensive unit tests for the ChromeDriver proxy and manual BiDi validation scripts (raw WebSocket, Puppeteer, Selenium).

Checklist

  • A link to a related issue in our repository
  • A description of the changes proposed in the pull request.
  • @mentions of the person or team responsible for reviewing proposed changes.

Note

Medium Risk
Moderate risk because it adds a new externally exposed ChromeDriver proxy/port and rewrites WebDriver/BiDi session payloads, which can break existing automation clients or routing if misconfigured.

Overview
Adds first-class WebDriver/BiDi support via ChromeDriver. The Chromium headful/headless images now install a matching chromedriver, run it under supervisord on 127.0.0.1:9225, and expose a new public port 9224 for ChromeDriver access.

Introduces a Go ChromeDriver proxy that intercepts POST /session (and BiDi session.new) to inject goog:chromeOptions.debuggerAddress pointing at the DevTools proxy, rewrites returned capabilities.webSocketUrl to route BiDi back through the proxy, and otherwise reverse-proxies ChromeDriver HTTP/WebSocket traffic.

Refactors and hardens proxy plumbing. DevTools proxy ports become configurable (DEVTOOLS_PROXY_PORT, CHROMEDRIVER_PROXY_PORT, etc.), DevTools JSON discovery proxying is generalized to also cover /json/list with recursive URL rewriting, and the shared WebSocket pump is extracted into a reusable wsproxy package.

Testing/ops updates. Adds unit tests for JSON rewriting and ChromeDriver proxy behavior, new BiDi e2e tests plus Node-based validation scripts, and updates e2e container helpers to map/wait on the new ChromeDriver port.

Written by Cursor Bugbot for commit 62f0fc5. This will update automatically on new commits. Configure here.

@tnsardesai tnsardesai marked this pull request as ready for review February 25, 2026 18:46
@tnsardesai tnsardesai force-pushed the tanmay/kernel-915-validation-gate branch from 7941a36 to 433f3d1 Compare February 25, 2026 19:13
tnsardesai and others added 4 commits March 6, 2026 15:56
Install ChromeDriver matching the Chromium version in both headful and
headless images, managed via supervisord on internal port 9225. A new
ChromeDriver proxy (exposed on port 9224) intercepts session creation to
inject goog:chromeOptions.debuggerAddress so ChromeDriver attaches to
the already-running browser, rewrites webSocketUrl in responses to route
BiDi traffic back through the proxy, and transparently proxies all other
HTTP and WebSocket traffic.

Extracts the shared WebSocket bidirectional pump logic from
devtoolsproxy into a reusable wsproxy package with a MessageTransform
hook, used by both the existing DevTools proxy and the new ChromeDriver
proxy. Expands CDP discovery endpoint proxying to include /json/list and
makes proxy ports configurable via environment variables.

Includes comprehensive unit tests for the ChromeDriver proxy and manual
BiDi validation scripts (raw WebSocket, Puppeteer, Selenium).

Co-authored-by: Cursor <cursoragent@cursor.com>
Make the chromedriver proxy runtime-configurable and more robust, then add explicit Vibium BiDi e2e coverage using dynamic session endpoints so remote WebDriver workflows are easier and less brittle.

Made-with: Cursor
Prevent parallel e2e tests from racing pnpm setup by making playwright dependency installation single-flight, avoiding intermittent ENOENT failures in CI.

Made-with: Cursor
@rgarcia rgarcia force-pushed the tanmay/kernel-915-validation-gate branch from 6b38b7c to d428c05 Compare March 6, 2026 21:32
rgarcia added 4 commits March 7, 2026 15:23
Serialize BiDi fixture dependency installation to avoid parallel npm races in e2e and recurse through nested Chrome JSON objects so URL rewriting is applied consistently.

Made-with: Cursor
Update the Vibium fixture to use the current start/stop API and exercise the ws://.../session path directly, so the e2e suite matches Vibium's documented remote-browser contract while keeping HTTP /session coverage for WebDriver clients.

Made-with: Cursor
Drop the newline-only difference in display.go so the PR no longer carries an unrelated formatting change.

Made-with: Cursor
Rename the ChromeDriver proxy setting to DevToolsProxyAddr so it reflects the CDP proxy endpoint it targets, and update the config surface to use DEVTOOLS_PROXY_ADDR consistently.

Made-with: Cursor
Restore the checked-in server/api file so this PR stops carrying an unrelated binary deletion, and ignore local reference checkouts plus the server/api build artifact path.

Made-with: Cursor
Copy link
Contributor

@hiroTamada hiroTamada left a comment

Choose a reason for hiding this comment

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

Clean, well-structured addition of ChromeDriver/BiDi support. The proxy design is minimal — only intercepts session creation and WebSocket URL rewriting. Good extraction of the shared wsproxy package, and solid test coverage across unit, integration, and real e2e with Puppeteer/Selenium/Vibium. Left two minor nits on the wrapper scripts.

Cancel upstream Chrome JSON fetches with the caller context and standardize headful/headless readiness checks so timeout warnings are visible and consistent across wrappers.

Made-with: Cursor
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@rgarcia rgarcia merged commit 9816e34 into main Mar 9, 2026
3 checks passed
@rgarcia rgarcia deleted the tanmay/kernel-915-validation-gate branch March 9, 2026 16:21
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.

3 participants