fix: poll health while waiting for proxy readiness#147
Open
dimaria1122 wants to merge 1 commit into
Open
Conversation
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.
中文
背景
我们在 macOS 上使用
web-access连接主 Chrome 时,check-deps.mjs在等待 proxy 就绪的阶段会循环请求/targets。问题在于/targets并不是纯粹的健康检查:它会进入cdp-proxy.mjs的正常请求路径,并在尚未完成授权时再次触发connect()。在我们的复现场景里,这会把一次正常的 Chrome 远程调试授权,放大成连续多次的连接尝试,用户侧表现为短时间内收到一串重复授权请求。
修改内容
waitForProxyConnection()helper/health/health.connected === true时才判定 proxy 已 ready,不再用/targets做探活为什么这样改
/health已经足够表达 check-deps 需要的状态:proxy 是否连上浏览器。相比之下,
/targets会触发更深的请求路径;在浏览器授权尚未完成时,重复请求它会制造额外的连接噪音,但不会带来更多有效信息。Test Plan
/healthnode --test tests/check-deps-wait.test.mjsnode scripts/check-deps.mjs --browser chrome,验证脚本可正常返回 readyEnglish
Background
When using
web-accesson macOS against the main Chrome instance,check-deps.mjscurrently polls/targetswhile waiting for the proxy to become ready. The problem is that/targetsis not a pure health check: it enters the normal request path incdp-proxy.mjsand can trigger anotherconnect()while browser authorization is still pending.In our repro, that turned a single normal Chrome remote-debugging approval into a burst of repeated connection attempts. On the user side, it showed up as multiple authorization prompts in a short time.
Changes
waitForProxyConnection()helper/healthduring the wait phase/health.connected === true, instead of probing readiness through/targetsWhy this change
/healthalready exposes the exact statecheck-depsneeds: whether the proxy is connected to a browser.By contrast,
/targetsexercises a deeper request path. While authorization is still pending, repeatedly hitting it adds connection noise without providing better readiness information.Test Plan
/healthonlynode --test tests/check-deps-wait.test.mjsnode scripts/check-deps.mjs --browser chromeand verify it returns ready