Repository navigation
fix(browser): deliver real screencast frames — #491 P0 实时画面在真实 Chromium 上从未工作过 - #522
Open
Qiyuanqiii wants to merge 2 commits into
Open
Qiyuanqiii wants to merge 2 commits into
Qiyuanqiii wants to merge 2 commits into
Conversation
… longer a string Real-browser verification (TRAVERSE_TEST_AGENT_BROWSER=1) exposed that the P0 live view never delivered a single frame against real Chromium: screencastFrame.params.sessionId has changed type across Chromium versions (now a number, previously a string, sometimes absent), and typing it as a string failed the whole event unmarshal, silently dropping every frame before the pump. The four pump tests passed only because their scripted events carried string ids. - Receive SessionID as a raw JSON token; session attribution keeps coming from the wire envelope, which onEvent already binds to the owning target session. - Ack echoes the raw token verbatim so string and numeric screencast session ids both round-trip with their original JSON type. - Add an opt-in real-browser E2E: an animated page yields decoded JPEG frames with sane viewport bounds, and Stop tears the tap down. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
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.
动机 / Motivation
#491 的 P0(只读 screencast 实时画面)在 main 上已有完整实现(泵、白名单、httpapi、前端 canvas),但从未做过真浏览器端到端验证——四个泵单测全部使用带 string
sessionId的脚本事件。本次用 opt-in 真浏览器(TRAVERSE_TEST_AGENT_BROWSER=1,本机已安装 Edge)实测时发现:实时画面在真实 Chromium 上一帧都从未送达过。根因(探针实证)
wire 层
Page.screencastFrame事件正常到达(envelope session 归属正确),但json.Unmarshal报:新版 Chromium 的
params.sessionId类型从 string 变成了 number,typed 解码使整个事件 unmarshal 失败,deliverScreencastLocked静默丢帧。泵、预算、ack 逻辑全部正常,帧根本到不了它们。修复 / Changes
SessionID改为json.RawMessage原样接收:会话归属继续由 wire 信封保证(onEvent已按event.SessionID == r.session过滤),params token 只用于 ack 回传。null视为缺席不 ack。TestAgentBrowserRealScreencastLiveFrames:动画页 → 解码 JPEG 帧(魔数 + viewport 边界校验)→ Stop 后 channel 正常关闭。验证 / Verification
gofmt -l无输出;go vet无告警;go test -race -count=1 ./internal/browserruntime/全通过。TRAVERSE_TEST_AGENT_BROWSER=1)。docs/reviews/browser-screencast-delivery-fix/。已知限制(如实记录):实测帧率由 Chromium 损伤/采样与 ack 流控共同决定,动画页约数 fps;#491 的 "≥5fps" 验收需在真实桌面会话进一步观测。
关联 #491(P0 可见性的交付修复)。同系列:#520(P1 下载隔离地基)。