Skip to content

fix(runtime): honor OPENCLI_CDP_ENDPOINT for web adapters#2148

Open
axxop wants to merge 1 commit into
jackwener:mainfrom
axxop:codex/honor-manual-cdp-endpoint
Open

fix(runtime): honor OPENCLI_CDP_ENDPOINT for web adapters#2148
axxop wants to merge 1 commit into
jackwener:mainfrom
axxop:codex/honor-manual-cdp-endpoint

Conversation

@axxop

@axxop axxop commented Jul 18, 2026

Copy link
Copy Markdown

Problem

OPENCLI_CDP_ENDPOINT is documented as the manual CDP endpoint override, but regular website adapters ignore it. getBrowserFactory() selects CDPBridge only for registered Electron apps and always selects BrowserBridge for sites such as xianyu.

As a result, a command such as:

OPENCLI_CDP_ENDPOINT=http://127.0.0.1:9333 opencli xianyu whoami

still tries to connect through the Browser Bridge daemon. In a setup with multiple connected extension profiles, it fails with BROWSER_CONNECT: Multiple Browser Bridge profiles are connected, even though the explicitly configured headless Chrome CDP endpoint is reachable and authenticated.

Fix

Give an explicitly configured OPENCLI_CDP_ENDPOINT precedence in getBrowserFactory() and select CDPBridge for any adapter when it is present. Existing behavior is unchanged when the variable is absent: registered Electron apps still use CDP and regular sites still use Browser Bridge.

Add regression coverage for both branches:

  • a regular site uses BrowserBridge by default
  • a regular site uses CDPBridge when OPENCLI_CDP_ENDPOINT is configured

Verification

  • npx vitest run --project unit src/runtime.test.ts — 2 passed
  • npm run typecheck — clean
  • Live verification with a dedicated authenticated Chrome profile running under --headless=new --remote-debugging-port=9333: opencli xianyu whoami -f json returned logged_in: true through the manual CDP endpoint.

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.

1 participant