Repository navigation
fix(browser-control): connect to guarded CDP without /json endpoints - #3668
Merged
Merged
Conversation
Chrome 144+ user-approved remote debugging (chrome://inspect) serves no
/json* HTTP endpoints, so discovery returned 404 while only the browser
WebSocket at /devtools/browser works. The Settings UI also aborted setup
after the default 30 s request deadline while the backend was still
waiting up to 60 s for the setting and 90 s for approval, which surfaced
as "Request timeout".
- Probe CDP ports as Http / GuardedNoHttp / Unreachable and fall back to
ws://127.0.0.1:{port}/devtools/browser for Chrome and Edge when
DevToolsActivePort is missing; verify the product after connecting.
- Probe Beta/Dev/Canary and Snap/Flatpak user-data directories.
- Retry guarded WebSocket connects only on refused or fast resets, never
after a stalled handshake that may be showing an approval prompt.
- Return actionable guidance from legacy HTTP callers on a guarded port.
- Give setup commands a 190 s UI deadline and a matching Peer RPC/host
invoke budget.
Fixes openBitFun#3654
Co-authored-by: OpenBitFun <318544290+bitfun-ai@users.noreply.github.com>
Co-authored-by: OpenBitFun <318544290+bitfun-ai@users.noreply.github.com>
- Match browser processes by exact name (pgrep -x) instead of command-line substrings that also matched crashpad helpers. - Cache the process-running answer per setup call and consult it only after the port probe and claim check pass. - Bound the late-404 setup fallback and its approval wait by one overall 170 s deadline, below the 180 s Peer host invoke limit.
3 tasks done
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
支持 Chrome/Edge 用户批准式(guarded)remote debugging:
/json*返回 404 时,经验证后使用 browser WebSocket,不再把所有 CDP 服务都当作旧式 HTTP discovery。同步贯通 Settings、Peer Host 和 relay 的授权等待预算。Fixes #3654
Type and Areas
Bug fix — browser-control provider、Core CDP/ControlHub、Desktop browser setup 与 account RPC、Web UI Settings/Peer adapter、对应的 Tokio owner contract。
Root cause and changes
/devtools/browserWebSocket,且默认 profile 目录中找不到DevToolsActivePort。现在先找已发布端点,再结合“所选浏览器正在运行”“其他浏览器未声明占用端口”等条件推断候选;HTTP 404 本身不是已连接或已授权的证据。Browser.getVersion;Chrome/Edge 不匹配时断开、不保留连接。两个浏览器同时运行且端点仅靠端口推断时,startup 不自动发起可能落到另一浏览器的授权请求。spawn_blocking;setup 轮询使用时间截止而非次数预算。timeoutMs;普通调用维持原有 120 秒默认及 ACK/overall 余量。browser-control仅新增它实际需要的tokio/rt,同步更新精确 owner contract,并增加移除该依赖后必须报错的 mutation test;未扩大根工作区 Tokio features。pgrep -x,Windowstasklist映像名),不再用pgrep -f chrome误匹配 Electron 的chrome_crashpad_handler。单次 setup 内缓存运行状态(最多 3 秒刷新一次),且仅在端口探测与端口占用检查通过后才查询。Verification
cargo test --locked -p openbitfun-services-integrations --no-default-features --features browser-control --lib browser_control::— 26 passed(含精确进程名、运行状态缓存、非 404 端口不查询进程的测试)。cargo test --locked -p openbitfun-core --no-default-features --features agent-runtime,tools-browser-web,git --lib -- browser_control:: control_hub— 101 passed,2 ignored。cargo test --locked -p openbitfun-desktop --lib -- api::browser_control_api::tests browser_control_setup_commands_get_the_consent_budget device_rpc_timeout_is_bounded— 5 passed(含总预算小于 Host 限制、回退预算有界、预算耗尽的明确失败)。remote_connect::realtime_client::tests— 2 passed(旧默认 deadline/payload、新的 185 秒 payload)。cargo check --locked -p openbitfun-services-integrations --no-default-features --features browser-control— passed。cargo test --locked -p openbitfun-core --no-default-features --features agent-runtime,tools-browser-web,tools-computer-use,git --lib browser_control::— 49 passed,1 ignored。control_hub— 58 passed,1 ignored。TAURI_CONFIG='{"bundle":{"resources":[],"externalBin":[]}}' cargo test --locked -p openbitfun-desktop --lib -- browser_control_setup_commands_get_the_consent_budget device_rpc_timeout_is_bounded_for_peer_requests— 2 passed。该配置仅免除单测构建中的打包资源要求,不是打包验证。首次共享其他 PR 的 target 目录时编译失败;使用本工作树独立 target 后通过,未通过修改产品代码绕过。corepack pnpm --dir src/web-ui run test:run src/app/scenes/settings/pages/shared/RuntimeSettings.test.tsx src/infrastructure/api/adapters/peer-device-adapter.test.ts— 104 passed。corepack pnpm run check:web— passed。corepack pnpm run fmt:rs、git diff --check— passed。corepack pnpm run check:core-boundaries— 在同一提交的外部 detached worktree 中通过,避免嵌套 Claude worktree 的 Cargo metadata 工作区发现问题。首次检查指出新增rt未登记;补齐精确 owner contract 后通过。node --test --test-name-pattern='Tokio' scripts/check-core-boundaries.test.mjs— 9 passed。新增 mutation case 已先失败、后通过。Compatibility and limitations
timeoutMswire 字段。旧 Host 的 120 秒限制仍可能明确超时,不声称旧端自动支持长预算。Generated with OpenBitFun